-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update TXM confirmation logic to use the mined transaction count #14405
Changes from 13 commits
d2a6193
39616c3
914876f
78509ea
d77cc28
568bee3
7d61e80
444c9c7
b1a8883
83b8a17
d3dc084
3c1023b
2adc3d6
9906082
dc2015e
59d419a
1277145
9d048f2
bfd7483
5f24154
4ecaead
45305ed
88ecf7c
aa5e837
42e4318
3dbd397
1bbf695
6edda8f
3c21241
0dcbaf5
7bc2a40
f1926b2
34d5bdb
814ab0b
5880e6a
65781d8
e1f31f3
a3fed95
06c5af7
3e74540
dd8aab8
ca2bac5
deec40c
f326514
006e9db
33295fb
cf6cb94
399ae79
37b3f4c
9b89974
f4bfbaf
53d7e02
52b973e
dd321e7
bba6f9a
1f056ac
23afc29
f003dd7
4333aa0
308b47d
262e192
b229119
f50a1ba
afb6e3f
61890a7
818a840
c565fc8
4fb063d
aeeb179
cff9dba
c15e5a8
72dca42
74e0afb
e27b285
4a828f2
175dbe0
4bda9b7
9744327
b1ec4e8
024d696
e2252d8
35b4631
95e800c
002d6a5
ca38fc9
fe22dc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"chainlink": minor | ||
--- | ||
|
||
#internal Updated the TXM confirmation logic to use the mined transaction count to identify re-org'd or confirmed transactions. | ||
|
||
- Confirmer uses the mined transaction count to determine if transactions have been re-org'd or confirmed. | ||
- Confirmer no longer sets transaction states to `confirmed_missing_receipt`. This state is maintained in queries for backwards compatibility. | ||
- Finalizer now responsible for fetching and storing receipts for confirmed transactions. | ||
- Finalizer now responsible for resuming pending task runs. | ||
- Finalizer now responsible for marking old transactions without receipts broadcasted before the finalized head as fatal. |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,12 +33,6 @@ type TxStore[ | |
TxHistoryReaper[CHAIN_ID] | ||
TransactionStore[ADDR, CHAIN_ID, TX_HASH, BLOCK_HASH, SEQ, FEE] | ||
|
||
// Find confirmed txes beyond the minConfirmations param that require callback but have not yet been signaled | ||
FindTxesPendingCallback(ctx context.Context, blockNum int64, chainID CHAIN_ID) (receiptsPlus []ReceiptPlus[R], err error) | ||
// Update tx to mark that its callback has been signaled | ||
UpdateTxCallbackCompleted(ctx context.Context, pipelineTaskRunRid uuid.UUID, chainId CHAIN_ID) error | ||
SaveFetchedReceipts(ctx context.Context, r []R, state TxState, errorMsg *string, chainID CHAIN_ID) error | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep these for now so we can keep track of every tx_store method required by the current TXM version and quickly compare it with TXMv2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't we still do that through the git history? Feel like I should clean this out with this change since they aren't being used anymore. Otherwise we'd also have to maintain the methods in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These methods are required by the Finalizer, so they have to be maintained by the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh sorry I thought you meant keeping all of the tx store methods I removed. Missed that you were specifically referring to these 3. I don't mind adding these back. |
||
// additional methods for tx store management | ||
CheckTxQueueCapacity(ctx context.Context, fromAddress ADDR, maxQueuedTransactions uint64, chainID CHAIN_ID) (err error) | ||
Close() | ||
|
@@ -68,20 +62,19 @@ type TransactionStore[ | |
CountUnstartedTransactions(ctx context.Context, fromAddress ADDR, chainID CHAIN_ID) (count uint32, err error) | ||
CreateTransaction(ctx context.Context, txRequest TxRequest[ADDR, TX_HASH], chainID CHAIN_ID) (tx Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
DeleteInProgressAttempt(ctx context.Context, attempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
FindLatestSequence(ctx context.Context, fromAddress ADDR, chainId CHAIN_ID) (SEQ, error) | ||
FindLatestSequence(ctx context.Context, fromAddress ADDR, chainID CHAIN_ID) (SEQ, error) | ||
// FindReorgOrIncludedTxs returns either a list of re-org'd transactions or included transactions based on the provided sequence | ||
FindReorgOrIncludedTxs(ctx context.Context, fromAddress ADDR, nonce SEQ, chainID CHAIN_ID) (reorgTx []*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], includedTxs []*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindTxsRequiringGasBump(ctx context.Context, address ADDR, blockNum, gasBumpThreshold, depth int64, chainID CHAIN_ID) (etxs []*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindTxsRequiringResubmissionDueToInsufficientFunds(ctx context.Context, address ADDR, chainID CHAIN_ID) (etxs []*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindTxAttemptsConfirmedMissingReceipt(ctx context.Context, chainID CHAIN_ID) (attempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindTxAttemptsRequiringReceiptFetch(ctx context.Context, chainID CHAIN_ID) (attempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindTxAttemptsRequiringResend(ctx context.Context, olderThan time.Time, maxInFlightTransactions uint32, chainID CHAIN_ID, address ADDR) (attempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
// Search for Tx using the idempotencyKey and chainID | ||
FindTxWithIdempotencyKey(ctx context.Context, idempotencyKey string, chainID CHAIN_ID) (tx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
// Search for Tx using the fromAddress and sequence | ||
FindTxWithSequence(ctx context.Context, fromAddress ADDR, seq SEQ) (etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindNextUnstartedTransactionFromAddress(ctx context.Context, fromAddress ADDR, chainID CHAIN_ID) (*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error) | ||
|
||
// FindTransactionsConfirmedInBlockRange retrieves tx with attempts and partial receipt values for optimization purpose | ||
FindTransactionsConfirmedInBlockRange(ctx context.Context, highBlockNumber, lowBlockNumber int64, chainID CHAIN_ID) (etxs []*Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
FindEarliestUnconfirmedBroadcastTime(ctx context.Context, chainID CHAIN_ID) (null.Time, error) | ||
FindEarliestUnconfirmedTxAttemptBlock(ctx context.Context, chainID CHAIN_ID) (null.Int, error) | ||
GetTxInProgress(ctx context.Context, fromAddress ADDR) (etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
|
@@ -90,23 +83,26 @@ type TransactionStore[ | |
GetTxByID(ctx context.Context, id int64) (tx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) | ||
HasInProgressTransaction(ctx context.Context, account ADDR, chainID CHAIN_ID) (exists bool, err error) | ||
LoadTxAttempts(ctx context.Context, etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
MarkAllConfirmedMissingReceipt(ctx context.Context, chainID CHAIN_ID) (err error) | ||
MarkOldTxesMissingReceiptAsErrored(ctx context.Context, blockNum int64, latestFinalizedBlockNum int64, chainID CHAIN_ID) error | ||
PreloadTxes(ctx context.Context, attempts []TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
SaveConfirmedMissingReceiptAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error | ||
SaveConfirmedAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error | ||
SaveInProgressAttempt(ctx context.Context, attempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
SaveInsufficientFundsAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error | ||
SaveReplacementInProgressAttempt(ctx context.Context, oldAttempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], replacementAttempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
SaveSentAttempt(ctx context.Context, timeout time.Duration, attempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error | ||
SetBroadcastBeforeBlockNum(ctx context.Context, blockNum int64, chainID CHAIN_ID) error | ||
UpdateBroadcastAts(ctx context.Context, now time.Time, etxIDs []int64) error | ||
UpdateTxAttemptInProgressToBroadcast(ctx context.Context, etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], attempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], NewAttemptState TxAttemptState) error | ||
// Update tx to mark that its callback has been signaled | ||
UpdateTxCallbackCompleted(ctx context.Context, pipelineTaskRunRid uuid.UUID, chainId CHAIN_ID) error | ||
UpdateTxsUnconfirmed(ctx context.Context, ids []int64) error | ||
// UpdateTxCallbackCompleted updates tx to mark that its callback has been signaled | ||
UpdateTxCallbackCompleted(ctx context.Context, pipelineTaskRunRid uuid.UUID, chainID CHAIN_ID) error | ||
// UpdateTxConfirmed updates transaction states to confirmed | ||
UpdateTxConfirmed(ctx context.Context, etxIDs []int64) error | ||
// UpdateTxFatalErrorAndDeleteAttempts updates transaction states to fatal error, deletes attempts, and clears broadcast info and sequence | ||
UpdateTxFatalErrorAndDeleteAttempts(ctx context.Context, etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
// UpdateTxFatalError updates transaction states to fatal error with error message | ||
UpdateTxFatalError(ctx context.Context, etxIDs []int64, errMsg string) error | ||
UpdateTxForRebroadcast(ctx context.Context, etxIDs []int64, attemptIDs []int64) error | ||
UpdateTxsUnconfirmed(ctx context.Context, etxIDs []int64) error | ||
UpdateTxUnstartedToInProgress(ctx context.Context, etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], attempt *TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
UpdateTxFatalError(ctx context.Context, etx *Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
UpdateTxForRebroadcast(ctx context.Context, etx Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], etxAttempt TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error | ||
} | ||
|
||
type TxHistoryReaper[CHAIN_ID types.ID] interface { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't classify this as a
minor
update, as this is a significant change. We need wider visibility from RelEng.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think marking this as
major
change might be too extreme since this is backwards compatible. I agree we probably want better visibility on this though but think we should do that separately from the semantic versioning.