{"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":"8bdcca82-782f-442e-bc78-7c6e5321b501","kind":"audit","nodes":[{"acceptedSubmissionHash":"b5755d415cc092201bce43efe552acc801fd2aa40cdc29159319392a9c5ed432","dependsOn":[],"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":"accepted"},{"acceptedSubmissionHash":"1d866a7adf7d2a8fde4664c5bd01a7b34c96b628b4dead3bdf09a6039db24caf","dependsOn":[],"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":"accepted"},{"acceptedSubmissionHash":"4b91defa3fa887ba309514f4beb6544f52596341db43e57add85f69a7a717233","dependsOn":["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":"accepted"},{"acceptedSubmissionHash":"c7e7a7c072a46bf58c57e07439e6d63bd4faf05dd7b0e24f7d556b1f00fc82c1","dependsOn":[],"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":"a5adb1a5241e9497c961a7a7dc48a61d11226c1d6f6038061455422b08eb654c","dependsOn":[],"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":"accepted"}],"objective":"Audit the chain path of uxp-labs/flop-devnet-lab at this commit: the code that will let an IMD worker open and pay a FLOP compute channel through a session key. None of it is used by a command yet. The spend path (imd-flop booking, ledger, caps) was audited at 33f3b9f and is out of scope here, as are viewer/, spend-guard/, imd-hire/ and tclk-rehearsal/.\nScope:\nA. The chain encoder, imd-flop/src/chain/ (extrinsic.ts, payload.ts, scale.ts, era.ts, calls.ts, fields.ts, reader.ts, describe.ts, table.ts, runtimes.ts, shape.ts). It encodes and signs FlopSessionKeys.execute_via_session around one ComputeChannel call (open_channel, top_up_escrow, timeout, force_open, expire_force_open) for runtime spec 1014020.\nB. The chain reads, imd-flop/src/chain-read/ and imd-flop/src/node-rpc.ts. They read a session's state and a block's events from a FLOP node and can send nothing.\nC. The decoder they rest on, observatory/src/scale/ (block.ts is its one door; shape.ts, decode.ts, storage-key.ts, metadata.ts, reader.ts) with the reviewed shape files observatory/shapes/*.json (format decoder-shape@3, 16 stated storage entries, specs 1014014 and 1014020).\nWork offline and read only: no network, no faucet, no keys, no call to any node, nothing signed with a real key, nothing sent. Do not run as root: some imd-flop tests need a read only file.\nRun first: in observatory, npm ci then npm run build then npm test (77 test files). In imd-flop, npm ci then npm test (1608 tests; it needs the observatory built first). The reference decoder and encoder for tests is polkadot-api (dev dependency of both packages). Recorded chain data is under observatory/fixtures/recording-*/ and the metadata of both specs is on the tape of recording-20261112080132-05842a6db1e9c890.\nThe promises under audit are stated in imd-flop/README.md (sections \"Chain encoder\" and \"Chain reads\"), observatory/RULES.md sections 9 and 10 and observatory/README.md (the decoder). In short: nothing is signed unless the call bytes read back as the input; the declared spend is computed, never passed; a read answers a known value or unknown with a reason and never a default for a value the node did not state; chain data is decoded only for a reviewed runtime, only for a stated entry, only under that entry's key.\nLook for:\n1. Encoder bytes. Any input, hostile ones included (a Proxy, a getter, a typed array with a patched length, a subclass, values at the edges of u32, u64 and u128), for which the sign function is called with bytes the chain would decode as another inner call, amount, channel, sla, signer, nonce, era or tip than the fields and words the encoder returns. Any way a spend, an era or a tip is taken from the caller. A declared spend that is not what the inner call moves. SCALE that differs from the reference for any of the five calls (compact integers, options, enum indices, field order). The signing payload rule for payloads over 256 bytes. The mortal era at its edges (period 64, a birth block at a multiple of the period, block 0, the last valid block).\n2. The encoder's table. Any pallet index, call index, field order or type in imd-flop/src/chain/runtimes.ts that is not what the recorded 1014020 metadata gives, and anything in it typed by hand. Any runtime other than the table's that is not refused before signing.\n3. Chain reads. Any node answer (a frame with another id, with both result and error, a list, a huge answer, hex in upper case or of odd length, null against \"0x\", a head that changes between calls, a header whose number and hash disagree) for which a read answers a known value the node did not state, or throws. Any path that takes a default for a stored value or a stored value for a default: a session that is not stored, a session nonce that is not stored (its default is 0), a breaker that is not stored. A session record that names another owner or delegate and is accepted. Any way a method other than the five read methods reaches the wire, or a socket is opened outside node-rpc.ts.\n4. The decoder's door. Any bytes for which decodeStorageValue or decodeBlockEvents answers decoded with a value that differs from the reference decoder, for the 16 stated entries at both specs. A value accepted under a wrong key (another entry, other key parts, extra key bytes), trailing bytes accepted, an entry the shape does not state decoded, a runtime not on the reviewed list decoded, a shape file that is not the reviewed one accepted (also a decoder-shape@2 file from observatory/fixtures/shapes-at-2). Whether stored and not stored are always told apart (the default of System.Account is not zero). An input that makes the decoder pass its stated budgets, loop, or fail with anything but its own ScaleError. A field or variant name from metadata (__proto__, constructor, toString) that changes an object's prototype or shadows a value.\n5. Storage keys (observatory/src/scale/storage-key.ts and imd-flop/src/chain-read/keys.ts, key-table.ts). Any key that differs from the reference for the stated entries, and any two different key parts that give the same key.\n6. The cross check (imd-flop/src/chain-read/cross-check.ts). Any session state and SessionCallExecuted event accepted together though their totals disagree, also with amounts above 2^53 and with decimal text against numbers.\n7. One fact to hold the code against: on devnet a refused session call does not move the session nonce (research/2026-11-12-encoder-devnet-test/results.final.json: session_nonce is 1 after T3, T4 and T5 and 2 after T6). Say whether anything in scope assumes otherwise.\n8. Words. Any sentence in the README and RULES sections named above that the code does not keep.\n9. The tests. Try to keep a wrong rule alive against imd-flop/test/chain-*.test.ts and review-chain-read-*.test.ts, and against the observatory's mutants (observatory/mutants/*.json, run by node scripts/mutate.mjs <file>). Name any rule with no test that fails without it.\nFor every finding give file and line, severity, impact and a reproduction that runs offline, and say whether it is inside or outside the stated promise. Mark every statement as confirmed (you ran it), inferred or unknown. Say which checks you ran and which you only read.","parentJobId":null,"planHash":"cbd8b51bccb6744b33fbecd58591e79ef0441f53e09b81359ec39a1808e09626","previousHash":"0000000000000000000000000000000000000000000000000000000000000000","projectId":"8bdcca82-782f-442e-bc78-7c6e5321b501","publication":{"commit":null,"deliveredAt":null,"repoUrl":null},"receiptIdentity":{"adapter":"0xde152afb7db5373f34876e1499fbd893a82dd336","chainId":1,"collection":"0x0000ec93127baa929e58e97dd0095a2bfb38ec1d","registry":"0x8004a169fb4a3325136eb29fa0ceb6d2e539a432"},"registry":"0xb6d0a187b050fa5bb0b87033a203f37becf4a775","research":[],"schema":"identitymd-work-v1","signals":[{"agentId":"53924","feedbackHash":"c0669c33d1753eb2add5f46bcfb9cb85db79b2c4b0b93800af3ef8fbd8b94b82","nodeKey":"audit_economics","submissionHash":"b5755d415cc092201bce43efe552acc801fd2aa40cdc29159319392a9c5ed432","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51367","feedbackHash":"30185f618f90e5056b58eaeaf65c2ba408f70983e852aa14d5dfe85d227289e2","nodeKey":"audit_flow","submissionHash":"1d866a7adf7d2a8fde4664c5bd01a7b34c96b628b4dead3bdf09a6039db24caf","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"52124","feedbackHash":"e60027832db9428c19d9e1f9776a9a6c523355477cc51fecbc6db091aa5e5ae8","nodeKey":"audit_judge","submissionHash":"4b91defa3fa887ba309514f4beb6544f52596341db43e57add85f69a7a717233","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51081","feedbackHash":"937bebe9914eb1e73146974ccbd4273e94e97faffc6a5c1a86e4312c6bbd153c","nodeKey":"audit_math","submissionHash":"c7e7a7c072a46bf58c57e07439e6d63bd4faf05dd7b0e24f7d556b1f00fc82c1","tag1":"review:submission","tag2":"acceptance-v2","value":1},{"agentId":"51473","feedbackHash":"1d9636c3ee47cf18de5dc34301ca64a743e3df1f24baf3f6192e53ac40cc08b5","nodeKey":"audit_permissions","submissionHash":"a5adb1a5241e9497c961a7a7dc48a61d11226c1d6f6038061455422b08eb654c","tag1":"review:submission","tag2":"acceptance-v2","value":1}],"site":null,"snapshotHash":"35b53555c0440352cdc997e35689428550249ee7e827f4b4c81eeb714fca6671","state":"completed","submissions":[{"artifacts":[],"attempt":1,"bundleHash":null,"device":"ddfb1efa72fe9a94","findings":[{"citation":"resolved","description":"imd-flop/README.md lines 135-136 and 139 state: 'A field must hold its value: a getter is refused', 'a Proxy's get trap is not used', and that 'a field missing, extra or a getter' is refused before the sign function is called. The top-level input, the inner call, the sla and the birth block go through takeFields/ownValue (fields.ts) which do refuse accessors and never use a get trap. But two parts of the input are read by ordinary property access: (1) the signer's publicKey and sign at extrinsic.ts:130-131, and (2) the runtime id's four names at table.ts:75-78 (`id.specName`, `id.specVersion`, ...). A getter on signer.publicKey or signer.sign runs and is accepted; a Proxy over the runtime id has its get trap invoked for all four names and is accepted; extra keys on the signer object are not refused. CONFIRMED by running dist/chain/extrinsic.js: `signSessionCall({..., signer: { get publicKey() { hits++; return pk }, sign }})` => accepted, 198-byte extrinsic, getter hit once; `runtime: new Proxy(ID, { get(t,k){ trapped.push(k); return t[k] } })` => accepted, trapped = [specName, specVersion, transactionVersion, genesisHash]; `encodeSessionCall({ runtime: { ...ID, get specVersion() { return 1014020 } }, ...})` => accepted. Impact: low. The values read are copied (bytesOf) and the extrinsic is verified by the strict reader, so the bytes signed cannot differ from the fields returned; a getter that returns a different key on a second read is not re-read. The defect is that the stated rule H1/'no getter, no get trap' is narrower in code than in words, and no test covers a getter on the signer or a Proxy as the runtime id (chain-snapshot.test.ts covers owner, sessionNonce, inner fields, sla and birth only). Inside the stated promise. Fix: read signer.publicKey/signer.sign and the four runtime names through ownValue (refusing accessors), or amend README lines 135-136 and 139 to name the signer and the runtime id as read by plain property access.","line":130,"path":"imd-flop/src/chain/extrinsic.ts","reproduction":"cd imd-flop && npm run build (or use dist/) then: node -e 'import(\"./dist/chain/extrinsic.js\").then(async ({signSessionCall})=>{const {RUNTIMES}=await import(\"./dist/chain/runtimes.js\");const {ed25519}=await import(\"@noble/curves/ed25519.js\");const RT=RUNTIMES[0];const ID={specName:RT.specName,specVersion:RT.specVersion,transactionVersion:RT.transactionVersion,genesisHash:RT.genesisHash};const seed=new Uint8Array(32).fill(7);const pk=ed25519.getPublicKey(seed);let hits=0;const out=signSessionCall({runtime:new Proxy(ID,{get(t,k){hits++;return t[k]}}),owner:new Uint8Array(32).fill(1),inner:{call:\"timeout\",channel_id:new Uint8Array(32).fill(2)},sessionNonce:1n,accountNonce:0,birth:{number:100,hash:new Uint8Array(32).fill(9)},signer:{get publicKey(){hits++;return pk},sign:(m)=>ed25519.sign(m,seed)}});console.log(\"accepted\",out.extrinsic.length,\"bytes; getter/trap hits\",hits)})'. Expected per README: a refusal with code BAD_INPUT before sign (a getter / a get trap). Actual: accepted, 198 bytes, 5 getter/trap hits.","severity":"low","snippet":"  const publicKey = bytesOf((signer as { publicKey?: unknown }).publicKey, 32, \"the device public key\");","title":"README promise 'a getter is refused, a Proxy's get trap is not used' is not kept for the signer object and the runtime id (words vs code, item 8; confirmed)"},{"citation":"resolved","description":"imd-flop/README.md line 141 says 'Everything `src/chain` exports is frozen where it is defined' (rule H7). The exported class ByteReader (scale.ts:52) and ChainEncodeError (errors.ts:35) are not frozen and their prototypes are writable (Object.isFrozen(ByteReader) === false, Object.isFrozen(ByteReader.prototype) === false). The strict reader (reader.ts) and the encoder's read-back check (extrinsic.ts checkedCallBytes) both stand on ByteReader, so a write to ByteReader.prototype changes what readCall/readExtrinsic/describeCall report, and because callBytes and the read-back use the same patched reader, the READ_BACK comparison does not catch it. CONFIRMED: after `ByteReader.prototype.uint = function(n){ const v = orig.call(this,n); return n===16 ? 0n : v }`, readCall(ID, bytes) of a top_up_escrow with additional 5n reports spend 0n and additional 0n (before the patch: 5n and 5n). The test that holds rule H7, test/chain-frozen.test.ts, skips every exported function at line 55 (`if (typeof value === \"function\") continue;`), so the rule has no test that fails without it for classes. Impact: low. This needs code running in the same process as the encoder, which could already replace modules; it is a words-vs-code gap and a test gap, not a remote attack. Inside the stated promise (README line 141, rule H7). Fix: Object.freeze(ByteReader) and Object.freeze(ByteReader.prototype) (and the same for ChainEncodeError) where they are defined, and make chain-frozen.test.ts walk exported functions and their prototypes; or narrow the README sentence to objects and arrays.","line":52,"path":"imd-flop/src/chain/scale.ts","reproduction":"cd imd-flop && node -e 'import(\"./dist/chain/scale.js\").then(async ({ByteReader})=>{const {readCall}=await import(\"./dist/chain/reader.js\");const {encodeSessionCall}=await import(\"./dist/chain/extrinsic.js\");const {RUNTIMES}=await import(\"./dist/chain/runtimes.js\");const RT=RUNTIMES[0];const ID={specName:RT.specName,specVersion:RT.specVersion,transactionVersion:RT.transactionVersion,genesisHash:RT.genesisHash};const bytes=encodeSessionCall({runtime:ID,owner:new Uint8Array(32).fill(1),inner:{call:\"top_up_escrow\",channel_id:new Uint8Array(32).fill(2),additional:5n},sessionNonce:1n});console.log(\"frozen?\",Object.isFrozen(ByteReader),Object.isFrozen(ByteReader.prototype));console.log(\"before\",readCall(ID,bytes).spend);const o=ByteReader.prototype.uint;ByteReader.prototype.uint=function(n){const v=o.call(this,n);return n===16?0n:v};console.log(\"after patch\",readCall(ID,bytes).spend)})'. Expected per README line 141: the assignment to ByteReader.prototype.uint throws (frozen) and readCall still reports 5n. Actual: frozen? false false; before 5n; after patch 0n.","severity":"low","snippet":"export class ByteReader {","title":"README 'Everything src/chain exports is frozen where it is defined' is not kept for exported classes: ByteReader.prototype is writable and patching it changes what the strict reader reads while READ_B"},{"citation":"resolved","description":"observatory/RULES.md lines 1073-1075 say: 'The storage it reads today: System.Events and System.LastRuntimeUpgrade, ComputeChannel.Channels, and FlopSessionKeys Sessions, SessionNonces and CircuitBreakers (`STATED_ENTRIES`).' That is six entries. observatory/src/scale/shape.ts STATED_TABLE (lines 56-83) and the derived STATED_ENTRIES hold sixteen entries, and the same section at lines 1140-1144 lists 'The 16 stated entries'. The code decodes any of the sixteen through decodeStorageValue (CONFIRMED: System.Account at both specs decodes, see the reproduction), so the first bullet is stale since the decoder-shape@3 round (round 29). No code defect; the sentence a reviewer reads first understates what the door decodes. Fix: replace the six-entry list at lines 1073-1075 with a reference to the sixteen of STATED_TABLE, or with 'the 16 stated entries below'.","line":1074,"path":"observatory/RULES.md","reproduction":"cd observatory && node -e 'import(\"./dist/scale/shape.js\").then(({STATED_ENTRIES})=>console.log(STATED_ENTRIES.length, STATED_ENTRIES.map(e=>e.join(\".\")).join(\", \")))'. Expected per RULES.md line 1073-1075: six entries. Actual: 16 (System.Events, System.LastRuntimeUpgrade, System.Account, ComputeChannel.Channels, ComputeChannel.FailedAcks, ComputeChannel.ChannelAuthoredOpenedAt, FlopSessionKeys.Sessions, .SessionNonces, .CircuitBreakers, .DelegateSessions, ModelRegistry.Models, .MeasuredRoots, .AllowedDecodePolicies, MinerStaking.Miners, HwCalibration.CalibrationVersions, .LastInitialCalibration). Also decodeStorageValue for System.Account with answer null at spec 1014014 and 1014020 answers decoded:true stored:false with flags 170141183460469231731687303715884105728, equal to the reference decoder's decode of the metadata's default bytes.","severity":"info","snippet":"  and System.LastRuntimeUpgrade, ComputeChannel.Channels, and FlopSessionKeys Sessions,","title":"RULES.md section 9 names six entries as 'the storage it reads today (STATED_ENTRIES)' while STATED_ENTRIES and the same section's shape bullet state sixteen (words, item 8; confirmed)"},{"citation":"resolved","description":"The chain reads promise (README line 152) that 'an answer over its cap (node.ts CAPS, each with its reason)' is unknown and that 'nothing throws for what a node said'. The caps in chain-read/node.ts (bytesWithin, measured) are applied to the parsed result. Before that, node-rpc.ts rpcCall takes the whole WebSocket message (`String(ev.data)`) and parses it (readOutsideJson, which per its header has 'no depth limit' and no size limit) with no bound on the frame's size, and the WebSocket is Node's built-in one created with no message-size option. A node that answers state_getStorage or state_getMetadata with a frame of several GiB makes the process allocate the string and the parsed value before any cap is consulted, so the outcome is an out-of-memory abort, not an unknown with a reason. INFERRED from reading node-rpc.ts lines 40-66 and chain-read/node.ts lines 104-110; not run, because the sandbox denies sockets to localhost and a multi-GiB allocation would risk the review machine. Impact: low (availability of the future provider against a hostile or broken node; nothing is signed or spent). At the edge of the stated promise: the caps are documented as the bound, and this is the one path a node's answer reaches before them. Fix: close the socket and reject with a fixed reason when ev.data exceeds a frame cap (for example 2 + 2 * CAPS.metadata characters, the largest answer any read accepts) before String()/parse, or construct the WebSocket with a maxPayload where the runtime supports one.","line":59,"path":"imd-flop/src/node-rpc.ts","reproduction":"Offline reading check: grep -n 'maxPayload\\|length\\|cap' imd-flop/src/node-rpc.ts imd-flop/src/outside-json.ts shows no bound before parse; the only caps are in imd-flop/src/chain-read/node.ts bytesWithin (line 107) and measured (line 134), both after rpcCall resolved. To observe with a scripted node outside this sandbox: serve a JSON-RPC frame {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x\" + \"00\".repeat(N)} with N large enough to exceed the process heap (for example 2 GiB of hex) and call readSessionState(nodeTransport(url), owner, delegate). Expected per README line 152: unknown with the cap's reason. Actual (inferred): the process aborts with an out-of-memory error while building the frame string or parsing it.","severity":"low","snippet":"        const a = answerOf(readOutsideJson(String(ev.data)));","title":"rpcCall reads and JSON-parses a whole frame before any cap applies: a node answering a frame larger than memory aborts the process instead of answering unknown (item 3 'a huge answer'; inferred, not r"}],"hash":"1d866a7adf7d2a8fde4664c5bd01a7b34c96b628b4dead3bdf09a6039db24caf","nodeId":"39c0f68e-9d6e-4961-b2ca-f3730af46f95","outcome":"completed","summary":"The review is complete and `.imd-findings.json` holds four findings, each with a verified file, line and snippet. No file in the tree was changed; the temporary mutation edits were restored in the same command and the vitest cache they left was removed.\n\n**Outcome.** The encoder, the chain reads and the decoder keep their stated promises on every hostile input I ran. The four findings are documentation-versus-code gaps and one inferred availability concern, none of which lets bytes be signed that differ from the returned fields, a spend be passed in, or a default be answered as a stored value.\n\n**Findings written**\n\n- **Low, confirmed.** README says a getter is refused and a Proxy get trap is never used. The signer's `publicKey` and `sign`, and the four runtime names, are read by plain property access (`extrinsic.ts:130`, `table.ts:75`). A getter on the signer and a Proxy runtime id were both accepted and signed.\n- **Low, confirmed.** README says everything `src/chain` exports is frozen. The exported `ByteReader` class has a writable prototype. Patching its `uint` made `readCall` report spend 0 for a 5-raw top-up while the read-back check still passed. The frozen test skips functions, so this rule has no test that fails without it.\n- **Info, confirmed.** RULES.md section 9 lists six entries as what the decoder reads today. The code and the same section's later bullet state sixteen.\n- **Low, inferred.** The socket path parses a whole frame before any cap applies. A multi-GiB answer would abort the process rather than answer unknown. Not run, since sockets and huge allocations are outside the sandbox.\n\n**Checks I ran (confirmed)**\n\n- Observatory: install, build, 77 test files pass. imd-flop: install, 1604 tests pass, 2 time out in `decision-properties.test.ts` (spend path, out of scope, a 20 s limit under load).\n- Encoder edge inputs: patched-length typed arrays, a lying subclass, u64 at 2^64, birth 0, birth at 2^32-64 accepted and 2^32-63 refused, extra `tip` key refused, a zero signature refused, spec 1014014 refused.\n- Decoder at both specs: System.Account default equals the reference and is not zero, `0x` is not null, a key with one extra byte and swapped key parts are refused, SessionNonces null is known 0 with stored false, and all 8 recorded session values agree with the reference.\n- Six mutants against the chain tests, all killed: payload hash boundary, era overflow, canonical head check, default-as-absent, delegate pair check, two cross-check events.\n- Frame handling in `answerOf`: other id, string id, list, both result and error, notification frame all rejected.\n\n**Only read, not run.** The observatory's 204 decoder mutants, the `chain-table` and `chain-read-keys` regeneration tests beyond their green run, and the era phase arithmetic against Substrate's source. On item 7, nothing in scope assumes a refused call moves the session nonce: the encoder takes the nonce from the caller and the reads report the stored value only.","treeHash":null,"usage":{"cachedInputTokens":2529459,"cost":{"source":"runtime","usdMicros":8158361},"inputTokens":514,"model":"claude-fable-5-1","outputTokens":65470,"runtime":"claude","turns":75,"wallClockMs":1558633}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"03845cacb54c3a73","findings":[{"citation":"resolved","description":"CONFIRMED (ran it). readBlockEvents(t, block) reads block.hash at lines 126, 127, 130, 132 and 137 and block.number at 123, 124, 126, 129 and 137, each time straight from the caller's object. Only the read at line 126 is compared with chain_getBlockHash(number); the header (127), the pin (130), the System.Events read (132) and the hash reported in the result (137) each take a fresh read. A hash property that is an accessor (or a Proxy get trap) answering the canonical hash A on the first read and a sibling hash B afterwards makes the read 'known', with the events the node holds at B, labelled with hash A. Nothing checks that the events are those of a canonical block. imd-flop/README.md line 149 ('Events are read only at a block the node reports finalized and canonical') is not kept for a caller object with an accessor, and the reads do not apply the rule H1 the encoder applies to its own input (fields.ts ownValue refuses an accessor; extrinsic.ts reads every field once into a snapshot). Impact: a future caller that hands in a non-plain object (a class instance with a getter, a Proxy) can get a non-canonical block's events reported under the canonical hash, and crossCheck then compares a session state with those events. The node's answers are not at fault, so the promise about node answers holds (a plain {number, hash: B} is refused: confirmed). Outside the stated promise about node answers, inside the README sentence quoted. Fix: read block.number and block.hash once at the top (own-property reads as fields.ts ownValue does, or at least one local copy) and use the copies everywhere, including atOf.","line":126,"path":"imd-flop/src/chain-read/read.ts","reproduction":"Offline, after `npm run build` in observatory and `npm test` in imd-flop (dist/ exists). Scripted transport from observatory/fixtures/recording-20261112080132-05842a6db1e9c890/tape.jsonl: A = recorded hash of 3528528 (0x187a4c5b...), B = 0xbb..bb (32 bytes, a sibling at the same height, not on the tape), C = recorded hash of 3528527, P = C (A's parent). chain_getFinalizedHead -> A; chain_getHeader(A or B) -> {number: '0x35d7d0', parentHash: P}; chain_getBlockHash(3528528) -> A; state_getMetadata(P) -> the metadata the tape holds at P; state_getStorage(k, A) -> tape at A; state_getStorage(LRU key, B) -> A's recorded LRU bytes; state_getStorage(System.Events key, B) -> C's recorded System.Events. Then:\n  let i = 0; const seq = [A, B, B, B, A];\n  const r = await readBlockEvents(transport, { number: 3528528, get hash() { return seq[i++] ?? A; } });\nExpected: unknown (B is not canonical; readBlockEvents(transport, {number: 3528528, hash: B}) is unknown: 'block 3528528 0xbb.. is not canonical: the node's hash at 3528528 is 0x187a...'). Actual: r.kind === 'known', r.value.hash === A, r.value.events.length === 6 (C's events) while the honest read of A gives 64 events. Transport log: chain_getFinalizedHead | chain_getHeader(A) | chain_getBlockHash(3528528) | chain_getHeader(B) | state_getStorage(LRU, B) | state_getMetadata(P) | state_getStorage(Events, B).","severity":"low","snippet":"  if (canonical.value !== block.hash) return unknown(`block ${block.number} ${block.hash} is not canonical: the node's hash at ${block.number} is ${canonical.value}`);","title":"readBlockEvents re-reads block.hash and block.number from the caller's object after the canonical check, so an accessor passes the check with the canonical hash and then reads a sibling block"},{"citation":"resolved","description":"CONFIRMED (ran it). imd-flop/README.md lines 135, 136 and 139 ('Chain encoder') say 'A field must hold its value: a getter is refused', 'An input field that is an accessor is refused, and a Proxy's get trap is not used', and that 'a field missing, extra or a getter' is refused before the sign function is called. The top-level input, the inner call, the sla and the birth block go through fields.ts takeFields/ownValue, which refuse accessors and never use a get trap (confirmed: birth with `get number()` is refused BAD_INPUT 'the birth block.number is an accessor, not a value'). Two parts of the input are exceptions: (1) takeSign reads signer.publicKey (extrinsic.ts:130) and signer.sign (:131) with ordinary property access, so a getter on either runs and its value is accepted, a Proxy signer's get trap is used, and extra keys on the signer object are not refused; (2) table.ts runtimeFor reads id.specName, id.specVersion, id.transactionVersion and id.genesisHash (table.ts:75-78) by plain access, so a getter or a Proxy get trap on the runtime id runs and is accepted. Impact on bytes: none. Each value is read once and copied (bytesOf), and the strict reader verifies the signature against the key in the extrinsic, so a getter that lies on a later read changes nothing signed. The three README sentences are unconditional and are false for these six fields, which are the one input object that runs caller code (the signer) and the one that selects the table line (the runtime id). No test covers a getter on the signer or a Proxy as the runtime id (chain-snapshot.test.ts covers owner, sessionNonce, inner fields, sla and birth). Inside the stated promise (words vs code, item 8). Fix: read the signer's two fields and the runtime id's four names through ownValue (refusing accessors, listing own keys as takeFields does), or narrow README lines 135-136 and 139 to name the signer and the runtime id as read by plain property access. Merged from three specialist findings (permissions, economics, flow) that reproduce the same mechanism.","line":130,"path":"imd-flop/src/chain/extrinsic.ts","reproduction":"Offline, from the repo root after imd-flop/dist exists:\n  const { signSessionCall, encodeSessionCall } = await import('./imd-flop/dist/chain/extrinsic.js'); const { RUNTIMES } = await import('./imd-flop/dist/chain/runtimes.js'); const { ed25519 } = await import('./imd-flop/node_modules/@noble/curves/ed25519.js');\n  const RT = RUNTIMES[0]; const ID = { specName: RT.specName, specVersion: RT.specVersion, transactionVersion: RT.transactionVersion, genesisHash: RT.genesisHash };\n  const seed = new Uint8Array(32).fill(7); const pk = ed25519.getPublicKey(seed);\n  const base = { runtime: ID, owner: new Uint8Array(32).fill(1), inner: { call: 'timeout', channel_id: new Uint8Array(32).fill(2) }, sessionNonce: 1n, accountNonce: 0, birth: { number: 100, hash: new Uint8Array(32).fill(9) } };\n  let hits = 0; signSessionCall({ ...base, signer: { get publicKey() { hits++; return pk; }, sign: (m) => ed25519.sign(m, seed) } }); // expected per README: BAD_INPUT (a getter). Actual: accepted, 198 byte extrinsic, hits === 1\n  signSessionCall({ ...base, signer: { publicKey: pk, get sign() { return (m) => ed25519.sign(m, seed); } } }); // actual: accepted\n  signSessionCall({ ...base, signer: { publicKey: pk, sign: (m) => ed25519.sign(m, seed), extra: 1 } }); // expected: refused (a field extra); actual: accepted\n  const trapped = []; signSessionCall({ ...base, runtime: new Proxy(ID, { get(t, k) { trapped.push(k); return t[k]; } }), signer: { publicKey: pk, sign: (m) => ed25519.sign(m, seed) } }); // expected: the get trap is not used; actual: accepted, trapped = ['specName','specVersion','transactionVersion','genesisHash']\n  encodeSessionCall({ runtime: { specName: ID.specName, get specVersion() { return ID.specVersion; }, transactionVersion: ID.transactionVersion, genesisHash: ID.genesisHash }, owner: base.owner, inner: base.inner, sessionNonce: 1n }); // expected: refused (a getter); actual: accepted, 92 call bytes\n  Control: signSessionCall({ ...base, birth: { get number() { return 100; }, hash: new Uint8Array(32).fill(9) }, signer: {...} }) is refused BAD_INPUT 'the birth block.number is an accessor, not a value'.","severity":"low","snippet":"  const publicKey = bytesOf((signer as { publicKey?: unknown }).publicKey, 32, \"the device public key\");","title":"README says a getter is refused and a Proxy's get trap is not used, but the signer's publicKey and sign and the runtime id's four names are read by plain property access (getters run and are accepted,"},{"citation":"resolved","description":"CONFIRMED (ran it). imd-flop/README.md line 141 (rule H7) says 'Everything `src/chain` exports is frozen where it is defined'. The exported classes ByteReader (scale.ts:52) and ChainEncodeError (errors.ts) are not frozen and their prototypes are writable: Object.isFrozen(ByteReader) === false, Object.isFrozen(ByteReader.prototype) === false, and the same for ChainEncodeError. The strict reader (reader.ts) and the encoder's read-back check (extrinsic.ts checkedCallBytes) both stand on ByteReader, so a write to ByteReader.prototype changes what readCall, readExtrinsic and describeCall report; because callBytes and the read-back use the same patched reader, the READ_BACK comparison does not notice. The test that holds rule H7, test/chain-frozen.test.ts, skips every exported function at line 55 (`if (typeof value === \"function\") continue;`), so the rule has no test that fails without it for classes. Impact: low. This needs code in the encoder's own process, which could already replace modules; it is a words-vs-code gap and a test gap, not a remote attack. Inside the stated promise (README line 141). Fix: Object.freeze(ByteReader) and Object.freeze(ByteReader.prototype) (and ChainEncodeError) where they are defined, and make chain-frozen.test.ts walk exported functions and their prototypes; or narrow the README sentence to objects and arrays.","line":52,"path":"imd-flop/src/chain/scale.ts","reproduction":"Offline, from the repo root after imd-flop/dist exists:\n  const { ByteReader } = await import('./imd-flop/dist/chain/scale.js'); const { readCall } = await import('./imd-flop/dist/chain/reader.js'); const { encodeSessionCall } = await import('./imd-flop/dist/chain/extrinsic.js'); const { RUNTIMES } = await import('./imd-flop/dist/chain/runtimes.js');\n  const RT = RUNTIMES[0]; const ID = { specName: RT.specName, specVersion: RT.specVersion, transactionVersion: RT.transactionVersion, genesisHash: RT.genesisHash };\n  const bytes = encodeSessionCall({ runtime: ID, owner: new Uint8Array(32).fill(1), inner: { call: 'top_up_escrow', channel_id: new Uint8Array(32).fill(2), additional: 5n }, sessionNonce: 1n });\n  Object.isFrozen(ByteReader), Object.isFrozen(ByteReader.prototype) // expected per README line 141: true, true. Actual: false, false\n  readCall(ID, bytes).spend // 5n\n  const o = ByteReader.prototype.uint; ByteReader.prototype.uint = function (n) { const v = o.call(this, n); return n === 16 ? 0n : v; }; // expected: throws (frozen prototype)\n  readCall(ID, bytes).spend, readCall(ID, bytes).inner.additional // expected: 5n, 5n. Actual: 0n, 0n","severity":"low","snippet":"export class ByteReader {","title":"README 'Everything src/chain exports is frozen where it is defined' is not kept for the exported classes: ByteReader.prototype is writable and patching it changes what the strict reader and the read-b"},{"citation":"resolved","description":"CONFIRMED (ran it). observatory/RULES.md lines 1073-1075 say: 'The storage it reads today: System.Events and System.LastRuntimeUpgrade, ComputeChannel.Channels, and FlopSessionKeys Sessions, SessionNonces and CircuitBreakers (`STATED_ENTRIES`).' That is six entries. STATED_TABLE and the derived STATED_ENTRIES in observatory/src/scale/shape.ts hold sixteen, and the same section lists 'The 16 stated entries' at lines 1140-1144. decodeStorageValue decodes any of the sixteen (confirmed: System.Account and FlopSessionKeys.SessionNonces with answer null at spec 1014020 decode with stored: false). A reader of the first bullet is told that DelegateSessions, FailedAcks, Models, Miners and the rest are not decoded by this code, which is false since the decoder-shape@3 round; the two lists in one section contradict each other. No code defect. Inside the stated promise (RULES.md section 9 is named by the task). Fix: replace the six-entry sentence with a reference to the sixteen stated entries of STATED_TABLE (or 'the 16 stated entries below'). Merged from two specialist findings (economics, flow).","line":1073,"path":"observatory/RULES.md","reproduction":"Offline, after `npm run build` in observatory:\n  cd observatory && node -e 'import(\"./dist/scale/shape.js\").then(({STATED_ENTRIES}) => console.log(STATED_ENTRIES.length, STATED_ENTRIES.map((e) => e.join(\".\")).join(\", \")))'\nExpected per RULES.md lines 1073-1075: 6. Actual: 16 (System.Events, System.LastRuntimeUpgrade, System.Account, ComputeChannel.Channels, ComputeChannel.FailedAcks, ComputeChannel.ChannelAuthoredOpenedAt, FlopSessionKeys.Sessions, .SessionNonces, .CircuitBreakers, .DelegateSessions, ModelRegistry.Models, .MeasuredRoots, .AllowedDecodePolicies, MinerStaking.Miners, HwCalibration.CalibrationVersions, .LastInitialCalibration). Also, with the 1014020 metadata from fixtures/recording-20261112080132-05842a6db1e9c890/tape.jsonl (sha256 91294eb6...), the committed shapes/tzkv-runtime-1014020.json and a LastRuntimeUpgrade of compact(1014020) ++ str('tzkv-runtime'), decodeStorageValue({ specName: 'tzkv-runtime', specVersion: 1014020, metadata, lastRuntimeUpgrade, shapeText, pallet: 'System', entry: 'Account', keys: [acct], key: storageKey(md, 'System', 'Account', [acct]), answer: null }) answers { decoded: true, stored: false, ... }, an entry the sentence says is not read.","severity":"low","snippet":"  its name and variant index, its fields and its phase. The storage it reads today: System.Events","title":"RULES.md section 9 says the decoder reads six storage entries 'today' (STATED_ENTRIES), but STATED_ENTRIES holds 16 and the door decodes the other ten"},{"citation":"resolved","description":"CONFIRMED (ran it). RULES.md section 9 lists five pin refusals and says refusal 4 holds deriveShape's code to the review. Replacing `if (derived !== i.shapeText) return refuse(` with `if (false) return refuse(` survives test/shape.test.ts through the project's own runner (node scripts/mutate.mjs with a one-mutant file: outcome 'survived', controls pass, exit 0). In a scratch copy of the package with the same mutation, the whole suite (vitest run) shows no failure in any scale, shape or decoder test; the only failures were workflow and schema tests broken by the copy's paths. mutants/decoder.json holds shape.ts mutants but none for this line, and no test asserts the refusal's words 'the shape derived from the metadata differs' (the 'differs from' matches in test/shape-at-2.test.ts and test/helpers/shape-file.ts are the write-shape compare script's words, not pinLine's). With the committed files refusals 2 and 3 (metadata sha256, shape file sha256) make refusal 4 unreachable, so a regression that removed it would not be noticed. Impact: none on current behaviour; a documented rule is unguarded (task item 9). Inside the stated promise. Fix: a test that reaches pinLine with a shape text whose sha256 is registered but whose text differs from the derivation (through a test seam over REVIEWED or deriveShape) and asserts the refusal names 'differs from'; and add the mutant to mutants/decoder.json.","line":561,"path":"observatory/src/scale/shape.ts","reproduction":"From observatory/ (built, tests passing): write a mutants file\n  [{\"id\":\"pin-derived-unchecked\",\"file\":\"src/scale/shape.ts\",\"find\":\"if (derived !== i.shapeText) return refuse(\",\"replace\":\"if (false) return refuse(\",\"test\":\"test/shape.test.ts\",\"why\":\"refusal 4\"}]\nand run `node scripts/mutate.mjs <that file>`. Expected: killed. Actual: 'mutants not a pass: 1 mutants, 0 killed, 1 survived', 'not killed: pin-derived-unchecked survived', controls control-pass, exit 0. `grep -rn 'derived from the metadata differs' test/` finds nothing.","severity":"info","snippet":"    if (derived !== i.shapeText) return refuse(`the shape derived from the metadata differs from ${reviewed.shapeFile}`);","title":"Pin refusal 4 (the shape derived again from the metadata differs from the file) has no test that fails without it: the mutant survives test/shape.test.ts and the whole observatory suite"},{"citation":"resolved","description":"CONFIRMED (ran it). Task item 9 asks for any rule with no test that fails without it. The strict reader's check that a mortal era's phase is below its period (Substrate's own Era::decode rule) is one. With the line replaced by `if (false) refuse(...)` in a scratch copy of imd-flop (node_modules linked), `npx vitest run test/chain-*.test.ts test/review-chain-read-*.test.ts` passes every test (476 passed; the 2 failures were chain-words tests that read contract/rules.json by a path the copy did not have). Byte-level impact: nil. readExtrinsic (reader.ts:134) compares the phase with birth.number % era.period, always below 64, so a phase of 1024 is still refused there with another message, and the encoder never writes such a phase (mortalEra takes birth % 64). Nothing is signed or accepted that the chain would read otherwise. Inside the stated promise; a test-coverage note, not a behaviour defect. Fix: a test that reads era bytes 0x05 0x40 (period 64, phase 1024) through readEra and asserts the refusal 'not below its period'.","line":43,"path":"imd-flop/src/chain/era.ts","reproduction":"Offline. In a copy of imd-flop (with node_modules, observatory and research linked beside it), change imd-flop/src/chain/era.ts line 43 from `if (phase >= period) refuse(` to `if (false) refuse(` and run `npx vitest run test/chain-*.test.ts test/review-chain-read-*.test.ts`. Expected: at least one test fails. Actual: Tests 476 passed (the two failures are ENOENT on contract/rules.json from the copy, not the era). Direct input on the unmutated dist: readEra(new ByteReader(Uint8Array.of(0x05, 0x40))) refuses BAD_BYTES 'an era phase 1024 not below its period'; under the mutant it returns { period: 64, phase: 1024 }.","severity":"info","snippet":"  if (phase >= period) refuse(\"BAD_BYTES\", `an era phase ${phase} not below its period`);","title":"readEra's phase-below-period rule has no test that fails without it: removing it leaves all chain and chain-read tests passing"},{"citation":"resolved","description":"CONFIRMED (ran it). The doc comment at node-rpc.ts:19-25 ends 'Never throws.' answerOf reads m.error (line 30) and m.jsonrpc / m.id (line 34) with plain property access, so a frame object whose property is an accessor that throws makes answerOf throw the caller's error. Not reachable from a node: rpcCall only passes objects from readOutsideJson (JSON.parse output has no accessors), and rpcCall's onmessage try/catch would turn such a throw into 'rpc returned malformed JSON'. Outside the stated README promise (the frame rule for rpcCall, which holds); it is the function's own comment that is not kept. Fix: read the fields through Object.getOwnPropertyDescriptor inside a try, or drop 'Never throws' from the comment.","line":30,"path":"imd-flop/src/node-rpc.ts","reproduction":"Offline: const { answerOf } = await import('./imd-flop/dist/node-rpc.js'); answerOf({ jsonrpc: '2.0', id: 1, get error() { throw new Error('boom'); } }) // expected per the comment: { ok: false, ... }; actual: throws Error('boom').","severity":"info","snippet":"    const e = m.error;","title":"answerOf is documented as 'Never throws' but throws when a frame's property is a throwing accessor (not reachable from the wire)"},{"citation":"resolved","description":"CONFIRMED (ran it). imd-flop vitest.config.ts sets testTimeout 20000. In two full runs of `npm test` on this machine (observatory built first), test/review-p3-properties.test.ts:255 ('2000 random signed calls: no two different extrinsics share one description') failed with 'Test timed out in 20000ms'; in one of them test/decision-properties.test.ts ('sequences of three steps over every trusted read ...') failed the same way. Both files pass when run alone (52 tests, 32 s total), so the failure is timing under the suite's parallel load, not logic. Impact: the suite the README names as the check of the encoder is red on a loaded or slow machine, so a real regression and a slow machine look alike. Outside the stated promise (test infrastructure). Fix: give these two tests their own timeout (it(..., 120_000)) or split the 2000-call loop into smaller cases.","line":255,"path":"imd-flop/test/review-p3-properties.test.ts","reproduction":"cd imd-flop && npm ci && npm test (with ../observatory built). Observed here: 'FAIL test/review-p3-properties.test.ts > H (P8): the words > 2000 random signed calls: no two different extrinsics share one description -- Error: Test timed out in 20000ms', and in one run also 'FAIL test/decision-properties.test.ts > the hold floor > sequences of three steps ...' with the same error. Then `npx vitest run test/review-p3-properties.test.ts test/decision-properties.test.ts` alone: 2 files, 52 tests passed in 32 s. (Eight other failures in lock.test.ts, review-hold-2.test.ts, audit-v3.test.ts and booking.test.ts appear only when the suite runs as root; they pass under `setpriv --inh-caps=-all --bounding-set=-all npx vitest run ...`, as the tests themselves ask.)","severity":"info","snippet":"  it(\"2000 random signed calls: no two different extrinsics share one description\", () => {","title":"Two property tests exceed the 20 s vitest timeout when the whole imd-flop suite runs, so `npm test` is red with no rule broken"},{"citation":"resolved","description":"INFERRED (read the code; no socket may be opened in this review, the test setup disables WebSocket and the sandbox denies localhost). Two bounded-resource gaps in the one socket function. (1) Size: rpcCall takes the whole message as String(ev.data) and parses it with readOutsideJson, whose header says it has no depth limit and which has no size limit; the WebSocket is Node's built-in one created with no message-size option. The caps of chain-read/node.ts (bytesWithin line 107, measured line 134) are applied to the parsed result, after rpcCall resolved. So a node that answers a frame of several GiB makes the process allocate the string and the parsed value before any cap is consulted; the likely outcome is an out-of-memory abort rather than the 'unknown with a reason' README line 152 promises for 'an answer over its cap'. (2) Close: rpcCall settles on a message, an error or the timer, and a peer that closes the socket cleanly (close frame 1000/1001, as a node does on shutdown or when dropping an idle client) fires onclose and not onerror, so the promise waits the whole timeoutMs (15000 by default) before 'rpc timeout'. The read then correctly becomes unknown, so no wrong value is answered; the cost is latency (readSessionState makes seven calls, readBlockEvents eight). Impact: low availability effect against a hostile or broken node; nothing is signed or spent. At the edge of the stated promise: the caps are documented as the bound, and the frame reaches the parser before them. Fix: reject with a fixed reason when ev.data.length exceeds a frame cap (for example 2 + 2 * CAPS.metadata characters, the largest any read accepts) before String()/parse, or construct the WebSocket with a maxPayload where the runtime supports one; and add ws.onclose = () => finish(new Error('rpc socket closed before an answer')). Merged from two specialist findings (flow: huge frame; permissions: onclose).","line":59,"path":"imd-flop/src/node-rpc.ts","reproduction":"Reading check, offline: `grep -n 'maxPayload\\|length\\|cap\\|onclose' imd-flop/src/node-rpc.ts imd-flop/src/outside-json.ts` shows no bound before parse and no onclose handler; the only caps are in imd-flop/src/chain-read/node.ts bytesWithin (line 107) and measured (line 134), both applied after rpcCall resolved. To observe outside this sandbox: (1) serve a JSON-RPC frame {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x\" + \"00\".repeat(N)} with N large enough to exceed the process heap and call readSessionState(nodeTransport(url), owner, delegate); expected per README line 152: unknown with the cap's reason; expected from the code: an out-of-memory abort. (2) start a WebSocket server whose connection handler calls socket.close(1000) on open and time rpcCall(url, 'chain_getFinalizedHead', [], 15000); expected: rejects promptly; from the code: rejects after 15 s with 'rpc timeout'.","severity":"info","snippet":"        const a = answerOf(readOutsideJson(String(ev.data)));","title":"rpcCall takes and JSON-parses a whole frame before any cap applies, and has no onclose handler: an oversize frame is handled only by the engine's memory, and a clean close waits out the 15 s timeout ("}],"hash":"4b91defa3fa887ba309514f4beb6544f52596341db43e57add85f69a7a717233","nodeId":"514efe74-1ff2-49ba-917b-d2d49b5f946a","outcome":"completed","summary":"The review is complete. The findings file is written at the repository root with nine merged findings, and no tracked file was changed.\n\n**What I ran**\n\n- Observatory: `npm ci`, `npm run build`, `npm test`. All 77 files and 2377 tests pass.\n- imd-flop: `npm ci`, `npm test`. The full run shows 10 failures. Eight are the lock and ledger tests that require running without root capabilities, and they pass under `setpriv --inh-caps=-all --bounding-set=-all`. The other two are property tests that hit the 20 s timeout under suite load and pass when run alone.\n- Offline scripts against the built `dist/` for every specialist claim, a scripted transport built from the recording tape for the events read, the observatory mutation runner for pin refusal 4, and scratch copies of both packages for the era-phase and pin-refusal mutants.\n- Probes of my own: era bytes at block 0, 63, 64 and the u32 edge, u64 and u128 bounds, a passed spend, a number instead of a bigint, the decoder door with a decoder-shape@2 file, a trailing byte, an extra key byte, a wrong key part, an unstated entry, an unreviewed spec, and the Default versus Optional distinction for System.Account, SessionNonces and Sessions. All behaved as the README and RULES state.\n\n**Findings kept, all reproduced**\n\n- **Low, read.ts line 126.** The events read re-reads the caller's block hash after the canonical check. An accessor that answers the canonical hash once and then a sibling hash gets a known result with the sibling's events, labelled with the canonical hash. Confirmed with a scripted node from the recording.\n- **Low, extrinsic.ts line 130.** The README's \"a getter is refused, a Proxy's get trap is not used\" is not kept for the signer's two fields or the runtime id's four names. Getters run, traps fire, and extra signer keys pass. Bytes are unaffected. Merged from three specialist reports.\n- **Low, scale.ts line 52.** ByteReader and ChainEncodeError are not frozen, against README line 141. Patching the prototype changes what the strict reader reports, and the frozen-exports test skips functions.\n- **Low, RULES.md line 1073.** Section 9 names six storage entries while STATED_ENTRIES holds sixteen and the door decodes all of them. Merged from two reports.\n- **Info, shape.ts line 561.** Pin refusal 4 has no killing test. The mutant survives the project's own mutation runner and the full suite.\n- **Info, era.ts line 43.** The phase-below-period rule has no killing test. 476 chain tests pass with it removed. No byte-level impact.\n- **Info, node-rpc.ts line 30.** The \"Never throws\" comment on answerOf is false for a throwing accessor, unreachable from the wire.\n- **Info, review-p3-properties.test.ts line 255.** Two property tests time out under full-suite load.\n- **Info, node-rpc.ts line 59.** No frame-size bound before parse and no onclose handler. This one is inferred from reading, not run, since no socket may be opened here, and it is marked as such.\n\n**Not kept or not found**\n\n- No specialist finding was dropped. The specialists' \"runtime getter\" case was folded into the signer finding as the same mechanism.\n- No finding is critical or high, and nothing here is Solidity, so no Foundry proof applies.\n- On item 7, nothing in scope assumes a refused session call moves the nonce. The encoder takes the session nonce as given, the reads report the stored value or the metadata default with a stored flag, and no code increments it. This is inferred from reading and grep, not from a devnet run.\n- The cross check holds for totals above 2^53, refuses a number in place of decimal text, and refuses a leading zero. Confirmed.\n\n**Checks only read, not run:** the rpcCall socket behaviour, and the whole-suite survival of the pin refusal 4 mutant, which I confirmed in a scratch copy where only path-dependent workflow tests broke.","treeHash":null,"usage":{"cachedInputTokens":1024421,"cost":{"source":"runtime","usdMicros":4655650},"inputTokens":322,"model":"claude-fable-5-1","outputTokens":35446,"runtime":"claude","turns":37,"wallClockMs":850850}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"dc34db8e17664ebd","findings":[{"citation":"resolved","description":"CONFIRMED (ran it). readBlockEvents(t, block) reads block.hash five times (lines 126, 127, 130, 132, 137) and block.number six times (123 twice, 124, 126, 129, 137) straight from the caller's object. The canonical check at line 126 compares chain_getBlockHash(number) with one read of block.hash; the header (127), the pin (130), the System.Events read (132) and the hash reported in the result (137) each take a fresh read. If block.hash is an accessor (or a Proxy get trap) that answers the canonical hash A on the first read and a sibling hash B after, the read is 'known', the events are those the node holds at B, and the result reports hash A. README 'Chain reads' says 'Events are read only at a block the node reports finalized and canonical', and the encoder's rule H1 (every field read once into a snapshot, extrinsic.ts/fields.ts) is exactly the defence the reads do not apply. Impact: a future caller that hands in a non-plain object (a class with a getter, a Proxy) can get the events of a non-canonical or forked block labelled with the canonical hash; crossCheck then compares a session state with those events. The node answers are not at fault, so this is outside the stated promise about node answers (which I confirmed holds: a plain {number, hash: B} is refused as not canonical), but the README sentence is not kept for a caller object with an accessor, and the reads fall short of the encoder's own H1 standard. Fix: read block.number and block.hash once at the top (own-property reads as fields.ts ownValue does, refusing accessors), and use the copies everywhere, including atOf.","line":127,"path":"imd-flop/src/chain-read/read.ts","reproduction":"Offline, after `npm run build` in observatory and `npm test` in imd-flop (dist/ exists). Scripted transport built from observatory/fixtures/recording-20261112080132-05842a6db1e9c890/tape.jsonl: A = recorded hash of 3528528 (0x187a4c5b...), B = 0xbb..bb (a sibling at the same height, not on the tape), C = recorded 3528527. chain_getFinalizedHead -> A; chain_getHeader(A or B) -> {number: 0x35d7d0 (3528528), parentHash: P}; chain_getBlockHash(3528528) -> A; state_getMetadata(P) -> the 1014014 metadata on the tape; state_getStorage(key, A) -> tape; state_getStorage(LRU key, B) -> A's LRU bytes; state_getStorage(Events key, B) -> C's recorded events. Then:\n  let i = 0; const seq = [A, B, B, B, A];\n  const r = await readBlockEvents(transport, { number: 3528528, get hash() { return seq[i++] ?? A; } });\nExpected: unknown (B is not canonical; the plain call readBlockEvents(transport, {number: 3528528, hash: B}) is indeed unknown: 'block 3528528 0xbb.. is not canonical'). Actual: r.kind === 'known', r.value.hash === A, r.value.events has 6 events equal (JSON) to the honest read of C, while the honest read of A has 64 events. Transport log: chain_getFinalizedHead | chain_getHeader(A) | chain_getBlockHash(3528528) | chain_getHeader(B) | state_getStorage(LRU, B) | state_getMetadata(P) | state_getStorage(Events, B).","severity":"low","snippet":"  const h = await header(t, block.hash);","title":"readBlockEvents re-reads block.hash and block.number from the caller's object after the canonical check, so an accessor can pass the check on the canonical hash and read a non-canonical sibling"},{"citation":"resolved","description":"CONFIRMED (ran it). README.md line 135: 'A field must hold its value: a getter is refused.' and line 139: 'Refused before the sign function is called ... a field missing, extra or a getter'. Every input field, the inner call, the sla and the birth block go through fields.ts ownValue, which refuses an accessor (confirmed: birth with `get number()` is refused BAD_INPUT 'the birth block.number is an accessor'). The signer is the exception: takeSign reads signer.publicKey (line 130) and signer.sign (line 131) with ordinary property access, so a getter runs and its value is accepted. The value is read exactly once and copied (the getter ran once; the signed extrinsic names the key it returned), so the H1 snapshot promise holds and nothing is signed wrongly; only the words 'a getter is refused' are not kept for the signer's two fields. The DeviceSigner interface documents an object with a method, which a class instance (sign on the prototype, publicKey perhaps a getter) naturally is, so the code's choice is defensible; the README should say the signer's fields are read once but may be accessors, or the code should refuse them like every other field.","line":130,"path":"imd-flop/src/chain/extrinsic.ts","reproduction":"let reads = 0;\nconst out = signSessionCall({ runtime: RUNTIME_ID, owner, inner: { call: 'timeout', channel_id }, sessionNonce: 1n, accountNonce: 0, birth, signer: { get publicKey() { reads++; return pk; }, sign: (m) => ed25519.sign(m, seed) } });\n// README: refused (a getter). Actual: accepted; reads === 1; out.fields.signer equals pk. Likewise signer: { publicKey: pk, get sign() { return (m) => ed25519.sign(m, seed); } } is accepted.\n// Contrast: signSessionCall({ ..., birth: { get number() { return 1; }, hash } }) is refused with BAD_INPUT 'the birth block.number is an accessor, not a value'.","severity":"info","snippet":"  const publicKey = bytesOf((signer as { publicKey?: unknown }).publicKey, 32, \"the device public key\");","title":"README 'Chain encoder' says a getter is refused, but the signer's publicKey and sign are read by plain property access, so accessors there run and are accepted"},{"citation":"resolved","description":"CONFIRMED (ran it twice). imd-flop vitest.config.ts sets testTimeout 20000. On this machine (observatory built, then `npm test`), the first run failed test/decision-properties.test.ts:461 ('sequences of three steps over every trusted read ...', 25823 ms) and the second run failed that one and test/review-p3-properties.test.ts:255 ('2000 random signed calls: no two different extrinsics share one description'), both with 'Error: Test timed out in 20000ms'. All other 1604 tests passed; the two tests are exhaustive/randomised walks whose run time depends on the machine, not on the code under test. Impact: the suite the README names as the check of the encoder is red on a slower or busy machine, so a real regression and a slow machine look alike; the mutation runner (observatory scripts/mutate.mjs copies this pattern) would count a timeout as a kill. Fix: give these two tests their own timeout (it(..., 120_000)) or split the 2000-call loop into smaller cases.","line":255,"path":"imd-flop/test/review-p3-properties.test.ts","reproduction":"cd imd-flop && npm ci && npm test   (observatory built first)\nObserved here: 'Test Files 2 failed | 67 passed (69); Tests 2 failed | 1604 passed | 3 skipped (1609)', with\n FAIL test/review-p3-properties.test.ts > H (P8): the words > 2000 random signed calls: no two different extrinsics share one description -- Error: Test timed out in 20000ms\n FAIL test/decision-properties.test.ts > the hold floor > sequences of three steps ... -- Error: Test timed out in 20000ms (25823ms).\nRunning either file alone on an idle machine passes, which shows the failure is timing, not logic.","severity":"info","snippet":"  it(\"2000 random signed calls: no two different extrinsics share one description\", () => {","title":"Two property tests exceed the 20 s vitest timeout on a loaded machine, so `npm test` in imd-flop fails with no rule broken"},{"citation":"resolved","description":"INFERRED from the code (no socket may be opened in this review, and the sandbox denies localhost, so not run). rpcCall settles the promise on a message, an error or the timer. A WebSocket that the peer closes cleanly (close frame, code 1000 or 1001, as a node does on shutdown or when it drops an idle client) fires onclose and not onerror; the one socket per call is already closed, and the promise waits the whole timeoutMs (15000 by default) before 'rpc timeout'. The read then correctly becomes unknown (node.ts call() catches it), so no wrong value is answered and the promise 'unknown with a reason' is kept; the cost is latency: readSessionState makes seven calls and readBlockEvents eight, each able to lose 15 s this way. Fix: add ws.onclose = () => finish(new Error('rpc socket closed before an answer')).","line":67,"path":"imd-flop/src/node-rpc.ts","reproduction":"Not runnable here (offline, localhost denied). To reproduce: start a local WebSocket server whose connection handler calls socket.close(1000) on open; call rpcCall('ws://127.0.0.1:PORT', 'chain_getFinalizedHead', [], 15000) and time it. Expected: rejects promptly. Actual (from the code): rejects after 15 s with 'rpc timeout'.","severity":"info","snippet":"    ws.onerror = () => {","title":"rpcCall has no onclose handler: a node that closes the socket without answering holds the call until the 15 s timeout instead of failing at once"}],"hash":"a5adb1a5241e9497c961a7a7dc48a61d11226c1d6f6038061455422b08eb654c","nodeId":"cd3643f3-a067-480f-a915-7b3d215187a1","outcome":"completed","summary":"The review is complete. The findings file `.imd-findings.json` holds four substantiated findings, no tracked file was changed, and the build outputs it needed are git-ignored.\n\n**Outcome.** The chain path largely keeps its promises. I found one real defect (low) and three informational items. Nothing lets the sign function receive bytes that differ from the fields returned, nothing takes a spend, era or tip from the caller, no node answer produces a known value the node did not state, and the decoder refused every wrong-key, trailing-byte, unstated-entry and shape@2 input I gave it.\n\n**Findings written**\n\n- **Low, `imd-flop/src/chain-read/read.ts:127`.** readBlockEvents reads the caller's `block.hash` and `block.number` repeatedly after the canonical check. With an accessor that answers the canonical hash first and a sibling hash after, the read returned \"known\" with the sibling's 6 events labelled with the canonical hash, where the honest read has 64. A plain object with the sibling hash is correctly refused. Confirmed with a scripted node built from the recorded tape. No chain-read test covers an accessor on the block object.\n- **Info, `imd-flop/src/chain/extrinsic.ts:130`.** The README says a getter is refused, but the signer's publicKey and sign are read by plain property access, so getters there run and are accepted. They are read once and copied, so only the words are off. Confirmed.\n- **Info, `imd-flop/test/review-p3-properties.test.ts:255`.** Two property tests exceeded the 20 s timeout on this machine, so `npm test` was red with no rule broken. Confirmed on two runs.\n- **Info, `imd-flop/src/node-rpc.ts:67`.** No onclose handler, so a clean close by the node holds a call for the full 15 s timeout. Inferred from code; not runnable here since sockets were out of bounds.\n\n**Checks I ran.** Observatory build and 77 test files passed. imd-flop ran 1604 of 1609 tests green with the two timeouts above. The repo's reference tests compare the five calls, the era at its edges and the whole extrinsic against polkadot-api, and they passed. I ran my own experiments on the built modules: Proxy traps on the inner call (only ownKeys and getOwnPropertyDescriptor fire), wrong key and wrong-message signatures (both refused), node-rpc frames with another id, both result and error, a list, a string id and a null error (all handled as the README states), cross-check totals above 2^53 and number-against-text (exact, unknown on any disagreement), and the decoder door with null, \"0x\", default-equal bytes, trailing bytes, a key one byte long, swapped key parts, a decoder-shape@2 file, an unstated entry and the System.Account default (all correct, with stored told apart from default). I ran 13 targeted rule mutations in a scratch copy against the chain and chain-read suites, and every one was killed.\n\n**Checks I only read.** The observatory's 204 decoder mutants (too long to run in budget), the full fuzz corpus, and the hash implementations.\n\n**On the nonce fact.** Nothing in scope assumes a refused call moves the session nonce. The encoder takes the nonce from the caller and chain-read reads SessionNonces from storage; no code increments or predicts it. Confirmed by grep.","treeHash":null,"usage":{"cachedInputTokens":3115661,"cost":{"source":"runtime","usdMicros":7973241},"inputTokens":610,"model":"claude-fable-5-1","outputTokens":59701,"runtime":"claude","turns":67,"wallClockMs":1584147}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"a7ac9f7a7687c25e","findings":[{"citation":"resolved","description":"Words the code does not keep (task item 8), inside the stated promise. imd-flop/README.md lines 135-136 (section 'Chain encoder') say: 'A field must hold its value: a getter is refused.' and 'An input field that is an accessor is refused, and a Proxy's get trap is not used.' The README also counts 'the signer's public key' among the fields of the input that are read once, checked and copied. takeFields/ownValue (fields.ts) do refuse accessors for every other field, but takeSign (extrinsic.ts:128-132) reads signer.publicKey and signer.sign with ordinary property access: a getter on publicKey is accepted and a Proxy signer's get trap is invoked (twice). CONFIRMED by running the built encoder offline. Impact: none on the bytes (the strict reader verifies the signature against the key in the extrinsic, so a getter that returns another key is caught as SIGNATURE_INVALID), but the README's unconditional sentence is false for the signer, which is the one input object that runs caller code. Fix: read publicKey and sign once through Object.getOwnPropertyDescriptor and refuse an accessor (as ownValue does), or narrow the README sentence to exclude the signer.","line":130,"path":"imd-flop/src/chain/extrinsic.ts","reproduction":"Offline, after `npm test` has built imd-flop/dist (node, from the repo root):\n  import { ed25519 } from '@noble/curves/ed25519.js'; const { signSessionCall } = await import('./imd-flop/dist/chain/extrinsic.js');\n  const seed = ed25519.utils.randomSecretKey(); const pub = ed25519.getPublicKey(seed);\n  const RT = { specName:'tzkv-runtime', specVersion:1014020, transactionVersion:2, genesisHash:'0x99c172c095340ace980631f9123544c6bebd4839f3437e463533422d8be2d631' };\n  const input = { runtime: RT, owner: new Uint8Array(32).fill(7), inner: { call:'top_up_escrow', channel_id: new Uint8Array(32).fill(9), additional: 1n }, sessionNonce: 1n, accountNonce: 0, birth: { number: 3528527, hash: new Uint8Array(32).fill(1) },\n    signer: { get publicKey() { return pub; }, sign: (m) => ed25519.sign(m, seed) } };\n  signSessionCall(input)  // expected per README: refused BAD_INPUT ('is an accessor, not a value'); actual: returns a signed extrinsic, fields.signer = pub.\n  let traps = 0; const proxy = new Proxy({}, { get: (t, k) => { traps++; return k === 'publicKey' ? pub : k === 'sign' ? ((m) => ed25519.sign(m, seed)) : undefined; } });\n  signSessionCall({ ...input, signer: proxy }); traps  // expected per README: the get trap is not used; actual: traps === 2 and the call signs.","severity":"low","snippet":"  const publicKey = bytesOf((signer as { publicKey?: unknown }).publicKey, 32, \"the device public key\");","title":"README promises a getter is refused and a Proxy's get trap is not used, but the signer's publicKey and sign are read through plain property access (getter accepted, get trap used)"},{"citation":"resolved","description":"Words the code does not keep (task item 8), inside the stated promise (RULES.md section 9 is named by the task as a promise under audit). Lines 1073-1075 state 'The storage it reads today: System.Events and System.LastRuntimeUpgrade, ComputeChannel.Channels, and FlopSessionKeys Sessions, SessionNonces and CircuitBreakers (STATED_ENTRIES)'. STATED_TABLE/STATED_ENTRIES in observatory/src/scale/shape.ts:56-94 hold 16 entries (the same section lists them at lines 1140-1144), and decodeStorageValue decodes e.g. FlopSessionKeys.DelegateSessions and System.Account. CONFIRMED offline. A reader of section 9's first bullet is told that a value of DelegateSessions, FailedAcks, Models, Miners etc. is not decoded by this code, which is false; the two lists in one section contradict each other. Fix: replace the six-entry sentence with a reference to the 16 stated entries (or to STATED_TABLE).","line":1073,"path":"observatory/RULES.md","reproduction":"Offline, with the observatory built and the 1014020 metadata taken from fixtures/recording-20261112080132-05842a6db1e9c890/tape.jsonl (the 0x string whose sha256 is 91294eb6...):\n  const { decodeStorageValue } = await import('./observatory/dist/scale/block.js'); const sk = await import('./observatory/dist/scale/storage-key.js'); const { parseMetadata } = await import('./observatory/dist/scale/metadata.js');\n  const md = parseMetadata(MD); const acct = new Uint8Array(32).fill(0x11);\n  const lru = Uint8Array.from([...compact(1014020n), 0x30, ...new TextEncoder().encode('tzkv-runtime')]); // Compact<u32> then str, as the reviewed shape states\n  decodeStorageValue({ specName:'tzkv-runtime', specVersion:1014020, metadata: MD, lastRuntimeUpgrade: lru, shapeText: readFileSync('observatory/shapes/tzkv-runtime-1014020.json','utf8'), pallet:'FlopSessionKeys', entry:'DelegateSessions', keys:[acct], key: sk.storageKey(md,'FlopSessionKeys','DelegateSessions',[acct]), answer: null })\n  // expected per RULES.md:1073-1075: not an entry the decoder reads; actual: { decoded: true, stored: false, value: [] }.","severity":"low","snippet":"  its name and variant index, its fields and its phase. The storage it reads today: System.Events","title":"RULES.md section 9 says the decoder reads six storage entries 'today', while STATED_ENTRIES holds 16 and the door decodes the other ten"},{"citation":"resolved","description":"Task item 9: a rule with no test that fails without it. Replacing `if (derived !== i.shapeText) return refuse(...)` with `if (false) return refuse(...)` survives test/shape.test.ts (run through the project's own runner, node scripts/mutate.mjs, with a mutant file holding this one mutation: outcome 'survived', controls passed), and no test file in observatory/test asserts the refusal's words ('the shape derived from the metadata differs'). mutants/decoder.json holds 50 shape.ts mutants but none for this line. RULES.md:1130 lists refusal 4 as one of the five pin refusals and 1132-1134 explains it is the check that holds deriveShape's code to the review; today refusals 2 and 3 (metadata sha256, shape file sha256) make it unreachable with the committed files, so a regression that removed it would not be noticed. CONFIRMED (mutant run; the same mutation in a full copy of the package also survives the whole observatory suite: the only failures there were census symlink fixtures lost by the copy and the workflow tests that need jq, none in scale/shape tests). Impact: none on current behaviour; a documented rule is unguarded. Fix: a test that calls pinLine with a shape text whose sha256 is temporarily registered (e.g. by stubbing REVIEWED through a test seam) or that derives the shape with a modified deriveShape, and asserts the refusal names 'differs from'; and add the mutant to mutants/decoder.json.","line":561,"path":"observatory/src/scale/shape.ts","reproduction":"From observatory/: write a mutants file [{\"id\":\"pin-derived-unchecked\",\"file\":\"src/scale/shape.ts\",\"find\":\"if (derived !== i.shapeText) return refuse(\",\"replace\":\"if (false) return refuse(\",\"test\":\"test/shape.test.ts\",\"why\":\"refusal 4\"}] and run `node scripts/mutate.mjs <that file>`. Expected: killed. Actual: outcome \"survived\", exit 0, controls pass. `grep -rn 'derived from the metadata differs' test/` finds nothing.","severity":"info","snippet":"    if (derived !== i.shapeText) return refuse(`the shape derived from the metadata differs from ${reviewed.shapeFile}`);","title":"Pin refusal 4 (shape derived again from the metadata differs from the file) has no test that fails without it"},{"citation":"resolved","description":"The doc comment at node-rpc.ts:19-25 ends 'Never throws.' answerOf reads m.error (line 30) and m.jsonrpc / m.id (line 34) with plain property access, so a frame object whose property is an accessor that throws makes answerOf throw the caller's error. Not reachable from the wire: rpcCall only passes objects from readOutsideJson (JSON.parse output has no accessors), and rpcCall's onmessage try/catch would turn such a throw into 'rpc returned malformed JSON'. Outside the stated README promise (which describes rpcCall's frame rule, which holds); it is the function's own contract that is not kept. CONFIRMED offline. Fix: read the fields through Object.getOwnPropertyDescriptor inside a try, or drop 'Never throws' from the comment.","line":29,"path":"imd-flop/src/node-rpc.ts","reproduction":"const { answerOf } = await import('./imd-flop/dist/node-rpc.js');\nanswerOf({ jsonrpc: '2.0', id: 1, get error() { throw new Error('boom'); } })\n// expected per the comment: { ok: false, ... }; actual: throws Error('boom').","severity":"info","snippet":"  if (own(m, \"error\")) {","title":"answerOf is documented as 'Never throws' but throws when the frame's error property is a throwing getter"}],"hash":"b5755d415cc092201bce43efe552acc801fd2aa40cdc29159319392a9c5ed432","nodeId":"35399f56-223b-4124-ad22-1154209b8827","outcome":"completed","summary":"The review is complete. Findings are written to `.imd-findings.json` (four findings, all snippets verified against the tree, no repository file changed; the untracked dotfiles in the status are the harness's, not mine).\n\n## Outcome\n\nThe chain path holds its stated promises. I found no input for which the encoder signs bytes the chain would read as another call, amount, channel, signer, nonce, era or tip, no node answer the reads turn into a false known value, and no bytes the decoder door decodes under a wrong key, entry, spec or shape. The four findings are two words gaps, one unguarded rule, and one comment contract.\n\n| Severity | Where | What |\n|---|---|---|\n| low | imd-flop/src/chain/extrinsic.ts:130 | README says a getter is refused and a Proxy get trap is never used. The signer's publicKey getter is accepted and a Proxy signer's get trap runs. Bytes stay right because the signature is verified against the key in the extrinsic. |\n| low | observatory/RULES.md:1073 | Section 9 says the decoder reads six entries \"today\". STATED_ENTRIES holds 16 and the door decodes DelegateSessions and System.Account. |\n| info | observatory/src/scale/shape.ts:561 | Pin refusal 4 (derived shape differs from the file) has no test that fails without it. The mutant survives the whole observatory suite. |\n| info | imd-flop/src/node-rpc.ts:29 | answerOf's comment says \"Never throws\", but a frame whose error property is a throwing getter makes it throw. Unreachable from the wire. |\n\n## Checks I ran (confirmed)\n\n- **Builds and suites.** Observatory: 76 of 77 test files pass. The one failure is publish-shell, which needs `jq`, absent on this machine. imd-flop: 69 files, 1606 tests pass.\n- **Reference SCALE.** All five inner calls at u32, u64 and u128 edges round-trip through polkadot-api's RuntimeCall codec with the same bytes, declared spend, nonce and amounts. Pallet 94/103, call indices 2, 0, 1, 5, 9, 11, field order and types, the nine signed extensions in order, and the Address Id and Signature Ed25519 indices all match the recorded 1014020 metadata.\n- **Era.** Births 0, 1, 63, 64, 65, 2^32-64 encode as Substrate's Mortal(64, phase). 2^32-63 and above, negatives, floats and NaN are refused. The reference decodes the bytes as Mortal with period 64.\n- **Signing.** An independently rebuilt payload verifies the signature. open_channel is 372 bytes and signed as its blake2b-256 hash. top_up_escrow is 190 bytes and signed as is.\n- **Hostile inputs.** Lying subclass length, own length property, Proxy bytes, offset views, extra fields, spend/era/tip passed in, 2^128, 2^64, 2^32, negative amounts, `__proto__` and `constructor` as call or enum names, a signer using another key or signing another message, a Proxy inner call lying through its get trap: each refused or taken from the snapshot only.\n- **Cross check.** Amounts above 2^53 compare as bigint. Off by one above 2^53, a number instead of decimal text, leading zeros, two events, another delegate, another hash: all unknown.\n- **Reads.** Upper-case hex, odd hex, lists, numbers, huge headers, leading-zero block numbers, result together with error, wrong id, a head whose number maps to another hash, a header naming another number, non-Error throws: all unknown, nothing thrown. A missing SessionNonces value is the default 0 with stored false, never absent and never a bare 0.\n- **Decoder door.** Keys for System.Account and FlopSessionKeys.Sessions equal polkadot-api's. imd-flop's five keys equal the observatory's. Swapped key parts differ. Trailing bytes, a 9-byte nonce, a key one byte long, a value under another entry's key, swapped parts, an unstated entry, a decoder-shape@2 file, spec 1014015, a LastRuntimeUpgrade naming another spec, the 1014014 metadata under a 1014020 pin: all refused with the decoder's own words. The System.Account default equals the reference's and is not zero.\n- **Mutation.** 34 hand-written mutants of imd-flop's chain code, 29 killed. The 5 survivors are equivalent: each is caugh","treeHash":null,"usage":{"cachedInputTokens":3002389,"cost":{"source":"runtime","usdMicros":9036421},"inputTokens":642,"model":"claude-fable-5-1","outputTokens":75250,"runtime":"claude","turns":52,"wallClockMs":1941726}},{"artifacts":[],"attempt":1,"bundleHash":null,"device":"2c968e88904ec22b","findings":[{"citation":"resolved","description":"Item 9 of the brief asks for any rule with no test that fails without it. The strict reader's era check that a mortal era's phase is below its period (Substrate's own Era::decode rule) is such a rule. With the line replaced by `if (false) refuse(...)`, every test in imd-flop/test/chain-*.test.ts and test/review-chain-read-*.test.ts still passes (478 of 478, confirmed in a throwaway copy of the tree). The impact on bytes is nil: readExtrinsic (reader.ts:134) compares the phase with `birth.number % era.period`, which is always below 64, so a phase of 1024 is still refused there, only with another message; and the encoder itself never writes such a phase (mortalEra takes birth % 64). Nothing is signed or accepted that the chain would read otherwise, so this is inside the stated promise and a test-coverage note, not a defect in behaviour. The other nine hand-made boundary mutants tried (lastValidBlock off by one, the u32 birth overflow refusal, the compact canonical check, the 256-byte payload rule, the u32 upper bound, the account-nonce u32 bound in the reader, the u64/u128 range in session-state, the header number regex width, and the cross check's decimal regex) were each killed by at least one test.","line":43,"path":"imd-flop/src/chain/era.ts","reproduction":"Offline. In a copy of the tree, edit imd-flop/src/chain/era.ts line 43 from `if (phase >= period) refuse(...)` to `if (false) refuse(...)`; then in imd-flop run `npx vitest run test/chain-*.test.ts test/review-chain-read-*.test.ts`. Expected: at least one test fails. Actual: Tests 478 passed (478). Direct input: `readEra(new ByteReader(Uint8Array.of(0x05, 0x40)))` (period 64, phase 1024) returns { period: 64, phase: 1024 } under the mutant instead of refusing BAD_BYTES; on the unmutated code it refuses with 'an era phase 1024 not below its period' (confirmed by running dist/chain/era.js). A test asserting that readExtrinsic on a rebuilt extrinsic whose era bytes are 0x05 0x40 refuses with the words 'not below its period' would pin the rule.","severity":"info","snippet":"  if (phase >= period) refuse(\"BAD_BYTES\", `an era phase ${phase} not below its period`);","title":"readEra's phase-below-period rule has no test: removing it leaves all 478 chain tests passing (redundant guard, no byte-level impact)"}],"hash":"c7e7a7c072a46bf58c57e07439e6d63bd4faf05dd7b0e24f7d556b1f00fc82c1","nodeId":"80b0c4c9-da8e-4d9e-a1ab-1f163aaa7936","outcome":"completed","summary":"The review is complete and `.imd-findings.json` holds one info-level note. No defect in the math, boundary or numerical behaviour of the chain path was found.\n\n**What I ran (confirmed)**\n\n- Observatory: `npm ci`, `npm run build`, `npm test`. 77 files, 2377 tests, all pass.\n- imd-flop: `npm ci`, `npm test`. 1598 pass, 8 fail, 3 skipped. The 8 failures are all permission tests in the out-of-scope spend path (lock, booking, review-hold-2, audit-v3) that need a non-root user. The sandbox refused dropping to another uid. Every chain and chain-read test passes.\n- An offline probe against the built code and polkadot-api: compact encoding at 0, 2^6, 2^14, 2^30, 2^32, 2^64, 2^128 edges matches the reference byte for byte, and both readers refuse every non-canonical form the reference silently accepts. Mortal era at births 0, 1, 63, 64, 65, 127, 4095, 4096, 2^32-65 and 2^32-64 equals an independent writing of Substrate's Era::mortal and decodes back; 2^32-63 and above are refused. Whole extrinsics for timeout, top_up_escrow at 0 and u128 max, and open_channel with escrow 2^64 and nonce u64 max decode under the reference with the declared spend equal to the inner amount, the era bytes and account nonce compact matching, and the payload hashed only above 256 bytes. Hostile numbers (1.5, 2^32, -1, 2^64, 2^128, a string) are refused before signing. Cross check: equal totals at 2^60 and u128 max are known, off by one is unknown, a number instead of decimal text, a leading zero, and 2^53+1 against the float 2^53 are all unknown. Storage keys for Sessions, SessionNonces, CircuitBreakers, Events and LastRuntimeUpgrade equal both the observatory's and polkadot-api's keys, and swapping the two account parts gives a different key.\n- Mutants: the observatory's 34 decoder mutants on reader.ts, decode.ts and storage-key.ts, all killed by `scripts/mutate.mjs`. Ten hand-made boundary mutants on imd-flop in a throwaway copy of the tree: nine killed, one survived (below).\n\n**What I only read (inferred)**\n\nObservatory shape.ts pin, events.ts layout, block.ts door, the RULES.md sections 9 and 10 and the README encoder and reads sections. Each sentence I checked against code holds, including the 256-byte rule, the Default-entry handling with `stored: false`, and the five-method transport. Item 7: nothing in scope increments or predicts a session nonce. The encoder takes the caller's current nonce and the reads return the stored value, so nothing assumes a refused call moves it.\n\n**Finding (info, inside the promise, test coverage only)**\n\n- `imd-flop/src/chain/era.ts:43`. The reader's rule that an era phase is below its period has no test. Replacing it with a no-op leaves all 478 chain tests passing. Impact is nil because `readExtrinsic` re-checks the phase against the birth block number, which is always below 64, so bytes like `0x05 0x40` are still refused, only with another message.\n\n**Not covered**\n\nThe System.Account non-zero default, trailing bytes and the decoder-shape@2 refusal were verified only by reading the code and by the passing observatory suite, not by my own probe.","treeHash":null,"usage":{"cachedInputTokens":2305624,"cost":{"source":"runtime","usdMicros":5965707},"inputTokens":642,"model":"claude-fable-5-1","outputTokens":40619,"runtime":"claude","turns":60,"wallClockMs":1424249}}],"verification":[]}