Skip to content

Commit 6fd1328

Browse files
ceyonurDarioush Jalali
andauthored
Coreth nits (#1336)
* ensure blob gas is zero in cancun * txlookup limit cleanup * use full faker * use full faker in api tests --------- Co-authored-by: Darioush Jalali <[email protected]>
1 parent 400862c commit 6fd1328

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

consensus/dummy/consensus.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ func (eng *DummyEngine) verifyHeader(chain consensus.ChainHeaderReader, header *
262262
if err := eip4844.VerifyEIP4844Header(parent, header); err != nil {
263263
return err
264264
}
265+
if *header.BlobGasUsed > 0 { // VerifyEIP4844Header ensures BlobGasUsed is non-nil
266+
return fmt.Errorf("blobs not enabled on avalanche networks: used %d blob gas, expected 0", *header.BlobGasUsed)
267+
}
265268
}
266269
return nil
267270
}

core/state_processor_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ func TestStateProcessorErrors(t *testing.T) {
121121
},
122122
GasLimit: params.TestChainConfig.FeeConfig.GasLimit.Uint64(),
123123
}
124-
blockchain, _ = NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewCoinbaseFaker(), vm.Config{}, common.Hash{}, false)
124+
// FullFaker used to skip header verification that enforces no blobs.
125+
blockchain, _ = NewBlockChain(db, DefaultCacheConfig, gspec, dummy.NewFullFaker(), vm.Config{}, common.Hash{}, false)
125126
tooBigInitCode = [params.MaxInitCodeSize + 1]byte{}
126127
)
127128

eth/ethconfig/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ type Config struct {
171171

172172
// SkipTxIndexing skips indexing transactions.
173173
// This is useful for validators that don't need to index transactions.
174-
// TxLookupLimit can be still used to control unindexing old transactions.
174+
// TransactionHistory can be still used to control unindexing old transactions.
175175
SkipTxIndexing bool
176176
}

internal/ethapi/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Ha
18191819
txHashes = make([]common.Hash, genBlocks)
18201820
)
18211821

1822-
backend := newTestBackend(t, genBlocks, genesis, dummy.NewCoinbaseFaker(), func(i int, b *core.BlockGen) {
1822+
backend := newTestBackend(t, genBlocks, genesis, dummy.NewFullFaker(), func(i int, b *core.BlockGen) {
18231823
var (
18241824
tx *types.Transaction
18251825
err error

plugin/evm/config_test.go

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,39 @@ func TestUnmarshalConfig(t *testing.T) {
7272
false,
7373
},
7474
{
75-
"empty tx lookup limit",
75+
"empty transaction history ",
7676
[]byte(`{}`),
77-
Config{TxLookupLimit: 0},
77+
Config{TransactionHistory: 0},
7878
false,
7979
},
8080
{
81-
"zero tx lookup limit",
82-
[]byte(`{"tx-lookup-limit": 0}`),
81+
"zero transaction history",
82+
[]byte(`{"transaction-history": 0}`),
8383
func() Config {
84-
return Config{TxLookupLimit: 0}
84+
return Config{TransactionHistory: 0}
8585
}(),
8686
false,
8787
},
8888
{
89-
"1 tx lookup limit",
90-
[]byte(`{"tx-lookup-limit": 1}`),
89+
"1 transaction history",
90+
[]byte(`{"transaction-history": 1}`),
9191
func() Config {
92-
return Config{TxLookupLimit: 1}
92+
return Config{TransactionHistory: 1}
9393
}(),
9494
false,
9595
},
9696
{
97-
"-1 tx lookup limit",
98-
[]byte(`{"tx-lookup-limit": -1}`),
97+
"-1 transaction history",
98+
[]byte(`{"transaction-history": -1}`),
9999
Config{},
100100
true,
101101
},
102+
{
103+
"deprecated tx lookup limit",
104+
[]byte(`{"tx-lookup-limit": 1}`),
105+
Config{TransactionHistory: 1, TxLookupLimit: 1},
106+
false,
107+
},
102108
{
103109
"allow unprotected tx hashes",
104110
[]byte(`{"allow-unprotected-tx-hashes": ["0x803351deb6d745e91545a6a3e1c0ea3e9a6a02a1a4193b70edfcd2f40f71a01c"]}`),
@@ -115,6 +121,7 @@ func TestUnmarshalConfig(t *testing.T) {
115121
assert.Error(t, err)
116122
} else {
117123
assert.NoError(t, err)
124+
tmp.Deprecate()
118125
assert.Equal(t, tt.expected, tmp)
119126
}
120127
})

0 commit comments

Comments
 (0)