@@ -39,7 +39,7 @@ import (
39
39
func TestUpdateLeaks (t * testing.T ) {
40
40
// Create an empty state database
41
41
db := rawdb .NewMemoryDatabase ()
42
- state , _ := New (common. Hash {} , NewDatabase (db ), nil )
42
+ state , _ := New (types . EmptyRootHash , NewDatabase (db ), nil )
43
43
44
44
// Update it with some accounts
45
45
for i := byte (0 ); i < 255 ; i ++ {
@@ -73,8 +73,8 @@ func TestIntermediateLeaks(t *testing.T) {
73
73
// Create two state databases, one transitioning to the final state, the other final from the beginning
74
74
transDb := rawdb .NewMemoryDatabase ()
75
75
finalDb := rawdb .NewMemoryDatabase ()
76
- transState , _ := New (common. Hash {} , NewDatabase (transDb ), nil )
77
- finalState , _ := New (common. Hash {} , NewDatabase (finalDb ), nil )
76
+ transState , _ := New (types . EmptyRootHash , NewDatabase (transDb ), nil )
77
+ finalState , _ := New (types . EmptyRootHash , NewDatabase (finalDb ), nil )
78
78
79
79
modify := func (state * StateDB , addr common.Address , i , tweak byte ) {
80
80
state .SetBalance (addr , big .NewInt (int64 (11 * i )+ int64 (tweak )))
@@ -149,7 +149,7 @@ func TestIntermediateLeaks(t *testing.T) {
149
149
// https://github.com/ethereum/go-ethereum/pull/15549.
150
150
func TestCopy (t * testing.T ) {
151
151
// Create a random state test to copy and modify "independently"
152
- orig , _ := New (common. Hash {} , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
152
+ orig , _ := New (types . EmptyRootHash , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
153
153
154
154
for i := byte (0 ); i < 255 ; i ++ {
155
155
obj := orig .GetOrNewStateObject (common .BytesToAddress ([]byte {i }))
@@ -409,7 +409,7 @@ func (test *snapshotTest) String() string {
409
409
func (test * snapshotTest ) run () bool {
410
410
// Run all actions and create snapshots.
411
411
var (
412
- state , _ = New (common. Hash {} , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
412
+ state , _ = New (types . EmptyRootHash , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
413
413
snapshotRevs = make ([]int , len (test .snapshots ))
414
414
sindex = 0
415
415
)
@@ -423,7 +423,7 @@ func (test *snapshotTest) run() bool {
423
423
// Revert all snapshots in reverse order. Each revert must yield a state
424
424
// that is equivalent to fresh state with all actions up the snapshot applied.
425
425
for sindex -- ; sindex >= 0 ; sindex -- {
426
- checkstate , _ := New (common. Hash {} , state .Database (), nil )
426
+ checkstate , _ := New (types . EmptyRootHash , state .Database (), nil )
427
427
for _ , action := range test .actions [:test .snapshots [sindex ]] {
428
428
action .fn (action , checkstate )
429
429
}
@@ -501,7 +501,7 @@ func TestTouchDelete(t *testing.T) {
501
501
// TestCopyOfCopy tests that modified objects are carried over to the copy, and the copy of the copy.
502
502
// See https://github.com/ethereum/go-ethereum/pull/15225#issuecomment-380191512
503
503
func TestCopyOfCopy (t * testing.T ) {
504
- state , _ := New (common. Hash {} , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
504
+ state , _ := New (types . EmptyRootHash , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
505
505
addr := common .HexToAddress ("aaaa" )
506
506
state .SetBalance (addr , big .NewInt (42 ))
507
507
@@ -518,7 +518,7 @@ func TestCopyOfCopy(t *testing.T) {
518
518
//
519
519
// See https://github.com/ethereum/go-ethereum/issues/20106.
520
520
func TestCopyCommitCopy (t * testing.T ) {
521
- state , _ := New (common. Hash {} , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
521
+ state , _ := New (types . EmptyRootHash , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
522
522
523
523
// Create an account and check if the retrieved balance is correct
524
524
addr := common .HexToAddress ("0xaffeaffeaffeaffeaffeaffeaffeaffeaffeaffe" )
@@ -590,7 +590,7 @@ func TestCopyCommitCopy(t *testing.T) {
590
590
//
591
591
// See https://github.com/ethereum/go-ethereum/issues/20106.
592
592
func TestCopyCopyCommitCopy (t * testing.T ) {
593
- state , _ := New (common. Hash {} , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
593
+ state , _ := New (types . EmptyRootHash , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
594
594
595
595
// Create an account and check if the retrieved balance is correct
596
596
addr := common .HexToAddress ("0xaffeaffeaffeaffeaffeaffeaffeaffeaffeaffe" )
@@ -680,7 +680,7 @@ func TestCopyCopyCommitCopy(t *testing.T) {
680
680
// first, but the journal wiped the entire state object on create-revert.
681
681
func TestDeleteCreateRevert (t * testing.T ) {
682
682
// Create an initial state with a single contract
683
- state , _ := New (common. Hash {} , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
683
+ state , _ := New (types . EmptyRootHash , NewDatabase (rawdb .NewMemoryDatabase ()), nil )
684
684
685
685
addr := common .BytesToAddress ([]byte ("so" ))
686
686
state .SetBalance (addr , big .NewInt (1 ))
@@ -713,7 +713,7 @@ func TestMissingTrieNodes(t *testing.T) {
713
713
memDb := rawdb .NewMemoryDatabase ()
714
714
db := NewDatabase (memDb )
715
715
var root common.Hash
716
- state , _ := New (common. Hash {} , db , nil )
716
+ state , _ := New (types . EmptyRootHash , db , nil )
717
717
addr := common .BytesToAddress ([]byte ("so" ))
718
718
{
719
719
state .SetBalance (addr , big .NewInt (1 ))
@@ -762,7 +762,7 @@ func TestStateDBAccessList(t *testing.T) {
762
762
763
763
memDb := rawdb .NewMemoryDatabase ()
764
764
db := NewDatabase (memDb )
765
- state , _ := New (common. Hash {} , db , nil )
765
+ state , _ := New (types . EmptyRootHash , db , nil )
766
766
state .accessList = newAccessList ()
767
767
768
768
verifyAddrs := func (astrings ... string ) {
@@ -932,7 +932,7 @@ func TestFlushOrderDataLoss(t *testing.T) {
932
932
var (
933
933
memdb = rawdb .NewMemoryDatabase ()
934
934
statedb = NewDatabase (memdb )
935
- state , _ = New (common. Hash {} , statedb , nil )
935
+ state , _ = New (types . EmptyRootHash , statedb , nil )
936
936
)
937
937
for a := byte (0 ); a < 10 ; a ++ {
938
938
state .CreateAccount (common.Address {a })
@@ -968,7 +968,7 @@ func TestFlushOrderDataLoss(t *testing.T) {
968
968
func TestStateDBTransientStorage (t * testing.T ) {
969
969
memDb := rawdb .NewMemoryDatabase ()
970
970
db := NewDatabase (memDb )
971
- state , _ := New (common. Hash {} , db , nil )
971
+ state , _ := New (types . EmptyRootHash , db , nil )
972
972
973
973
key := common.Hash {0x01 }
974
974
value := common.Hash {0x02 }
0 commit comments