datahaven/test/utils
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
..
contracts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
anvil.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
blockscout.ts test: Add E2E Tests (#36) 2025-04-14 16:22:43 -03:00
constants.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
contracts.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
docker.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
events.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
index.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
input.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
kurtosis.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
logger.ts feat: Add Polkadot API support to CLI and e2e testing infra (#68) 2025-05-13 03:03:21 +00:00
papi.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
parameters.ts perf: Batch runtime parameter updates to speed up E2E setup (#368) 2025-12-22 15:57:32 +01:00
parser.ts fix: 🔨 Fix Kurtosis & Snowbridge relay configs for Fulu fork (#356) 2025-12-18 15:50:09 +01:00
rpc.ts test: Add E2E Tests (#36) 2025-04-14 16:22:43 -03:00
service-mappings.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
shell.ts Fix: command cli deploy contracts (#319) 2025-11-27 15:06:04 +01:00
types.ts feat: Implement EigenLayer Rewards V2 distribution (#351) 2026-01-06 23:53:03 +00:00
validators.ts refactor(test): reorganize e2e test suites (#373) 2026-01-20 15:52:33 +02:00
viem.ts fix: 🚨 Add error in TS for missing awaits (#81) 2025-05-19 22:28:43 +00:00
waits.ts feat: 🚀 Add deploy command to CLI (#87) 2025-06-12 10:24:03 +02:00