From 9323278662b9fb0b0c444e2651ec8dc77cd80e3f Mon Sep 17 00:00:00 2001 From: Daniel Gushchyan <39884512+dangush@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:46:21 -0400 Subject: [PATCH] fix: get app_hash at proof_height instead of latest (#59) Co-authored-by: Shoaib Ahmed --- utils/tm-prover/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/tm-prover/src/main.rs b/utils/tm-prover/src/main.rs index 1225048..ed8902e 100644 --- a/utils/tm-prover/src/main.rs +++ b/utils/tm-prover/src/main.rs @@ -187,6 +187,7 @@ async fn main() -> Result<()> { let status = client.status().await?; let latest_height = status.sync_info.latest_block_height; + let latest_app_hash = status.sync_info.latest_app_hash; // `proof_height` is the height at which we want to query the blockchain's state // This is one less than than the `latest_height` because we want to verify the merkle-proof for @@ -228,9 +229,6 @@ async fn main() -> Result<()> { ) .await?; - let status = client.status().await?; - let latest_app_hash = status.sync_info.latest_app_hash; - let path = WASM_STORE_KEY.to_owned(); let data = CwAbciKey::new(args.contract_address, args.storage_key, None); let result = client @@ -248,7 +246,7 @@ async fn main() -> Result<()> { if let Some(trace_file) = args.trace_file { // replace the last block in the trace (i.e. the (latest - 1) block) with the latest block // we don't actually verify the latest block because it will be verified on the other side - let latest_block = primary.fetch_light_block(status.sync_info.latest_block_height)?; + let latest_block = primary.fetch_light_block(latest_height)?; let _ = primary_trace.pop(); primary_trace.push(latest_block);