Skip to content

chore(upgrade-signal): read new ProtocolVersions schedule contract#3963

Merged
PelleKrab merged 6 commits into
mainfrom
pellekrab/upgrade-signal-protocol-versions
Jul 16, 2026
Merged

chore(upgrade-signal): read new ProtocolVersions schedule contract#3963
PelleKrab merged 6 commits into
mainfrom
pellekrab/upgrade-signal-protocol-versions

Conversation

@PelleKrab

Copy link
Copy Markdown
Contributor

Summary

Adds support for reading dynamic upgrade activation schedules from the L1 ProtocolVersions contract.

This updates the upgrade-signal utility to:

  • read the contract-backed upgrade schedule with getSchedule()
  • read the global minimumProtocolVersion()
  • map contract schedule entries onto known BaseUpgrade::CONTRACT_VARIANTS
  • reject schedules requiring a newer node protocol version than the binary supports
  • derive the node protocol version from the Cargo/GitHub release version
  • allow unreleased 0.0.0 dev builds to bypass the minimum-version rejection with U256::MAX

The Solidity ABI in this crate intentionally includes only the read surface used by nodes, not the
full contract interface.

Notes

CONTRACT_VARIANTS remains explicit because it is not the same as all BaseUpgrade variants. It
represents the contract-backed upgrade set in L1 schedule order and intentionally excludes non-
contract-backed upgrades like Bedrock and Zombie.

Tests

cargo fmt --check -p base-upgrade-signal
cargo test -p base-upgrade-signal --all-features
cargo clippy -p base-upgrade-signal --all-targets --all-features -- -D warnings

@cb-heimdall

cb-heimdall commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@PelleKrab
PelleKrab force-pushed the pellekrab/upgrade-signal-protocol-versions branch 2 times, most recently from 8b0a575 to b8b8020 Compare July 14, 2026 23:10
Comment thread crates/utilities/upgrade-signal/src/metrics.rs
Comment thread crates/utilities/upgrade-signal/src/config/mod.rs Outdated
@PelleKrab
PelleKrab force-pushed the pellekrab/upgrade-signal-protocol-versions branch from c80117f to 93c2d9d Compare July 15, 2026 00:07
Comment thread crates/utilities/upgrade-signal/src/contract.rs Outdated
@PelleKrab
PelleKrab force-pushed the pellekrab/upgrade-signal-protocol-versions branch from 93c2d9d to 6581bce Compare July 15, 2026 16:43
Comment thread crates/utilities/upgrade-signal/src/contract.rs

@jackchuma jackchuma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good - just one optional nit to address

Comment thread crates/utilities/upgrade-signal/src/config/mod.rs Outdated
PelleKrab and others added 6 commits July 16, 2026 11:07
Replace the per-upgrade IUpgradeSignal reads (getTimestamp/getProtocolVersion
by name) with the new ProtocolVersions interface from base/contracts#353:

- read the full id-ordered schedule with one getSchedule() call and the
  global minimumProtocolVersion() in a single pinned L1 block read
- map schedule entries onto the node hardfork ladder in activation
  (timestamp) order: id 0 (lowest timestamp) aligns with the oldest
  contract-backed hardfork; entries newer than the known ladder are
  logged and ignored, and unregistered hardforks produce no signal
- attach the global minimum protocol version to every mapped signal so the
  existing validation and sink pipeline is unchanged
- bump the supported node protocol version from 7 to packed semver 1.1.0
- drop the now-impossible TimestampOverflow error (timestamps are uint64
  onchain)
Co-authored-by: Codex <codex-noreply@coinbase.com>
Cache node_protocol_version() in a LazyLock and add tests for the
0.0.0 -> U256::MAX dev-build invariant. Note the packed-semver input
assumption on protocol_version_to_f64.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
The reader only issues eth_calls for getSchedule and minimumProtocolVersion;
nothing decodes TimestampSet or MinimumProtocolVersionUpdated. Remove them and
re-add if event-based reads are introduced later.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
…sion

- Document that map_schedule aligns entries by registration id (positional),
  not by activation timestamp; timestamps need not be monotonic (README + doc).
- Cache the Cargo-derived node protocol version in a LazyLock instead of
  recomputing on every call.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@PelleKrab
PelleKrab force-pushed the pellekrab/upgrade-signal-protocol-versions branch from 9f25b7c to 3dc0af9 Compare July 16, 2026 18:07
@github-actions

Copy link
Copy Markdown
Contributor

Review Summary

Reviewed the migration from per-upgrade getTimestamp/getProtocolVersion calls to the batch getSchedule() + minimumProtocolVersion() contract interface.

No new issues found. The implementation is clean:

  • The positional mapping via CONTRACT_VARIANTS.iter().zip(timestamps.iter()) correctly aligns contract registration IDs with the hardfork ladder, and the doc comment accurately describes the semantics (positional by id, not a timestamp sort).
  • The packed-semver encoding in packed_protocol_version correctly places major << 96 | minor << 64 | patch << 32 into the U256 limb layout, and protocol_version_to_f64 decodes using the matching inverse.
  • The 0.0.0 → U256::MAX dev-build bypass is well-tested and documented.
  • Error handling in read_schedule correctly records metrics for all upgrade IDs on failure (no partial-success paths remain after the batch migration).
  • read_schedule_tolerant properly delegates to read_schedule without double-counting error metrics.
  • The expect calls on env!("CARGO_PKG_VERSION_*").parse() are safe — Cargo guarantees these are numeric strings.
  • Test coverage is thorough: partial schedules, full schedules, filtering, unknown entries, and hardforks without contract entries are all exercised.

Previous inline comments from an earlier review run addressed minor documentation points that appear to already be resolved in this version of the PR.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

❌ base-std fork tests did not run

The build or setup step failed before any tests could execute. Check the workflow logs for details.

Dependency Ref Commit
base-std main 4658f1b7
base-anvil f4370bc97756557d0ef1a6c325ad7d2532e71112 f4370bc9

@PelleKrab
PelleKrab added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit 8a32847 Jul 16, 2026
22 of 24 checks passed
@PelleKrab
PelleKrab deleted the pellekrab/upgrade-signal-protocol-versions branch July 16, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants