From b10e97eb42cad387d22706df3aedbd1da7fa5714 Mon Sep 17 00:00:00 2001 From: amit-momin Date: Thu, 27 Jun 2024 17:33:37 -0500 Subject: [PATCH 1/2] Suppressed unused function warnings while adding framework --- common/txmgr/address_state.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/common/txmgr/address_state.go b/common/txmgr/address_state.go index a9e5ebf0aac..d458952c178 100644 --- a/common/txmgr/address_state.go +++ b/common/txmgr/address_state.go @@ -40,6 +40,7 @@ type addressState[ fatalErroredTxs map[int64]*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // newAddressState returns a new addressState instance with initialized transaction state func newAddressState[ CHAIN_ID types.ID, @@ -127,16 +128,19 @@ func newAddressState[ return &as } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // countTransactionsByState returns the number of transactions that are in the given state func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) countTransactionsByState(txState txmgrtypes.TxState) int { return 0 } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // findTxWithIdempotencyKey returns the transaction with the given idempotency key. If no transaction is found, nil is returned. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTxWithIdempotencyKey(key string) *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] { return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // applyToTxsByState calls the given function for each transaction in the given states. // If txIDs are provided, only the transactions with those IDs are considered. // If no txIDs are provided, all transactions in the given states are considered. @@ -148,6 +152,7 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) applyT ) { } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // findTxAttempts returns all attempts for the given 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. @@ -162,6 +167,7 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTx return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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. @@ -174,29 +180,35 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTx return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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) { } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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]) { } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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) { return nil, nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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) { return nil, nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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 { return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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( etx *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], @@ -205,6 +217,7 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUn return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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( txID int64, @@ -212,6 +225,7 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveCo return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveInProgressToUnconfirmed moves the in-progress transaction to the unconfirmed state. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveInProgressToUnconfirmed( etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], @@ -220,6 +234,7 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveIn return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveUnconfirmedToConfirmed moves the unconfirmed transaction to the confirmed state. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUnconfirmedToConfirmed( receipt txmgrtypes.ChainReceipt[TX_HASH, BLOCK_HASH], @@ -227,6 +242,7 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUn return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveTxToFatalError moves a transaction to the fatal error state. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveTxToFatalError( txID int64, txError null.String, @@ -234,16 +250,19 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveTx return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveUnconfirmedToConfirmedMissingReceipt moves the unconfirmed transaction to the confirmed missing receipt state. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUnconfirmedToConfirmedMissingReceipt(attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error { return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveInProgressToConfirmedMissingReceipt moves the in-progress transaction to the confirmed missing receipt state. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveInProgressToConfirmedMissingReceipt(attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error { return nil } +//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveConfirmedToUnconfirmed moves the confirmed transaction to the unconfirmed state. func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveConfirmedToUnconfirmed(attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error { return nil From c1d40af28b2eb93ed4b9b28bf16ece88dfed66cb Mon Sep 17 00:00:00 2001 From: amit-momin Date: Thu, 27 Jun 2024 17:48:16 -0500 Subject: [PATCH 2/2] Fixed linting error --- common/txmgr/address_state.go | 57 +++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/common/txmgr/address_state.go b/common/txmgr/address_state.go index d458952c178..9ffc5baa081 100644 --- a/common/txmgr/address_state.go +++ b/common/txmgr/address_state.go @@ -40,8 +40,9 @@ type addressState[ fatalErroredTxs map[int64]*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // newAddressState returns a new addressState instance with initialized transaction state +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func newAddressState[ CHAIN_ID types.ID, ADDR, TX_HASH, BLOCK_HASH types.Hashable, @@ -128,23 +129,26 @@ func newAddressState[ return &as } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // countTransactionsByState returns the number of transactions that are in the given state +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) countTransactionsByState(txState txmgrtypes.TxState) int { return 0 } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // findTxWithIdempotencyKey returns the transaction with the given idempotency key. If no transaction is found, nil is returned. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTxWithIdempotencyKey(key string) *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE] { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // applyToTxsByState calls the given function for each transaction in the given states. // If txIDs are provided, only the transactions with those IDs are considered. // If no txIDs are provided, all transactions in the given states are considered. // If no txStates are provided, all transactions are considered. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) applyToTxsByState( txStates []txmgrtypes.TxState, fn func(*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]), @@ -152,12 +156,13 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) applyT ) { } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // findTxAttempts returns all attempts for the given 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. // If no txStates are provided, all transactions are considered. // The txFilter is applied to the transactions and the txAttemptFilter is applied to the attempts. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTxAttempts( txStates []txmgrtypes.TxState, txFilter func(*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) bool, @@ -167,11 +172,12 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTx return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // 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. // If no txStates are provided, all transactions are considered. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTxs( txStates []txmgrtypes.TxState, filter func(*txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) bool, @@ -180,36 +186,42 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) findTx return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // pruneUnstartedTxQueue removes the transactions with the given IDs from the unstarted transaction queue. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) pruneUnstartedTxQueue(ids []int64) { } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // deleteTxs removes the transactions with the given IDs from the address state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework 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]) { } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // peekNextUnstartedTx returns the next unstarted transaction in the queue without removing it from the unstarted queue. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework 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) { return nil, nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // peekInProgressTx returns the in-progress transaction without removing it from the in-progress state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework 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) { return nil, nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // addTxToUnstarted adds the given transaction to the unstarted queue. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework 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 { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveUnstartedToInProgress moves the next unstarted transaction to the in-progress state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUnstartedToInProgress( etx *txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], txAttempt *txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], @@ -217,16 +229,18 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUn return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveConfirmedMissingReceiptToUnconfirmed moves the confirmed missing receipt transaction to the unconfirmed state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveConfirmedMissingReceiptToUnconfirmed( txID int64, ) error { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveInProgressToUnconfirmed moves the in-progress transaction to the unconfirmed state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveInProgressToUnconfirmed( etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], txAttempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], @@ -234,36 +248,41 @@ func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveIn return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveUnconfirmedToConfirmed moves the unconfirmed transaction to the confirmed state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUnconfirmedToConfirmed( receipt txmgrtypes.ChainReceipt[TX_HASH, BLOCK_HASH], ) error { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveTxToFatalError moves a transaction to the fatal error state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveTxToFatalError( txID int64, txError null.String, ) error { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveUnconfirmedToConfirmedMissingReceipt moves the unconfirmed transaction to the confirmed missing receipt state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveUnconfirmedToConfirmedMissingReceipt(attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveInProgressToConfirmedMissingReceipt moves the in-progress transaction to the confirmed missing receipt state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveInProgressToConfirmedMissingReceipt(attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], broadcastAt time.Time) error { return nil } -//lint:ignore U1000 Ignore unused function temporarily while adding the framework // moveConfirmedToUnconfirmed moves the confirmed transaction to the unconfirmed state. +// +//lint:ignore U1000 Ignore unused function temporarily while adding the framework func (as *addressState[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) moveConfirmedToUnconfirmed(attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) error { return nil }