mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core/state: modify related testcase
create a obj before `set` operations be done
This commit is contained in:
parent
022b11eef6
commit
71cef7ad21
3 changed files with 6 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ func create() (*ManagedState, *account) {
|
||||||
db, _ := ethdb.NewMemDatabase()
|
db, _ := ethdb.NewMemDatabase()
|
||||||
statedb, _ := New(common.Hash{}, db)
|
statedb, _ := New(common.Hash{}, db)
|
||||||
ms := ManageState(statedb)
|
ms := ManageState(statedb)
|
||||||
|
ms.StateDB.createObject(addr)
|
||||||
ms.StateDB.SetNonce(addr, 100)
|
ms.StateDB.SetNonce(addr, 100)
|
||||||
ms.accounts[addr] = newAccount(ms.StateDB.getStateObject(addr))
|
ms.accounts[addr] = newAccount(ms.StateDB.getStateObject(addr))
|
||||||
return ms, ms.accounts[addr]
|
return ms, ms.accounts[addr]
|
||||||
|
|
@ -116,6 +117,7 @@ func TestSetNonce(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
addr[0] = 1
|
addr[0] = 1
|
||||||
|
ms.StateDB.createObject(addr)
|
||||||
ms.StateDB.SetNonce(addr, 1)
|
ms.StateDB.SetNonce(addr, 1)
|
||||||
|
|
||||||
if ms.GetNonce(addr) != 1 {
|
if ms.GetNonce(addr) != 1 {
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ func (s *StateSuite) TestSnapshot(c *checker.C) {
|
||||||
data1 := common.BytesToHash([]byte{42})
|
data1 := common.BytesToHash([]byte{42})
|
||||||
data2 := common.BytesToHash([]byte{43})
|
data2 := common.BytesToHash([]byte{43})
|
||||||
|
|
||||||
|
s.state.createObject(stateobjaddr)
|
||||||
// set initial state object value
|
// set initial state object value
|
||||||
s.state.SetState(stateobjaddr, storageaddr, data1)
|
s.state.SetState(stateobjaddr, storageaddr, data1)
|
||||||
// get snapshot of current state
|
// get snapshot of current state
|
||||||
|
|
@ -143,6 +144,8 @@ func TestSnapshot2(t *testing.T) {
|
||||||
|
|
||||||
stateobjaddr0 := toAddr([]byte("so0"))
|
stateobjaddr0 := toAddr([]byte("so0"))
|
||||||
stateobjaddr1 := toAddr([]byte("so1"))
|
stateobjaddr1 := toAddr([]byte("so1"))
|
||||||
|
state.createObject(stateobjaddr0)
|
||||||
|
state.createObject(stateobjaddr1)
|
||||||
var storageaddr common.Hash
|
var storageaddr common.Hash
|
||||||
|
|
||||||
data0 := common.BytesToHash([]byte{17})
|
data0 := common.BytesToHash([]byte{17})
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ func TestIntermediateLeaks(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSnapshotRandom(t *testing.T) {
|
func TestSnapshotRandom(t *testing.T) {
|
||||||
t.Skip("@fjl fix me please")
|
//t.Skip("@fjl fix me please")
|
||||||
config := &quick.Config{MaxCount: 1000}
|
config := &quick.Config{MaxCount: 1000}
|
||||||
err := quick.Check((*snapshotTest).run, config)
|
err := quick.Check((*snapshotTest).run, config)
|
||||||
if cerr, ok := err.(*quick.CheckError); ok {
|
if cerr, ok := err.(*quick.CheckError); ok {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue