Loading
Bifrost: Hold vault lock through broadcast & add RPC context deadlines
Closing in favor of !4596 (merged).
Reason: same changes were reopened from an upstream source branch instead of a fork. Please continue review/discussion in !4596 (merged).
Summary
This MR improves UTXO signing safety and RPC resilience, and aligns ZEC/BTC RPC client interfaces so one shared client abstraction can be used.
Problem
- Vault-level locking did not consistently cover the full sign -> broadcast window, which can allow concurrent UTXO selection/broadcast races.
- UTXO RPC wrapper calls did not consistently enforce context deadlines.
-
rpc.Clientandzec.Clienthad mismatched interfaces, forcing split fields and chain-specific branching. - Simulation code still used the old rpc.NewClient signature.
Changes
- Hold vault lock through broadcast in UTXO consolidate flow and signer flow (via lock-capability interface) to eliminate local double-spend risk on concurrent work.
- Add timeout-aware context handling to UTXO RPC wrapper calls (Call and batch paths).
- Pass configured HTTP timeout into UTXO RPC client creation.
- Add
CallContextandBatchCallContexttozec.Client. - Introduce a shared
rpcClientinterface (Call,BatchCall,CallContext,BatchCallContext) and use a single client field for both standard RPC and ZEC RPC implementations. - Update simulation UTXO constructor call to match new RPC client signature.
Impact
- Safer concurrent signing/broadcast behavior for UTXO vaults.
- Better failure behavior on slow/stuck RPC calls via deadlines.
- Less duplicated chain-conditional RPC code and cleaner client abstraction.
Test plan
-
make testpasses -
make lintpasses -
make test-simulationpasses
Edited by ZlyDevMaya