Skip to content

fix(L1): sanity-check protocol version fits in 128 bits - #387

Merged
PelleKrab merged 1 commit into
mainfrom
fix/protocol-version-max-size
Jul 29, 2026
Merged

fix(L1): sanity-check protocol version fits in 128 bits#387
PelleKrab merged 1 commit into
mainfrom
fix/protocol-version-max-size

Conversation

@PelleKrab

Copy link
Copy Markdown
Contributor

Summary

  • registerUpgrade and setMinimumProtocolVersion accepted an unbounded uint256 protocol version, but the offchain client only packs a protocol version into the lower 128 bits.
  • Both now revert with ProtocolVersions_InvalidProtocolVersion if the provided value exceeds type(uint128).max, preventing a value that would silently lose its upper bits offchain.

Test plan

  • Added test_setMinimumProtocolVersion_tooLarge_reverts and test_setMinimumProtocolVersion_maxValue_succeeds
  • Added test_registerUpgrade_minProtocolVersionTooLarge_reverts
  • forge test — full suite passes
  • just semver-lock — refreshed ProtocolVersions hash in snapshots/semver-lock.json

@cb-heimdall

cb-heimdall commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/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

jackchuma
jackchuma previously approved these changes Jul 29, 2026
registerUpgrade and setMinimumProtocolVersion accepted an unbounded
uint256, but the offchain client packs a protocol version into only
the lower 128 bits. Reject values above type(uint128).max so an
oversized value can't silently truncate offchain.
@PelleKrab
PelleKrab force-pushed the fix/protocol-version-max-size branch from 652d064 to aa2f59b Compare July 29, 2026 13:49
@cb-heimdall
cb-heimdall dismissed jackchuma’s stale review July 29, 2026 13:49

Approved review 4807619613 from jackchuma is now dismissed due to new commit. Re-request for approval.

@PelleKrab
PelleKrab merged commit 57a8809 into main Jul 29, 2026
6 checks passed
@PelleKrab
PelleKrab deleted the fix/protocol-version-max-size branch July 29, 2026 19:14
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