|
|
@ -50,7 +50,7 @@ func TestUpdateLeaks(t *testing.T) { |
|
|
|
state.SetState(addr, common.BytesToHash([]byte{i, i, i}), common.BytesToHash([]byte{i, i, i, i})) |
|
|
|
state.SetState(addr, common.BytesToHash([]byte{i, i, i}), common.BytesToHash([]byte{i, i, i, i})) |
|
|
|
} |
|
|
|
} |
|
|
|
if i%3 == 0 { |
|
|
|
if i%3 == 0 { |
|
|
|
state.SetCode(addr, []byte{i, i, i, i, i}, false) |
|
|
|
state.SetCode(addr, []byte{i, i, i, i, i}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ func TestIntermediateLeaks(t *testing.T) { |
|
|
|
state.SetState(addr, common.Hash{i, i, i, tweak}, common.Hash{i, i, i, i, tweak}) |
|
|
|
state.SetState(addr, common.Hash{i, i, i, tweak}, common.Hash{i, i, i, i, tweak}) |
|
|
|
} |
|
|
|
} |
|
|
|
if i%3 == 0 { |
|
|
|
if i%3 == 0 { |
|
|
|
state.SetCode(addr, []byte{i, i, i, i, i, tweak}, false) |
|
|
|
state.SetCode(addr, []byte{i, i, i, i, i, tweak}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -286,7 +286,7 @@ func newTestAction(addr common.Address, r *rand.Rand) testAction { |
|
|
|
code := make([]byte, 16) |
|
|
|
code := make([]byte, 16) |
|
|
|
binary.BigEndian.PutUint64(code, uint64(a.args[0])) |
|
|
|
binary.BigEndian.PutUint64(code, uint64(a.args[0])) |
|
|
|
binary.BigEndian.PutUint64(code[8:], uint64(a.args[1])) |
|
|
|
binary.BigEndian.PutUint64(code[8:], uint64(a.args[1])) |
|
|
|
s.SetCode(addr, code, false) |
|
|
|
s.SetCode(addr, code) |
|
|
|
}, |
|
|
|
}, |
|
|
|
args: make([]int64, 2), |
|
|
|
args: make([]int64, 2), |
|
|
|
}, |
|
|
|
}, |
|
|
@ -525,9 +525,9 @@ func TestCopyCommitCopy(t *testing.T) { |
|
|
|
skey := common.HexToHash("aaa") |
|
|
|
skey := common.HexToHash("aaa") |
|
|
|
sval := common.HexToHash("bbb") |
|
|
|
sval := common.HexToHash("bbb") |
|
|
|
|
|
|
|
|
|
|
|
state.SetBalance(addr, big.NewInt(42)) // Change the account trie
|
|
|
|
state.SetBalance(addr, big.NewInt(42)) // Change the account trie
|
|
|
|
state.SetCode(addr, []byte("hello"), false) // Change an external metadata
|
|
|
|
state.SetCode(addr, []byte("hello")) // Change an external metadata
|
|
|
|
state.SetState(addr, skey, sval) // Change the storage trie
|
|
|
|
state.SetState(addr, skey, sval) // Change the storage trie
|
|
|
|
|
|
|
|
|
|
|
|
if balance := state.GetBalance(addr); balance.Cmp(big.NewInt(42)) != 0 { |
|
|
|
if balance := state.GetBalance(addr); balance.Cmp(big.NewInt(42)) != 0 { |
|
|
|
t.Fatalf("initial balance mismatch: have %v, want %v", balance, 42) |
|
|
|
t.Fatalf("initial balance mismatch: have %v, want %v", balance, 42) |
|
|
@ -597,9 +597,9 @@ func TestCopyCopyCommitCopy(t *testing.T) { |
|
|
|
skey := common.HexToHash("aaa") |
|
|
|
skey := common.HexToHash("aaa") |
|
|
|
sval := common.HexToHash("bbb") |
|
|
|
sval := common.HexToHash("bbb") |
|
|
|
|
|
|
|
|
|
|
|
state.SetBalance(addr, big.NewInt(42)) // Change the account trie
|
|
|
|
state.SetBalance(addr, big.NewInt(42)) // Change the account trie
|
|
|
|
state.SetCode(addr, []byte("hello"), false) // Change an external metadata
|
|
|
|
state.SetCode(addr, []byte("hello")) // Change an external metadata
|
|
|
|
state.SetState(addr, skey, sval) // Change the storage trie
|
|
|
|
state.SetState(addr, skey, sval) // Change the storage trie
|
|
|
|
|
|
|
|
|
|
|
|
if balance := state.GetBalance(addr); balance.Cmp(big.NewInt(42)) != 0 { |
|
|
|
if balance := state.GetBalance(addr); balance.Cmp(big.NewInt(42)) != 0 { |
|
|
|
t.Fatalf("initial balance mismatch: have %v, want %v", balance, 42) |
|
|
|
t.Fatalf("initial balance mismatch: have %v, want %v", balance, 42) |
|
|
@ -717,10 +717,10 @@ func TestMissingTrieNodes(t *testing.T) { |
|
|
|
addr := common.BytesToAddress([]byte("so")) |
|
|
|
addr := common.BytesToAddress([]byte("so")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
state.SetBalance(addr, big.NewInt(1)) |
|
|
|
state.SetBalance(addr, big.NewInt(1)) |
|
|
|
state.SetCode(addr, []byte{1, 2, 3}, false) |
|
|
|
state.SetCode(addr, []byte{1, 2, 3}) |
|
|
|
a2 := common.BytesToAddress([]byte("another")) |
|
|
|
a2 := common.BytesToAddress([]byte("another")) |
|
|
|
state.SetBalance(a2, big.NewInt(100)) |
|
|
|
state.SetBalance(a2, big.NewInt(100)) |
|
|
|
state.SetCode(a2, []byte{1, 2, 4}, false) |
|
|
|
state.SetCode(a2, []byte{1, 2, 4}) |
|
|
|
root, _ = state.Commit(false) |
|
|
|
root, _ = state.Commit(false) |
|
|
|
t.Logf("root: %x", root) |
|
|
|
t.Logf("root: %x", root) |
|
|
|
// force-flush
|
|
|
|
// force-flush
|
|
|
|