Repository navigation
Add npm run judge, JUDGES.md, and refuse failed deliveries honestly - #19
Merged
Merged
Conversation
scripts/judge-testnet.ts runs every claim on testnet with real transactions and prints PASS or FAIL with explorer links: the desk's refusals before signing, earned standing lifting a limit, the factory's own mandate checks, a full job attacked while funded (the buyer cannot deliver, nobody can expire early or close, only the buyer may freeze, the worker key cannot move NEAR or call anything else), a gasless delivery that pays at once, close returning the deposit, and a job left to expire. Each attempt to break a rule must fail with its code. Running it found a real bug: a relayed delivery that the clause refuses (for example after the deadline) still reported success, because a meta-transaction's outer status covers the delegate action, not the call inside it. The relayer now reads the receipt the clause ran, the desk answers 422 with the contract's reason and does not log a delivery, and the agent library checks the clause left "funded". Scripts and the agent library now use FastNEAR's RPC; the public rpc.testnet.near.org endpoint is deprecated and rate-limits. JUDGES.md gives a five-minute path and maps each claim to its check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Part 4 of the plan: one command for judges, plus a bug the command found.
npm run judge(scripts/judge-testnet.ts) runs real testnet transactions and prints PASS or FAIL per claim:A. The desk refuses 40 (
maxPerClause) and 12 to a payee with no paid jobs (newPayeeCeiling); the same 12 passes for a payee with released clauses.B. A direct
create_clausepanicsMANDATE:max_per_clauseandMANDATE:new_payee_ceiling;set_mandatefrom a non-DAO account panicsONLY_OWNER; a forgedrecord_outcomepanicsONLY_OWN_CLAUSE.C. A full job: the clause has exactly one function-call key. While it is funded:
submit_delivery→ONLY_WORKER_KEYexpire→NOT_EXPIREDclose→NOT_TERMINALfreeze→ONLY_BUYERThen a gasless delivery pays exactly 2, standing rises by 1, and close returns about 1.99 NEAR.
D. A 1-minute job: a late delivery is refused, anyone can
expireand the buyer gets 2 back, and close returns the deposit.Latest run: 23 of 24 passed before the fix in this PR. The 24th was the late delivery, which the clause did refuse on chain while the desk's reply said success. With this PR the check passes as refused. After merge it will show
DEADLINE_PASSEDonce the desk deploys.Bug fixed
DEADLINE_PASSED) was logged as delivered and answered as success.relayDeliverynow reads the clause's own receipt (innerFailure) and throwsDeliveryRefusedErrorwith the contract's reason./relayanswers 422 and does not log a delivery.funded.tests/relayer.inner.test.ts, 1 new intests/near.relayer.test.ts.Also
src/agentuse FastNEAR RPC;rpc.testnet.near.orgis deprecated and rate-limited us mid-run.JUDGES.md: a five-minute path, each claim mapped to its check and reason code, the test counts, the on-chain accounts, and the known limits. Linked from the top of the README.Checks: root typecheck, 226 tests.
🤖 Generated with Claude Code