Skip to content

Commit

Permalink
Modles.go evm prefix cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
simsonraj committed Jun 20, 2023
1 parent e42536d commit 0a0a311
Show file tree
Hide file tree
Showing 51 changed files with 447 additions and 447 deletions.
6 changes: 3 additions & 3 deletions core/chains/evm/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Chain interface {
Config() evmconfig.ChainScopedConfig
LogBroadcaster() log.Broadcaster
HeadBroadcaster() httypes.HeadBroadcaster
TxManager() txmgr.EvmTxManager
TxManager() txmgr.TxManager
HeadTracker() httypes.HeadTracker
Logger() logger.Logger
BalanceMonitor() monitor.BalanceMonitor
Expand All @@ -55,7 +55,7 @@ type chain struct {
id *big.Int
cfg evmconfig.ChainScopedConfig
client evmclient.Client
txm txmgr.EvmTxManager
txm txmgr.TxManager
logger logger.Logger
headBroadcaster httypes.HeadBroadcaster
headTracker httypes.HeadTracker
Expand Down Expand Up @@ -272,7 +272,7 @@ func (c *chain) Config() evmconfig.ChainScopedConfig { return c.cfg }
func (c *chain) LogBroadcaster() log.Broadcaster { return c.logBroadcaster }
func (c *chain) LogPoller() logpoller.LogPoller { return c.logPoller }
func (c *chain) HeadBroadcaster() httypes.HeadBroadcaster { return c.headBroadcaster }
func (c *chain) TxManager() txmgr.EvmTxManager { return c.txm }
func (c *chain) TxManager() txmgr.TxManager { return c.txm }
func (c *chain) HeadTracker() httypes.HeadTracker { return c.headTracker }
func (c *chain) Logger() logger.Logger { return c.logger }
func (c *chain) BalanceMonitor() monitor.BalanceMonitor { return c.balanceMonitor }
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/chain_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ type ChainSetOpts struct {
GenLogBroadcaster func(*big.Int) log.Broadcaster
GenLogPoller func(*big.Int) logpoller.LogPoller
GenHeadTracker func(*big.Int, httypes.HeadBroadcaster) httypes.HeadTracker
GenTxManager func(*big.Int) txmgr.EvmTxManager
GenTxManager func(*big.Int) txmgr.TxManager
GenGasEstimator func(*big.Int) gas.EvmFeeEstimator
}

Expand Down
4 changes: 2 additions & 2 deletions core/chains/evm/evm_txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func newEvmTxm(
lggr logger.Logger,
logPoller logpoller.LogPoller,
opts ChainSetOpts,
) (txm txmgr.EvmTxManager,
) (txm txmgr.TxManager,
estimator gas.EvmFeeEstimator,
err error,
) {
chainID := cfg.ChainID()
if !evmRPCEnabled {
txm = &txmgr.NullEvmTxManager{ErrMsg: fmt.Sprintf("Ethereum is disabled for chain %d", chainID)}
txm = &txmgr.NullTxManager{ErrMsg: fmt.Sprintf("Ethereum is disabled for chain %d", chainID)}
return txm, nil, nil
}

Expand Down
24 changes: 12 additions & 12 deletions core/chains/evm/txmgr/attempts.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type TxAttemptSigner[ADDR commontypes.Hashable] interface {
SignTx(fromAddress ADDR, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
}

var _ EvmTxAttemptBuilder = (*evmTxAttemptBuilder)(nil)
var _ TxAttemptBuilder = (*evmTxAttemptBuilder)(nil)

type evmTxAttemptBuilder struct {
chainID big.Int
Expand All @@ -48,7 +48,7 @@ func NewEvmTxAttemptBuilder(chainID big.Int, config evmTxAttemptBuilderConfig, f

// NewTxAttempt builds an new attempt using the configured fee estimator + using the EIP1559 config to determine tx type
// used for when a brand new transaction is being created in the txm
func (c *evmTxAttemptBuilder) NewTxAttempt(ctx context.Context, etx EvmTx, lggr logger.Logger, opts ...feetypes.Opt) (attempt EvmTxAttempt, fee gas.EvmFee, feeLimit uint32, retryable bool, err error) {
func (c *evmTxAttemptBuilder) NewTxAttempt(ctx context.Context, etx Tx, lggr logger.Logger, opts ...feetypes.Opt) (attempt TxAttempt, fee gas.EvmFee, feeLimit uint32, retryable bool, err error) {
txType := 0x0
if c.feeConfig.EIP1559DynamicFees() {
txType = 0x2
Expand All @@ -58,7 +58,7 @@ func (c *evmTxAttemptBuilder) NewTxAttempt(ctx context.Context, etx EvmTx, lggr

// NewTxAttemptWithType builds a new attempt with a new fee estimation where the txType can be specified by the caller
// used for L2 re-estimation on broadcasting (note EIP1559 must be disabled otherwise this will fail with mismatched fees + tx type)
func (c *evmTxAttemptBuilder) NewTxAttemptWithType(ctx context.Context, etx EvmTx, lggr logger.Logger, txType int, opts ...feetypes.Opt) (attempt EvmTxAttempt, fee gas.EvmFee, feeLimit uint32, retryable bool, err error) {
func (c *evmTxAttemptBuilder) NewTxAttemptWithType(ctx context.Context, etx Tx, lggr logger.Logger, txType int, opts ...feetypes.Opt) (attempt TxAttempt, fee gas.EvmFee, feeLimit uint32, retryable bool, err error) {
keySpecificMaxGasPriceWei := c.config.KeySpecificMaxGasPriceWei(etx.FromAddress)
fee, feeLimit, err = c.EvmFeeEstimator.GetFee(ctx, etx.EncodedPayload, etx.FeeLimit, keySpecificMaxGasPriceWei, opts...)
if err != nil {
Expand All @@ -71,7 +71,7 @@ func (c *evmTxAttemptBuilder) NewTxAttemptWithType(ctx context.Context, etx EvmT

// NewBumpTxAttempt builds a new attempt with a bumped fee - based on the previous attempt tx type
// used in the txm broadcaster + confirmer when tx ix rejected for too low fee or is not included in a timely manner
func (c *evmTxAttemptBuilder) NewBumpTxAttempt(ctx context.Context, etx EvmTx, previousAttempt EvmTxAttempt, priorAttempts []EvmTxAttempt, lggr logger.Logger) (attempt EvmTxAttempt, bumpedFee gas.EvmFee, bumpedFeeLimit uint32, retryable bool, err error) {
func (c *evmTxAttemptBuilder) NewBumpTxAttempt(ctx context.Context, etx Tx, previousAttempt TxAttempt, priorAttempts []TxAttempt, lggr logger.Logger) (attempt TxAttempt, bumpedFee gas.EvmFee, bumpedFeeLimit uint32, retryable bool, err error) {
keySpecificMaxGasPriceWei := c.config.KeySpecificMaxGasPriceWei(etx.FromAddress)

bumpedFee, bumpedFeeLimit, err = c.EvmFeeEstimator.BumpFee(ctx, previousAttempt.TxFee, etx.FeeLimit, keySpecificMaxGasPriceWei, newEvmPriorAttempts(priorAttempts))
Expand All @@ -85,7 +85,7 @@ func (c *evmTxAttemptBuilder) NewBumpTxAttempt(ctx context.Context, etx EvmTx, p

// NewCustomTxAttempt is the lowest level func where the fee parameters + tx type must be passed in
// used in the txm for force rebroadcast where fees and tx type are pre-determined without an estimator
func (c *evmTxAttemptBuilder) NewCustomTxAttempt(etx EvmTx, fee gas.EvmFee, gasLimit uint32, txType int, lggr logger.Logger) (attempt EvmTxAttempt, retryable bool, err error) {
func (c *evmTxAttemptBuilder) NewCustomTxAttempt(etx Tx, fee gas.EvmFee, gasLimit uint32, txType int, lggr logger.Logger) (attempt TxAttempt, retryable bool, err error) {
switch txType {
case 0x0: // legacy
if fee.Legacy == nil {
Expand Down Expand Up @@ -115,7 +115,7 @@ func (c *evmTxAttemptBuilder) NewCustomTxAttempt(etx EvmTx, fee gas.EvmFee, gasL
}

// NewEmptyTxAttempt is used in ForceRebroadcast to create a signed tx with zero value sent to the zero address
func (c *evmTxAttemptBuilder) NewEmptyTxAttempt(nonce evmtypes.Nonce, feeLimit uint32, fee gas.EvmFee, fromAddress common.Address) (attempt EvmTxAttempt, err error) {
func (c *evmTxAttemptBuilder) NewEmptyTxAttempt(nonce evmtypes.Nonce, feeLimit uint32, fee gas.EvmFee, fromAddress common.Address) (attempt TxAttempt, err error) {
value := big.NewInt(0)
payload := []byte{}

Expand All @@ -136,7 +136,7 @@ func (c *evmTxAttemptBuilder) NewEmptyTxAttempt(nonce evmtypes.Nonce, feeLimit u

}

func (c *evmTxAttemptBuilder) newDynamicFeeAttempt(etx EvmTx, fee gas.DynamicFee, gasLimit uint32) (attempt EvmTxAttempt, err error) {
func (c *evmTxAttemptBuilder) newDynamicFeeAttempt(etx Tx, fee gas.DynamicFee, gasLimit uint32) (attempt TxAttempt, err error) {
if err = validateDynamicFeeGas(c.config, c.feeConfig.TipCapMin(), fee, gasLimit, etx); err != nil {
return attempt, errors.Wrap(err, "error validating gas")
}
Expand Down Expand Up @@ -169,7 +169,7 @@ var Max256BitUInt = big.NewInt(0).Exp(big.NewInt(2), big.NewInt(256), nil)

// validateDynamicFeeGas is a sanity check - we have other checks elsewhere, but this
// makes sure we _never_ create an invalid attempt
func validateDynamicFeeGas(cfg evmTxAttemptBuilderConfig, tipCapMinimum *assets.Wei, fee gas.DynamicFee, gasLimit uint32, etx EvmTx) error {
func validateDynamicFeeGas(cfg evmTxAttemptBuilderConfig, tipCapMinimum *assets.Wei, fee gas.DynamicFee, gasLimit uint32, etx Tx) error {
gasTipCap, gasFeeCap := fee.TipCap, fee.FeeCap

if gasTipCap == nil {
Expand Down Expand Up @@ -217,7 +217,7 @@ func newDynamicFeeTransaction(nonce uint64, to common.Address, value *big.Int, g
}
}

func (c *evmTxAttemptBuilder) newLegacyAttempt(etx EvmTx, gasPrice *assets.Wei, gasLimit uint32) (attempt EvmTxAttempt, err error) {
func (c *evmTxAttemptBuilder) newLegacyAttempt(etx Tx, gasPrice *assets.Wei, gasLimit uint32) (attempt TxAttempt, err error) {
if err = validateLegacyGas(c.config, c.feeConfig.PriceMin(), gasPrice, gasLimit, etx); err != nil {
return attempt, errors.Wrap(err, "error validating gas")
}
Expand Down Expand Up @@ -251,7 +251,7 @@ func (c *evmTxAttemptBuilder) newLegacyAttempt(etx EvmTx, gasPrice *assets.Wei,

// validateLegacyGas is a sanity check - we have other checks elsewhere, but this
// makes sure we _never_ create an invalid attempt
func validateLegacyGas(cfg evmTxAttemptBuilderConfig, minGasPriceWei, gasPrice *assets.Wei, gasLimit uint32, etx EvmTx) error {
func validateLegacyGas(cfg evmTxAttemptBuilderConfig, minGasPriceWei, gasPrice *assets.Wei, gasLimit uint32, etx Tx) error {
if gasPrice == nil {
panic("gas price missing")
}
Expand All @@ -266,7 +266,7 @@ func validateLegacyGas(cfg evmTxAttemptBuilderConfig, minGasPriceWei, gasPrice *
return nil
}

func (c *evmTxAttemptBuilder) newSignedAttempt(etx EvmTx, tx *types.Transaction) (attempt EvmTxAttempt, err error) {
func (c *evmTxAttemptBuilder) newSignedAttempt(etx Tx, tx *types.Transaction) (attempt TxAttempt, err error) {
hash, signedTxBytes, err := c.SignTx(etx.FromAddress, tx)
if err != nil {
return attempt, errors.Wrapf(err, "error using account %s to sign transaction %v", etx.FromAddress.String(), etx.ID)
Expand Down Expand Up @@ -305,7 +305,7 @@ func (c *evmTxAttemptBuilder) SignTx(address common.Address, tx *types.Transacti
return txHash, rlp.Bytes(), nil
}

func newEvmPriorAttempts(attempts []EvmTxAttempt) (prior []gas.EvmPriorAttempt) {
func newEvmPriorAttempts(attempts []TxAttempt) (prior []gas.EvmPriorAttempt) {
for i := range attempts {
priorAttempt := gas.EvmPriorAttempt{
ChainSpecificFeeLimit: attempts[i].ChainSpecificFeeLimit,
Expand Down
20 changes: 10 additions & 10 deletions core/chains/evm/txmgr/attempts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestTxm_NewDynamicFeeTx(t *testing.T) {
cfg := evmtest.NewChainScopedConfig(t, gcfg)
cks := txmgr.NewEvmTxAttemptBuilder(*big.NewInt(1), cfg.EVM(), newFeeConfig(), kst, nil)
dynamicFee := gas.DynamicFee{TipCap: assets.GWei(100), FeeCap: assets.GWei(200)}
a, _, err := cks.NewCustomTxAttempt(txmgr.EvmTx{Sequence: &n, FromAddress: addr}, gas.EvmFee{
a, _, err := cks.NewCustomTxAttempt(txmgr.Tx{Sequence: &n, FromAddress: addr}, gas.EvmFee{
DynamicTipCap: dynamicFee.TipCap,
DynamicFeeCap: dynamicFee.FeeCap,
}, 100, 0x2, lggr)
Expand Down Expand Up @@ -142,7 +142,7 @@ func TestTxm_NewDynamicFeeTx(t *testing.T) {
cfg := evmtest.NewChainScopedConfig(t, gcfg)
cks := txmgr.NewEvmTxAttemptBuilder(*big.NewInt(1), cfg.EVM(), cfg.EVM().GasEstimator(), kst, nil)
dynamicFee := gas.DynamicFee{TipCap: test.tipcap, FeeCap: test.feecap}
_, _, err := cks.NewCustomTxAttempt(txmgr.EvmTx{Sequence: &n, FromAddress: addr}, gas.EvmFee{
_, _, err := cks.NewCustomTxAttempt(txmgr.Tx{Sequence: &n, FromAddress: addr}, gas.EvmFee{
DynamicTipCap: dynamicFee.TipCap,
DynamicFeeCap: dynamicFee.FeeCap,
}, 100, 0x2, lggr)
Expand Down Expand Up @@ -172,7 +172,7 @@ func TestTxm_NewLegacyAttempt(t *testing.T) {

t.Run("creates attempt with fields", func(t *testing.T) {
var n evmtypes.Nonce
a, _, err := cks.NewCustomTxAttempt(txmgr.EvmTx{Sequence: &n, FromAddress: addr}, gas.EvmFee{Legacy: assets.NewWeiI(25)}, 100, 0x0, lggr)
a, _, err := cks.NewCustomTxAttempt(txmgr.Tx{Sequence: &n, FromAddress: addr}, gas.EvmFee{Legacy: assets.NewWeiI(25)}, 100, 0x0, lggr)
require.NoError(t, err)
assert.Equal(t, 100, int(a.ChainSpecificFeeLimit))
assert.NotNil(t, a.TxFee.Legacy)
Expand All @@ -182,7 +182,7 @@ func TestTxm_NewLegacyAttempt(t *testing.T) {
})

t.Run("verifies max gas price", func(t *testing.T) {
_, _, err := cks.NewCustomTxAttempt(txmgr.EvmTx{FromAddress: addr}, gas.EvmFee{Legacy: assets.NewWeiI(100)}, 100, 0x0, lggr)
_, _, err := cks.NewCustomTxAttempt(txmgr.Tx{FromAddress: addr}, gas.EvmFee{Legacy: assets.NewWeiI(100)}, 100, 0x0, lggr)
require.Error(t, err)
assert.Contains(t, err.Error(), fmt.Sprintf("specified gas price of 100 wei would exceed max configured gas price of 50 wei for key %s", addr.String()))
})
Expand All @@ -200,21 +200,21 @@ func TestTxm_NewCustomTxAttempt_NonRetryableErrors(t *testing.T) {
legacyFee := assets.NewWeiI(100)

t.Run("dynamic fee with legacy tx type", func(t *testing.T) {
_, retryable, err := cks.NewCustomTxAttempt(txmgr.EvmTx{}, gas.EvmFee{
_, retryable, err := cks.NewCustomTxAttempt(txmgr.Tx{}, gas.EvmFee{
DynamicTipCap: dynamicFee.TipCap,
DynamicFeeCap: dynamicFee.FeeCap,
}, 100, 0x0, lggr)
require.Error(t, err)
assert.False(t, retryable)
})
t.Run("legacy fee with dynamic tx type", func(t *testing.T) {
_, retryable, err := cks.NewCustomTxAttempt(txmgr.EvmTx{}, gas.EvmFee{Legacy: legacyFee}, 100, 0x2, lggr)
_, retryable, err := cks.NewCustomTxAttempt(txmgr.Tx{}, gas.EvmFee{Legacy: legacyFee}, 100, 0x2, lggr)
require.Error(t, err)
assert.False(t, retryable)
})

t.Run("invalid type", func(t *testing.T) {
_, retryable, err := cks.NewCustomTxAttempt(txmgr.EvmTx{}, gas.EvmFee{}, 100, 0xA, lggr)
_, retryable, err := cks.NewCustomTxAttempt(txmgr.Tx{}, gas.EvmFee{}, 100, 0xA, lggr)
require.Error(t, err)
assert.False(t, retryable)
})
Expand All @@ -234,19 +234,19 @@ func TestTxm_EvmTxAttemptBuilder_RetryableEstimatorError(t *testing.T) {
cks := txmgr.NewEvmTxAttemptBuilder(*big.NewInt(1), cfg, &feeConfig{eip1559DynamicFees: true}, kst, est)

t.Run("NewAttempt", func(t *testing.T) {
_, _, _, retryable, err := cks.NewTxAttempt(ctx, txmgr.EvmTx{}, lggr)
_, _, _, retryable, err := cks.NewTxAttempt(ctx, txmgr.Tx{}, lggr)
require.Error(t, err)
assert.Contains(t, err.Error(), "failed to get fee")
assert.True(t, retryable)
})
t.Run("NewAttemptWithType", func(t *testing.T) {
_, _, _, retryable, err := cks.NewTxAttemptWithType(ctx, txmgr.EvmTx{}, lggr, 0x0)
_, _, _, retryable, err := cks.NewTxAttemptWithType(ctx, txmgr.Tx{}, lggr, 0x0)
require.Error(t, err)
assert.Contains(t, err.Error(), "failed to get fee")
assert.True(t, retryable)
})
t.Run("NewBumpAttempt", func(t *testing.T) {
_, _, _, retryable, err := cks.NewBumpTxAttempt(ctx, txmgr.EvmTx{}, txmgr.EvmTxAttempt{}, nil, lggr)
_, _, _, retryable, err := cks.NewBumpTxAttempt(ctx, txmgr.Tx{}, txmgr.TxAttempt{}, nil, lggr)
require.Error(t, err)
assert.Contains(t, err.Error(), "failed to bump fee")
assert.True(t, retryable)
Expand Down
36 changes: 18 additions & 18 deletions core/chains/evm/txmgr/broadcaster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func NewTestEthBroadcaster(
ethClient evmclient.Client,
keyStore keystore.Eth,
config evmconfig.ChainScopedConfig,
checkerFactory txmgr.EvmTransmitCheckerFactory,
checkerFactory txmgr.TransmitCheckerFactory,
nonceAutoSync bool,
) (*txmgr.EvmBroadcaster, error) {
) (*txmgr.Broadcaster, error) {
t.Helper()
eventBroadcaster := cltest.NewEventBroadcaster(t, config.Database().URL())
err := eventBroadcaster.Start(testutils.Context(t.(*testing.T)))
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {
nonce := evmtypes.Nonce(342)
errStr := "some error"

etxUnconfirmed := txmgr.EvmTx{
etxUnconfirmed := txmgr.Tx{
Sequence: &nonce,
FromAddress: fromAddress,
ToAddress: toAddress,
Expand All @@ -193,7 +193,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {
Error: null.String{},
State: txmgrcommon.TxUnconfirmed,
}
etxWithError := txmgr.EvmTx{
etxWithError := txmgr.Tx{
Sequence: nil,
FromAddress: fromAddress,
ToAddress: toAddress,
Expand All @@ -214,7 +214,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {

t.Run("sends 3 EthTxs in order with higher value last, and lower values starting from the earliest", func(t *testing.T) {
// Higher value
expensiveEthTx := txmgr.EvmTx{
expensiveEthTx := txmgr.Tx{
FromAddress: fromAddress,
ToAddress: toAddress,
EncodedPayload: []byte{42, 42, 0},
Expand All @@ -229,10 +229,10 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {

// Earlier
tr := int32(99)
b, err := json.Marshal(txmgr.EvmTxMeta{JobID: &tr})
b, err := json.Marshal(txmgr.TxMeta{JobID: &tr})
require.NoError(t, err)
meta := datatypes.JSON(b)
earlierEthTx := txmgr.EvmTx{
earlierEthTx := txmgr.Tx{
FromAddress: fromAddress,
ToAddress: toAddress,
EncodedPayload: []byte{42, 42, 0},
Expand All @@ -256,7 +256,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {
}), fromAddress).Return(clienttypes.Successful, nil).Once()

// Later
laterEthTx := txmgr.EvmTx{
laterEthTx := txmgr.Tx{
FromAddress: fromAddress,
ToAddress: toAddress,
EncodedPayload: []byte{42, 42, 1},
Expand Down Expand Up @@ -300,7 +300,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {
assert.NotNil(t, earlierTransaction.BroadcastAt)
assert.NotNil(t, earlierTransaction.InitialBroadcastAt)
assert.Len(t, earlierTransaction.TxAttempts, 1)
var m txmgr.EvmTxMeta
var m txmgr.TxMeta
err = json.Unmarshal(*earlierEthTx.Meta, &m)
require.NoError(t, err)
assert.NotNil(t, m.JobID)
Expand Down Expand Up @@ -395,7 +395,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success(t *testing.T) {

t.Run("transaction simulation", func(t *testing.T) {
t.Run("when simulation succeeds, sends tx as normal", func(t *testing.T) {
txRequest := txmgr.EvmTxRequest{
txRequest := txmgr.TxRequest{
FromAddress: fromAddress,
ToAddress: toAddress,
EncodedPayload: []byte{42, 0, 0},
Expand Down Expand Up @@ -656,7 +656,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Success_WithMultiplier(t *testing
return true
}), fromAddress).Return(clienttypes.Successful, nil).Once()

txRequest := txmgr.EvmTxRequest{
txRequest := txmgr.TxRequest{
FromAddress: fromAddress,
ToAddress: gethCommon.HexToAddress("0x6C03DDA95a2AEd917EeCc6eddD4b9D16E6380411"),
EncodedPayload: []byte{42, 42, 0},
Expand Down Expand Up @@ -692,7 +692,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_ResumingFromCrash(t *testing.T) {
ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth()
_, fromAddress := cltest.MustInsertRandomKeyReturningState(t, ethKeyStore, nextNonce)

firstInProgress := txmgr.EvmTx{
firstInProgress := txmgr.Tx{
FromAddress: fromAddress,
Sequence: &firstNonce,
ToAddress: toAddress,
Expand All @@ -703,7 +703,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_ResumingFromCrash(t *testing.T) {
State: txmgrcommon.TxInProgress,
}

secondInProgress := txmgr.EvmTx{
secondInProgress := txmgr.Tx{
FromAddress: fromAddress,
Sequence: &secondNonce,
ToAddress: toAddress,
Expand Down Expand Up @@ -1018,7 +1018,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) {
// Check that the transaction was saved correctly with its attempt
// We assume success and hand off to eth confirmer to eventually mark it as failed
var latestID int64
var etx1 txmgr.EvmTx
var etx1 txmgr.Tx
require.NoError(t, db.Get(&latestID, "SELECT max(id) FROM eth_txes"))
etx1, err = txStore.FindTxWithAttempts(latestID)
require.NoError(t, err)
Expand Down Expand Up @@ -1077,7 +1077,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) {
t.Run("with callback", func(t *testing.T) {
run := cltest.MustInsertPipelineRun(t, db)
tr := cltest.MustInsertUnfinishedPipelineTaskRun(t, db, run.ID)
etx := txmgr.EvmTx{
etx := txmgr.Tx{
FromAddress: fromAddress,
ToAddress: toAddress,
EncodedPayload: encodedPayload,
Expand Down Expand Up @@ -1392,7 +1392,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) {
assert.Equal(t, "30 gwei", attempt.TxFee.Legacy.String())
})

etxUnfinished := txmgr.EvmTx{
etxUnfinished := txmgr.Tx{
FromAddress: fromAddress,
ToAddress: toAddress,
EncodedPayload: encodedPayload,
Expand Down Expand Up @@ -1892,8 +1892,8 @@ type testChecker struct {
func (t *testChecker) Check(
_ context.Context,
_ logger.Logger,
_ txmgr.EvmTx,
_ txmgr.EvmTxAttempt,
_ txmgr.Tx,
_ txmgr.TxAttempt,
) error {
return t.err
}
Loading

0 comments on commit 0a0a311

Please sign in to comment.