Skip to content

Commit

Permalink
Ignore tx type 126 for celo (#14875)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
finleydecker and amit-momin authored Oct 24, 2024
1 parent a7e245a commit 101fbbc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-sloths-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#updated ignoring tx type 126 on celo
14 changes: 9 additions & 5 deletions core/chains/evm/gas/block_history_estimator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/gas/chain_specific.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 101fbbc

Please sign in to comment.