Separate core and Bitcoin concerns, move BTC state to dynamic field#338
Open
Bridgerz wants to merge 3 commits intohashi-refactor-phase1from
Open
Separate core and Bitcoin concerns, move BTC state to dynamic field#338Bridgerz wants to merge 3 commits intohashi-refactor-phase1from
Bridgerz wants to merge 3 commits intohashi-refactor-phase1from
Conversation
3f7739b to
e72d8f2
Compare
b0855be to
24d7817
Compare
e72d8f2 to
9f2a54e
Compare
3edb7ce to
7d8b5bd
Compare
9f2a54e to
8a53192
Compare
7d8b5bd to
23362fa
Compare
b88c5e9 to
339f678
Compare
23362fa to
ad5e451
Compare
Decouple BTC-specific fee parameters and calculation functions from the core Config module to prepare for multi-chain support. - Create btc_config.move with all BTC-specific constants (dust threshold, fee rates, vbyte calculations), config accessors (deposit_fee, withdrawal_fee_btc, max_fee_rate, etc.), and calculation functions (worst_case_network_fee, withdrawal_minimum, deposit_minimum) - Slim config.move to core concerns: paused state, version management, upgrade management, and generic get/upsert (now public(package)) - Config still holds BTC key names in is_valid_config_entry for UpdateConfig proposal validation (pragmatic: avoids circular deps) - BTC defaults initialized via btc_config::init_defaults, called separately from config::create - Update all consumers to use btc_config:: qualified calls
Pure file moves — no logic changes. Makes the auth/bridge separation visible in the file system. core/ — protocol-agnostic authentication, signing, and governance: committee/, config, config_value, threshold, tob, cert_submission, validator, reconfig, treasury, proposal/ btc/ — Bitcoin bridge logic: btc, btc_config, utxo, utxo_pool, deposit, deposit_queue, withdraw, withdrawal_queue hashi.move remains at the root as the shared object aggregating both.
339f678 to
9f2bdbf
Compare
Extract deposit_queue, withdrawal_queue, and utxo_pool from the Hashi struct into a BitcoinState struct stored as a dynamic field. This decouples chain-specific state from the core Hashi object, allowing future chains to be added without modifying the shared object layout. Move side: new bitcoin_state module with BitcoinState/BitcoinStateKey, Hashi accessors borrow_bitcoin_state/borrow_bitcoin_state_mut, updated all BTC entry functions and tests. Rust side: slimmed move_types::Hashi deserialization, scrape_hashi now fetches BitcoinState via dynamic field derivation.
9f2bdbf to
5cb3fb3
Compare
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.
Summary
Builds on #337. Restructures the Hashi package to separate core MPC/auth infrastructure from Bitcoin-specific logic, then moves BTC state out of the Hashi struct into a dynamic field.
Config split
config.movesplit into genericconfig(version gating, pause, upgrade cap) andbtc_config(deposit fees, withdrawal params, dust limits)Directory reorganization
core/(committee, config, treasury, proposals, reconfig, validator, tob, threshold) andbtc/(deposit, withdraw, utxo, btc_config, queues)BitcoinState dynamic field
bitcoin_statemodule withBitcoinState/BitcoinStateKeystructs holdingdeposit_queue,withdrawal_queue,utxo_poolHashistruct slimmed to chain-agnostic fields;BitcoinStateattached viadf::addininitborrow_bitcoin_state()/borrow_bitcoin_state_mut()accessors onHashicommit_withdrawal_txsequences borrows: bridge ops, then treasury burn + config read, then re-borrow for insertRust:
move_types::Hashislimmed to match;scrape_hashifetchesBitcoinStatevialist_dynamic_fieldson the Hashi object.Test plan
sui move build— cleansui move test— 63 tests passcargo check— compilescargo test -p hashi --lib— 154 tests passcargo clippy/cargo fmt --check— clean