fix(session-keys): honor expiry == 0 as never-expires sentinel#70
Open
Ridwannurudeen wants to merge 1 commit intoSeismicSystems:mainfrom
Open
fix(session-keys): honor expiry == 0 as never-expires sentinel#70Ridwannurudeen wants to merge 1 commit intoSeismicSystems:mainfrom
Ridwannurudeen wants to merge 1 commit intoSeismicSystems:mainfrom
Conversation
…verifyAndConsumeNonce Keys created with expiry = 0 are documented as 'never expires' in both the Key struct NatSpec and the IShieldedDelegationAccount interface. However, the runtime checks in execute() and verifyAndConsumeNonce() used a strict > comparison: require(S.expiry > block.timestamp, "key expired"); Since 0 > block.timestamp is always false, any key created with expiry = 0 was permanently locked out — a documented feature that silently didn't work. Fix: change both checks to allow expiry == 0 as the sentinel for unlimited keys: require(S.expiry == 0 || S.expiry > block.timestamp, "key expired"); Fixes SeismicSystems#66
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.
Problem
Keys created with
expiry = 0are documented as "never expires" in both theKeystruct NatSpec and theIShieldedDelegationAccountinterface:However, both
execute()andverifyAndConsumeNonce()used a strict>comparison:Since
0 > block.timestampis alwaysfalse, any key created withexpiry = 0was permanently locked out — a documented feature that silently didn't work. Callers relying on unlimited-expiry keys get an immediate revert on every call.Fix
Change both expiry checks to treat
0as the unlimited sentinel:This matches the documented behavior in
IShieldedDelegationAccount.soland theKeystruct NatSpec.Files changed
contracts/src/seismic-std-lib/session-keys/ShieldedDelegationAccount.solexecute(): session-key path expiry checkverifyAndConsumeNonce(): expiry checkCloses #66