@ -116,7 +116,7 @@ func testTwoOperandOp(t *testing.T, tests []TwoOperandTestcase, opFn executionFu
expected := new ( uint256 . Int ) . SetBytes ( common . Hex2Bytes ( test . Expected ) )
stack . push ( x )
stack . push ( y )
opFn ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil } )
opFn ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil , 0 , nil , false } )
if len ( stack . data ) != 1 {
t . Errorf ( "Expected one item on stack after %v, got %d: " , name , len ( stack . data ) )
}
@ -231,7 +231,7 @@ func TestAddMod(t *testing.T) {
stack . push ( z )
stack . push ( y )
stack . push ( x )
opAddmod ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil } )
opAddmod ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil , 0 , nil , false } )
actual := stack . pop ( )
if actual . Cmp ( expected ) != 0 {
t . Errorf ( "Testcase %d, expected %x, got %x" , i , expected , actual )
@ -258,7 +258,7 @@ func TestWriteExpectedValues(t *testing.T) {
y := new ( uint256 . Int ) . SetBytes ( common . Hex2Bytes ( param . y ) )
stack . push ( x )
stack . push ( y )
opFn ( & pc , interpreter , & ScopeContext { nil , stack , nil } )
opFn ( & pc , interpreter , & ScopeContext { nil , stack , nil , 0 , nil , false } )
actual := stack . pop ( )
result [ i ] = TwoOperandTestcase { param . x , param . y , fmt . Sprintf ( "%064x" , actual ) }
}
@ -294,7 +294,7 @@ func opBenchmark(bench *testing.B, op executionFunc, args ...string) {
var (
env = NewEVM ( BlockContext { } , TxContext { } , nil , params . TestChainConfig , Config { } )
stack = newstack ( )
scope = & ScopeContext { nil , stack , nil }
scope = & ScopeContext { nil , stack , nil , 0 , nil , false }
evmInterpreter = NewEVMInterpreter ( env )
)
@ -545,13 +545,13 @@ func TestOpMstore(t *testing.T) {
v := "abcdef00000000000000abba000000000deaf000000c0de00100000000133700"
stack . push ( new ( uint256 . Int ) . SetBytes ( common . Hex2Bytes ( v ) ) )
stack . push ( new ( uint256 . Int ) )
opMstore ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil } )
opMstore ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil , 0 , nil , false } )
if got := common . Bytes2Hex ( mem . GetCopy ( 0 , 32 ) ) ; got != v {
t . Fatalf ( "Mstore fail, got %v, expected %v" , got , v )
}
stack . push ( new ( uint256 . Int ) . SetUint64 ( 0x1 ) )
stack . push ( new ( uint256 . Int ) )
opMstore ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil } )
opMstore ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil , 0 , nil , false } )
if common . Bytes2Hex ( mem . GetCopy ( 0 , 32 ) ) != "0000000000000000000000000000000000000000000000000000000000000001" {
t . Fatalf ( "Mstore failed to overwrite previous value" )
}
@ -575,7 +575,7 @@ func BenchmarkOpMstore(bench *testing.B) {
for i := 0 ; i < bench . N ; i ++ {
stack . push ( value )
stack . push ( memStart )
opMstore ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil } )
opMstore ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil , 0 , nil , false } )
}
}
@ -590,7 +590,7 @@ func TestOpTstore(t *testing.T) {
to = common . Address { 1 }
contractRef = contractRef { caller }
contract = NewContract ( contractRef , AccountRef ( to ) , new ( uint256 . Int ) , 0 )
scopeContext = ScopeContext { mem , stack , contract }
scopeContext = ScopeContext { mem , stack , contract , 0 , nil , false }
value = common . Hex2Bytes ( "abcdef00000000000000abba000000000deaf000000c0de00100000000133700" )
)
@ -638,7 +638,7 @@ func BenchmarkOpKeccak256(bench *testing.B) {
for i := 0 ; i < bench . N ; i ++ {
stack . push ( uint256 . NewInt ( 32 ) )
stack . push ( start )
opKeccak256 ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil } )
opKeccak256 ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil , 0 , nil , false } )
}
}
@ -705,7 +705,7 @@ func TestCreate2Addresses(t *testing.T) {
stack . push ( big . NewInt ( int64 ( len ( code ) ) ) ) //size
stack . push ( big . NewInt ( 0 ) ) // memstart
stack . push ( big . NewInt ( 0 ) ) // value
gas , _ := gasCreate2 ( params . GasTable { } , nil , nil , stack , nil , 0 )
gas , _ := gasCreate2 ( params . GasTable { } , nil , nil , stack , nil , 0 , nil , false , 0 )
fmt . Printf ( "Example %d\n* address `0x%x`\n* salt `0x%x`\n* init_code `0x%x`\n* gas (assuming no mem expansion): `%v`\n* result: `%s`\n\n" , i , origin , salt , code , gas , address . String ( ) )
* /
expected := common . BytesToAddress ( common . FromHex ( tt . expected ) )
@ -733,7 +733,7 @@ func TestRandom(t *testing.T) {
pc = uint64 ( 0 )
evmInterpreter = env . interpreter
)
opRandom ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil } )
opRandom ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil , 0 , nil , false } )
if len ( stack . data ) != 1 {
t . Errorf ( "Expected one item on stack after %v, got %d: " , tt . name , len ( stack . data ) )
}
@ -775,7 +775,7 @@ func TestBlobHash(t *testing.T) {
evmInterpreter = env . interpreter
)
stack . push ( uint256 . NewInt ( tt . idx ) )
opBlobHash ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil } )
opBlobHash ( & pc , evmInterpreter , & ScopeContext { nil , stack , nil , 0 , nil , false } )
if len ( stack . data ) != 1 {
t . Errorf ( "Expected one item on stack after %v, got %d: " , tt . name , len ( stack . data ) )
}
@ -916,7 +916,7 @@ func TestOpMCopy(t *testing.T) {
mem . Resize ( memorySize )
}
// Do the copy
opMcopy ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil } )
opMcopy ( & pc , evmInterpreter , & ScopeContext { mem , stack , nil , 0 , nil , false } )
want := common . FromHex ( strings . ReplaceAll ( tc . want , " " , "" ) )
if have := mem . store ; ! bytes . Equal ( want , have ) {
t . Errorf ( "case %d: \nwant: %#x\nhave: %#x\n" , i , want , have )