{"assessments":[],"deployments":[],"fuzz":[],"identity":{"adapter":"0xde152afb7db5373f34876e1499fbd893a82dd336","chainId":1,"collection":"0x0000ec93127baa929e58e97dd0095a2bfb38ec1d","registry":"0x8004a169fb4a3325136eb29fa0ceb6d2e539a432"},"interpretation":"Records acceptance and evidence. Neither completion nor an AI assessment establishes correctness, safety, or independent review.","jobId":"e1780683-4b86-470d-b664-d91fd15b250c","kind":"shape:chain","nodes":[{"acceptedSubmissionHash":null,"dependsOn":["build_contract_project"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_economics","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"working"},{"acceptedSubmissionHash":null,"dependsOn":["build_contract_project"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_flow","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"working"},{"acceptedSubmissionHash":null,"dependsOn":["build_contract_project","write_foundry_tests","manifest","audit_math","audit_permissions","audit_economics","audit_flow"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"b89279670f5a00f5d26286edee00c97dd158b997031350a01cafe6e0329ad227","skillId":"audit-judge","subagents":4,"tools":[]},"key":"audit_judge","kind":"code","role":"review","skillHash":"b89279670f5a00f5d26286edee00c97dd158b997031350a01cafe6e0329ad227","skillId":"audit-judge","state":"waiting"},{"acceptedSubmissionHash":"8419d680473f36caf1090ca9c324b3d66a0338d3bb4918b859c650819e08886f","dependsOn":["build_contract_project"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_math","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"accepted"},{"acceptedSubmissionHash":null,"dependsOn":["build_contract_project"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","subagents":3,"tools":[]},"key":"audit_permissions","kind":"code","role":"review","skillHash":"bc5bfc8455464381f2db18badb2b55cf8bec1e535c019349a0378fa990741171","skillId":"audit-specialist","state":"working"},{"acceptedSubmissionHash":"4b2c2fc759f3d850a199ae9475a82a8d4137bd0d0456222936ea0bef0aabb3ad","dependsOn":[],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"15b04fc8f60521936b9e2b37c09a804685ec689fc98cd5b04510d986d3106a15","skillId":"build-contract-project","tools":[]},"key":"build_contract_project","kind":"code","role":"implement","skillHash":"15b04fc8f60521936b9e2b37c09a804685ec689fc98cd5b04510d986d3106a15","skillId":"build-contract-project","state":"accepted"},{"acceptedSubmissionHash":null,"dependsOn":["build_contract_project"],"execution":{"network":false,"profile":"foundry","requires":[],"tools":[]},"key":"manifest","kind":"code","role":"integrate","skillHash":null,"skillId":null,"state":"failed"},{"acceptedSubmissionHash":null,"dependsOn":["build_contract_project"],"execution":{"network":false,"profile":"foundry","requires":[],"skillHash":"1ddb4d02eb75e52d5f38cfd5c9bb54f332687b81929c68880cf1e8a6ab27254d","skillId":"write-foundry-tests","subagents":4,"tools":[]},"key":"write_foundry_tests","kind":"code","role":"tests","skillHash":"1ddb4d02eb75e52d5f38cfd5c9bb54f332687b81929c68880cf1e8a6ab27254d","skillId":"write-foundry-tests","state":"working"}],"objective":"Build, test and deploy to Sepolia the contracts for Arms v1, a small protocol with no owner. Bonded agents called arms answer a fixed form about a target contract. Two sealed answers are compared key by key. An IMD oracle panel rules on disputes.\n\nDESIGN RULES\nNo owner, admin, upgrade or pause in the core. Every number is an immutable constructor argument. On the token use only transfer, transferFrom, balanceOf and burn(uint256). Anyone can advance any timeout.\n\nCONTRACTS\nArms (core), ICourt (rulings interface), IMDCourt (IMD IntakeClient adapter), a mock court and a burnable mock token.\n\nARMS AND BONDS\nAn arm is an address with a bond of at least minBond. bond(amount) is capped by maxBondPerArm and maxTotalBonded. setSigner(address) names a signer that may only commit and reveal. Pay and withdrawals go to the arm address. Every job an arm is drawn for locks a tranche of its bond, trancheMultiple x that job's feePerArm, from the draw until the job's challenge window has closed with no challenge open on the job. requestExit() stops new draws at once. withdraw() pays out the unlocked bond after exitDelay. Only a ruled challenge reduces a bond.\n\nFORMS\nregisterForm(formId, keyCount, uri) by anyone, once per formId, keyCount 1 to 32, uri at most 200 bytes. formId is the keccak256 hash of the form text. serve(formId, minFee) opts an arm in and names the lowest feePerArm it will work for. stopServing(formId) opts out. An answer is one bytes32 per key. Two reserved values: UNKNOWN (never paid, never slashed) and NOT_APPLICABLE (an answer like any other).\n\nJOBS\npost(formId, targetChainId, target, atBlock, feePerArm) escrows 3 x feePerArm, with feePerArm at least minFeePerArm and targetChainId in a list fixed at deploy.\ndraw(jobId), at least one block later, picks two arms uniformly among those that serve the form at or under the job's fee, are active, are not the poster or already on the job, and have unlocked bond for the tranche. It is seeded by a later block hash and the job id. A call that finds none can be repeated. If that hash is gone, the seed block moves forward. If the seed is divisible by spotCheckOneIn, a third arm is drawn with them and works blind too. Anyone can cancel a job not filled by fillDeadline for a full refund.\ncommit(jobId, hash) inside commitWindow, hash = keccak256(abi.encode(jobId, arm, values, salt)). Reveal opens as soon as every drawn arm has committed. reveal(jobId, values, salt, evidenceURI) inside revealWindow. An arm that misses either is replaced by a new draw and gets a strike. strikesToDeactivate strikes make it inactive until reactivate() after strikeCooldown.\nsettle(jobId): a key is AGREED when all revealed answers give the same value other than UNKNOWN. Where two arms differ, a tie break arm is drawn. It answers only the disputed keys and may see both answers. Those keys settle by majority (MAJORITY) or stay UNRESOLVED. Each arm is paid feePerArm x (its keys equal to the final value / keyCount). A tie break arm is paid feePerArm x (disputed keys it gets right / disputed keys). burnBps of every payment is burned with token.burn. The rest of the escrow returns to the poster.\nReads: verdict(jobId) and latest(targetChainId, target, formId): per key the value and status (AGREED, MAJORITY, UNRESOLVED, CORRECTED, OVERTURNED), plus feePerArm, whether the job was overturned, when its challenge window ends, atBlock, the arms and their evidence URIs.\n\nCHALLENGES\nchallenge(jobId, key, claimedValue, maxCourtFee) inside challengeWindow after settle, on a key with status AGREED or MAJORITY, with claimedValue different from the stored value. It pulls challengeStake (stakeMultiple x feePerArm) and the court's fee from the challenger and opens a court case. Several challenges can be open on one job, so a bad one cannot block a good one.\nresolve(jobId, key, claimedValue) once the court has ruled or courtDeadline has passed.\nRuling CLAIMED or NEITHER: the key becomes CORRECTED with the claimed value, or OVERTURNED for NEITHER, and the job is marked overturned. Every arm that gave the stored value for that key loses its tranche for the job, once per job at most. The first slash on a job pays, in order: the poster's refund of the job's cost, then challengerRewardBps of the rest set aside as the reward, then the remainder burned. Any later slash on the same job is burned.\nThe reward goes to the first challenge on that job ruled CLAIMED. If all challenges on the job have resolved and none was ruled CLAIMED, the reward is burned.\nThe stake is returned on CLAIMED, NEITHER or no ruling, and on any ruling once the job is overturned. On STORED with the job not overturned, it is split among the arms that gave the stored value.\n\nTHE COURT\nICourt: ask(caseId, formId, formURI, key, targetChainId, target, atBlock, storedValue, claimedValue, payer, maxFee) and ruling(caseId) returning NONE, STORED, CLAIMED or NEITHER.\nIMDCourt asks the IMD oracle through the IMD Intake contract (0xa43e6f75ee006411f79ac1c84120606c2330de82) with action oracle.request@oracle-1. It reads the price with priceOf when the case opens, refuses if that is above maxFee, and pulls it from the payer. One question shape serves every form: for contract target on chain targetChainId at block atBlock, under key number key of the form whose text hashes to formId and is published at formURI, which is correct: the stored value, the claimed value, or neither. Answer type uint256: 1 stored, 2 claimed, 0 neither. Panel size 5, quorum 4, window fromBlock = toBlock = atBlock, evidence panel, consumer = this contract.\nonOracleResult requires: the caller is the Intake, the requestId maps to an open case, agreed >= quorum, the attestation has not expired, and the EIP 712 OracleAttestation (domain name IdentityMD Oracle, version 2, verifying contract = this contract) is signed by the oracle signer fixed at deploy. The signed requestId binds the answer to the case. The callback only stores the ruling and must fit IMD's mainnet callback gas limit of 200,000. A failed request ends at courtDeadline.\nRead the Intake interface, the IMD token per chain, the oracle body format and the live attester address from IMD's docs and API, not from this text. If any part cannot be done as IMD documents it, say which and why, and keep the difference behind ICourt.\n\nCHAIN NOTES\nSepolia only. Robinhood Chain (4663, Arbitrum Orbit) comes later, so read block number and hash through one small library that can switch to ArbSys.\n\nTESTS\nUnit tests for every path and timeout. Fuzz and invariant tests: the token balance of Arms equals bonds plus escrow plus stakes plus rewards set aside; unlocked bond can always be withdrawn after exitDelay; no owner, admin, pause or upgrade function exists; UNKNOWN is never paid or slashed; a poster never gets more than the escrow plus one refund; no arm is drawn twice in a job and the poster never; no arm loses more than one tranche per job and no ruling applies twice; the first slash on a job always covers the refund; an operator controlling poster, arms and challenger never ends with more tokens than it began with. One full job and one full challenge with the mock court. Then one real oracle question on Sepolia through IMDCourt, with transaction hashes in the README.\n\nDELIVER\nA repo with src, test, script and a README stating every parameter and trust assumption (token owner, oracle signer and price, block hash seed) and the Sepolia addresses. Get the independent adversarial review before deployment and list its findings and the changes.\nSepolia parameters: trancheMultiple 10, stakeMultiple 2, minBond 20 x minFeePerArm, burnBps 1000, challengerRewardBps 3000, spotCheckOneIn 10, commitWindow 6 hours, revealWindow 2 hours, fillDeadline 1 day, challengeWindow and courtDeadline 7 days, exitDelay 14 days, strikesToDeactivate 3, strikeCooldown 1 day.","parentJobId":null,"planHash":"5afbc2b25389aac02b59e55ac4874e162197215492a5b774bfb4a08597dbee2e","previousHash":"0000000000000000000000000000000000000000000000000000000000000000","projectId":"e1780683-4b86-470d-b664-d91fd15b250c","publication":{"commit":null,"deliveredAt":null,"repoUrl":"https://github.com/identity-md-launches/launch-3241-build-test-deploy-sepolia"},"receiptIdentity":{"adapter":"0xde152afb7db5373f34876e1499fbd893a82dd336","chainId":1,"collection":"0x0000ec93127baa929e58e97dd0095a2bfb38ec1d","registry":"0x8004a169fb4a3325136eb29fa0ceb6d2e539a432"},"registry":"0xb6d0a187b050fa5bb0b87033a203f37becf4a775","research":[],"schema":"identitymd-work-v1","signals":[{"agentId":"52604","feedbackHash":"2a7c2b496bf524e6c4c5dea33f9edf6f8ea825b103fc6880ca8483fbba627ee5","nodeKey":"audit_math","submissionHash":"8419d680473f36caf1090ca9c324b3d66a0338d3bb4918b859c650819e08886f","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"54231","feedbackHash":"eecb94f160cf5f543a6c283b85f556f10cbf7b08da7907a03533f24cac8adf32","nodeKey":"build_contract_project","submissionHash":"4b2c2fc759f3d850a199ae9475a82a8d4137bd0d0456222936ea0bef0aabb3ad","tag1":"verification:checks","tag2":"acceptance-v2","value":1}],"site":null,"snapshotHash":"9b2b27f73a3c63d74b99e6743f6b5bd9b849c2ff97e52cb138a4ebf302e0fc6a","state":"blocked","submissions":[{"artifacts":[],"attempt":2,"bundleHash":null,"device":"393ade31b99d5d5b","findings":[],"hash":"4aa03afe31a7a56e49385c5e69dcb87b340148b0d6c8ef2d2ceafa85ef4b486c","nodeId":"106338ee-0bac-42a8-bcf8-0ce04282c9b9","outcome":"failed","summary":"needs input: The accepted Arms constructor takes Params with 24 static ABI fields. The supplied evm-contracts-launch reference requires one constructorArgs entry per struct field and limits that list to 16 entries. A manifest matching Arms therefore exceeds the launch limit; shortening or packing its entries would mismatch the accepted ABI. This task permits changing only launch.json, so the constructor cannot be repaired here. All deployment values are available. forge build succeeded and forge test passed all 49 tests with the required fuzz seed. — Can you return this to the contract build step to revise Arms' constructor to fit the fixed 16-word launch limit while preserving the approved behavior, then retry the manifest-only task?","treeHash":null,"usage":{"cachedInputTokens":568704,"cost":{"source":"estimated","usdMicros":1786084},"inputTokens":92273,"model":"gpt-6-astra","outputTokens":5893,"runtime":"codex","turns":5,"wallClockMs":202601}},{"artifacts":[],"attempt":1,"bundleHash":"a42f5859b8c3f7148cfe68e0551105a72ff02dcd7542b8c601125b1f93d79565","device":"a0f92fec784312b7","findings":[],"hash":"4b2c2fc759f3d850a199ae9475a82a8d4137bd0d0456222936ea0bef0aabb3ad","nodeId":"59e82409-69b1-4b0b-8982-9b16d043cef8","outcome":"completed","summary":"The deliverable is complete and verified locally. Final state:\n\n**What was built** (Foundry project at the repository root, solc 0.8.26, via-IR, `bytecode_hash = \"none\"`):\n- `src/Arms.sol`: the ownerless core with bonds, forms, jobs, seeded draws with spot checks, commit/reveal, tie breaks, settlement with burn, challenges, slashing, rewards and the `verdict`/`latest` reads. Runtime 23,765 bytes, under EIP-170.\n- `src/ICourt.sol`, `src/IMDCourt.sol`: the rulings interface and the IMD Intake adapter. One question shape, panel 5 / quorum 4, `consumer` set to the court, callback bound by `questionHash`, signer fixed at deploy, ruling stored under the 200,000 gas stipend.\n- `src/mocks/MockCourt.sol`, `src/mocks/MockToken.sol`, `src/Blocks.sol` (ArbSys switch), and the protocol's `OracleAttestation`/`OracleQuestion` copied from the reference.\n- `script/Deploy.s.sol` (config as constants, tested directly) and `script/AskSepolia.s.sol` for the real oracle question after launch.\n- `README.md` with every parameter, trust assumptions, review findings and changes, and after-launch steps.\n\n**Verification**\n\n| Check | Result |\n| --- | --- |\n| `forge build` | passes |\n| `forge test` with the verifier's fuzz seed | 49 passed, 0 failed (unit, fuzz, invariants, court, conformance, deploy) |\n| `forge fmt --check` | passes |\n\n**Live values confirmed today** from api.imd.fun and Sepolia RPC: attester `0x5598…2982`, Intake `0xa43e…de82` selling `oracle.request` at 0.5 imdTEST (`0x56bc…58bf`), and the question body returned no blockers from the body check.\n\n**Not done, and why**\n- No Sepolia addresses or transaction hashes are in the README. Deployment is IMD's launch step and this assignment has no wallet and never broadcasts. The README states this and gives the exact script commands to run the one real oracle question after launch and record its hashes.\n- No independent adversarial review was commissioned, since that is IMD's separate step. The README lists the implementation's own ten review findings and the fixes made for each.\n\n**Deliberate deviations, documented in the README**: the court pulls its fee from the asking contract rather than an arbitrary payer (Arms pulls from the challenger), cases are namespaced by asker, and the intake, asset, action and signer are immutable because the brief forbids any owner.\n\nSources used for the live values: [api.imd.fun capabilities](https://api.imd.fun/requests/capabilities), [api.imd.fun oracle requests](https://api.imd.fun/oracle/requests), and the IMD launch repositories found via search, such as [launch-2765](https://github.com/identity-md-launches/launch-2765-launch-two-contracts-repository) and [launch-594](https://github.com/identity-md-launches/launch-594-build-test-independently-review).","treeHash":"921fbf1c97824c40bc8839ce34416911cab40158","usage":{"cachedInputTokens":3703955,"cost":{"source":"runtime","usdMicros":12733779},"inputTokens":770,"model":"claude-fable-5-1","outputTokens":140850,"runtime":"claude","turns":50,"wallClockMs":3694342}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"9e17b97b8ac7c97a","findings":[{"citation":"resolved","description":"Math precision / numerical gap (boundary x invariant). post() escrows exactly 3 x feePerArm (Arms.sol:458), but a spot-checked job has three main arms and can also draw a tie break arm. The spec pays each main arm feePerArm x correctKeys/keyCount and the tie break arm feePerArm x correctDisputed/disputed. With 3 arms and d disputed keys out of K, the main arms can earn up to 3*fee - 2*fee*d/K, and the tie break arm is owed up to fee, so the total due is up to 4*fee - 2*fee*d/K, which is more than the escrow whenever K > 2d. _finalize pays the main arms first and then caps the tie break arm at whatever escrow is left (`due > j.escrow ? j.escrow : due`). It does not revert or flag this. The tie break arm locks a full tranche (10 x fee) and carries slash risk on the disputed keys for a fraction of the pay the spec promises. The spec invariant 'a tie break arm is paid feePerArm x (disputed keys it gets right / disputed keys)' breaks. The poster also gets 0 back, so the protocol's per-job budget is inconsistent with its own pay rule.","line":982,"path":"src/Arms.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {Arms} from \"src/Arms.sol\";\nimport {MockCourt} from \"src/mocks/MockCourt.sol\";\nimport {MockToken} from \"src/mocks/MockToken.sol\";\n\ncontract ProofTieUnderpaid is Test {\n    uint256 constant FEE = 1 ether;\n    MockToken token;\n    MockCourt court;\n    Arms arms;\n    address owner_ = makeAddr(\"owner\");\n    address poster = makeAddr(\"poster\");\n    bytes32 formId = keccak256(\"form\");\n    address[] armSet;\n\n    function _params(uint256 spot) internal view returns (Arms.Params memory p) {\n        p.token = address(token);\n        p.court = address(court);\n        p.trancheMultiple = 10;\n        p.stakeMultiple = 2;\n        p.minFeePerArm = FEE;\n        p.minBond = 20 * FEE;\n        p.maxBondPerArm = 1000 ether;\n        p.maxTotalBonded = 100_000 ether;\n        p.burnBps = 1000;\n        p.challengerRewardBps = 3000;\n        p.spotCheckOneIn = spot;\n        p.commitWindow = 6 hours;\n        p.revealWindow = 2 hours;\n        p.fillDeadline = 1 days;\n        p.challengeWindow = 7 days;\n        p.courtDeadline = 7 days;\n        p.exitDelay = 14 days;\n        p.strikesToDeactivate = 3;\n        p.strikeCooldown = 1 days;\n        p.chainA = 11155111;\n    }\n\n    function _deploy(uint256 spot, uint8 keys, uint256 nArms) internal {\n        vm.warp(1_800_000_000);\n        vm.roll(1000);\n        token = new MockToken(owner_);\n        court = new MockCourt(address(token), 0);\n        arms = new Arms(_params(spot));\n        arms.registerForm(formId, keys, \"ipfs://form\");\n        for (uint256 i; i < nArms; ++i) {\n            address a = makeAddr(string.concat(\"arm\", vm.toString(i)));\n            _fund(a, 1000 ether);\n            vm.startPrank(a);\n            arms.bond(500 ether);\n            arms.serve(formId, FEE);\n            vm.stopPrank();\n            armSet.push(a);\n        }\n        _fund(poster, 1000 ether);\n    }\n\n    function _fund(address who, uint256 amount) internal {\n        vm.prank(owner_);\n        token.mint(who, amount);\n        vm.prank(who);\n        token.approve(address(arms), type(uint256).max);\n    }\n\n    function _job(uint256 id) internal view returns (Arms.Job memory j) {\n        (, bytes memory d) = address(arms).staticcall(abi.encodeWithSelector(arms.jobs.selector, id));\n        j = abi.decode(d, (Arms.Job));\n    }\n\n    function _salt(address a) internal pure returns (bytes32) {\n        return keccak256(abi.encode(\"salt\", a));\n    }\n\n    function _cr(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.commit(id, keccak256(abi.encode(id, a, v, _salt(a))));\n    }\n\n    function _rv(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.reveal(id, v, _salt(a), \"\");\n    }\n\n    function _vals(uint8 keys, bytes32 base, uint8 diffKey, bytes32 diffVal) internal pure returns (bytes32[] memory v) {\n        v = new bytes32[](keys);\n        for (uint256 k; k < keys; ++k) v[k] = keccak256(abi.encode(base, k));\n        if (diffKey < keys) v[diffKey] = diffVal;\n    }\n\n    /// Spot-checked job (3 arms), 32 keys, one disputed: the tie break arm is owed feePerArm but gets 1/16.\n    function test_tieBreakerUnderpaidInSpotCheck() public {\n        _deploy(1, 32, 6);\n        vm.prank(poster);\n        uint256 id = arms.post(formId, 11155111, address(0xBEEF), 100, FEE);\n        vm.roll(vm.getBlockNumber() + 2);\n        arms.draw(id);\n        address[] memory d = arms.armsOf(id);\n        assertEq(d.length, 3);\n        bytes32[] memory va = _vals(32, \"t\", 0, keccak256(\"X\"));\n        bytes32[] memory vb = _vals(32, \"t\", 0, keccak256(\"Y\"));\n        bytes32[] memory vc = _vals(32, \"t\", 0, keccak256(\"Z\"));\n        _cr(id, d[0], va); _cr(id, d[1], vb); _cr(id, d[2], vc);\n        _rv(id, d[0], va); _rv(id, d[1], vb); _rv(id, d[2], vc);\n        arms.settle(id);\n        vm.roll(vm.getBlockNumber() + 2);\n        arms.draw(id);\n        address t = _job(id).tieBreaker;\n        bytes32[] memory tv = new bytes32[](1);\n        tv[0] = keccak256(\"X\");\n        vm.prank(t); arms.commit(id, keccak256(abi.encode(id, t, tv, _salt(t))));\n        uint256 before = token.balanceOf(t);\n        vm.prank(t); arms.reveal(id, tv, _salt(t), \"\");\n        arms.settle(id);\n        uint256 got = token.balanceOf(t) - before;\n        // spec: feePerArm x (1 right / 1 disputed) = 1 ether, less 10% burn = 0.9 ether\n        emit log_named_uint(\"tie breaker received\", got);\n        assertEq(got, 0.9 ether, \"tie breaker paid less than its due\");\n    }\n}","reproduction":"Sepolia params with spotCheckOneIn=1 (the same arithmetic occurs on 1 in 10 jobs with spotCheckOneIn=10), keyCount=32, feePerArm=1e18. Arms A, B and C reveal the same values on keys 1..31. On key 0 they reveal X, Y and Z, so key 0 is disputed (d=1). The tie break arm T reveals X and settle() runs. Main pay: A gets 32/32 = 1e18, B and C get 31/32 = 0.96875e18 each, total 2.9375e18. Escrow left is 0.0625e18. T is owed 1e18 (1/1 disputed keys right) but is paid 0.0625e18, so after the 10% burn it receives 0.05625e18 instead of 0.9e18. Expected: T is paid 0.9e18 net (for example, the escrow is 4 x fee when needed==3, or the tie break pay is reserved first). Actual: 0.05625e18. Run the proof: forge test --match-path test/scratch/ProofTieUnderpaid.t.sol fails with '56250000000000000 != 900000000000000000'.","severity":"medium","snippet":"        if (withTie && j.disputedCount > 0) {\n            uint256 due = j.feePerArm * tieCorrect / j.disputedCount;\n            _pay(jobId, j, j.tieBreaker, due > j.escrow ? j.escrow : due);\n        }","title":"Spot-checked job with a tie break: escrow (3 x fee) cannot cover the 3 main arms plus the tie break arm, so the tie break arm silently receives only what is left (as little as 1/16 of its due)"},{"citation":"resolved","description":"Boundary x invariant. In COMMIT/REVEAL, timeout() removes only arms that missed the step and reverts NotPending when nobody missed (Arms.sol:587-599). The tie break branch never checks whether the tie break arm committed or revealed. Once the TIE_REVEAL deadline passes, anyone can call timeout() on a tie break arm that revealed in time. That arm gets a strike (3 strikes deactivate it), loses its pay, its answer is deleted, and the job returns to TIE_OPEN with a fresh openSince. A main arm that expects to lose the disputed key can keep doing this. Every reopen resets openSince, so this can continue until no candidate is left. settle() then marks the keys UNRESOLVED, which cannot be challenged. The only defence is that someone calls settle() inside the reveal window.","line":601,"path":"src/Arms.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {Arms} from \"src/Arms.sol\";\nimport {MockCourt} from \"src/mocks/MockCourt.sol\";\nimport {MockToken} from \"src/mocks/MockToken.sol\";\n\ncontract ProofTieTimeout is Test {\n    uint256 constant FEE = 1 ether;\n    MockToken token;\n    MockCourt court;\n    Arms arms;\n    address owner_ = makeAddr(\"owner\");\n    address poster = makeAddr(\"poster\");\n    bytes32 formId = keccak256(\"form\");\n    address[] armSet;\n\n    function _params(uint256 spot) internal view returns (Arms.Params memory p) {\n        p.token = address(token);\n        p.court = address(court);\n        p.trancheMultiple = 10;\n        p.stakeMultiple = 2;\n        p.minFeePerArm = FEE;\n        p.minBond = 20 * FEE;\n        p.maxBondPerArm = 1000 ether;\n        p.maxTotalBonded = 100_000 ether;\n        p.burnBps = 1000;\n        p.challengerRewardBps = 3000;\n        p.spotCheckOneIn = spot;\n        p.commitWindow = 6 hours;\n        p.revealWindow = 2 hours;\n        p.fillDeadline = 1 days;\n        p.challengeWindow = 7 days;\n        p.courtDeadline = 7 days;\n        p.exitDelay = 14 days;\n        p.strikesToDeactivate = 3;\n        p.strikeCooldown = 1 days;\n        p.chainA = 11155111;\n    }\n\n    function _deploy(uint256 spot, uint8 keys, uint256 nArms) internal {\n        vm.warp(1_800_000_000);\n        vm.roll(1000);\n        token = new MockToken(owner_);\n        court = new MockCourt(address(token), 0);\n        arms = new Arms(_params(spot));\n        arms.registerForm(formId, keys, \"ipfs://form\");\n        for (uint256 i; i < nArms; ++i) {\n            address a = makeAddr(string.concat(\"arm\", vm.toString(i)));\n            _fund(a, 1000 ether);\n            vm.startPrank(a);\n            arms.bond(500 ether);\n            arms.serve(formId, FEE);\n            vm.stopPrank();\n            armSet.push(a);\n        }\n        _fund(poster, 1000 ether);\n    }\n\n    function _fund(address who, uint256 amount) internal {\n        vm.prank(owner_);\n        token.mint(who, amount);\n        vm.prank(who);\n        token.approve(address(arms), type(uint256).max);\n    }\n\n    function _job(uint256 id) internal view returns (Arms.Job memory j) {\n        (, bytes memory d) = address(arms).staticcall(abi.encodeWithSelector(arms.jobs.selector, id));\n        j = abi.decode(d, (Arms.Job));\n    }\n\n    function _salt(address a) internal pure returns (bytes32) {\n        return keccak256(abi.encode(\"salt\", a));\n    }\n\n    function _cr(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.commit(id, keccak256(abi.encode(id, a, v, _salt(a))));\n    }\n\n    function _rv(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.reveal(id, v, _salt(a), \"\");\n    }\n\n    function _vals(uint8 keys, bytes32 base, uint8 diffKey, bytes32 diffVal) internal pure returns (bytes32[] memory v) {\n        v = new bytes32[](keys);\n        for (uint256 k; k < keys; ++k) v[k] = keccak256(abi.encode(base, k));\n        if (diffKey < keys) v[diffKey] = diffVal;\n    }\n\n    /// A tie break arm that committed and revealed in time is struck and replaced by timeout().\n    function test_revealedTieBreakerStruckByTimeout() public {\n        _deploy(1000, 2, 6);\n        vm.prank(poster);\n        uint256 id = arms.post(formId, 11155111, address(0xBEEF), 100, FEE);\n        vm.roll(vm.getBlockNumber() + 2);\n        arms.draw(id);\n        address[] memory d = arms.armsOf(id);\n        require(d.length == 2, \"spot\");\n        bytes32[] memory va = _vals(2, \"t\", 0, keccak256(\"X\"));\n        bytes32[] memory vb = _vals(2, \"t\", 0, keccak256(\"Y\"));\n        _cr(id, d[0], va); _cr(id, d[1], vb);\n        _rv(id, d[0], va); _rv(id, d[1], vb);\n        arms.settle(id);\n        vm.roll(vm.getBlockNumber() + 2);\n        arms.draw(id);\n        address t = _job(id).tieBreaker;\n        bytes32[] memory tv = new bytes32[](1);\n        tv[0] = keccak256(\"X\");\n        vm.prank(t); arms.commit(id, keccak256(abi.encode(id, t, tv, _salt(t))));\n        vm.prank(t); arms.reveal(id, tv, _salt(t), \"\");\n        // reveal window passes before anyone settles; the losing arm calls timeout instead\n        vm.warp(vm.getBlockTimestamp() + 2 hours + 1);\n        vm.prank(d[1]);\n        try arms.timeout(id) {} catch {}\n        (,,,,,,, uint32 strikes) = arms.arms(t);\n        assertEq(strikes, 0, \"honest tie breaker that revealed was struck\");\n        assertEq(uint8(_job(id).phase), uint8(Arms.Phase.TIE_REVEAL), \"revealed tie break was discarded\");\n    }\n}","reproduction":"Two-arm job, keyCount=2. A reveals [X, v1] and B reveals [Y, v1]. settle() opens the tie break, and T is drawn, commits [X] and reveals [X] inside revealWindow. Nobody calls settle(). After warp(+2h+1), B calls timeout(jobId). Expected: revert NotPending, as in the REVEAL branch, and settle() stays available with X as MAJORITY. Actual: T.strikes == 1, T's entry is deleted and the phase is TIE_OPEN. Run the proof: forge test --match-path test/scratch/ProofTieTimeout.t.sol fails with 'honest tie breaker that revealed was struck: 1 != 0'.","severity":"medium","snippet":"        } else if (j.phase == Phase.TIE_COMMIT || j.phase == Phase.TIE_REVEAL) {\n            address a = j.tieBreaker;\n            arms[a].locked -= tranche;\n            _strike(a);\n            delete entries[jobId][a];\n            j.tieBreaker = address(0);\n            emit Replaced(jobId, a);\n            _reopen(j, Phase.TIE_OPEN);","title":"timeout() in TIE_REVEAL strikes and discards a tie break arm that has already revealed, while the same case in REVEAL is protected with NotPending"},{"citation":"resolved","description":"Boundary (block-hash edge) x the uniform-draw invariant. When blockhash(seedBlock) has expired, draw() sets seedBlock = n-1 and seeds from blockhash(n-1) in the same call. That hash is public before the caller's transaction, so the caller can compute the exact arms drawn, and whether seed % spotCheckOneIn == 0 adds a third arm, for each block and send draw() only in a block where the outcome suits it. A poster that controls two serving arms can wait 256 blocks (about 51 minutes on Sepolia, well inside fillDeadline = 1 day) and draw exactly its own pair with no spot check. That pair can then AGREE on any value. Before expiry the seed is also fixed once seedBlock is mined, but the candidate array (serve/stopServing reorder it by swap-and-pop, minFee and bond change eligibility) can be reshaped by the caller in the same block, which changes `idx = keccak(seed,i) % left`. The spec's 'picks two arms uniformly ... seeded by a later block hash' does not hold. The fix is to move seedBlock to a future block (n+1) and return without drawing, and to fix the candidate set at the seed block.","line":472,"path":"src/Arms.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {Arms} from \"src/Arms.sol\";\nimport {MockCourt} from \"src/mocks/MockCourt.sol\";\nimport {MockToken} from \"src/mocks/MockToken.sol\";\n\ncontract ProofDrawSeed is Test {\n    uint256 constant FEE = 1 ether;\n    MockToken token;\n    MockCourt court;\n    Arms arms;\n    address owner_ = makeAddr(\"owner\");\n    address poster = makeAddr(\"poster\");\n    bytes32 formId = keccak256(\"form\");\n    address[] armSet;\n\n    function _params(uint256 spot) internal view returns (Arms.Params memory p) {\n        p.token = address(token);\n        p.court = address(court);\n        p.trancheMultiple = 10;\n        p.stakeMultiple = 2;\n        p.minFeePerArm = FEE;\n        p.minBond = 20 * FEE;\n        p.maxBondPerArm = 1000 ether;\n        p.maxTotalBonded = 100_000 ether;\n        p.burnBps = 1000;\n        p.challengerRewardBps = 3000;\n        p.spotCheckOneIn = spot;\n        p.commitWindow = 6 hours;\n        p.revealWindow = 2 hours;\n        p.fillDeadline = 1 days;\n        p.challengeWindow = 7 days;\n        p.courtDeadline = 7 days;\n        p.exitDelay = 14 days;\n        p.strikesToDeactivate = 3;\n        p.strikeCooldown = 1 days;\n        p.chainA = 11155111;\n    }\n\n    function _deploy(uint256 spot, uint8 keys, uint256 nArms) internal {\n        vm.warp(1_800_000_000);\n        vm.roll(1000);\n        token = new MockToken(owner_);\n        court = new MockCourt(address(token), 0);\n        arms = new Arms(_params(spot));\n        arms.registerForm(formId, keys, \"ipfs://form\");\n        for (uint256 i; i < nArms; ++i) {\n            address a = makeAddr(string.concat(\"arm\", vm.toString(i)));\n            _fund(a, 1000 ether);\n            vm.startPrank(a);\n            arms.bond(500 ether);\n            arms.serve(formId, FEE);\n            vm.stopPrank();\n            armSet.push(a);\n        }\n        _fund(poster, 1000 ether);\n    }\n\n    function _fund(address who, uint256 amount) internal {\n        vm.prank(owner_);\n        token.mint(who, amount);\n        vm.prank(who);\n        token.approve(address(arms), type(uint256).max);\n    }\n\n    function _job(uint256 id) internal view returns (Arms.Job memory j) {\n        (, bytes memory d) = address(arms).staticcall(abi.encodeWithSelector(arms.jobs.selector, id));\n        j = abi.decode(d, (Arms.Job));\n    }\n\n    function _salt(address a) internal pure returns (bytes32) {\n        return keccak256(abi.encode(\"salt\", a));\n    }\n\n    function _cr(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.commit(id, keccak256(abi.encode(id, a, v, _salt(a))));\n    }\n\n    function _rv(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.reveal(id, v, _salt(a), \"\");\n    }\n\n    function _vals(uint8 keys, bytes32 base, uint8 diffKey, bytes32 diffVal) internal pure returns (bytes32[] memory v) {\n        v = new bytes32[](keys);\n        for (uint256 k; k < keys; ++k) v[k] = keccak256(abi.encode(base, k));\n        if (diffKey < keys) v[diffKey] = diffVal;\n    }\n\n    /// After the seed hash expires, draw seeds from blockhash(n-1), which the caller knows before sending.\n    function test_drawSeedKnownToCallerAfterExpiry() public {\n        _deploy(1000, 2, 6);\n        vm.prank(poster);\n        uint256 id = arms.post(formId, 11155111, address(0xBEEF), 100, FEE);\n        uint256 seedBlock = _job(id).seedBlock;\n        vm.roll(seedBlock + 300); // seed hash is gone\n        // The caller predicts the exact draw from data available before its transaction.\n        bytes32 known = blockhash(vm.getBlockNumber() - 1);\n        uint256 seed = uint256(keccak256(abi.encode(known, id, uint256(0))));\n        address[] memory s = arms.serversOf(formId);\n        uint256 idx = uint256(keccak256(abi.encode(seed, uint256(0)))) % s.length;\n        address predicted = s[idx];\n        arms.draw(id);\n        address[] memory d = arms.armsOf(id);\n        // A draw must not be decided by a hash already known when it is called.\n        assertTrue(d.length == 0 || d[0] != predicted, \"first arm was predictable/choosable by the caller\");\n    }\n}","reproduction":"Post a job. vm.roll(seedBlock + 300) so the seed hash is gone. Before calling, the caller computes seed = keccak256(abi.encode(blockhash(block.number-1), jobId, 0)) and idx = keccak256(abi.encode(seed, 0)) % servers.length, then calls draw(jobId). Expected: a draw whose seed hash has expired picks no arms until a not-yet-mined block exists. Actual: armsOf(jobId)[0] == servers[idx], exactly as predicted. Run the proof: forge test --match-path test/scratch/ProofDrawSeed.t.sol fails with 'first arm was predictable/choosable by the caller'.","severity":"medium","snippet":"        bytes32 h = Blocks.hash(j.seedBlock, arbitrumBlocks);\n        if (h == bytes32(0)) {\n            // The hash is gone: the seed block moves forward to the newest one still available.\n            j.seedBlock = n - 1;\n            h = Blocks.hash(n - 1, arbitrumBlocks);\n        }\n        uint256 seed = uint256(keccak256(abi.encode(h, jobId, j.drawNonce)));","title":"draw() seed is known to the caller before it calls: after 256 blocks it uses blockhash(n-1) of the current block, and before that the seed is fixed while the candidate list stays mutable"},{"citation":"resolved","description":"Boundary (unbounded array). serve() (Arms.sol:411-421) needs no bond and no active status, so any address can push itself onto forms[formId].servers. _candidates loops over every server and does about 4 cold SLOADs each (measured at about 9.3k gas per entry), and draw() calls it for every job and tie break on the form. A form can be registered only once per formId (the hash of its text), and only each server can remove itself, so the form cannot be recovered. With about 4,000 entries draw() needs more than 37M gas, and the limit is reached sooner as the block gas limit falls. Each serve() costs about 100k gas from a fresh address or a CREATE2 minion, so about 0.4B gas in total. That is negligible on Sepolia and roughly 0.4 ETH at 1 gwei on mainnet. Jobs already posted can only be cancelled (OPEN) or settled UNRESOLVED (TIE_OPEN) after fillDeadline. No new job on the form can ever be filled.","line":860,"path":"src/Arms.sol","proof":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.26;\n\nimport {Test} from \"forge-std/Test.sol\";\nimport {Arms} from \"src/Arms.sol\";\nimport {MockCourt} from \"src/mocks/MockCourt.sol\";\nimport {MockToken} from \"src/mocks/MockToken.sol\";\n\ncontract ProofServersDoS is Test {\n    uint256 constant FEE = 1 ether;\n    MockToken token;\n    MockCourt court;\n    Arms arms;\n    address owner_ = makeAddr(\"owner\");\n    address poster = makeAddr(\"poster\");\n    bytes32 formId = keccak256(\"form\");\n    address[] armSet;\n\n    function _params(uint256 spot) internal view returns (Arms.Params memory p) {\n        p.token = address(token);\n        p.court = address(court);\n        p.trancheMultiple = 10;\n        p.stakeMultiple = 2;\n        p.minFeePerArm = FEE;\n        p.minBond = 20 * FEE;\n        p.maxBondPerArm = 1000 ether;\n        p.maxTotalBonded = 100_000 ether;\n        p.burnBps = 1000;\n        p.challengerRewardBps = 3000;\n        p.spotCheckOneIn = spot;\n        p.commitWindow = 6 hours;\n        p.revealWindow = 2 hours;\n        p.fillDeadline = 1 days;\n        p.challengeWindow = 7 days;\n        p.courtDeadline = 7 days;\n        p.exitDelay = 14 days;\n        p.strikesToDeactivate = 3;\n        p.strikeCooldown = 1 days;\n        p.chainA = 11155111;\n    }\n\n    function _deploy(uint256 spot, uint8 keys, uint256 nArms) internal {\n        vm.warp(1_800_000_000);\n        vm.roll(1000);\n        token = new MockToken(owner_);\n        court = new MockCourt(address(token), 0);\n        arms = new Arms(_params(spot));\n        arms.registerForm(formId, keys, \"ipfs://form\");\n        for (uint256 i; i < nArms; ++i) {\n            address a = makeAddr(string.concat(\"arm\", vm.toString(i)));\n            _fund(a, 1000 ether);\n            vm.startPrank(a);\n            arms.bond(500 ether);\n            arms.serve(formId, FEE);\n            vm.stopPrank();\n            armSet.push(a);\n        }\n        _fund(poster, 1000 ether);\n    }\n\n    function _fund(address who, uint256 amount) internal {\n        vm.prank(owner_);\n        token.mint(who, amount);\n        vm.prank(who);\n        token.approve(address(arms), type(uint256).max);\n    }\n\n    function _job(uint256 id) internal view returns (Arms.Job memory j) {\n        (, bytes memory d) = address(arms).staticcall(abi.encodeWithSelector(arms.jobs.selector, id));\n        j = abi.decode(d, (Arms.Job));\n    }\n\n    function _salt(address a) internal pure returns (bytes32) {\n        return keccak256(abi.encode(\"salt\", a));\n    }\n\n    function _cr(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.commit(id, keccak256(abi.encode(id, a, v, _salt(a))));\n    }\n\n    function _rv(uint256 id, address a, bytes32[] memory v) internal {\n        vm.prank(a);\n        arms.reveal(id, v, _salt(a), \"\");\n    }\n\n    function _vals(uint8 keys, bytes32 base, uint8 diffKey, bytes32 diffVal) internal pure returns (bytes32[] memory v) {\n        v = new bytes32[](keys);\n        for (uint256 k; k < keys; ++k) v[k] = keccak256(abi.encode(base, k));\n        if (diffKey < keys) v[diffKey] = diffVal;\n    }\n\n    /// Unbonded addresses can bloat a form's server list until draw() exceeds the block gas limit.\n    function test_serverListGas() public {\n        _deploy(1000, 2, 6);\n        for (uint256 i; i < 4000; ++i) {\n            vm.prank(address(uint160(0x100000 + i)));\n            arms.serve(formId, FEE);\n        }\n        vm.prank(poster);\n        uint256 id = arms.post(formId, 11155111, address(0xBEEF), 100, FEE);\n        vm.roll(vm.getBlockNumber() + 2);\n        (bool ok,) = address(arms).call{gas: 30_000_000}(abi.encodeCall(Arms.draw, (id)));\n        assertTrue(ok, \"draw does not fit in 30M gas\");\n    }\n}","reproduction":"registerForm(f, 2, uri). 6 bonded arms serve f. 4,000 fresh unbonded addresses each call serve(f, 1e18). post(f, ...) and roll 2 blocks. draw(jobId) with 30,000,000 gas runs out of gas. Measured: draw with 4,001 unbonded servers uses 37,468,706 gas. Expected: draw stays bounded, for example by requiring isActive/minBond in serve() and capping servers per form, or by drawing from a bonded-only set. Run the proof: forge test --match-path test/scratch/ProofServersDoS.t.sol fails with 'draw does not fit in 30M gas'.","severity":"medium","snippet":"        address[] storage servers = forms[j.formId].servers;\n        uint256 tranche = trancheMultiple * j.feePerArm;\n        out = new address[](servers.length);\n        uint256 n;\n        for (uint256 i; i < servers.length; ++i) {\n            address a = servers[i];\n            if (a == j.poster || wasDrawn[jobId][a]) continue;\n            if (minFeeOf[j.formId][a] > j.feePerArm) continue;\n            if (!isActive(a)) continue;\n            if (arms[a].bond - arms[a].locked < tranche) continue;","title":"Unbonded addresses can grow a form's server list without limit until draw() exceeds the block gas limit, which disables the form permanently"}],"hash":"8419d680473f36caf1090ca9c324b3d66a0338d3bb4918b859c650819e08886f","nodeId":"8d1effcc-9631-4377-a4f4-6b8ffaca5cdd","outcome":"completed","summary":"I found four defects, all medium severity, and each has a Foundry proof that fails on the current code for the reason stated. They are in `.imd-findings.json` with a coverage row for all 21 entry points, plus three invariant rows. I changed no source files; the proofs are under `test/scratch/`.\n\n1. **The tie break arm is underpaid in spot-checked jobs** (`src/Arms.sol:982`, `post` at :458). Escrow is 3 × fee, but a job with three arms plus a tie break arm can owe up to 4 × fee. `_finalize` pays the three main arms first, then pays the tie break arm only what is left. Example: 32 keys, 1 disputed. The main arms take 2.9375 × fee, so the tie break arm receives 0.05625e18 after the 10% burn instead of 0.9e18. This happens on about 1 in 10 jobs with the Sepolia parameters.\n2. **`timeout()` can strike a tie break arm that already revealed** (`src/Arms.sol:601`). The main commit/reveal branch refuses when nobody missed a step; the tie break branch has no such check. Once the reveal deadline passes without anyone calling `settle`, anyone can call `timeout`. The arm gets a strike, its answer is deleted and the job goes back to drawing. Each reopen resets the fill clock. So the arm that would lose the disputed key can repeat this until no candidates are left, and the key then ends UNRESOLVED and can't be challenged.\n3. **The `draw()` seed can be predicted** (`src/Arms.sol:472`). After the seed block's hash expires, `draw` uses the previous block's hash in the same call, which the caller already knows. A poster with two serving arms can wait about 51 minutes and call `draw` in a block where its own pair is picked and no third arm is added. Before expiry the seed is fixed, but the caller can still reorder the candidate list to change who is picked.\n4. **Anyone can make a form's `draw()` run out of gas** (`src/Arms.sol:860`, `serve` at :411). `serve()` needs no bond, and `draw` loops over every server at about 9.3k gas each. With about 4,000 unbonded servers, `draw` needs 37.5M gas. Forms can't be re-registered, so the form can never be used for a new job.\n\n**Checked and found sound:** I went through the Math Precision, Boundary and Numerical Gap guides. These hold:\n- Every token movement keeps the contract's balance equal to bonds plus escrow plus stakes plus rewards set aside.\n- The first slash always covers the poster's refund, because the constructor requires at least 3 × fee per tranche.\n- A poster never gets back more than the escrow plus one refund.\n- Rounding of arm pay never exceeds the escrow, and the burn split and the stake-split leftover are handled correctly.\n- Bond and locked amounts stay consistent through slashing.\n- The deadline comparisons on commit, timeout, challenge and release don't overlap.\n- No step can make 32-bit or 64-bit fields overflow.\n- `IMDCourt` checks the fee limit, question hash, panel size, quorum and signature.\n\n**Not reached:** I didn't check the economics of operators who control the poster, arms and challenger beyond the slash and reward arithmetic. I didn't check the Sepolia deployment or the README.\n\nTo run a proof: `forge test --match-path test/scratch/ProofTieUnderpaid.t.sol` (the others are `ProofTieTimeout`, `ProofDrawSeed` and `ProofServersDoS`).","treeHash":null,"usage":{"cachedInputTokens":1163133,"cost":{"source":"runtime","usdMicros":1823183},"inputTokens":28,"model":"claude-opus-5-5","outputTokens":35148,"runtime":"claude","turns":15,"wallClockMs":411134}},{"artifacts":[],"attempt":3,"bundleHash":null,"device":"61b4050710026370","findings":[],"hash":"9d008d14a3107ca5c28211725909140eb5e7f0072e07fe05c1982c98da2d85fb","nodeId":"106338ee-0bac-42a8-bcf8-0ce04282c9b9","outcome":"failed","summary":"needs input: The accepted Arms constructor cannot be described in a valid manifest. Arms(Params) takes one struct of 24 static ABI words (token, court, 17 uint256 parameters, chainA..chainD, arbitrumBlocks). The launch manifest writes a struct one entry per field and refuses more than 16 entries (launch_manifest check: 'contracts.2.constructorArgs: Too big: expected array to have <=16 items'). Fewer entries make the Arms creation code revert on argument decoding, packing values changes the accepted ABI, and no contract in the accepted source deploys Arms from fewer arguments. This task may change only launch.json, so the constructor cannot be shrunk here. MockToken (1 argument) and IMDCourt (4 arguments) fit; deploying only those two without the core is not a faithful launch. The brief's 'every number is an immutable constructor argument' conflicts with the network's 16-argument rule; by the stated precedence the network rule wins, so the fix belongs in the build step: keep token, court and the val","treeHash":null,"usage":{"cachedInputTokens":800202,"cost":{"source":"runtime","usdMicros":3285222},"inputTokens":452,"model":"claude-fable-5-1","outputTokens":17471,"runtime":"claude","turns":26,"wallClockMs":329314}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"6156e0902980b6f9","findings":[],"hash":"fc00e6acafd50d0a6c60af97fd6ea4a1bd6de4697b0c8f1b8403bc7d87ab2241","nodeId":"106338ee-0bac-42a8-bcf8-0ce04282c9b9","outcome":"failed","summary":"Inline source file exceeds operator boundary","treeHash":null,"usage":{"cachedInputTokens":0,"inputTokens":0,"model":null,"outputTokens":0,"runtime":"codex","turns":0,"wallClockMs":11603}}],"verification":[{"checks":[{"durationMs":38992,"exitCode":0,"name":"build","output":"Compiling 62 files with Solc 0.8.26\nSolc 0.8.26 finished in 38.87s\nCompiler run successful!\n","passed":true},{"durationMs":1489,"exitCode":0,"name":"test","output":"No files changed, compilation skipped\n\nRan 1 test for test/Deploy.t.sol:DeployTest\n[PASS] test_deploySepoliaConfig() (gas: 17840263)\nSuite result: ok. 1 passed; 0 failed; 0 skipped; finished in 1.39ms (898.40µs CPU time)\n\nRan 4 tests for test/OracleConformance.t.sol:OracleConsumerConformanceTest\n[PASS] test_acceptsAFreshSignatureFromTheVectorKey() (gas: 1531340)\n[PASS] test_callbackSelectorIsCanonical() (gas: 3925)\n[PASS] test_digestMatchesTheProtocol() (gas: 13660)\n[PASS] test_questionHashMatchesTheProtocolVector() (gas: 40578)\nSuite result: ok. 4 passed; 0 failed; 0 skipped; finished in 2.65ms (2.32ms CPU time)\n\nRan 10 tests for test/IMDCourt.t.sol:IMDCourtTest\n[PASS] test_ask_buildsExactBodyAndPullsFee() (gas: 1883968)\n[PASS] test_ask_refusesDuplicateAndFeeAboveMax() (gas: 2681899)\n[PASS] test_ask_whenNotSoldReverts() (gas: 444956)\n[PASS] test_callback_answerCodes() (gas: 4224488)\n[PASS] test_callback_refusals() (gas: 2094552)\n[PASS] test_callback_storesRulingUnder200kGas() (gas: 1884790)\n[PASS] test_failure_closesCaseWithoutRuling() (gas: 1886470)\n[PASS] test_fullChallengeNoAnswerEndsAtCourtDeadline() (gas: 3649094)\n[PASS] test_fullChallengeThroughIMDCourt() (gas: 4097536)\n[PASS] test_question_refusesNonAsciiAndUppercaseHexValue() (gas: 91209)\nSuite result: ok. 10 passed; 0 failed; 0 skipped; finished in 12.16ms (30.57ms CPU time)\n\nRan 33 tests for test/Arms.t.sol:ArmsTest\n[PASS] testFuzz_bondWithdrawRoundTrip(uint96,uint32) (runs: 256, μ: 334467, ~: 334436)\nLogs:\n  Bound result 211189272154816414526\n  Bound result 18944753\n\n[PASS] testFuzz_commitHashBindsJobArmValuesSalt(bytes32,bytes32) (runs: 256, μ: 1154812, ~: 1154980)\n[PASS] testFuzz_settlePaymentsNeverExceedEscrow(bytes32,bytes32,uint8) (runs: 256, μ: 1894757, ~: 1906667)\n[PASS] test_bond_capsAndExit() (gas: 629890)\n[PASS] test_bond_totalCap() (gas: 5543363)\n[PASS] test_cancel_refundsAndUnlocks() (gas: 1170452)\n[PASS] test_challenge_rules() (gas: 3724613)\n[PASS] test_commitReveal_rules() (gas: 1496989)\n[PASS] test_constructor_rejectsBadParams() (gas: 504548)\n[PASS] test_draw_excludesPosterAndIneligible() (gas: 1075411)\n[PASS] test_draw_seedBlockMovesForwardWhenHashIsGone() (gas: 652136)\n[PASS] test_draw_tooEarlyThenFills() (gas: 770968)\n[PASS] test_noOwnerAdminPauseOrUpgrade() (gas: 429989)\n[PASS] test_post_rules() (gas: 507386)\n[PASS] test_registerForm_rules() (gas: 268308)\n[PASS] test_resolve_claimedCorrectsSlashesRefundsRewards() (gas: 3108164)\n[PASS] test_resolve_neitherOverturnsHoldsRewardThenBurnsIt() (gas: 2869207)\n[PASS] test_resolve_noRulingAfterCourtDeadline() (gas: 2727617)\n[PASS] test_resolve_secondSlashBurnsAndArmsLoseOneTrancheOnly() (gas: 3536973)\n[PASS] test_resolve_storedAfterOverturnReturnsStake() (gas: 3273155)\n[PASS] test_resolve_storedSplitsStakeAmongArms() (gas: 2737387)\n[PASS] test_serve_rules() (gas: 310248)\n[PASS] test_setSigner_commitsAndReveals() (gas: 1490114)\n[PASS] test_settle_agreedPaysBurnsReturns() (gas: 2012236)\n[PASS] test_settle_disputeGoesToTieBreakAndMajority() (gas: 2590168)\n[PASS] test_settle_tieBreakTimeoutsStrikeAndUnresolvedWhenNobodyCanBeDrawn() (gas: 2800906)\n[PASS] test_settle_unknownNeverPaidAndNotApplicableIsAnAnswer() (gas: 1852904)\n[PASS] test_spotCheck_threeArmsMajorityWithoutTieBreak() (gas: 59786000)\n[PASS] test_tieBreakerIsSlashedWhenItGaveTheStoredValue() (gas: 3350768)\n[PASS] test_timeout_afterEveryoneRevealedIsNotATimeout() (gas: 1829882)\n[PASS] test_timeout_commitMissStrikesAndReplaces() (gas: 2322660)\n[PASS] test_timeout_revealMissAndDeactivation() (gas: 10257264)\n[PASS] test_withdraw_onlyUnlocked() (gas: 858968)\nSuite result: ok. 33 passed; 0 failed; 0 skipped; finished in 79.58ms (238.55ms CPU time)\n\nRan 1 test for test/ArmsInvariant.t.sol:ArmsInvariantTest\n[PASS]\nArmsInvariantTest invariants:\n[PASS] invariant_balanceEqualsBondsEscrowStakesRewards\n[PASS] invariant_bondsSumAndLockedWithinBond\n[PASS] invariant_handlerPropertiesHeld\n[PASS] invariant_operatorNeverGains\n[PASS] invariant_posterNeverGetsMoreThanEscrowPlusOneRefund\n ArmsInvariantTest invariants (runs: 64, calls: 2560, reverts: 7)\n\n╭-------------+-----------------+-------+---------+----------╮\n| Contract    | Selector        | Calls | Reverts | Discards |\n+============================================================+\n| ArmsHandler | answer          | 186   | 7       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | bond            | 135   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | cancel          | 158   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | challenge       | 162   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | draw            | 163   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | exitAndWithdraw | 181   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | post            | 167   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | reactivate      | 166   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | release         | 187   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | requestExit     | 169   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | resolve         | 184   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | rule            | 167   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | settle          | 162   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | timeout         | 191   | 0       | 0        |\n|-------------+-----------------+-------+---------+----------|\n| ArmsHandler | warp            | 182   | 0       | 0        |\n╰-------------+-----------------+-------+---------+----------╯\n\nLogs:\n  Bound result 6687\n  Bound result 4\n  Bound result 23295\n  Bound result 66\n  Bound result 19011\n  Bound result 200000000000000000000\n  Bound result 17672\n\nSuite result: ok. 1 passed; 0 failed; 0 skipped; finished in 1.33s (1.32s CPU time)\n\nRan 5 test suites in 1.33s (1.42s CPU time): 49 tests passed, 0 failed, 0 skipped (49 total tests)\n","passed":true},{"durationMs":65,"exitCode":0,"name":"source-index","output":"{\"v\":1,\"entryPoints\":[\"Arms.bond(uint256)\",\"Arms.cancel(uint256)\",\"Arms.challenge(uint256,uint8,bytes32,uint256)\",\"Arms.commit(uint256,bytes32)\",\"Arms.draw(uint256)\",\"Arms.post(bytes32,uint256,address,uint256,uint256)\",\"Arms.reactivate()\",\"Arms.registerForm(bytes32,uint8,string)\",\"Arms.release(uint256)\",\"Arms.requestExit()\",\"Arms.resolve(uint256,uint8,bytes32)\",\"Arms.reveal(uint256,bytes32[],bytes32,string)\",\"Arms.serve(bytes32,uint256)\",\"Arms.setSigner(address)\",\"Arms.settle(uint256)\",\"Arms.stopServing(bytes32)\",\"Arms.timeout(uint256)\",\"Arms.withdraw()\",\"IMDCourt.ask(bytes32,bytes32,string,uint8,uint256,address,uint256,bytes32,bytes32,address,uint256)\",\"IMDCourt.onOracleFailure(bytes32,uint8,bytes32,uint16,uint16,bytes)\",\"IMDCourt.onOracleResult(bytes32,(bytes32,uint256,bytes32,uint8,bytes,uint256,uint64,uint64,bytes32,bytes32,uint16,uint16,uint16,uint64,uint64),bytes)\"],\"files\":{\".gitignore\":4,\"README.md\":156,\"foundry.toml\":31,\"script/AskSepolia.s.sol\":53,\"script/Deploy.s.sol\":83,\"src/Arms.sol\":1059,\"src/Blocks.sol\":31,\"src/ICourt.sol\":43,\"src/IIntake.sol\":21,\"src/IMDCourt.sol\":251,\"src/OracleAttestation.sol\":221,\"src/OracleQuestion.sol\":277,\"src/mocks/MockCourt.sol\":107,\"src/mocks/MockToken.sol\":17,\"test/Arms.t.sol\":886,\"test/ArmsBase.t.sol\":191,\"test/ArmsInvariant.t.sol\":410,\"test/Deploy.t.sol\":58,\"test/IMDCourt.t.sol\":358,\"test/OracleConformance.t.sol\":138,\"test/mocks/MockIntake.sol\":86},\"excluded\":[\"lib/\",\"node_modules/\"],\"truncated\":false}","passed":true},{"durationMs":7965,"exitCode":0,"name":"slither","output":"[medium/medium] divide-before-multiply at src/Arms.sol:1041: Arms._splitStake(uint256,Arms.Job,uint8,bytes32,uint256) (src/Arms.sol#1041-1058) performs a multiplication on the result of a division:\n[medium/medium] reentrancy-no-eth at src/Arms.sol:736: Reentrancy in Arms.resolve(uint256,uint8,bytes32) (src/Arms.sol#736-783):\n[medium/medium] reentrancy-no-eth at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[medium/medium] reentrancy-no-eth at src/Arms.sol:736: Reentrancy in Arms.resolve(uint256,uint8,bytes32) (src/Arms.sol#736-783):\n[medium/medium] reentrancy-no-eth at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[medium/medium] reentrancy-no-eth at src/IMDCourt.sol:90: Reentrancy in IMDCourt.ask(bytes32,bytes32,string,uint8,uint256,address,uint256,bytes32,bytes32,address,uint256) (src/IMDCourt.sol#90-136):\n[medium/medium] reentrancy-no-eth at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[medium/medium] uninitialized-local at src/Arms.sol:925: Arms._evaluate(uint256,Arms.Job,uint8,bool).m (src/Arms.sol#925) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:924: Arms._evaluate(uint256,Arms.Job,uint8,bool).cnt (src/Arms.sol#924) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:967: Arms._finalize(uint256,Arms.Job,bool).tieCorrect (src/Arms.sol#967) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:622: Arms.settle(uint256).count (src/Arms.sol#622) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:927: Arms._evaluate(uint256,Arms.Job,uint8,bool).answered (src/Arms.sol#927) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:621: Arms.settle(uint256).mask (src/Arms.sol#621) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:1014: Arms._slash(uint256,Arms.Job,uint8,bytes32).total (src/Arms.sol#1014) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:949: Arms._evaluate(uint256,Arms.Job,uint8,bool).best (src/Arms.sol#949) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:560: Arms.reveal(uint256,bytes32[],bytes32,string).v (src/Arms.sol#560) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:1044: Arms._splitStake(uint256,Arms.Job,uint8,bytes32,uint256).g (src/Arms.sol#1044) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:582: Arms.timeout(uint256).removed (src/Arms.sol#582) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:934: Arms._evaluate(uint256,Arms.Job,uint8,bool).found (src/Arms.sol#934) is a local variable never initialized\n[medium/medium] uninitialized-local at src/Arms.sol:923: Arms._evaluate(uint256,Arms.Job,uint8,bool).vals (src/Arms.sol#923) is a local variable never initialized\n[low/medium] missing-zero-check at src/mocks/MockCourt.sol:41: MockCourt.constructor(address,uint256).feeToken_ (src/mocks/MockCourt.sol#41) lacks a zero-check on :\n[low/medium] calls-loop at src/Arms.sol:996: Arms._pay(uint256,Arms.Job,address,uint256) (src/Arms.sol#996-1005) has external calls inside a loop: token.burn(burned) (src/Arms.sol#1002)\n[low/medium] calls-loop at src/Arms.sol:842: Arms._send(address,uint256) (src/Arms.sol#842-844) has external calls inside a loop: ! token.transfer(to,amount) (src/Arms.sol#843)\n[low/medium] reentrancy-benign at src/IMDCourt.sol:90: Reentrancy in IMDCourt.ask(bytes32,bytes32,string,uint8,uint256,address,uint256,bytes32,bytes32,address,uint256) (src/IMDCourt.sol#90-136):\n[low/medium] reentrancy-benign at src/Arms.sol:736: Reentrancy in Arms.resolve(uint256,uint8,bytes32) (src/Arms.sol#736-783):\n[low/medium] reentrancy-benign at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[low/medium] reentrancy-events at src/Arms.sol:996: Reentrancy in Arms._pay(uint256,Arms.Job,address,uint256) (src/Arms.sol#996-1005):\n[low/medium] reentrancy-events at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[low/medium] reentrancy-events at src/Arms.sol:736: Reentrancy in Arms.resolve(uint256,uint8,bytes32) (src/Arms.sol#736-783):\n[low/medium] reentrancy-events at src/Arms.sol:508: Reentrancy in Arms.cancel(uint256) (src/Arms.sol#508-523):\n[low/medium] reentrancy-events at src/Arms.sol:651: Reentrancy in Arms.release(uint256) (src/Arms.sol#651-669):\n[low/medium] reentrancy-events at src/IMDCourt.sol:90: Reentrancy in IMDCourt.ask(bytes32,bytes32,string,uint8,uint256,address,uint256,bytes32,bytes32,address,uint256) (src/IMDCourt.sol#90-136):\n[low/medium] reentrancy-events at src/Arms.sol:349: Reentrancy in Arms.withdraw() (src/Arms.sol#349-359):\n[low/medium] reentrancy-events at src/Arms.sol:440: Reentrancy in Arms.post(bytes32,uint256,address,uint256,uint256) (src/Arms.sol#440-463):\n[low/medium] reentrancy-events at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[low/medium] reentrancy-events at src/Arms.sol:964: Reentrancy in Arms._finalize(uint256,Arms.Job,bool) (src/Arms.sol#964-994):\n[low/medium] reentrancy-events at src/Arms.sol:736: Reentrancy in Arms.resolve(uint256,uint8,bytes32) (src/Arms.sol#736-783):\n[low/medium] reentrancy-events at src/Arms.sol:325: Reentrancy in Arms.bond(uint256) (src/Arms.sol#325-337):\n[low/medium] reentrancy-events at src/Arms.sol:681: Reentrancy in Arms.challenge(uint256,uint8,bytes32,uint256) (src/Arms.sol#681-733):\n[low/medium] timestamp at src/Arms.sol:526: Arms.commit(uint256,bytes32) (src/Arms.sol#526-544) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:508: Arms.cancel(uint256) (src/Arms.sol#508-523) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:576: Arms.timeout(uint256) (src/Arms.sol#576-612) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:736: Arms.resolve(uint256,uint8,bytes32) (src/Arms.sol#736-783) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:859: Arms._candidates(uint256,Arms.Job) (src/Arms.sol#859-875) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:349: Arms.withdraw() (src/Arms.sol#349-359) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:651: Arms.release(uint256) (src/Arms.sol#651-669) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:373: Arms.reactivate() (src/Arms.sol#373-380) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:617: Arms.settle(uint256) (src/Arms.sol#617-647) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:547: Arms.reveal(uint256,bytes32[],bytes32,string) (src/Arms.sol#547-573) uses timestamp for comparisons\n[low/medium] timestamp at src/Arms.sol:681: Arms.challenge(uint256,uint8,bytes32,uint256) (src/Arms.sol#681-733) uses timestamp for comparisons\n[low/medium] timestamp at src/OracleAttestation.sol:157: OracleAttestationConsumer._verifyAttestation(OracleAttestation.Attestation,bytes) (src/OracleAttestation.sol#157-165) uses timestamp for comparisons","passed":true},{"durationMs":803,"exitCode":0,"name":"aderyn","output":"[high] reentrancy-state-change at src/Arms.sol:742: Reentrancy: State change after external call (2 places)\n[low] centralization-risk at src/mocks/MockToken.sol:11: Centralization Risk (2 places)\n[low] costly-loop at src/Arms.sol:485: Costly operations inside loop (9 places)\n[low] internal-function-used-once at src/OracleAttestation.sol:200: Internal Function Used Only Once (2 places)\n[low] large-numeric-literal at src/Arms.sol:233: Large Numeric Literal\n[low] literal-instead-of-constant at src/Arms.sol:288: Literal Instead of Constant (21 places)\n[low] local-variable-shadowing at src/Arms.sol:48: Local Variable Shadows State Variable (25 places)\n[low] require-revert-in-loop at src/Arms.sol:400: Loop Contains `require`/`revert` (5 places)\n[low] uninitialized-local-variable at src/Arms.sol:400: Uninitialized Local Variable (22 places)\n[low] unsafe-erc20-operation at src/Arms.sol:716: Unsafe ERC20 Operation (3 places)\n[low] unused-public-function at src/Arms.sol:382: Public Function Not Used Internally","passed":true}],"detail":"all checks passed","evaluation":"checks","profile":"foundry","status":"accepted","submissionHash":"4b2c2fc759f3d850a199ae9475a82a8d4137bd0d0456222936ea0bef0aabb3ad","verifiedTreeHash":"921fbf1c97824c40bc8839ce34416911cab40158","verifierVersion":"0.1.0+b51cee5a"}]}