Skip to content

Conversation

StephenButtolph
Copy link
Contributor

@StephenButtolph StephenButtolph commented Sep 10, 2024

Why this should be merged

This PR introduces the ACP-77 validation expiry state. It supports maintaining a set of ExpiryEntrys and iterating over them from lower to higher timestamps.

  • Iteration will be used to remove expired entries when advancing the chain time.
    • During this DeleteExpiry will be used
  • When verifying a RegisterValidatorTx - HasExpiry will be used to very that the tx isn't being replayed.
  • When executing a RegisterValidatorTx - PutExpiry will be used to prevent replaying in a following transaction.

How this works

There is one interesting oddity. Specifically, I wanted the interface of the state.Chain to make no assumptions on the usage pattern. Even though we should never call PutExpiry when the ExpiryEntry already exists, this implementation handles that gracefully by deduplicating values between the added tree and parent/base expiry tree.

How this was tested

  • Added unit tests for the new Diff logic
  • Added unit tests for the new State writing and loding logic

@StephenButtolph StephenButtolph added this to the v1.11.12 milestone Sep 10, 2024
@StephenButtolph StephenButtolph self-assigned this Sep 10, 2024
@StephenButtolph StephenButtolph changed the title WIP Add Expiry Replay Protection Add Expiry Replay Protection Sep 10, 2024
@StephenButtolph StephenButtolph changed the base branch from master to replace-iterator-test-helper September 10, 2024 19:39
Base automatically changed from replace-iterator-test-helper to master September 10, 2024 20:18
@StephenButtolph StephenButtolph marked this pull request as ready for review September 11, 2024 03:41
This was referenced Sep 11, 2024
@StephenButtolph StephenButtolph changed the base branch from master to implement-deduplication-iterator September 11, 2024 16:01
Base automatically changed from implement-deduplication-iterator to master September 11, 2024 17:01
@StephenButtolph StephenButtolph added this pull request to the merge queue Sep 12, 2024
Merged via the queue into master with commit d366a13 Sep 12, 2024
20 of 21 checks passed
@StephenButtolph StephenButtolph deleted the implement-acp-77-add-validator-replay-protection branch September 12, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants