diff --git a/core/vm/instructions.go b/core/vm/instructions.go index a7622f4876..96f5910b9b 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -19,6 +19,7 @@ package vm import ( "bytes" "errors" + "fmt" "math/big" "github.com/ethereum/go-ethereum/common" @@ -776,12 +777,14 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory if bytes.Equal(toAddr.Bytes(), OvmContractAddress) && bytes.Equal(args[0:4], OvmSLOADMethodId) { loc := common.BytesToHash(args[4:36]) val := interpreter.evm.StateDB.GetState(contract.Address(), loc) + fmt.Printf("SLOAD %x\n", loc) memory.Set(retOffset.Uint64(), retSize.Uint64(), val.Bytes()) stack.push(interpreter.intPool.get().SetUint64(1)) return val.Bytes(), nil } else if bytes.Equal(toAddr.Bytes(), OvmContractAddress) && bytes.Equal(args[0:4], OvmSSTOREMethodId) { loc := common.BytesToHash(args[4:36]) val := common.BytesToHash(args[36:68]) + fmt.Printf("SSTORE %x %x\n", loc, val) interpreter.evm.StateDB.SetState(contract.Address(), loc, val) interpreter.intPool.put(val.Big()) stack.push(interpreter.intPool.get().SetUint64(1)) diff --git a/tests/ovm_test.go b/tests/ovm_test.go index df3bdfde37..c271611c39 100644 --- a/tests/ovm_test.go +++ b/tests/ovm_test.go @@ -86,8 +86,8 @@ func TestOvm(t *testing.T) { t.Fatal("didn't expect error", err) } - if !bytes.Equal(returnValue, VALUE) { - t.Errorf("Expected %020x; got %020x", returnValue, VALUE) + if !bytes.Equal(common.BigToHash(common.Big1).Bytes(), returnValue) { + t.Errorf("Expected %020x; got %020x", common.BigToHash(common.Big1).Bytes(), returnValue) } }