# Cancun Fork Status – ChainID 138

## Summary

**Adding Cancun is already done** in your production genesis. No extra work is required for the chain config.

---

## Current State

### Production genesis (`genesis-138.json`)

The phase1 genesis used for deployment already enables Shanghai and Cancun from block 0:

```json
"shanghaiTime": 0,
"cancunTime": 0,
```

- **Source**: `smom-dbis-138/terraform/phases/phase1/config/genesis-138.json`
- **Deployed to**: Besu nodes via phase1 scripts (e.g. `/genesis/genesis.json` or `/opt/besu/config/genesis.json`)

So the chain is **already configured for Cancun** at genesis.

### Genesis template

`config/genesis-template.json` has been updated to include `shanghaiTime: 0` and `cancunTime: 0`, so any new genesis generated from this template will also have Cancun from block 0.

---

## EIP-7702 (delegation) on top of Cancun

EIP-7702 requires:

1. **Cancun fork** – ✅ Already in genesis (`cancunTime: 0`).
2. **Besu 24.1.0+** – Must be checked on each node.

To confirm Besu version on all nodes:

```bash
# Full list (validators, sentries, RPC)
PROXMOX_HOST=192.168.11.10 ./scripts/check-besu-version-all-nodes.sh

# Quick check on running RPC VMIDs only
BESU_VMIDS="2101 2400 2401 2402" ./scripts/check-besu-version-all-nodes.sh
```

**Last run (sample):** VMIDs 2400 and 2402 reported Besu **23.10.0** (below 24.1.0). Use the project upgrade script to bring all nodes to latest:

```bash
# From repo root (proxmox)
./scripts/upgrade-besu-all-nodes.sh              # upgrade to 25.12.0
./scripts/upgrade-besu-all-nodes.sh --dry-run    # show what would be done
BESU_VERSION=25.11.0 ./scripts/upgrade-besu-all-nodes.sh
```

- Ensure every Besu node runs **Besu 24.1.0 or later**.
- Ensure the **deployed** genesis on each node is the one that contains `cancunTime: 0` (i.e. your current `genesis-138.json` or equivalent).
- Use `scripts/enable-eip-7702-besu.sh` to verify genesis and remind about the Besu version requirement.

---

## If you were adding Cancun from scratch

Difficulty: **low**.

1. **Genesis**: In the genesis `config` object add (time-based) or block-based equivalents:
   - `"shanghaiTime": 0` (or a Unix timestamp)
   - `"cancunTime": 0` (or a Unix timestamp)
2. **Besu**: No extra Besu options; fork activation is driven by the genesis file.
3. **Deploy**: Replace genesis on all nodes with the updated file and restart Besu (or roll out in a coordinated way if scheduling a future fork time/block).

For a **new** chain (genesis block 0), using `0` activates Shanghai and Cancun from the first block.

---

## References

- Besu genesis reference: [Genesis file items](https://besu.hyperledger.org/stable/public-networks/reference/genesis-items)
- EIP-7702 script: `scripts/enable-eip-7702-besu.sh`
- Fork analysis: `smom-dbis-138/docs/operations/status-reports/FORK_ANALYSIS.md`
