Context
Smart contract upgrades carry significant risk. A faulty upgrade can lock funds, break integrations, or introduce vulnerabilities.
Current Limitation/Problem
Contract upgrades are deployed with manual verification. There is no automated pre-deployment health check, state compatibility validation, or post-deployment smoke test suite.
Expected Outcome
An automated upgrade safety service that validates contract upgrades before deployment, checks storage layout compatibility, simulates upgrade, and runs smoke tests post-deployment.
Acceptance Criteria
- Storage layout diff checker: detect variable reordering, type changes, slot collisions
- Simulate upgrade on a fork (Hardhat mainnet fork / Soroban sandbox)
- Run automated test suite against upgraded contract on fork
- Check admin/key permissions are preserved after upgrade
- Verify proxy admin ownership is not accidentally renounced
- Post-deployment: verify implementation address, run health check transactions
- Rollback capability if smoke tests fail
- Dashboard showing upgrade history and safety check results
Technical Scope
backend/src/services/contracts/upgrade-validator.ts - upgrade validation
- Hardhat mainnet forking for EVM simulation
- Soroban sandbox for Stellar simulation
- Prisma:
ContractUpgrade, UpgradeValidationReport models
- CI integration: required before deployment to mainnet
- Edge cases: immutable variables, constructor args in upgrades, beacon proxies
Context
Smart contract upgrades carry significant risk. A faulty upgrade can lock funds, break integrations, or introduce vulnerabilities.
Current Limitation/Problem
Contract upgrades are deployed with manual verification. There is no automated pre-deployment health check, state compatibility validation, or post-deployment smoke test suite.
Expected Outcome
An automated upgrade safety service that validates contract upgrades before deployment, checks storage layout compatibility, simulates upgrade, and runs smoke tests post-deployment.
Acceptance Criteria
Technical Scope
backend/src/services/contracts/upgrade-validator.ts- upgrade validationContractUpgrade,UpgradeValidationReportmodels