@ -122,12 +122,7 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
}
}
// Configure a blockchain with the given prestate
// Configure a blockchain with the given prestate
var (
var (
signer = types . MakeSigner ( test . Genesis . Config , new ( big . Int ) . SetUint64 ( uint64 ( test . Context . Number ) ) , uint64 ( test . Context . Time ) )
signer = types . MakeSigner ( test . Genesis . Config , new ( big . Int ) . SetUint64 ( uint64 ( test . Context . Number ) ) , uint64 ( test . Context . Time ) )
origin , _ = signer . Sender ( tx )
txContext = vm . TxContext {
Origin : origin ,
GasPrice : tx . GasPrice ( ) ,
}
context = vm . BlockContext {
context = vm . BlockContext {
CanTransfer : core . CanTransfer ,
CanTransfer : core . CanTransfer ,
Transfer : core . Transfer ,
Transfer : core . Transfer ,
@ -146,11 +141,11 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
if err != nil {
if err != nil {
t . Fatalf ( "failed to create call tracer: %v" , err )
t . Fatalf ( "failed to create call tracer: %v" , err )
}
}
evm := vm . NewEVM ( context , txContext , statedb , test . Genesis . Config , vm . Config { Tracer : tracer } )
msg , err := core . TransactionToMessage ( tx , signer , context . BaseFee )
msg , err := core . TransactionToMessage ( tx , signer , nil )
if err != nil {
if err != nil {
t . Fatalf ( "failed to prepare transaction for tracing: %v" , err )
t . Fatalf ( "failed to prepare transaction for tracing: %v" , err )
}
}
evm := vm . NewEVM ( context , core . NewEVMTxContext ( msg ) , statedb , test . Genesis . Config , vm . Config { Tracer : tracer } )
vmRet , err := core . ApplyMessage ( evm , msg , new ( core . GasPool ) . AddGas ( tx . Gas ( ) ) )
vmRet , err := core . ApplyMessage ( evm , msg , new ( core . GasPool ) . AddGas ( tx . Gas ( ) ) )
if err != nil {
if err != nil {
t . Fatalf ( "failed to execute transaction: %v" , err )
t . Fatalf ( "failed to execute transaction: %v" , err )
@ -222,10 +217,6 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
b . Fatalf ( "failed to parse testcase input: %v" , err )
b . Fatalf ( "failed to parse testcase input: %v" , err )
}
}
signer := types . MakeSigner ( test . Genesis . Config , new ( big . Int ) . SetUint64 ( uint64 ( test . Context . Number ) ) , uint64 ( test . Context . Time ) )
signer := types . MakeSigner ( test . Genesis . Config , new ( big . Int ) . SetUint64 ( uint64 ( test . Context . Number ) ) , uint64 ( test . Context . Time ) )
msg , err := core . TransactionToMessage ( tx , signer , nil )
if err != nil {
b . Fatalf ( "failed to prepare transaction for tracing: %v" , err )
}
origin , _ := signer . Sender ( tx )
origin , _ := signer . Sender ( tx )
txContext := vm . TxContext {
txContext := vm . TxContext {
Origin : origin ,
Origin : origin ,
@ -240,6 +231,10 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
Difficulty : ( * big . Int ) ( test . Context . Difficulty ) ,
Difficulty : ( * big . Int ) ( test . Context . Difficulty ) ,
GasLimit : uint64 ( test . Context . GasLimit ) ,
GasLimit : uint64 ( test . Context . GasLimit ) ,
}
}
msg , err := core . TransactionToMessage ( tx , signer , context . BaseFee )
if err != nil {
b . Fatalf ( "failed to prepare transaction for tracing: %v" , err )
}
triedb , _ , statedb := tests . MakePreState ( rawdb . NewMemoryDatabase ( ) , test . Genesis . Alloc , false , rawdb . HashScheme )
triedb , _ , statedb := tests . MakePreState ( rawdb . NewMemoryDatabase ( ) , test . Genesis . Alloc , false , rawdb . HashScheme )
defer triedb . Close ( )
defer triedb . Close ( )