@@ -77,7 +77,7 @@ func TestProcessor(t *testing.T) {
7777
7878 // Each set of params is effectively a test case, but they are all run on
7979 // the same [Processor].
80- params := []blockParams {
80+ tests := []blockParams {
8181 {
8282 numTxs : 0 ,
8383 },
@@ -108,39 +108,40 @@ func TestProcessor(t *testing.T) {
108108
109109 rng := rand .New (rand .NewPCG (0 , 0 )) //nolint:gosec // Reproducibility is useful for testing
110110 for range 100 {
111- params = append (params , blockParams {
111+ tests = append (tests , blockParams {
112112 numTxs : rng .IntN (1000 ),
113113 sendToAddrEvery : 1 + rng .IntN (30 ),
114114 sufficientGasEvery : 1 + rng .IntN (30 ),
115115 })
116116 }
117117
118- for _ , tc := range params {
118+ for _ , tt := range tests {
119119 t .Run ("" , func (t * testing.T ) {
120- t .Logf ("%+v" , tc )
120+ t .Logf ("%+v" , tt )
121121
122- txs := make (types.Transactions , tc .numTxs )
123- wantProcessed := make ([]bool , tc .numTxs )
122+ var rules params.Rules
123+ txs := make (types.Transactions , tt .numTxs )
124+ wantProcessed := make ([]bool , tt .numTxs )
124125 for i := range len (txs ) {
125126 var (
126127 to common.Address
127128 extraGas uint64
128129 )
129130
130131 wantProcessed [i ] = true
131- if i % tc .sendToAddrEvery == 0 {
132+ if i % tt .sendToAddrEvery == 0 {
132133 to = handler .addr
133134 } else {
134135 wantProcessed [i ] = false
135136 }
136- if i % tc .sufficientGasEvery == 0 {
137+ if i % tt .sufficientGasEvery == 0 {
137138 extraGas = handler .gas
138139 } else {
139140 wantProcessed [i ] = false
140141 }
141142
142143 data := binary .BigEndian .AppendUint64 (nil , uint64 (i ))
143- gas , err := core .IntrinsicGas (data , nil , false , true , true , true )
144+ gas , err := core .IntrinsicGas (data , nil , false , rules . IsHomestead , rules . IsIstanbul , rules . IsShanghai )
144145 require .NoError (t , err , "core.IntrinsicGas(%#x, nil, false, true, true, true)" , data )
145146
146147 txs [i ] = types .NewTx (& types.LegacyTx {
@@ -151,7 +152,7 @@ func TestProcessor(t *testing.T) {
151152 }
152153
153154 block := types .NewBlock (& types.Header {}, txs , nil , nil , trie .NewStackTrie (nil ))
154- require .NoError (t , p .StartBlock (block ), "BeforeBlock ()" )
155+ require .NoError (t , p .StartBlock (block , rules ), "StartBlock ()" )
155156 defer p .FinishBlock (block )
156157
157158 for i , tx := range txs {
@@ -285,7 +286,8 @@ func TestIntegration(t *testing.T) {
285286 }
286287
287288 block := types .NewBlock (& types.Header {}, txs , nil , nil , trie .NewStackTrie (nil ))
288- require .NoError (t , sut .StartBlock (block ), "StartBlock()" )
289+ rules := evm .ChainConfig ().Rules (block .Number (), true , block .Time ())
290+ require .NoError (t , sut .StartBlock (block , rules ), "StartBlock()" )
289291 defer sut .FinishBlock (block )
290292
291293 pool := core .GasPool (math .MaxUint64 )
0 commit comments