fix: block-based whitelist entry expiry#394
Open
matthias-wright wants to merge 6 commits into
Open
Conversation
Contributor
|
Changes ops whitelist from time-based to block-based expiry with enhanced sentinel transaction validation. Phase 2
LGTM. The transition from Unix timestamps to block numbers eliminates TEE host clock manipulation risks, and the comprehensive sentinel transaction validation (validator ID binding, canonical chain checks, nonce-based replay protection) significantly strengthens the ops whitelist security model. The extensive test coverage demonstrates the edge cases are well-considered. |
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.
Builds on #393.
Replace the wall-clock
expiresAtfield on the sentinelwhitelistKeyABI withkeyExpiresAtBlock.The whitelist entry's validity is now specified in canonical block height instead of
SystemTime::now(), which is host-OS-controlled and therefore untrusted in TEEs.Changes:
expiresAt→keyExpiresAtBlock(u64 block number).Whitelist::add(addr, key_expires_at_block),is_authorized(addr, current_block),evict_expired(current_block)are now strict-less block comparisons.CurrentBlockFn = Arc<dyn Fn() -> u64 + Send + Sync>injected intoSignatureAuthConfig; the node builder wires it from the provider'sbest_block_number. The middleware reads it per request and threadscurrent_blockinto the whitelist checks.SystemTime/UNIX_EPOCHfromsignature_auth_layer.rsandtransaction.rs; the sentinel handler now compareskey_expires_at_blockagainst the same head used for the envelope expiry check.This is the updated shim contract that represents the ABI for whitelist and revoke actions: