Fix proof gen and verify
This commit is contained in:
parent
6c70969814
commit
8c0c871666
2 changed files with 14 additions and 14 deletions
File diff suppressed because one or more lines are too long
|
@ -180,19 +180,20 @@ async fn main() -> Result<()> {
|
||||||
.latest_trusted()
|
.latest_trusted()
|
||||||
.ok_or_else(|| eyre!("No trusted state found for primary"))?;
|
.ok_or_else(|| eyre!("No trusted state found for primary"))?;
|
||||||
|
|
||||||
let primary_block = {
|
let status = client.status().await?;
|
||||||
info!("Verifying to latest height on primary...");
|
let latest_height = status.sync_info.latest_block_height;
|
||||||
|
|
||||||
let status = client.status().await?;
|
// `proof_height` is the height at which we want to query the blockchain's state
|
||||||
let proof_height = {
|
// This is one less than than the `latest_height` because we want to verify the merkle-proof for
|
||||||
let latest_height = status.sync_info.latest_block_height;
|
// the state against the `app_hash` at `latest_height`.
|
||||||
(latest_height.value() - 1)
|
// (because Tendermint commits to the latest `app_hash` in the subsequent block)
|
||||||
.try_into()
|
let proof_height = (latest_height.value() - 1)
|
||||||
.expect("infallible conversion")
|
.try_into()
|
||||||
};
|
.expect("infallible conversion");
|
||||||
|
|
||||||
primary.verify_to_height(proof_height)
|
info!("Verifying to latest height on primary...");
|
||||||
}?;
|
|
||||||
|
let primary_block = primary.verify_to_height(latest_height)?;
|
||||||
|
|
||||||
info!("Verified to height {} on primary", primary_block.height());
|
info!("Verified to height {} on primary", primary_block.height());
|
||||||
let mut primary_trace = primary.get_trace(primary_block.height());
|
let mut primary_trace = primary.get_trace(primary_block.height());
|
||||||
|
@ -223,8 +224,7 @@ async fn main() -> Result<()> {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let status = client.status().await?;
|
let status = client.status().await?;
|
||||||
let (proof_height, latest_app_hash) =
|
let latest_app_hash = status.sync_info.latest_app_hash;
|
||||||
(primary_block.height(), status.sync_info.latest_app_hash);
|
|
||||||
|
|
||||||
let path = WASM_STORE_KEY.to_owned();
|
let path = WASM_STORE_KEY.to_owned();
|
||||||
let data = CwAbciKey::new(args.contract_address, args.storage_key, None);
|
let data = CwAbciKey::new(args.contract_address, args.storage_key, None);
|
||||||
|
|
Loading…
Reference in a new issue