Repository navigation
[simplex, docs]: bind source confirmations to the scanned placement block - #1409
Open
seunlanlege wants to merge 1 commit into
Open
seunlanlege wants to merge 1 commit into
seunlanlege wants to merge 1 commit into
Conversation
…lock A cross-chain order's confirmation wait now counts depth only while a quorum places the placement transaction in the block its OrderPlaced log was scanned from, and the source escrow is re-read through the quorum right before bidding. A reorg that re-mines the placement under a new nonce keeps the transaction hash but changes the commitment; the filler no longer bids on the stale one.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
For a cross-chain order the filler read the source escrow once, on a single endpoint, then waited for confirmations of the placement transaction hash (
QuorumPublicClient.getTransactionConfirmations). The quorum grouped receipts by(blockHash, blockNumber)but returned only the depth, and nothing re-read the escrow beforeexecuteOrderbid.IntentGatewayV2.placeOrdersetsorder.nonce = _nonce++, and the commitment hashes the whole order. A source reorg that re-mines the placement in a different position, for example behind another placement made in that window, keeps the transaction hash but changes the nonce and so the commitment. The wait kept counting confirmations of the re-mined transaction. The filler then bid on the stale commitment, which the placer can select with its session key; the destination paid the output, and redeeming on source revertedUnknownOrder, losing one full output. Exploiting it needs a reorg deeper than the confirmation curve during the wait (Polygon: 2–5 blocks).What changes
EventMonitorpasses theblockHashalready onScannedOrderthroughnewOrderintoIntentFiller.handleNewOrder.QuorumPublicClient.getTransactionInclusionreturns theblockHash,blockNumberandconfirmationsa quorum agreed on (getTransactionConfirmationsis now its depth; aggregation moved toaggregateInclusion). Every poll, including the first, compares the agreed block with the scanned one. On a mismatch the wait stops and the order is skipped withorderSkippedreasonSource placement reorged.QuorumPublicClient.readWithQuorum(label, read)runs a read on every endpoint and returns the value a quorum agrees on; failing endpoints don't vote, as on every quorum path. After the wait,verifyOrderOnSource(order, sourceQuorumClient)reads every leg's escrow through it, so each endpoint votes on the whole vector. An empty or unreadable escrow skips the order (Source escrow missing after confirmations).Placement block unknown). The built-inChainScanneralways supplies one from mined logs.sdk/packages/simplex/docs/ai/changelog/2026-10-16-confirmations-bound-to-the-placement-block.md, one sentence in the order-intake flow, and the "Quorum-checked confirmations" section ofdocs/content/developers/evm/simplex/confirmations.mdx. No version bumps.Validation
vitest --watch=false src/tests/quorum-public-client.test.ts src/tests/quorum-failure-handling.test.ts src/tests/core src/tests/activity-recorder.test.ts src/tests/scanner: 24 files, 221 passed, 5 skipped (the network-gated quorum tests).src/tests/core/source-reorg.test.ts(11 cases) driveshandleNewOrderthrough the wait:readLegEscrowcallback runs against a stub client;Most cases fail on the old code.
quorum-public-client.test.tscases foraggregateInclusion,getTransactionInclusion(including a quorum agreeing on a re-mined block) andreadWithQuorum(divergent minority, failing endpoints including a synchronous throw, bigint vectors, no quorum).chain-lifecycle.test.tschecks thatnewOrdercarriesblockHash.tsc --noEmit: no errors beyond the 11 already onmain. Biome on the changed files: no new diagnostics.