-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: get app_hash at proof_height instead of latest #59
Conversation
utils/tm-prover/src/main.rs
Outdated
let status = client.status().await?; | ||
let latest_app_hash = status.sync_info.latest_app_hash; | ||
let latest_app_hash = primary_block.signed_header.header.app_hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change for the fix right @dangush?
I just confirmed that this is indeed the root cause of the bug we were seeing yesterday by adding this sleep before we get the status (and latest app hash) -> $ git diff src/main.rs
diff --git a/utils/tm-prover/src/main.rs b/utils/tm-prover/src/main.rs
index 1225048..738d709 100644
--- a/utils/tm-prover/src/main.rs
+++ b/utils/tm-prover/src/main.rs
@@ -228,6 +228,9 @@ async fn main() -> Result<()> {
)
.await?;
+ let ten_secs = std::time::Duration::from_secs(10);
+ std::thread::sleep(ten_secs);
+
let status = client.status().await?;
let latest_app_hash = status.sync_info.latest_app_hash; The old code (without the fix in this PR) always fails. Also just confirmed that the fix works even with this delay. |
So the verifier was failing with this change. I solved this in a slightly different way by avoiding the extra status call altoghether -> diff --git a/utils/tm-prover/src/main.rs b/utils/tm-prover/src/main.rs
index 1225048..d9fb05e 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); Will push soon. 🙏 |
4aecc8b
to
99fdd5b
Compare
Closes #58
Instead of getting the latest app hash, I extract the
app_hash
from theprimary_block
which was queried and used during proof generation.Should be a simple change, but I'm not familiar with the library so not sure if there's something I missed.