feat: document and enforce config field lifecycle (immutable/append-only/mutable)#1265
Open
geoknee wants to merge 1 commit into
Open
feat: document and enforce config field lifecycle (immutable/append-only/mutable)#1265geoknee wants to merge 1 commit into
geoknee wants to merge 1 commit into
Conversation
…nly/mutable) Chain config TOMLs mix values that are fixed at genesis and can never change (e.g. chain_id, block_time, the genesis block) with values that evolve over time (hardfork activations, role rotations, contract upgrades). Nothing told a reader — or CI — which is which. This change makes the distinction explicit and enforced: - Each Chain field carries a `lifecycle` struct tag (immutable / append-only / mutable) with a doc comment explaining the contract and how to classify new fields. This is the source of truth. - superchain/configs/README.md gains a "Field lifecycle" table documenting the contract for humans. - config.CheckImmutableFields compares an old and new config, driven by the tags: immutable fields must be unchanged; hardfork activations are append-only with a time rule — a not-yet-active activation may be added or re-scheduled, but one already in the past is frozen (it is on-chain history). - TestImmutableFieldsUnchanged (ops/internal/manage) enforces this in CI by diffing every changed superchain/configs/*.toml against the merge-base, mirroring the existing codegen check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Chain config TOMLs mix values that are fixed at genesis and can never change (e.g.
chain_id,block_time, the[genesis]block) with values that evolve over time (hardfork activations, role rotations, contract upgrades). Nothing told a reader — or CI — which is which. This PR makes the distinction explicit and enforced.How
Three layers, all driven by one source of truth:
ops/internal/config/chain.go) — everyChainfield carries alifecycle:"immutable|append-only|mutable"tag, plus guidance on classifying new fields. This is the source of truth.superchain/configs/README.md) — a new "Field lifecycle" section with a table and examples.config.CheckImmutableFieldscompares old vs new configs based on the tags, andTestImmutableFieldsUnchanged(ops/internal/manage) runs it against every changedsuperchain/configs/*.toml, diffing against the merge-base (mirroring the existing codegen check).The lifecycle rules
chain_id,block_time,seq_window_size,max_sequencer_drift,gas_paying_token,[genesis][hardforks][roles],[addresses], RPCs,superchain_level,data_availability_type,[optimism], …The append-only rule is time-aware on purpose: hardfork activations are routinely pushed out while still in the future (e.g.
jovian_timewas rescheduled twice via merged PRs). A naive "freeze any set value" rule would have falsely rejected those legitimate PRs. Past activations are on-chain history and stay frozen.Classifications were verified against repo history (e.g.
data_availability_typelegitimately changedeth-da → alt-daon lyra;eip1559params changed on worldchain → both correctlymutable).Testing
Chainfield is added without a tag.go test ./internal/config/... ./internal/manage/,go vet,gofmtall clean.🤖 Generated with Claude Code