@@ -25,7 +25,6 @@ import (
25
25
"testing"
26
26
"time"
27
27
28
- "github.com/ethereum/go-ethereum/core/rawdb"
29
28
"github.com/ethereum/go-ethereum/core/state"
30
29
"github.com/ethereum/go-ethereum/core/types"
31
30
"github.com/ethereum/go-ethereum/params"
@@ -109,7 +108,7 @@ func testPrecompiled(addr string, test precompiledTest, t *testing.T) {
109
108
vmctx := BlockContext {
110
109
Transfer : func (StateDB , common.Address , common.Address , * uint256.Int ) {},
111
110
}
112
- statedb , _ := state .New (types .EmptyRootHash , state .NewDatabase ( rawdb . NewMemoryDatabase ()), nil )
111
+ statedb , _ := state .New (types .EmptyRootHash , state .NewDatabaseForTesting () )
113
112
evm := NewEVM (vmctx , TxContext {}, statedb , params .AllEthashProtocolChanges , Config {})
114
113
t .Run (fmt .Sprintf ("%s-Gas=%d" , test .Name , gas ), func (t * testing.T ) {
115
114
if res , _ , err := RunPrecompiledContract (evm , p , in , gas , nil ); err != nil {
@@ -136,7 +135,7 @@ func testPrecompiledOOG(addr string, test precompiledTest, t *testing.T) {
136
135
vmctx := BlockContext {
137
136
Transfer : func (StateDB , common.Address , common.Address , * uint256.Int ) {},
138
137
}
139
- statedb , _ := state .New (types .EmptyRootHash , state .NewDatabase ( rawdb . NewMemoryDatabase ()), nil )
138
+ statedb , _ := state .New (types .EmptyRootHash , state .NewDatabaseForTesting () )
140
139
evm := NewEVM (vmctx , TxContext {}, statedb , params .AllEthashProtocolChanges , Config {})
141
140
142
141
t .Run (fmt .Sprintf ("%s-Gas=%d" , test .Name , gas ), func (t * testing.T ) {
@@ -160,7 +159,7 @@ func testPrecompiledFailure(addr string, test precompiledFailureTest, t *testing
160
159
vmctx := BlockContext {
161
160
Transfer : func (StateDB , common.Address , common.Address , * uint256.Int ) {},
162
161
}
163
- statedb , _ := state .New (types .EmptyRootHash , state .NewDatabase ( rawdb . NewMemoryDatabase ()), nil )
162
+ statedb , _ := state .New (types .EmptyRootHash , state .NewDatabaseForTesting () )
164
163
evm := NewEVM (vmctx , TxContext {}, statedb , params .AllEthashProtocolChanges , Config {})
165
164
166
165
t .Run (test .Name , func (t * testing.T ) {
@@ -198,7 +197,7 @@ func benchmarkPrecompiled(addr string, test precompiledTest, bench *testing.B) {
198
197
vmctx := BlockContext {
199
198
Transfer : func (StateDB , common.Address , common.Address , * uint256.Int ) {},
200
199
}
201
- statedb , _ := state .New (types .EmptyRootHash , state .NewDatabase ( rawdb . NewMemoryDatabase ()), nil )
200
+ statedb , _ := state .New (types .EmptyRootHash , state .NewDatabaseForTesting () )
202
201
evm := NewEVM (vmctx , TxContext {}, statedb , params .AllEthashProtocolChanges , Config {})
203
202
copy (data , in )
204
203
res , _ , err = RunPrecompiledContract (evm , p , data , reqGas , nil )
0 commit comments