Conversation
karim-en
reviewed
Apr 28, 2026
Collaborator
|
Please fix the CI |
karim-en
approved these changes
Apr 29, 2026
There was a problem hiding this comment.
Pull request overview
Adds a new verify_transaction_inclusion_v2 pathway (contract + relayer) that validates a coinbase merkle proof in addition to the target transaction merkle proof, intended to mitigate the 64-byte transaction Merkle proof forgery issue.
Changes:
- Introduce
ProofArgsV2and contract methodverify_transaction_inclusion_v2; deprecateverify_transaction_inclusion. - Add relayer support (
NearClient::verify_transaction_inclusion_v2) and integration test flow for v2 verification. - Add contract tests covering v2 valid/invalid coinbase proofs and related error cases.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| relayer/tests/integration_tests.rs | Adds an integration test and flow exercising relayer calls to the v2 verification method. |
| relayer/src/near_client.rs | Adds verify_transaction_inclusion_v2, refactors verify-response parsing, and tweaks batch tx nonce handling. |
| relayer/src/adaptive_batch.rs | Simplifies num_parallel_txs computation using checked_div. |
| contract/tests/test_basics.rs | Adds unit tests for verify_transaction_inclusion_v2 behavior (valid/invalid proofs, confirmations, etc.). |
| contract/src/lib.rs | Deprecates v1 verification and adds v2 method with coinbase merkle proof validation. |
| contract/Cargo.toml | Bumps contract crate version to 0.5.0. |
| contract/Cargo.lock | Updates lockfile version entry to 0.5.0. |
| contract/.gitattributes | Removes LFS rule for a test data file. |
| btc-types/src/contract_args.rs | Adds ProofArgsV2 and conversion into existing ProofArgs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+500
to
+506
| // Always print so the gas measurement is visible under | ||
| // `cargo test ... -- --nocapture`, regardless of RUST_LOG. | ||
| println!( | ||
| "[{method_label}] gas_burnt = {gas_burnt} ({} TGas, rounded), tokens_burnt = {tokens_burnt}", | ||
| gas_burnt / 1_000_000_000_000 | ||
| ); | ||
| info!("[{method_label}] gas_burnt = {gas_burnt}, tokens_burnt = {tokens_burnt}"); |
| ) == header.block_header.merkle_root, | ||
| "Incorrect coinbase merkle proof" | ||
| ); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
verify_transaction_inclusion_v2with coinbase merkle proof validation to mitigate the 64-byte transaction forgery vulnerability. The original method is marked as deprecated.