Repository navigation
Conversation
handleExecuteTransaction ran HandleGCR.applyToTx(tx, false, false) for storageProgram txs at broadcast time. That wrote state before the mempool duplicate check and before any inclusion decision. Consensus (applyGCREditsFromMergedMempool) and sync (syncGCRTables) then applied the same edits again, guarded only by Chain.checkTxExists, which stays false until the block is inserted. Results: - non-idempotent ops (APPEND_ITEM, fee/interactionTxs accumulation) ran twice on the receiving node - resubmitting the same validatedData wrote again each time - the write stayed when the tx was never included (mempool add error, relay not accepted, consensus failure); storage routines have no undo - a second CREATE failed in consensus and pruned the tx on that node only Storage-program edits now go through the same simulated apply as every other tx type; the real write happens only when the block is applied. Adds tests/storageprogram/executeTransaction.test.ts covering the validator path, the relay path, resubmission and a failed simulation.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
|
Automated launch review: needs-changes at An automated reviewer checked this PR for the Demos mainnet launch, using public research on how established chains handle the same problem. Each finding cites the code at this head. If a finding is wrong, reply here with the reason.
|
Fixes for the security-review findings on #762. This PR targets
feature/storage-program-execute, so merging it adds this commit to #762.Heads-up: this fix reverses #762's behaviour change. The broadcast path now simulates storageProgram edits like every other tx type. The real write happens once, in the block path:
applyGCREditsFromMergedMempoolduring consensus,syncGCRTablesduring sync. Apart from a comment,endpointHandlers.tsnow matches the merge base. If the goal was storage writes visible right after broadcast, that needs its own design: an atomic applied-marker plus a real undo, or serving pending state from the mempool.Mempool.addTransactionHandleGCR.rollbackdoesn't passsimulate, so a failed multi-edit tx can write for real. Fixing it changes rollback for every edit type, so it's left to maintainershashGCRTablesTests:
npx jest tests/storageprogram/executeTransaction.test.ts: 4 pass. All 4 fail against #762's head. The type-check errors are the same before and after the change.🤖 Generated with Claude Code