Skip to content

refactor: add minimal reasoning verifier hook for ERC-8183#31

Open
ThoughtProof wants to merge 3 commits intoerc-8183:mainfrom
ThoughtProof:feat/reasoning-verifier-upstream
Open

refactor: add minimal reasoning verifier hook for ERC-8183#31
ThoughtProof wants to merge 3 commits intoerc-8183:mainfrom
ThoughtProof:feat/reasoning-verifier-upstream

Conversation

@ThoughtProof
Copy link
Copy Markdown

@ThoughtProof ThoughtProof commented Apr 17, 2026

Summary

This PR reintroduces the reasoning verifier hook on top of the current upstream architecture.

What changed

  • adds a minimal IReasoningVerifier interface
  • adds ReasoningVerifierHook built on BaseERC8183Hook
  • gates _preSubmit(...) using the ERC-8183 deliverable as the canonical hash
  • adds ThoughtProofReasoningVerifier as a reference implementation under contracts/examples/
  • adds tests covering the hook and the example verifier on the current upstream architecture

Design intent

The goal is to keep the core hook small, generic, and compatible with the current hook stack:

  • BaseERC8183Hook-native
  • verifier-agnostic
  • minimal surface area
  • product-specific example separated from the core hook

Canonical hash choice

This version treats the ERC-8183 deliverable as 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
  • 'forge build' ✅

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants