datahaven/contracts/test
Gonza Montiel 7097767021
feat: contracts upgrade command (#463)
## Contracts upgrade command with simple version tracking

This PR aims to take the most minimal changes from #438 to make the
upgrade command available.
So it adds the `bun cli contracts upgrade` command for deploying a new
`DataHavenServiceManager` implementation and upgrading the proxy, and
includes a simple version tracking via a `contracts/VERSION` file.

### Contracts
**`DataHavenServiceManager.sol`**
- Added `_version` storage variable
- Added `DATAHAVEN_VERSION()` view function, 
- Added `updateVersion(string)` function gated by `onlyProxyAdmin`
- Added `VersionUpdated` event
- The version is set at initialization and updated atomically with proxy
upgrades via `upgradeAndCall`.
 
### CLI

**`bun cli contracts upgrade`** works in two modes: _dry-run_ or
_execute_.

**Dry-run (default)**

Deploys the new implementation on-chain (signed by the deployer key),
then prints a ready-to-submit JSON payload for the multisig to execute
the proxy upgrade. No AVS owner key required.

```bash
# Uses version from contracts/VERSION (standard workflow)
bun cli contracts upgrade --chain hoodi

# Override version for this upgrade only (warns if it differs from contracts/VERSION)
bun cli contracts upgrade --chain hoodi --target x.y.z
```

Example output:
```json
{
  "to": "0xProxyAdmin...",
  "value": "0",
  "data": "0x...",
  "description": "Upgrade ServiceManager proxy to 0xNewImpl... and set version to 1.1.0"
}
```

**Execute mode (`--execute`)**

Deploys the implementation and broadcasts the proxy upgrade + version
update in a single atomic `upgradeAndCall` transaction. Requires
`AVS_OWNER_PRIVATE_KEY`. Used mostly for testing.

```bash
  bun cli contracts upgrade --chain anvil --execute
```
---
### Expected flow
- Bump mannually contracts/VERSION (e.g., 1.1.0)
- Run bun cli contracts upgrade --chain anvil|hoodi|mainnet
2026-03-02 21:50:10 +01:00
..
mocks fix: resolve forge build warnings (#398) 2026-01-22 09:48:27 -03:00
storage feat: automated validator set submission with era targeting (#433) 2026-02-20 10:31:44 +01:00
utils feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
MessageEncoding.t.sol feat: automated validator set submission with era targeting (#433) 2026-02-20 10:31:44 +01:00
OperatorAddressMappings.t.sol fix: 🩹 map validator address improvements (#460) 2026-03-02 15:48:55 +01:00
RewardsSubmitter.t.sol fix: 🩹 map validator address improvements (#460) 2026-03-02 15:48:55 +01:00
Slashing.t.sol fix: 🩹 map validator address improvements (#460) 2026-03-02 15:48:55 +01:00
SnowbridgeIntegration.t.sol feat: implement weighted top-32 validator selection (#443) 2026-02-24 09:23:57 +01:00
ValidatorSetSelection.t.sol feat: implement weighted top-32 validator selection (#443) 2026-02-24 09:23:57 +01:00
ValidatorSetSubmitter.t.sol feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00