|
@@ -25,6 +25,7 @@ import (
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
|
+ "github.com/ethereum/go-ethereum/core/state"
|
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
|
"github.com/ethereum/go-ethereum/core/vm"
|
|
|
"github.com/ethereum/go-ethereum/params"
|
|
"github.com/ethereum/go-ethereum/params"
|
|
|
)
|
|
)
|
|
@@ -43,8 +44,14 @@ func (account) ReturnGas(*big.Int) {}
|
|
|
func (account) SetCode(common.Hash, []byte) {}
|
|
func (account) SetCode(common.Hash, []byte) {}
|
|
|
func (account) ForEachStorage(cb func(key, value common.Hash) bool) {}
|
|
func (account) ForEachStorage(cb func(key, value common.Hash) bool) {}
|
|
|
|
|
|
|
|
|
|
+type dummyStatedb struct {
|
|
|
|
|
+ state.StateDB
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (dummyStatedb) GetRefund() uint64 { return 1337 }
|
|
|
|
|
+
|
|
|
func runTrace(tracer *Tracer) (json.RawMessage, error) {
|
|
func runTrace(tracer *Tracer) (json.RawMessage, error) {
|
|
|
- env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, nil, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
|
|
|
|
|
|
|
+ env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
|
|
|
|
|
|
|
|
contract := vm.NewContract(account{}, account{}, big.NewInt(0), 10000)
|
|
contract := vm.NewContract(account{}, account{}, big.NewInt(0), 10000)
|
|
|
contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0}
|
|
contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0}
|
|
@@ -126,7 +133,7 @@ func TestHaltBetweenSteps(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, nil, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
|
|
|
|
|
|
|
+ env := vm.NewEVM(vm.Context{BlockNumber: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
|
|
|
contract := vm.NewContract(&account{}, &account{}, big.NewInt(0), 0)
|
|
contract := vm.NewContract(&account{}, &account{}, big.NewInt(0), 0)
|
|
|
|
|
|
|
|
tracer.CaptureState(env, 0, 0, 0, 0, nil, nil, contract, 0, nil)
|
|
tracer.CaptureState(env, 0, 0, 0, 0, nil, nil, contract, 0, nil)
|