Module: meridian-contracts/contracts/escrow, meridian-contracts/contracts/risk_pool
Problem
Both contracts store state in fixed DataKey shapes with no storage version
field or migration path. AdvancedEscrow sets DataKey::Version (escrow/src/lib.rs:32)
but never reads/migrates it; RiskPoolContract has no version at all. If we add
fields (e.g. escrow fee_bps, risk-pool locked_capital), old deployments
will deserialize garbage or panic. There is also a stray lib.rs.new file in
the escrow src/ (escrow/src/lib.rs.new) that must be reconciled.
Deliverables
- Define a
StorageVersion and a migrate(env, to_version) entry point on both
contracts that performs additive, backward-compatible migrations.
- Reconcile/delete
escrow/src/lib.rs.new and document what it was.
- Write a simulation test that deploys an "old" instance (no new fields),
migrates, and verifies old data is preserved and new fields default correctly.
- Document the migration policy in
meridian-contracts/contracts/README.md.
Acceptance criteria
migrate is callable only by admin and is idempotent.
- Migration test passes;
lib.rs.new removed or merged.
- No breaking change to existing on-chain reads.
Module:
meridian-contracts/contracts/escrow,meridian-contracts/contracts/risk_poolProblem
Both contracts store state in fixed
DataKeyshapes with no storage versionfield or migration path.
AdvancedEscrowsetsDataKey::Version(escrow/src/lib.rs:32)but never reads/migrates it;
RiskPoolContracthas no version at all. If we addfields (e.g. escrow
fee_bps, risk-poollocked_capital), old deploymentswill deserialize garbage or panic. There is also a stray
lib.rs.newfile inthe escrow
src/(escrow/src/lib.rs.new) that must be reconciled.Deliverables
StorageVersionand amigrate(env, to_version)entry point on bothcontracts that performs additive, backward-compatible migrations.
escrow/src/lib.rs.newand document what it was.migrates, and verifies old data is preserved and new fields default correctly.
meridian-contracts/contracts/README.md.Acceptance criteria
migrateis callable only by admin and is idempotent.lib.rs.newremoved or merged.