Skip to content

sync: on-chain pitches, proofs, and AuctionAccepted event#2

Merged
beauwilliams merged 2 commits into
mainfrom
sync/v2-onchain-pitches-proofs
May 12, 2026
Merged

sync: on-chain pitches, proofs, and AuctionAccepted event#2
beauwilliams merged 2 commits into
mainfrom
sync/v2-onchain-pitches-proofs

Conversation

@beauwilliams
Copy link
Copy Markdown
Contributor

Summary

Sync from the private taskmarket repo. Brings the reference implementation in line with PR daydreamsai/taskmarket#83.

The on-chain testnet implementation (proxy 0x436C05C6059D6974608c6123E98B94cC388949a6 on Base Sepolia) was upgraded earlier today to this exact contract; the deployed implementation is 0x738088D288B2D20C528bB2123a5BA4aC1F002AeD.

Contract changes

Three new events extend the surface to cover flows that were previously off-chain:

  • PitchSubmitted(bytes32 indexed taskId, address indexed worker, bytes32 pitchHash)
  • ProofSubmitted(bytes32 indexed taskId, address indexed worker, bytes32 proofHash, bytes32 proofType, uint256 metricValue)
  • AuctionAccepted(bytes32 indexed taskId, address indexed worker, uint256 acceptedPrice) — emitted alongside the legacy BidSubmitted + TaskWorkerSelected pair from acceptAuction so existing indexers keep working

Two new functions anchor content hashes on-chain. The pitch text and proof data themselves stay off-chain; the hash is a tamper-evident commitment that third parties can verify against operator-served content:

  • submitPitch(bytes32 taskId, bytes32 pitchHash) external onlyTrustedForwarder — pitch-mode tasks, status=Open, before pitchDeadline
  • submitProof(bytes32 taskId, bytes32 proofHash, bytes32 proofType, uint256 metricValue) external onlyTrustedForwarder — benchmark mode

Both use _effectiveSender() to recover the worker (the existing PGTR pattern). Hash construction is domain-separated: backends are expected to compute keccak256(abi.encode(taskId, worker, content)) so the same content can't be replayed across tasks or workers.

Storage layout (UUPS-safe, append-only)

  • New: taskPitchHashes (slot 10), taskProofHashes (slot 11)
  • __gap shrunk from 48 → 46
  • storage-layout.before.json and storage-layout.after.json committed
  • New scripts/verify-storage-layout.ts diffs the two and asserts every existing non-gap slot is unchanged. Run with npx tsx scripts/verify-storage-layout.ts
  • New Forge test test_StorageGapIs46Slots reads gap slots directly via vm.load

Other

  • script/AddForwarder.s.sol and script/DeployForwarder.s.sol added (operational scripts that already lived in the private tree)
  • abi/TaskMarket.json regenerated from forge build — 91 ABI entries, including the three new events

Verification

  • forge build — clean
  • forge test — 149 passing
  • npx tsx scripts/verify-storage-layout.ts — 11 existing slots unchanged, gap 48 → 46, 2 new slots appended

Deploy ordering (testnet rehearsal already complete)

For anyone tracking the deployed contract: the upgrade was performed earlier via Upgrade.s.sol against the existing Base Sepolia proxy. Proxy address unchanged. The first mainnet deploy (whenever that happens) will be a fresh Deploy.s.sol with v2 baked in — no upgrade is needed because mainnet has not been launched.

Brings the reference implementation in line with the private repo's v2
contract changes (PR #83 there).

Contract changes:
- New events: PitchSubmitted(taskId, worker, pitchHash),
  ProofSubmitted(taskId, worker, proofHash, proofType, metricValue),
  AuctionAccepted(taskId, worker, acceptedPrice). The auction event
  coexists with the legacy BidSubmitted + TaskWorkerSelected pair from
  acceptAuction so existing indexers keep working.
- New functions: submitPitch(taskId, pitchHash) and
  submitProof(taskId, proofHash, proofType, metricValue) anchor a
  domain-separated content commitment on-chain. Both follow the existing
  PGTR forwarder pattern (onlyTrustedForwarder + _effectiveSender).
- submitPitch enforces pitchDeadline as well as expiryTime.
- Storage: two new mappings appended (taskPitchHashes at slot 10,
  taskProofHashes at slot 11). __gap shrunk from 48 to 46. The committed
  storage-layout.before.json and storage-layout.after.json + the new
  scripts/verify-storage-layout.ts make accidental reordering a CI
  failure for future upgrades.

Other:
- AddForwarder.s.sol and DeployForwarder.s.sol added (operational
  scripts that already existed in the private tree).
- ABI artifact regenerated: 91 entries, including the three new events.

Forge test: 149 passing.
Storage-layout verifier: 11 existing slots unchanged, gap 48 → 46.
Brings the ERC-8195 draft in line with the v2 reference implementation.

- ITMP interface gains submitPitch, submitProof, acceptAuction
  functions and PitchSubmitted, ProofSubmitted, AuctionAccepted events.
- Pitch state machine no longer says "off-chain"; pitch hashes are
  anchored on-chain via submitPitch and indexed via PitchSubmitted.
- Benchmark mode documents submitProof as the canonical on-chain
  anchor path. Validation Registry acceptance remains supported.
- Auction mode adds the acceptAuction* transition (Dutch /
  reverse-Dutch); AuctionAccepted event documented as the primary
  signal, with the legacy BidSubmitted + TaskWorkerSelected pair
  marked OPTIONAL for backward compatibility.
- Part IV renamed "Deliverable Anchoring" -> "Content Anchoring";
  generalized to cover all three anchor types. Pitch and proof hashes
  MUST be domain-separated as keccak256(abi.encode(taskId, worker,
  content)) — rationale added.
- Part VIII indexer requirements extended to require PitchSubmitted,
  ProofSubmitted, and AuctionAccepted with their full argument lists.
- Appendix A.3 adds a Proof Payload schema mirroring the existing
  Pitch Payload.
- Reference Implementation paragraph updated to mention the new test
  coverage and storage-layout verifier script.
@beauwilliams beauwilliams merged commit 67d4e65 into main May 12, 2026
1 check passed
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