fix(engine-bridge): release nonce on tx-aggregator execution failure - #229
Open
xeladev4 wants to merge 1 commit into
Open
fix(engine-bridge): release nonce on tx-aggregator execution failure#229xeladev4 wants to merge 1 commit into
xeladev4 wants to merge 1 commit into
Conversation
Fixes nonce leak in TxAggregator.execute() when submission fails before reaching the ledger. Previously, reserved nonces were never released on sendTransaction ERROR or poll-loop timeout, causing permanent desync between the in-process cache and the real account sequence. Changes: - Add optional sourceAccountId and sequence parameters to execute() - Call nonceManager.release() on ERROR and timeout paths - Update all existing tests to pass the new parameters - Add regression tests for nonce release on both failure paths Closes Vero-protocol#181
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.
Summary
Fixes a critical nonce leak bug in TxAggregator.execute() where reserved sequence numbers were never released when transaction submission failed before reaching the ledger. This caused permanent desynchronization between the in-process nonce cache and the real account sequence, leading to tx_bad_seq errors and eventual service outage.
Changes
TxAggregator.execute()to accept optionalsourceAccountIdandsequenceparametersnonceManager.release()calls in both error paths:sendTransactionreturns status "ERROR" (sequence never consumed on-chain)Testing
cd engine-bridge && npm testcd engine-bridge && npm run lintSecurity Considerations
This fix prevents a denial-of-service condition where the nonce cache could drift ahead of the real account sequence, causing all subsequent transactions to fail with tx_bad_seq. This is a reliability/security issue for the fund-moving path.
Checklist
Closes #181