-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feature to TXM to detect and purge stuck transactions (#12881)
* Added the EVM stuck tx detector component * Added stuck tx handling in Confirmer * Fixed linting * Fixed toml config decoding * Fixed config tests * Fixed web resolver config tests * Fixed config docs test * Added zkEVM overflow detection and added unit tests for the detector * Fixed broken tests after merge * Reverted AutoPurgeConfig validation changes and fixed config tests * Added changeset and fixed config validation logic * Fixed linting * Fixed linting * Fixed purge attempt builder and added tests * Updated evm.txes contraint to allow non-null nonce if fatal_error * Added confirmer test * Adjusted confirmer test to better reflect actual process * Fixed linting * Added purge block num loading on Confirmer startup * Updated EVM tx store mock * Fixed linting and testdata * Updated stuck tx fatal error messages * Updated sql migration file sequence * Skipped loading purge block num if auto-purge feature disabled and fixed test * Fixed linting * Renamed function and moved log * Added stricter config validation * Fixed linting * Updated auto-purge feature configs to adhere to config naming standards * Fixed config doc test and updated changeset * Updated Scroll and zkEVM config defaults and linted common config * Updated config doc * Generated config doc and fixed linting * Updated config description for AutoPurge.MinAttempts * Fixed sql migration conflict * Fixed linting * Updated stuck tx detector to use PriceMax config and added comments * Fixed linting * Updated DetectionApiUrl config example * Fixed issues from latest merge * Renumbered sql migration file * Fixed testdata
- Loading branch information
1 parent
33dfd57
commit d675d86
Showing
47 changed files
with
1,761 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": minor | ||
--- | ||
|
||
#added Added an auto-purge feature to the EVM TXM that identifies terminally stuck transactions either through a chain specific method or heurisitic then purges them to unblock the nonce. Included 4 new toml configs under Transactions.AutoPurge to configure this new feature: Enabled, Threshold, MinAttempts, and DetectionApiUrl. |
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package types | ||
|
||
import ( | ||
"context" | ||
|
||
feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" | ||
"github.com/smartcontractkit/chainlink/v2/common/types" | ||
) | ||
|
||
// StuckTxDetector is used by the Confirmer to determine if any unconfirmed transactions are terminally stuck | ||
type StuckTxDetector[ | ||
CHAIN_ID types.ID, // CHAIN_ID - chain id type | ||
ADDR types.Hashable, // ADDR - chain address type | ||
TX_HASH, BLOCK_HASH types.Hashable, // various chain hash types | ||
SEQ types.Sequence, // SEQ - chain sequence type (nonce, utxo, etc) | ||
FEE feetypes.Fee, // FEE - chain fee type | ||
] interface { | ||
// Uses either a chain specific API or heuristic to determine if any unconfirmed transactions are terminally stuck. Returns only one transaction per enabled address. | ||
DetectStuckTransactions(ctx context.Context, enabledAddresses []ADDR, blockNum int64) ([]Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error) | ||
// Loads the internal map that tracks the last block num a transaction was purged at using the DB state | ||
LoadPurgeBlockNumMap(ctx context.Context, addresses []ADDR) error | ||
// Sets the last purged block num after a transaction has been successfully purged with receipt | ||
SetPurgeBlockNum(fromAddress ADDR, blockNum int64) | ||
// Returns the error message to set in the transaction error field to mark it as terminally stuck | ||
StuckTxFatalError() *string | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.