Skip to content

Commit

Permalink
fix state_trie_key (#45)
Browse files Browse the repository at this point in the history
* fix state_trie_key

* fix testsuite
  • Loading branch information
seunlanlege authored May 24, 2023
1 parent f44024f commit bea7812
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ismp-testsuite/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl ConsensusClient for MockClient {
Ok(())
}

fn state_trie_key(&self, _request: RequestResponse) -> Vec<Vec<u8>> {
fn state_trie_key(&self, _request: Vec<Request>) -> Vec<Vec<u8>> {
Default::default()
}

Expand Down
4 changes: 2 additions & 2 deletions ismp/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
host::{IsmpHost, StateMachine},
messaging::Proof,
prelude::Vec,
router::RequestResponse,
router::{Request, RequestResponse},
};
use codec::{Decode, Encode};
use core::time::Duration;
Expand Down Expand Up @@ -113,7 +113,7 @@ pub trait ConsensusClient {
) -> Result<(), Error>;

/// Transform the requests/responses into their equivalent key in the state trie.
fn state_trie_key(&self, request: RequestResponse) -> Vec<Vec<u8>>;
fn state_trie_key(&self, request: Vec<Request>) -> Vec<Vec<u8>>;

/// Verify the state of proof of some arbitrary data. Should return the verified data
fn verify_state_proof(
Expand Down
3 changes: 1 addition & 2 deletions ismp/src/handlers/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use crate::{
handlers::{validate_state_machine, MessageResult},
host::IsmpHost,
messaging::TimeoutMessage,
router::RequestResponse,
util::hash_request,
};
use alloc::vec::Vec;
Expand Down Expand Up @@ -56,7 +55,7 @@ where
}
}

let key = consensus_client.state_trie_key(RequestResponse::Request(requests.clone()));
let key = consensus_client.state_trie_key(requests.clone());

let values = consensus_client.verify_state_proof(host, key, state, &timeout_proof)?;

Expand Down

0 comments on commit bea7812

Please sign in to comment.