Files
smom-dbis-138/docs/operations/status-reports/FORK_ANALYSIS.md
defiQUG 1fb7266469 Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control.
- Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities.
- Created .gitmodules to include OpenZeppelin contracts as a submodule.
- Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment.
- Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks.
- Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring.
- Created scripts for resource import and usage validation across non-US regions.
- Added tests for CCIP error handling and integration to ensure robust functionality.
- Included various new files and directories for the orchestration portal and deployment scripts.
2025-12-12 14:57:48 -08:00

4.1 KiB

Fork Analysis: Can We Use Mainnet WETH9 Address?

Question: If ChainID 138 is a fork of Ethereum Mainnet, can we use the existing WETH9 address?

Answer: YES - If it's a fork, WETH9 already exists at the Mainnet address!


Understanding Forks

What is a Fork?

A fork of Ethereum Mainnet means:

  • The new chain starts with a copy of Mainnet's state at a specific block
  • All existing contracts are preserved at their original addresses
  • All account balances and contract storage are preserved
  • The chain then diverges from that point

What is a New Chain?

A new chain (not a fork) means:

  • Starts with empty state (genesis block)
  • No existing contracts
  • Must deploy all contracts from scratch
  • Addresses will be different

Current Status: ChainID 138

Genesis Configuration Analysis

Looking at config/genesis.json:

  • Chain ID: 138 (different from Mainnet's 1)
  • Consensus: QBFT 2.0 (different from Mainnet's Proof of Stake)
  • Alloc: Limited pre-allocated accounts
  • WETH9 Address: Not found in genesis

Conclusion: NOT a Fork

Based on the genesis configuration, ChainID 138 appears to be a NEW chain, not a fork:

  • Different consensus mechanism (QBFT 2.0 vs PoS)
  • Different chain ID (138 vs 1)
  • No Mainnet state included
  • WETH9 address not in genesis

If We Made It a Fork

Option 1: Fork at a Specific Block

If we configure ChainID 138 as a fork of Ethereum Mainnet:

{
  "config": {
    "chainId": 138,
    "berlinBlock": 0,
    "londonBlock": 0,
    "istanbulBlock": 0,
    "qbft2": { ... }
  },
  "alloc": {
    // Mainnet state at fork block would be included
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
      "balance": "...",
      "code": "...",  // WETH9 bytecode
      "storage": { ... }  // WETH9 storage
    }
  }
}

Result:

  • WETH9 exists at 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
  • No deployment needed
  • Same address as Mainnet
  • All Mainnet contracts available

Option 2: Use Besu's Fork Configuration

Hyperledger Besu supports forking Ethereum Mainnet:

# besu-config.toml
genesis-file="/config/genesis.json"
fork-block-number=18000000  # Fork at block 18,000,000

Result:

  • Mainnet state preserved
  • WETH9 at original address
  • All contracts available

Current Implementation: New Chain

Since ChainID 138 is configured as a new chain (not a fork):

Implications:

  1. WETH9 does NOT exist
  2. Must deploy WETH9
  3. Address will be different from Mainnet
  4. Full control over chain state
  5. Custom consensus (QBFT 2.0)

Deployment Options:

  1. Deploy with CREATE: New address (current method)
  2. Deploy with CREATE2: Deterministic address (but still different from Mainnet)
  3. Fork Mainnet: WETH9 already exists (requires genesis reconfiguration)

Recommendation

If You Want WETH9 at Mainnet Address:

Option A: Reconfigure as Fork

  1. Update genesis.json to include Mainnet state
  2. Configure Besu to fork from a specific Mainnet block
  3. WETH9 will exist at 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
  4. No deployment needed

Option B: Keep as New Chain

  1. Deploy WETH9 with CREATE or CREATE2
  2. Document the new address
  3. Users will use the new address on ChainID 138

Trade-offs:

Aspect Fork New Chain
WETH9 Address Same as Mainnet Different
Mainnet Contracts All available Must deploy
State Size ⚠️ Large (full Mainnet state) Small (empty)
Control ⚠️ Limited (inherits Mainnet state) Full control
Consensus ⚠️ Must match Mainnet Custom (QBFT 2.0)

Next Steps

  1. Decide: Fork or New Chain?
  2. If Fork: Update genesis.json with Mainnet state
  3. If New Chain: Continue with current deployment method
  4. Document: Clearly state whether it's a fork or new chain

Conclusion

Current Status: ChainID 138 is a NEW CHAIN, not a fork.

To Use Mainnet WETH9 Address: Reconfigure as a fork of Ethereum Mainnet.

Otherwise: Deploy WETH9 and use the new address.