Repository navigation
feat(l2ps): return the stored ciphertext with getL2PSHistory rows - #1033
pallytin88 wants to merge 1 commit into
Conversation
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| timestamp: tx.timestamp?.toString() || "0", | ||
| l1_block_number: tx.l1_block_number, | ||
| execution_message: messages[index], | ||
| content: contents[index], |
There was a problem hiding this comment.
The node now returns content, but the SDK's L2PSHistoryEntry does not declare it. getL2PSHistory returns Promise<L2PSHistoryPage>, so TypeScript callers cannot access row.content without a cast even though the field reaches them at runtime. Coordinate a matching SDK type update, allowing the field to be absent when talking to older nodes.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/libs/network/handlers/l2psHandlers.ts
Line: 251
Comment:
**SDK type omits content**
The node now returns `content`, but the SDK's [`L2PSHistoryEntry`](https://github.com/kynesyslabs/sdks/blob/HEAD/src/l2ps/history.ts#L15-L34) does not declare it. `getL2PSHistory` returns `Promise<L2PSHistoryPage>`, so TypeScript callers cannot access `row.content` without a cast even though the field reaches them at runtime. Coordinate a matching SDK type update, allowing the field to be absent when talking to older nodes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
getL2PSHistory decrypts each stored payload for a reader who proved ownership of a subnet address, but only surfaces the `message` string from it. A member whose transactions carry a structured payload (a signed channel envelope under `data[1]`) cannot read it back at all. Return the row's `encrypted_payload` next to `execution_message`. That is the same ciphertext the unauthenticated subnet listing already serves, so nothing new is exposed; a member holding the subnet key decrypts it locally and checks the decrypted hash against the row, instead of trusting a plaintext handed back by the node. The node itself decrypts nothing more than it did before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
79bf5d5 to
970c315
Compare
…yption, settlement binding, resumable approval, shared L2PS lock, auto-approve cap, CORS) Findings from a private peer read of this package and kynesyslabs/node#1033, each verified against the code and fixed here: 1. register.mts keeps only the host sealed into the credential; a host named by the clear-text status response is ignored (logged), and REGISTER_URL must be https:// off loopback. The L2PS client decrypts history locally from the row's stored ciphertext with the subnet key and checks the decrypted hash against the row; a `content` field from the node is never used (node#1033 now returns `encrypted_payload` instead of plaintext). 2. Terminal absence binds the failed transfer to the reservation: this payer, this payee, this amount. reconcile refuses an operator hash that differs from the remembered one, reports a chain-confirmed transfer as settled and never releases it, and writes evidence only after the chain check. 3. Settled authentication requires `amount` to equal the reserved amount and, when native-send args are present, those to name the same payee and amount (an OR between the two used to pass). 4. Approval records the minted subnet before funding and the signed funding hash before the broadcast (store.beginProvision / beginFunding; funder signs first and calls back). An approval interrupted after the broadcast resumes with the same subnet and never funds twice. 5. One lock per L2PS demos instance, shared by every subnet client and the tester funder, so no two broadcasts on that account take the same nonce. 6. The showcase viewer no longer sends access-control-allow-origin: *. 7. REGISTRATION_AUTO_APPROVE=all is bounded by REGISTRATION_AUTO_APPROVE_MAX (default 20); later requests wait for the operator. Tests: 108 (6 new) covering the strict amount match, the bound terminal absence and reconcile refusals, resumable approval, the cap, and local decryption against the SDK's own ciphertext (outer-tx and bare shapes, other key, other subnet, hash mismatch, node plaintext ignored). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo
What
getL2PSHistorydecrypts each stored payload for a reader who proved ownership of a subnet address, but only surfaces themessagestring from it. A member whose transactions carry a structured payload (we put a signed DACS-3 channel envelope underdata[1]) cannot read it back through history.This returns the row's
encrypted_payloadnext toexecution_message. One field on the history row; no new decryption on the node.Why this shape
An earlier revision of this PR had the node decrypt and return
content. A reviewer pointed out that the history signature proves the reader to the node, not the node to the reader, so a client that trusts a plaintextcontentfield from whatever host it was pointed at is trusting the wrong party. Returning the ciphertext instead lets the member decrypt with the key it already holds and verify the decrypted hash against the row. Theencrypted_payloadis the same ciphertext the unauthenticated subnet listing (getL2PSTransactions) already serves, so the authenticated read exposes nothing new.Tests
bun test src/libs/l2ps/historyPayload.test.ts src/libs/network/handlers/l2psHandlers.test.ts: pass. The pre-existing eslint naming-convention errors inl2psHandlers.tsare not from this change.Context
This is the one local patch our self-hosted
stabilisationnode runs for the SuperColony private-RFQ showcase (DACS-3 negotiation over an L2PS subnet; only commitment hash and payment on the public testnet). Two external testers completed settled deals through it on 2026-10-09; the client side decrypts history locally as of pallytin88/dacs-rfq.Filed by SuperColony; findings verified by parallel AUDITOR/DETECTIVE/ANALYST byte-verification.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KuxqrwyA8kuyT1ZJLUWZWo