From 101fbbc75a76893d2ebe0c24fa61773876007d76 Mon Sep 17 00:00:00 2001 From: Finley Decker Date: Wed, 23 Oct 2024 23:44:17 -1000 Subject: [PATCH] Ignore tx type 126 for celo (#14875) * ignore tx type 126 for celo * add changeset * Update .changeset/few-sloths-explain.md Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com> * added 0x7e to tx type tests for celo * fix linting issues * update celo bhe test * update celo bhe test * remove uncessary booleans in BHE celo test * change 0x7e tx to switch statement * linting * add default case * ignore 0x7e for celo --------- Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com> --- .changeset/few-sloths-explain.md | 5 +++++ .../chains/evm/gas/block_history_estimator_test.go | 14 +++++++++----- core/chains/evm/gas/chain_specific.go | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .changeset/few-sloths-explain.md diff --git a/.changeset/few-sloths-explain.md b/.changeset/few-sloths-explain.md new file mode 100644 index 00000000000..78efd6cc7f3 --- /dev/null +++ b/.changeset/few-sloths-explain.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#updated ignoring tx type 126 on celo diff --git a/core/chains/evm/gas/block_history_estimator_test.go b/core/chains/evm/gas/block_history_estimator_test.go index de698fc9a08..384825c3a2c 100644 --- a/core/chains/evm/gas/block_history_estimator_test.go +++ b/core/chains/evm/gas/block_history_estimator_test.go @@ -1433,15 +1433,19 @@ func TestBlockHistoryEstimator_IsUsable(t *testing.T) { assert.Equal(t, true, bhe.IsUsable(tx, block, defaultChainType, geCfg.PriceMin(), logger.Test(t))) }) - t.Run("returns false if transaction is of type 0x7c or 0x7b only on Celo", func(t *testing.T) { + t.Run("returns false if transaction is of type 0x7c, 0x7b, or 0x7e only on Celo", func(t *testing.T) { tx := evmtypes.Transaction{Type: 0x7c, GasPrice: assets.NewWeiI(10), GasLimit: 42, Hash: utils.NewHash()} - assert.Equal(t, false, bhe.IsUsable(tx, block, chaintype.ChainCelo, geCfg.PriceMin(), logger.Test(t))) + assert.False(t, bhe.IsUsable(tx, block, chaintype.ChainCelo, geCfg.PriceMin(), logger.Test(t))) tx2 := evmtypes.Transaction{Type: 0x7b, GasPrice: assets.NewWeiI(10), GasLimit: 42, Hash: utils.NewHash()} - assert.Equal(t, false, bhe.IsUsable(tx2, block, chaintype.ChainCelo, geCfg.PriceMin(), logger.Test(t))) + assert.False(t, bhe.IsUsable(tx2, block, chaintype.ChainCelo, geCfg.PriceMin(), logger.Test(t))) - assert.Equal(t, true, bhe.IsUsable(tx, block, defaultChainType, geCfg.PriceMin(), logger.Test(t))) - assert.Equal(t, true, bhe.IsUsable(tx2, block, defaultChainType, geCfg.PriceMin(), logger.Test(t))) + tx3 := evmtypes.Transaction{Type: 0x7e, GasPrice: assets.NewWeiI(10), GasLimit: 42, Hash: utils.NewHash()} + assert.False(t, bhe.IsUsable(tx2, block, chaintype.ChainCelo, geCfg.PriceMin(), logger.Test(t))) + + assert.True(t, bhe.IsUsable(tx, block, defaultChainType, geCfg.PriceMin(), logger.Test(t))) + assert.True(t, bhe.IsUsable(tx2, block, defaultChainType, geCfg.PriceMin(), logger.Test(t))) + assert.True(t, bhe.IsUsable(tx3, block, defaultChainType, geCfg.PriceMin(), logger.Test(t))) }) t.Run("returns false if transaction is of type 0x16 only on WeMix", func(t *testing.T) { diff --git a/core/chains/evm/gas/chain_specific.go b/core/chains/evm/gas/chain_specific.go index d1add00758b..a647f2ad272 100644 --- a/core/chains/evm/gas/chain_specific.go +++ b/core/chains/evm/gas/chain_specific.go @@ -31,7 +31,7 @@ func chainSpecificIsUsable(tx evmtypes.Transaction, baseFee *assets.Wei, chainTy } if chainType == chaintype.ChainCelo { // Celo specific transaction types that utilize the feeCurrency field. - if tx.Type == 0x7c || tx.Type == 0x7b { + if tx.Type == 0x7c || tx.Type == 0x7b || tx.Type == 0x7e { return false } // Celo has not yet fully migrated to the 0x7c type for special feeCurrency transactions