Skip to content

feat: add _packValidationDataBlockRange helper (fixes silent block-deadline degradation) - #622

Open
SashaMIT wants to merge 1 commit into
eth-infinitism:developfrom
SashaMIT:fix/pack-validation-data-block-range
Open

SashaMIT wants to merge 1 commit into
eth-infinitism:developfrom
SashaMIT:fix/pack-validation-data-block-range

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • EntryPoint._getValidationData applies block-number validity only when both validAfter and validUntil carry VALIDITY_BLOCK_RANGE_FLAG; otherwise the values are read as timestamps.
  • No packing helper exists for block ranges. The natural hand-rolled encoding for "valid until block N, no start bound" — validUntil = FLAG|N, validAfter = 0 — fails the both-bounds check, so FLAG|N (~140 trillion) is read as a timestamp and the UserOp stays valid for ~4.4 million years instead of until block N.
  • Add _packValidationDataBlockRange(sigFailed, validUntilBlock, validAfterBlock) which always flags both bounds, and maps a zero deadline to an open-ended block range (mirroring the timestamp 0 = indefinitely convention).

Impact if unsolved

Accounts/paymasters encoding block deadlines with no start bound — e.g. "this intent is only valid for the next 100 blocks" — get silent unlimited validity: a signature intended to die at block N remains executable indefinitely if leaked or front-run later.

Test plan

  • New #packValidationDataBlockRange cases in test/helpers.test.ts: both bounds flagged even when 0; sigFailed preserved; zero deadline → open-ended range.
  • yarn hardhat compile + full test/helpers.test.ts suite passes (5/5).

Made with Cursor

Block-range validity only applies when BOTH bounds carry the range flag. There is no helper for block ranges, and the natural hand-rolled encoding for 'deadline, no start bound' (validUntil flagged, validAfter = 0) fails the both-bounds check and is silently interpreted as a timestamp range — the block deadline becomes validity for millions of years. The helper always flags both bounds and maps a zero deadline to an open-ended range, mirroring the timestamp convention.

Signed-off-by: SashaMIT <sash@ela.city>
Co-authored-by: Cursor <cursoragent@cursor.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.

1 participant