Skip to content

PoC probes: enforceable-hooks / wrapper support on Gnosis#16

Draft
anxolin wants to merge 5 commits into
mainfrom
feat/post-enforceable-hook-order
Draft

PoC probes: enforceable-hooks / wrapper support on Gnosis#16
anxolin wants to merge 5 commits into
mainfrom
feat/post-enforceable-hook-order

Conversation

@anxolin

@anxolin anxolin commented Jul 23, 2026

Copy link
Copy Markdown
Owner

What

Gnosis probe scripts investigating whether CoW's order flow can support an "enforceable hooks" wrapper for cow-shed. Each is a JOBS entry in src/index.ts (uncomment the one you want).

  • probeWrappersAppData.ts — uploads an appData doc with metadata.wrappers (built with the wrappers-aware MetadataApi from @cowprotocol/sdk-app-data, re-exported by cow-sdk) to the orderbook's app-data endpoint, vs a control, to confirm the field is accepted. No wallet needed.
  • probeOrder1271Wrapper.ts — deploys a minimal EIP-1271 stub and posts 1271 orders owned by it (with/without wrappers, sig valid/invalid) to test whether the orderbook accepts an order whose signature only validates at settlement.
  • postHookOrder.ts — posts an order with standard CoW hooks in appData (earlier probe).

Why

Validate, against the live Gnosis system, the two assumptions behind the wrapper design: (1) an order can carry a settlement wrapper via metadata.wrappers, and (2) the orderbook defers 1271 signature validation to settlement for wrapper orders (so a shed only "blessed" at settle-time can still get its order accepted).

Run

yarn install
# .env: PRIVATE_KEY, RPC_URL_100 (probeOrder1271Wrapper also needs a little xDAI to deploy the stub)
yarn dev   # runs the active JOBS entry

@anxolin
anxolin marked this pull request as draft July 23, 2026 21:04
@anxolin anxolin changed the title Add Gnosis script to post an order with hooks in appData Tests for PoC of enforceable hooks Jul 23, 2026
@anxolin
anxolin force-pushed the feat/post-enforceable-hook-order branch from 05c1d25 to 477ce8b Compare July 23, 2026 21:11
Adds src/scripts/gnosis/postHookOrder.ts: posts a CoW order on Gnosis
Chain carrying CoW hooks in the order's appData, and prints the full
appData document + hash + order URL so we can inspect how the real
backend/solvers convey and treat hooks.

This is to validate the transport assumption behind an enforceable-hooks
wrapper (cow-shed): that pre/post interactions and wrapper routing travel
via appData. This SDK version exposes standard CoW hooks
(metadata.hooks) but no wrapper/Atomic-Bundles field, so the script
probes the hooks-in-appData path (the closest existing mechanism).

Also adds WXDAI/COW Gnosis token constants and registers the script as
the active JOBS entry.
@anxolin
anxolin force-pushed the feat/post-enforceable-hook-order branch from 477ce8b to c44640a Compare July 23, 2026 21:41
anxolin added 4 commits July 24, 2026 01:04
The docs describe conveying a settlement wrapper via a top-level
`wrappers` array in appData, but that field is absent from released
@cowprotocol/app-data (3.3.1) and cow-sdk (9.2.2). This script uploads a
control appData doc and one with a `wrappers` entry to the Gnosis
orderbook app-data endpoint (PUT /app_data/{hash}) to see whether the
server schema accepts it. No wallet/RPC needed.
wrappers isn't in the deprecated @cowprotocol/app-data; it lives in
@cowprotocol/sdk-app-data (5.3.1, schema v1.15.0), re-exported by
cow-sdk 9.2.2 as MetadataApi. It's under metadata.wrappers with fields
{ address, data?, is_omittable? } (the docs' root-level {target,
isOmittable} is stale). Probe now uses the typed builder + correct
shape.
Replace the deprecated @cowprotocol/app-data package with the new
@cowprotocol/sdk-app-data across all scripts. The `latest` type
namespace is now exported as `cowAppDataLatestScheme`.
…g + wrappers?

Deploys a minimal Mock1271Signer on Gnosis (isValidSignature returns
magic only when valid==true; false mimics an unblessed shed), then posts
three 1271 orders owned by it and compares acceptance:
  A) valid=false, no wrappers    -> expect reject (orderbook validates 1271 at post)
  B) valid=false, with wrappers  -> the question (does it defer validation?)
  C) valid=true,  with wrappers  -> expect accept (sanity)

This is the make-or-break gate for the wrapper-blesses-at-settlement
design. Env: PRIVATE_KEY, RPC_URL_100 (+ a little xDAI to deploy); set
MOCK_1271 to reuse a deployed stub.
@anxolin anxolin changed the title Tests for PoC of enforceable hooks PoC probes: enforceable-hooks / wrapper support on Gnosis Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant