feat: owner-managed global default hooks on V2 MultiHookRouter#34
Closed
JhiNResH wants to merge 3 commits into
Closed
feat: owner-managed global default hooks on V2 MultiHookRouter#34JhiNResH wants to merge 3 commits into
JhiNResH wants to merge 3 commits into
Conversation
Extends the V2 per-selector, per-hook-data router with owner-managed global default hook lists. Resolution per (jobId, selector): - per-job list non-empty → use per-job (unchanged V2 behavior) - per-job list empty → fall back to global defaults - both empty → no-op All V2 guarantees apply to resolved lists from either source: - per-hook data dispatch via abi.encode(bytes[]) - de-whitelist resilience (skipped, event emitted) - selector completeness validation against IERC8183HookMetadata Validation at FUND runs unconditionally so a dependent hook declared on one selector without its counterpart globally is caught before value transfers begin. Admin surface (onlyOwner): configureGlobalHooks, batchConfigureGlobalHooks, addGlobalHook, removeGlobalHook, reorderGlobalHooks. Views: getGlobalHooks, globalHookCount, resolveHooks. 23 new tests cover admin CRUD, per-selector independence, revert paths, resolution precedence, runtime dispatch, de-whitelist skip, and cross-selector dependency validation.
3 tasks
…faults-v2 # Conflicts: # contracts/hooks/MultiHookRouter.sol
…faults-v2 # Conflicts: # contracts/hooks/MultiHookRouter.sol
Author
Collaborator
|
Hi @JhiNResH, Thanks for addressing the requested changes. Appreciate the work. After thorough review, this PR will be closed rather than merged. The global-defaults model conflicts with the router's core invariant (client-elected hooks, locked at Funded), and the implementation has security regressions on top of that:
|
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.
Rewritten on V2 per @ariessa's comment. Closes #28.
Summary
Extends the V2 per-selector, per-hook-data router with owner-managed global default hook lists that apply when a job has no per-job configuration for a given selector.
Resolution per
(jobId, selector):All V2 guarantees carry through for resolved lists regardless of source:
abi.encode(bytes[])IERC8183HookMetadataValidation at
FUNDruns unconditionally — even whenFUNDhas no resolved hooks — so a dependent hook declared on one selector without its counterpart globally is caught before value transfers begin.Admin surface (onlyOwner)
configureGlobalHooks(selector, hooks)— replace per-selector listbatchConfigureGlobalHooks(selectors[], hooksPerSelector[][])addGlobalHook(selector, hook)removeGlobalHook(selector, hook)reorderGlobalHooks(selector, hooks)Views:
getGlobalHooks,globalHookCount,resolveHooks.Events
GlobalHooksConfigured,GlobalHookAdded,GlobalHookRemoved,GlobalHooksReordered.Tests
23 new tests in
test/MultiHookRouterGlobal.t.sol:Test plan
forge buildgreenforge test --match-contract MultiHookRouterGlobalTest— 23/23 passing