Skip to content

Commit

Permalink
Add block hash comparism in block header verification.
Browse files Browse the repository at this point in the history
  • Loading branch information
livelybug committed Mar 25, 2022
1 parent aa49838 commit 03c6f96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
11 changes: 2 additions & 9 deletions modules/src/clients/ics10_grandpa/client_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,17 @@ impl ClientDef for GrandpaClient {
let mmr_leaf_hash = beefy_merkle_tree::Keccak256::hash(&mmr_leaf_encode[..]);
let mmr_leaf = beefy_light_client::mmr::MmrLeaf::from(header.clone().mmr_leaf);

let header_hash = header.hash();

if mmr_leaf.parent_number_and_hash.1.is_empty() {
return Err(Error::empty_mmr_leaf_parent_hash_mmr_root());
}
tracing::trace!(
"ics1 client_def :[check_header_and_update_state] >> header_hash = {:?}",
header_hash
);
tracing::trace!(
"ics1 client_def :[check_header_and_update_state] >> parent_mmr_root = {:?}",
mmr_leaf.parent_number_and_hash.1
);

/* if header_hash != mmr_leaf.parent_number_and_hash.1 {
if header.block_header.parent_hash != mmr_leaf.parent_number_and_hash.1.to_vec() {
return Err(Error::header_hash_not_match());
}*/
// Todo: Is this comparism needed?
}

tracing::trace!(
"in client_def: [check_header_and_update_state] >> mmr_root = {:?}",
Expand Down
4 changes: 2 additions & 2 deletions relayer/src/chain/substrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ impl ChainEndpoint for SubstrateChain {
proto_msgs: TrackedMsgs,
) -> Result<Vec<TxResponse>, Error> {
tracing::debug!(
"in substrate: [send_messages_and_wait_check_tx], raw msg to send {:?}",
proto_msgs
"in substrate: [send_messages_and_wait_check_tx], url of msg to send {:?}",
proto_msgs.messages().to_vec().iter().map(|value| value.type_url.clone()).collect::<Vec<String>>()
);

// sleep(Duration::from_secs(4));
Expand Down

0 comments on commit 03c6f96

Please sign in to comment.