refactor: add minimal reasoning verifier hook for ERC-8183#31
Open
ThoughtProof wants to merge 3 commits intoerc-8183:mainfrom
Open
refactor: add minimal reasoning verifier hook for ERC-8183#31ThoughtProof wants to merge 3 commits intoerc-8183:mainfrom
ThoughtProof wants to merge 3 commits intoerc-8183:mainfrom
Conversation
douglasborthwick-crypto
added a commit
to douglasborthwick-crypto/hook-contracts
that referenced
this pull request
Apr 18, 2026
Adds a minimal ERC-8183 hook that gates the fund stage on a condition-based wallet-state verifier. Complements existing score-based gating (TrustGateHook, erc-8183#9/erc-8183#32) and content-based verification (ReasoningVerifierHook, erc-8183#31) with a third shape: "does this wallet satisfy a named condition set right now?" - contracts/interfaces/IWalletStateVerifier.sol Minimal (bool verified, uint256 validUntil) interface keyed on (wallet, conditionsHash). Hooks stay stateless views. - contracts/hooks/WalletStateHook.sol Inherits BaseERC8183Hook + IERC8183HookMetadata. Immutable verifier + conditionsHash (deploy one hook per distinct condition set, mirrors the minConfidence immutable pattern in ReasoningVerifierHook). Overrides _preFund only — verifier.checkWalletState(caller, conditionsHash) → pass/fail + freshness, reverts otherwise. - contracts/examples/InsumerWalletStateVerifier.sol Reference IWalletStateVerifier implementation. Relayer-push model with optional RIP-7212 P256VERIFY precompile verification of off-chain ECDSA P-256 (ES256) attestation signatures. Works on Base, Arbitrum, Optimism, Polygon, Scroll, ZKsync, Celo — standard ERC-8183 L2 footprint. - test/WalletStateHook.t.sol 21 tests, all passing. Covers constructor guards, _preFund happy path, not-verified revert, expired-attestation revert, validUntil boundary, selector isolation, ERC-165 interface support, verifier relayer auth, and signature-mode flag. Stacked on top of erc-8183#30 (IACPHook → IERC8183Hook rename). Targets main; will rebase cleanly once erc-8183#30 merges.
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
This PR reintroduces the reasoning verifier hook on top of the current upstream architecture.
What changed
IReasoningVerifierinterfaceReasoningVerifierHookbuilt onBaseERC8183Hook_preSubmit(...)using the ERC-8183deliverableas the canonical hashThoughtProofReasoningVerifieras a reference implementation undercontracts/examples/Design intent
The goal is to keep the core hook small, generic, and compatible with the current hook stack:
BaseERC8183Hook-nativeCanonical hash choice
This version treats the ERC-8183
deliverableas the canonical hash checked during_preSubmit(...).That keeps the hook small and avoids adding extra hook-specific encoding requirements.
Verification
Local verification performed:
forge test --match-path test/ReasoningVerifierHook.t.sol✅