Skip to content

feat(L1): add ProtocolVersions upgrade schedule contract#353

Open
PelleKrab wants to merge 6 commits into
mainfrom
dynamic-hardfork-protocol-id
Open

feat(L1): add ProtocolVersions upgrade schedule contract#353
PelleKrab wants to merge 6 commits into
mainfrom
dynamic-hardfork-protocol-id

Conversation

@PelleKrab

Copy link
Copy Markdown

Summary

Adds ProtocolVersions, a Security Council-controlled L1 contract that
maintains an ordered registry of L2 upgrade activation timestamps and
commits to a reproducible scheduleId hash chain.

  • Registry: upgrades are registered by name (e.g. "canyon") with an
    owner-assigned protocol version; timestamps are set/cleared separately
    by the owner
  • chainTeam role: a secondary address (appointed/revocable by the owner)
    that can only push already-scheduled activations further into the future
    via delayTimestamp, it cannot register, clear, or pull timestamps earlier
  • scheduleId: a cumulative keccak256 chain over (l2ChainId, address, ordered keys, current timestamps).
  • getSchedule: single eth_call view returning the full ordered schedule
    (name, timestamp, protocol version, per-entry hash) for off-chain consumers

Test plan

  • forge test --match-path test/L1/ProtocolVersions.t.sol passes
  • Confirm scheduleId reproducibility manually: compute chain from
    (l2ChainId, address, ordered keys, timestamps) and compare to
    scheduleId() return value
  • Verify delayTimestamp cannot be used to pull an activation earlier
    or to schedule a fresh one
  • Verify setTimestamp(id, 0) correctly clears a pending timestamp and
    reverts the scheduleId to the post-registration value

PelleKrab and others added 5 commits June 25, 2026 18:10
Add the Security Council-controlled upgrade activation schedule contract,
its interface, and tests. Maintains an ordered registry of upgrades and their
L2 activation timestamps, committed via scheduleId.

Generated with Claude Code

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

Replace the history-dependent rolling hash with a per-upgrade cumulative hash
chain reproducible from (l2ChainId, address, ordered keys, current timestamps).
When a timestamp changes, only the affected suffix is recomputed (O(n-j) bubble-up)
rather than hashing the full state on every mutation.

- Add MIN_NOTICE (1 hour) guard on setTimestamp; expose it in the interface
- Require non-zero protocolVersion; use _protocolVersions as existence sentinel,
  removing the separate _upgradeIndex mapping
- Move all errors and events into IProtocolVersions; add MIN_NOTICE to interface
- Replace assembly in _keyFromUpgradeId with bytes32(raw) Solidity cast
- Rename constructor params to leading-underscore convention
- Restructure test file into grouped contracts with snake_case naming,
  external visibility, and @notice on each test function per repo style

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Returns the full ordered upgrade schedule in a single eth_call — name,
activation timestamp, protocol version, and cumulative scheduleId per entry.
Name is recovered from the bytes32 key at read time via _nameFromKey,
avoiding a separate storage mapping.

Generated with Claude Code

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

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the per-call keccak256(abi.encode(l2ChainId, address(this)))
in _refreshScheduleId with a cached immutable _seed set once in the
constructor, saving a hash + encode on every schedule mutation.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@PelleKrab PelleKrab requested a review from jackchuma June 26, 2026 01:21
@cb-heimdall

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 1
Sum 2

Reflects bytecode change from caching hash chain seed as immutable.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants