Skip to content

Unify verify methods into verify_withdraw_v2 and remove deprecated endpoints#65

Open
olga24912 wants to merge 1 commit into
omni-mainfrom
verify_merge
Open

Unify verify methods into verify_withdraw_v2 and remove deprecated endpoints#65
olga24912 wants to merge 1 commit into
omni-mainfrom
verify_merge

Conversation

@olga24912

@olga24912 olga24912 commented Jul 16, 2026

Copy link
Copy Markdown

This pull request removes deprecated v1 bridge API methods from the satoshi-bridge contract and its tests, consolidating all deposit, withdraw, active UTXO management, and refund flows onto the v2 API. It also updates internal logic and documentation to reflect these changes, ensuring that only the latest, coinbase-proof-based verification methods are used.

The most important changes are:

API Cleanup and Migration to v2 Methods:

  • Removed all deprecated v1 API methods from bridge.rs, including verify_deposit, safe_verify_deposit, safe_verify_deposit_compact, verify_withdraw, verify_active_utxo_management, and verify_refund_finalize, as well as their corresponding test helpers. Users are now required to use the v2 methods for all operations. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Updated refund flow so that finalization is now performed via verify_withdraw_v2 instead of the removed verify_refund_finalize method. Internal logic and documentation were updated accordingly. [1] [2] [3]

Documentation and Error Message Updates:

  • Updated documentation comments and error messages to reference only v2 methods and clarify expected flows (e.g., deposit and refund flows now reference v2 APIs). [1] [2] [3]

Test Utilities:

  • Added a new proof_json helper in test utilities to simplify constructing proof arguments for v2 API calls.

Version Update:

  • Bumped the satoshi-bridge crate version to 0.9.5.

@karim-en karim-en left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Just minor comments inconstancies
bridge.rs:360 doc comment: "verified via verify_deposit" → should be verify_deposit_v2.
bridge.rs:373 inline comment: same.
refund.rs:311, refund.rs:377 — same drift.
Several test-file comments still say verify_deposit / safe_verify_deposit / verify_refund_finalize (cosmetic).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the migration of the satoshi-bridge contract API to the v2 verification methods by removing deprecated v1 endpoints and consolidating withdraw / active UTXO management / refund finalization onto verify_withdraw_v2, while updating the test suite and related internal helpers accordingly.

Changes:

  • Removed deprecated v1 public methods (and some v2-specific method variants) and routed all finalization to verify_withdraw_v2 based on pending-tx state.
  • Updated tests and test context helpers to call verify_deposit_v2 / verify_withdraw_v2, and introduced a proof_json helper for constructing v2 proof arguments.
  • Updated refund logic wiring (internal_verify_refund_finalize_entry) and refreshed error messages/docs to reflect the v2-only API.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
contracts/satoshi-bridge/src/api/bridge.rs Removes deprecated endpoints and dispatches verify_withdraw_v2 across withdraw/active-management/refund flows.
contracts/satoshi-bridge/src/refund.rs Updates refund-finalization documentation and introduces an internal entrypoint used by verify_withdraw_v2.
contracts/satoshi-bridge/src/btc_light_client/deposit.rs Updates user-facing error messages to be flow-based instead of endpoint-based.
contracts/satoshi-bridge/tests/setup/context.rs Removes v1/v2 helper calls that are no longer supported; keeps v2-only helpers.
contracts/satoshi-bridge/tests/setup/utils.rs Adds proof_json helper to build v2 proof JSON for test calls.
contracts/satoshi-bridge/tests/test_satoshi_bridge.rs Migrates test calls to v2 endpoints and adjusts direct JSON calls to v2 argument shapes.
contracts/satoshi-bridge/tests/test_refund.rs Migrates refund tests to finalize via verify_withdraw_v2 and updates deposit verification calls to v2.
contracts/satoshi-bridge/tests/test_refund_zcash.rs Migrates Zcash refund tests to v2 deposit + unified finalization via verify_withdraw_v2.
contracts/satoshi-bridge/tests/test_orchard_withdrawal.rs Updates Orchard withdrawal tests to use verify_deposit_v2 proof-based calls.
contracts/satoshi-bridge/tests/test_orchard_validation.rs Updates Orchard validation tests to use verify_deposit_v2.
contracts/satoshi-bridge/tests/test_nu63_ironwood.rs Updates Ironwood-related refund finalization to use verify_withdraw_v2.
contracts/satoshi-bridge/Cargo.toml Bumps satoshi-bridge crate version to 0.9.5.
Cargo.lock Updates lockfile to reflect the satoshi-bridge version bump.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -3015,7 +2901,7 @@
.unwrap();

// 1. Deposit via v1 to get UTXOs and nBTC
Comment on lines 3075 to +3079
// safe_verify_deposit succeeds at the transaction level but safe_mint
// returns U128(0) because alice is not registered; safe_mint_callback
// then burns the mint_amount from the bridge.
let outcome = context
.safe_verify_deposit(
.verify_deposit_v2(
Comment on lines 169 to 172
check!(
print "verify_refund_finalize"
context.verify_refund_finalize(
context.verify_withdraw_v2(
"relayer",
Comment on lines 461 to 465
// 6. verify_refund_finalize — finalize the refund
check!(
print "verify_refund_finalize"
context.verify_refund_finalize(
context.verify_withdraw_v2(
"relayer",
Comment on lines 478 to +482
// 8. verify_deposit STILL blocked after verify_refund_finalize
check!(
context.verify_deposit("relayer", deposit_msg, tx_bytes, vout, blockhash, 1, vec![]),
context.verify_deposit_v2(
"relayer",
deposit_msg,
Comment on lines 1127 to 1131
// 6. verify_refund_finalize — finalize the refund
check!(
print "verify_refund_finalize"
context.verify_refund_finalize(
context.verify_withdraw_v2(
"relayer",
Comment on lines 1144 to +1148
// 8. safe_verify_deposit STILL blocked after verify_refund_finalize
check!(
context.safe_verify_deposit("relayer", deposit_msg, tx_bytes, vout, blockhash, 1, vec![]),
context.verify_deposit_v2(
"relayer",
deposit_msg,
Comment on lines 254 to 257
check!(
print "verify_refund_finalize"
context.verify_refund_finalize(
context.verify_withdraw_v2(
"relayer",
Comment on lines 223 to 226
check!(
print "verify_refund_finalize"
context.verify_refund_finalize(
context.verify_withdraw_v2(
"relayer",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants