Skip to content
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

TXM In-memory: step 3-01-Non-Persistent Methods #12215

Merged
merged 45 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7f614e4
implement read only in memory store methods
poopoothegorilla Feb 29, 2024
965b4ce
Merge branch 'jtw/step-3-01' into jtw/step-3-01-non-persistent
poopoothegorilla Mar 4, 2024
745710c
Merge branch 'jtw/step-3-01' into jtw/step-3-01-non-persistent
poopoothegorilla Mar 4, 2024
c37666b
add tests for FindTxWithIdempotencyKey
poopoothegorilla Mar 4, 2024
4acd096
add test for CheckTxQueueCapacity
poopoothegorilla Mar 5, 2024
0ef6869
implement tests for CountUnstartedTransactions and CountUnconfirmedTr…
poopoothegorilla Mar 5, 2024
1bd8ac4
implment tests for FindTxAttemptsConfirmedMissingReceipt
poopoothegorilla Mar 6, 2024
04e5930
add comment
poopoothegorilla Mar 6, 2024
a2321b1
Merge branch 'jtw/step-3-01' into jtw/step-3-01-non-persistent
poopoothegorilla Mar 8, 2024
7a35db5
clean FindTxWithIdempotencyKey
poopoothegorilla Mar 8, 2024
c2a1949
some test cleanup
poopoothegorilla Mar 8, 2024
9ca93e0
remove unused pkgs
poopoothegorilla Mar 11, 2024
5a24821
Merge branch 'jtw/step-3-01' into jtw/step-3-01-non-persistent
poopoothegorilla Mar 19, 2024
dff17a1
implement tests for FindTxAttemptsRequiringReceiptFetch
poopoothegorilla Mar 19, 2024
ed9ad22
implement tests for GetInProgressTxAttempts
poopoothegorilla Mar 19, 2024
dca5e1f
implement tests for HasInProgressTransaction
poopoothegorilla Mar 19, 2024
1df21a2
implement tests for GetTxByID
poopoothegorilla Mar 19, 2024
e3438b4
implement tests for FindTxWithSequence
poopoothegorilla Mar 19, 2024
f017ea1
implement tests for CountTransactionsByState
poopoothegorilla Mar 19, 2024
81b6359
implement tests for FindTxsRequiringResubmissionDueToInsufficientFunds
poopoothegorilla Mar 20, 2024
158972f
implement tests for GetNonFatalTransactions
poopoothegorilla Mar 20, 2024
431776b
add test for wrong chain id and clean up
poopoothegorilla Mar 20, 2024
676917b
implement FindTransactionsConfirmedInBlockRange
poopoothegorilla Mar 20, 2024
164f48d
implement tests for FindEarliestUnconfirmedBroadcastTime
poopoothegorilla Mar 20, 2024
fe601b2
implements tests for FindEarliestUnconfirmedTxAttemptBlock
poopoothegorilla Mar 20, 2024
2011e06
implement tests for LoadTxAttempts
poopoothegorilla Mar 20, 2024
c28a5e7
implement tests for PreloadTxes
poopoothegorilla Mar 20, 2024
bf5299f
implement tests for IsTxFinalized
poopoothegorilla Mar 20, 2024
47c1e9a
implement tests for FindTxsRequiringGasBump
poopoothegorilla Mar 21, 2024
66e60da
clean up contexts to use testutils
poopoothegorilla Mar 22, 2024
29834c9
implement tests for FindTxesByMetaFieldAndStates
poopoothegorilla Mar 22, 2024
46cf23e
implement tests for FindTxesWithMetaFieldByStates
poopoothegorilla Mar 23, 2024
e8804c9
implement test for FindTxesWithMetaFieldByReceiptBlockNum
poopoothegorilla Mar 24, 2024
cdb374a
implement tests for FindTxAttemptsRequiringResend
poopoothegorilla Mar 25, 2024
eca0d81
Merge branch 'jtw/step-3-01' into jtw/step-3-01-non-persistent
poopoothegorilla Mar 25, 2024
89b8f22
add comment about figuring out sorting issues
poopoothegorilla Mar 25, 2024
6609492
clean up merge issues
poopoothegorilla Mar 25, 2024
163fb0e
implement tests for FindTxesPendingCallback
poopoothegorilla Mar 25, 2024
1430b7d
remove initials from NOTE
poopoothegorilla Mar 25, 2024
6080271
Merge branch 'jtw/step-3-01' into jtw/step-3-01-non-persistent
poopoothegorilla Apr 4, 2024
85ff0e1
remove wrong chain id test cases
poopoothegorilla Apr 4, 2024
759b962
remove setting Tx in txAttempts
poopoothegorilla Apr 4, 2024
431fdf3
bypass all functions that cant replicate sorting
poopoothegorilla Apr 4, 2024
41949b9
update TODO comments
poopoothegorilla Apr 19, 2024
e17ae31
apply refactor
poopoothegorilla Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions common/txmgr/address_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@
return txAttempts
}

// findTxByID returns the transaction with the given ID.
// If no transaction is found, nil is returned.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTxByID(txID int64) *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] {
as.RLock()
defer as.RUnlock()

return as.allTxs[txID]
}

// findTxs returns all transactions that match the given filters.
// If txIDs are provided, only the transactions with those IDs are considered.
// If no txIDs are provided, all transactions are considered.
Expand Down Expand Up @@ -351,30 +360,30 @@
}

// pruneUnstartedTxQueue removes the transactions with the given IDs from the unstarted transaction queue.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) pruneUnstartedTxQueue(ids []int64) {

Check failure on line 363 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).pruneUnstartedTxQueue is unused (unused)
}

// deleteTxs removes the transactions with the given IDs from the address state.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) deleteTxs(txs ...txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) {

Check failure on line 367 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).deleteTxs is unused (unused)
}

// peekNextUnstartedTx returns the next unstarted transaction in the queue without removing it from the unstarted queue.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) peekNextUnstartedTx() (*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error) {

Check failure on line 371 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).peekNextUnstartedTx is unused (unused)
return nil, nil
}

// peekInProgressTx returns the in-progress transaction without removing it from the in-progress state.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) peekInProgressTx() (*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], error) {

Check failure on line 376 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).peekInProgressTx is unused (unused)
return nil, nil
}

// addTxToUnstarted adds the given transaction to the unstarted queue.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) addTxToUnstarted(tx *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error {

Check failure on line 381 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).addTxToUnstarted is unused (unused)
return nil
}

// moveUnstartedToInProgress moves the next unstarted transaction to the in-progress state.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUnstartedToInProgress(

Check failure on line 386 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).moveUnstartedToInProgress is unused (unused)
etx *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE],
txAttempt *txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE],
) error {
Expand All @@ -382,7 +391,7 @@
}

// moveConfirmedMissingReceiptToUnconfirmed moves the confirmed missing receipt transaction to the unconfirmed state.
func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveConfirmedMissingReceiptToUnconfirmed(

Check failure on line 394 in common/txmgr/address_state.go

View workflow job for this annotation

GitHub Actions / lint

func (*addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]).moveConfirmedMissingReceiptToUnconfirmed is unused (unused)
txID int64,
) error {
return nil
Expand Down
Loading
Loading