Skip to content

Commit

Permalink
Fix Router by implementing on storage instead on seperate module (#38)
Browse files Browse the repository at this point in the history
* impl router on storage instead of another struct

* impl router on storage instead of another struct

* rm module holder

* rm unneccesary logs

* fixed merge conflicts

* fixed storing client counter

* rm unneccesary commented code

* added comments

* impl storing seq on inner type

* fmt

* fmt

* use btreemap from alloc

* fmt

* fix borrow

* fmt

---------

Co-authored-by: Michal Nazarewicz <[email protected]>
  • Loading branch information
dhruvja and mina86 authored Oct 19, 2023
1 parent f276d85 commit 583708d
Show file tree
Hide file tree
Showing 9 changed files with 261 additions and 393 deletions.
1 change: 1 addition & 0 deletions common/sealable-trie/src/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub const EMPTY_TRIE_ROOT: CryptoHash = CryptoHash::DEFAULT;
/// a single value at a key whose length is withing 36 bytes has a single
/// node however if that key is longer than 36 bytes the trie needs at least
/// two nodes.
#[derive(Debug)]
pub struct Trie<A> {
/// Pointer to the root node. `None` if the trie is empty or the root node
/// has been sealed.
Expand Down
12 changes: 10 additions & 2 deletions solana/solana-ibc/programs/solana-ibc/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ impl ibc::clients::ics07_tendermint::ValidationContext
height: &Height,
) -> Result<Option<Self::AnyConsensusState>, ContextError> {
let end_height = (height.revision_number() + 1, 1);
match self.consensus_states.get(&(client_id.to_string(), end_height)) {
let solana_ibc_store = &self.0.borrow().solana_ibc_store;
match solana_ibc_store
.consensus_states
.get(&(client_id.to_string(), end_height))
{
Some(data) => {
let result: Self::AnyConsensusState =
serde_json::from_str(data).unwrap();
Expand All @@ -434,7 +438,11 @@ impl ibc::clients::ics07_tendermint::ValidationContext
height: &Height,
) -> Result<Option<Self::AnyConsensusState>, ContextError> {
let end_height = (height.revision_number(), 1);
match self.consensus_states.get(&(client_id.to_string(), end_height)) {
let solana_ibc_store = &self.0.borrow().solana_ibc_store;
match solana_ibc_store
.consensus_states
.get(&(client_id.to_string(), end_height))
{
Some(data) => {
let result: Self::AnyConsensusState =
serde_json::from_str(data).unwrap();
Expand Down
Loading

0 comments on commit 583708d

Please sign in to comment.