Unify verify methods into verify_withdraw_v2 and remove deprecated endpoints#65
Unify verify methods into verify_withdraw_v2 and remove deprecated endpoints#65olga24912 wants to merge 1 commit into
Conversation
karim-en
left a comment
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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_v2based on pending-tx state. - Updated tests and test context helpers to call
verify_deposit_v2/verify_withdraw_v2, and introduced aproof_jsonhelper 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 | |||
| // 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( |
| check!( | ||
| print "verify_refund_finalize" | ||
| context.verify_refund_finalize( | ||
| context.verify_withdraw_v2( | ||
| "relayer", |
| // 6. verify_refund_finalize — finalize the refund | ||
| check!( | ||
| print "verify_refund_finalize" | ||
| context.verify_refund_finalize( | ||
| context.verify_withdraw_v2( | ||
| "relayer", |
| // 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, |
| // 6. verify_refund_finalize — finalize the refund | ||
| check!( | ||
| print "verify_refund_finalize" | ||
| context.verify_refund_finalize( | ||
| context.verify_withdraw_v2( | ||
| "relayer", |
| // 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, |
| check!( | ||
| print "verify_refund_finalize" | ||
| context.verify_refund_finalize( | ||
| context.verify_withdraw_v2( | ||
| "relayer", |
| check!( | ||
| print "verify_refund_finalize" | ||
| context.verify_refund_finalize( | ||
| context.verify_withdraw_v2( | ||
| "relayer", |
This pull request removes deprecated v1 bridge API methods from the
satoshi-bridgecontract 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:
bridge.rs, includingverify_deposit,safe_verify_deposit,safe_verify_deposit_compact,verify_withdraw,verify_active_utxo_management, andverify_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]verify_withdraw_v2instead of the removedverify_refund_finalizemethod. Internal logic and documentation were updated accordingly. [1] [2] [3]Documentation and Error Message Updates:
Test Utilities:
proof_jsonhelper in test utilities to simplify constructing proof arguments for v2 API calls.Version Update:
satoshi-bridgecrate version to0.9.5.