datahaven/test/scripts
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
..
cargo-crossbuild.ts test: 🏗️ Setup e2e testing framework (#104) 2025-07-16 18:51:07 +02:00
check-generated-state.ts test : improve contract injection (#326) 2026-01-06 11:27:50 +00:00
compile-contracts.sh test: port Moonwall block validation suite (#201) 2025-10-06 09:47:35 +02:00
compile-contracts.ts refactor(test): reorganize e2e test suites (#373) 2026-01-20 15:52:33 +02:00
contracts-checksum.ts test : improve contract injection (#326) 2026-01-06 11:27:50 +00:00
deploy-contracts.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
fund-providers.ts test: launch backend in e2e tests and cli (#418) 2026-02-04 15:56:25 +01:00
fund-validators.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
generate-contracts.ts fix: 🩹 map validator address to operator address for rewards & slashes (#441) 2026-02-18 21:38:13 +02:00
register-providers.ts feat: 🚀 add storage-hub nodes to CLI (#287) 2025-11-22 11:49:14 +01:00
send-txn.ts test: refactor e2e tests (#365) 2025-12-24 13:31:40 +01:00
set-datahaven-parameters.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00
setup-validators.ts feat: implement weighted top-32 validator selection (#443) 2026-02-24 09:23:57 +01:00
test-parallel.ts test: port ethereum tests from moonbeam (#278) 2025-11-22 10:02:05 +01:00
update-validator-set.ts feat: contracts upgrade command (#463) 2026-03-02 21:50:10 +01:00