Problem Statement
All contracts (GistRegistry, BatchWallet, MultiSig, Governance) live in a single Rust crate. This couples their versioning, compilation, testing, and deployment lifecycles. Independent contract upgrades are impossible without affecting other contracts.
Evidence
contracts/Cargo.toml — Single crate with all code
contracts/src/lib.rs — GistRegistry
contracts/src/multi.rs — MultiSig + Governance code
contracts/src/ops.rs, rollback.rs — BatchWallet tests
Impact
Monolithic crate couples unrelated contract lifecycles. Versioning is tied together. Testing one contract requires compiling all contracts.
Proposed Solution
- Create directory structure:
contracts/gist-registry/, contracts/multisig/, contracts/governance/, contracts/batch-wallet/
- Each gets its own Cargo.toml, src/lib.rs
- Move relevant code to each package
- Create workspace Cargo.toml at contracts/ root
- Update CI/CD deployment pipeline to target specific contracts
Technical Requirements
- Each contract must compile independently to WASM
- Each contract must have its own test suite
- Workspace must support shared dev-dependencies
- CI must build and test each contract independently
Acceptance Criteria
- contracts/ is a Cargo workspace
- Each contract builds independently:
cargo build -p gist-registry --target wasm32-unknown-unknown --release
- Each contract's tests pass independently
- Workspace build builds all contracts
- CI pipeline updated to build/test/deploy individual contracts
- WASM binary sizes are not regressed
File Inventory
contracts/Cargo.toml
contracts/src/lib.rs
contracts/src/multi.rs
contracts/src/vault.rs
contracts/src/ops.rs
contracts/src/rollback.rs
infrastructure/ci/contract-deployment.yml
Dependencies
Issue #1 (deduplicate contracts) must be completed first.
Testing Strategy
- Build and test each contract independently
- Verify workspace build produces same total output
Security Considerations
Independent contracts reduce blast radius of a vulnerability in one contract.
Definition of Done
Problem Statement
All contracts (GistRegistry, BatchWallet, MultiSig, Governance) live in a single Rust crate. This couples their versioning, compilation, testing, and deployment lifecycles. Independent contract upgrades are impossible without affecting other contracts.
Evidence
contracts/Cargo.toml— Single crate with all codecontracts/src/lib.rs— GistRegistrycontracts/src/multi.rs— MultiSig + Governance codecontracts/src/ops.rs,rollback.rs— BatchWallet testsImpact
Monolithic crate couples unrelated contract lifecycles. Versioning is tied together. Testing one contract requires compiling all contracts.
Proposed Solution
contracts/gist-registry/,contracts/multisig/,contracts/governance/,contracts/batch-wallet/Technical Requirements
Acceptance Criteria
cargo build -p gist-registry --target wasm32-unknown-unknown --releaseFile Inventory
contracts/Cargo.tomlcontracts/src/lib.rscontracts/src/multi.rscontracts/src/vault.rscontracts/src/ops.rscontracts/src/rollback.rsinfrastructure/ci/contract-deployment.ymlDependencies
Issue #1 (deduplicate contracts) must be completed first.
Testing Strategy
Security Considerations
Independent contracts reduce blast radius of a vulnerability in one contract.
Definition of Done