Skip to content

Commit

Permalink
converting serialized string to bytes without borsh
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvja committed Oct 18, 2023
1 parent b7bb648 commit dcb602e
Showing 3 changed files with 236 additions and 238 deletions.
19 changes: 8 additions & 11 deletions solana/solana-ibc/programs/solana-ibc/src/execution_context.rs
Original file line number Diff line number Diff line change
@@ -57,11 +57,9 @@ impl ClientExecutionContext for SolanaIbcStorage<'_, '_> {
}
.to_vec();
let trie = self.trie.as_mut().unwrap();
let client_state_hash =
borsh::to_vec(&serialized_client_state).unwrap();
trie.set(
client_state_trie_key,
&lib::hash::CryptoHash::digest(&client_state_hash),
&lib::hash::CryptoHash::digest(serialized_client_state.as_bytes()),
)
.unwrap();

@@ -93,11 +91,11 @@ impl ClientExecutionContext for SolanaIbcStorage<'_, '_> {
}
.to_vec();
let trie = self.trie.as_mut().unwrap();
let consensus_state_hash =
borsh::to_vec(&serialized_consensus_state).unwrap();
trie.set(
consensus_state_trie_key,
&lib::hash::CryptoHash::digest(&consensus_state_hash),
&lib::hash::CryptoHash::digest(
serialized_consensus_state.as_bytes(),
),
)
.unwrap();

@@ -205,11 +203,11 @@ impl ExecutionContext for SolanaIbcStorage<'_, '_> {
serde_json::to_string(&connection_end).unwrap();
let connection_trie_key = &TrieKey::from(connection_path).to_vec();
let trie = self.trie.as_mut().unwrap();
let consensus_state_hash =
borsh::to_vec(&serialized_connection_end).unwrap();
trie.set(
connection_trie_key,
&lib::hash::CryptoHash::digest(&consensus_state_hash),
&lib::hash::CryptoHash::digest(
serialized_connection_end.as_bytes(),
),
)
.unwrap();

@@ -369,10 +367,9 @@ impl ExecutionContext for SolanaIbcStorage<'_, '_> {
serde_json::to_string(&channel_end).unwrap();
let channel_end_trie_key = &TrieKey::from(channel_end_path).to_vec();
let trie = self.trie.as_mut().unwrap();
let channel_end_hash = borsh::to_vec(&serialized_channel_end).unwrap();
trie.set(
channel_end_trie_key,
&lib::hash::CryptoHash::digest(&channel_end_hash),
&lib::hash::CryptoHash::digest(serialized_channel_end.as_bytes()),
)
.unwrap();

1 change: 0 additions & 1 deletion solana/solana-ibc/programs/solana-ibc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ use std::collections::BTreeMap;
use anchor_lang::prelude::*;
use borsh::{BorshDeserialize, BorshSerialize};
use ibc::core::ics24_host::identifier::PortId;

use ibc::core::router::{Module, ModuleId, Router};
use module_holder::ModuleHolder;

Loading

0 comments on commit dcb602e

Please sign in to comment.