Open
Conversation
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.
Summary
Adds
ModularValidationHook, a periphery validation hook that composes multiple independentIValidationHookmodules behind a single hook address. This allows auction deployers to run parallel validation checks (e.g. gating + KYC + rate-limiting) without complex inheritance, while remaining discoverable to offchain integrators via ERC-165 and on-chain getters.Key features
Modulestructs, each wrapping anIValidationHookwithhasHookDataandallowRevertflagssetHookData), which takes priority over user-provided calldata to prevent relay tamperingrequireSenderIsOwner,isReplayable, andvalidUntilBlockexpiry; non-replayable data is consumed on useallowRevert = trueare skipped on failure; others bubble up wrapped revert reasons viaCustomRevertsimulate()dry-runs validation and returns the revert reason (if any) without reverting the callerModuleValidationHook→ModularValidationHook,ValidationModuleLib→ModuleLibInteraction flow
sequenceDiagram participant Auction as ContinuousClearingAuction participant MVH as ModularValidationHook participant HookA as ValidationHook A participant HookB as ValidationHook B Note over MVH: Initialized with Module[]<br/>(HookA: hasHookData=true, HookB: hasHookData=false) Auction->>MVH: validate(maxPrice, amount, owner, sender, hookData) MVH->>MVH: Decode hookData as bytes[]<br/>Load moduleIds from storage loop For each module alt Module has cached hookData MVH->>MVH: Load cached ModuleHookData<br/>(check sender/expiry/replay) else Module needs provided hookData MVH->>MVH: Search provided bytes[] for matching moduleId end MVH->>HookA: validate(maxPrice, amount, owner, sender, moduleHookData) HookA-->>MVH: success / revert MVH->>HookB: validate(maxPrice, amount, owner, sender, "") HookB-->>MVH: success / revert end MVH-->>Auction: success / revert (ValidateReverted) Note over HookA,MVH: Modules can also write cached data: HookA->>MVH: setHookData(moduleId, owner, ModuleHookData) HookA->>MVH: deleteHookData(moduleId, owner)Test plan
ModuleValidationHook.t.solcovering initialization, hook data lifecycle, revert bubbling, simulation, and gas snapshots🤖 Generated with Claude Code