feat: add --mainnet/--hoodi network presets and bump go-ethereum#973
feat: add --mainnet/--hoodi network presets and bump go-ethereum#973tomatoishealthy wants to merge 3 commits into
Conversation
Wire CLI/env > network preset > existing fallback for the L1 contract addresses consumed at startup, so operators can run mainnet or hoodi without listing every address individually: * --mainnet / --hoodi flags select rollup, sync deposit and L1 sequencer contract defaults; --derivation.rollupAddress / --sync.depositContractAddr / --l1.sequencerContract still win when provided. * Mainnet and hoodi flags are mutually exclusive at startup. * Default constants moved from node/core/config.go to node/types/networks.go so sync/, derivation/ and cmd/ can consume them without an import cycle through node/core (core already depends on sync). * derivation.NewDerivationClient now mirrors sync.NewSyncer's `latestSynced == nil` branch: when the DB has no derivation cursor and no startHeight is configured, pin to the current L1 head. * Bump morph-l2/go-ethereum replace directive across all go.mod files to v0.0.0-20260603075727-e0a2cd340919.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The first-run startHeight fallback in NewDerivationClient was using l1Client.BlockNumber (raw L1 head). With the default cfg.L1.Confirmations=safe (or any non-latest setting), derivationBlock's getLatestConfirmedBlockNumber returns a smaller height than the head, so on the first poll `latest < start` and the loop logs "latest less than start" until L1 catches up. Switch the fallback to nodecommon.GetLatestConfirmedBlockNumber with the same cfg.L1.Confirmations the rest of the loop uses, so StartHeight is always <= the next confirmed `latest`.
…Height fallback
Move the first-run startHeight fallback below the &Derivation{...}
construction so it can call the existing d.getLatestConfirmedBlockNumber
method instead of repeating the nodecommon.GetLatestConfirmedBlockNumber
call signature. Pure refactor — same call path, same confirmations
setting, no behavior change.
Summary
--mainnet/--hoodiCLI flags that select preset L1 contract addresses (rollup, sync deposit, L1 sequencer) at startup. Explicit--derivation.rollupAddress,--sync.depositContractAddr,--l1.sequencerContract(or their env vars) still win — presets are defaults, not overrides. The two flags are mutually exclusive.node/core/config.gotonode/types/networks.go.node/corealready depends onsync/andderivation/, so keeping the constants incorewould have created an import cycle once those packages started consuming them.derivation.NewDerivationClientnow mirrorssync.NewSyncer'slatestSynced == nilbranch: when the DB has no derivation cursor andcfg.StartHeight == 0, pinStartHeightto the current L1 head and log it. Existing nodes (with a populated derivation cursor) are unaffected.morph-l2/go-ethereumreplace directive across all 9go.modfiles in the repo tov0.0.0-20260603075727-e0a2cd340919(HEAD offeat/sequencer-finalon the geth side).Priority order (CLI/env > preset > fallback)
--mainnet--hoodiRollupContractAddress--derivation.rollupAddressMainnetRollupContractAddressHoodiRollupContractAddressL1MessageQueueAddress(sync deposit)--sync.depositContractAddrMainnetSyncDepositContractAddressHoodiSyncDepositContractAddress--l1.sequencerContractMainnetL1SequencerContractAddressHoodiL1SequencerContractAddressStartHeight--derivation.startHeightThe L1Sequencer presets are wired through but currently still hold the zero address — the preset structure is in place ahead of those values being filled in.
Test plan
go build ./...clean across all 9 modulesgo vet ./...cleango mod tidyclean across all 9 modules--mainnetflag (no per-address overrides) confirms rollup/sync deposit addresses load correctly--derivation.rollupAddressset alongside--mainnetconfirms CLI wins--derivation.startHeightconfirms it pins to the current L1 head🤖 Generated with Claude Code