mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
fix(test): fix TestStoreCapture (#711)
This commit is contained in:
parent
b078aca5f6
commit
675d81b417
1 changed files with 10 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
|
|
@ -52,10 +53,18 @@ func (*dummyStatedb) GetRefund() uint64 {
|
|||
func (*dummyStatedb) GetState(_ common.Address, _ common.Hash) common.Hash { return common.Hash{} }
|
||||
func (*dummyStatedb) SetState(_ common.Address, _ common.Hash, _ common.Hash) {}
|
||||
|
||||
// newTestStateDB create a sample test state to test node-wise reconstruction.
|
||||
func newTestStateDB() *state.StateDB {
|
||||
// Create an empty state
|
||||
db := state.NewDatabase(rawdb.NewMemoryDatabase())
|
||||
stateDb, _ := state.New(common.Hash{}, db, nil)
|
||||
return stateDb
|
||||
}
|
||||
|
||||
func TestStoreCapture(t *testing.T) {
|
||||
var (
|
||||
logger = NewStructLogger(nil)
|
||||
env = vm.NewEVM(vm.BlockContext{}, vm.TxContext{}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Tracer: logger})
|
||||
env = vm.NewEVM(vm.BlockContext{}, vm.TxContext{}, newTestStateDB(), params.TestChainConfig, vm.Config{Tracer: logger})
|
||||
contract = vm.NewContract(&dummyContractRef{}, &dummyContractRef{}, new(big.Int), 100000)
|
||||
)
|
||||
contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x0, byte(vm.SSTORE)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue