mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Pass ovm_test.go
This commit is contained in:
parent
e78aecbf1f
commit
a3a9d1d632
2 changed files with 5 additions and 2 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue