-
Notifications
You must be signed in to change notification settings - Fork 42
/
eip-1153.go
89 lines (85 loc) · 2.69 KB
/
eip-1153.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright Martin Holst Swende
// This file is part of the goevmlab library.
//
// The library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the goevmlab library. If not, see <http://www.gnu.org/licenses/>.
package fuzzing
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
func fillTstore(gst *GstMaker, fork string) {
// The accounts which we want to be able to invoke
addrs := []common.Address{
common.HexToAddress("0xF1"),
common.HexToAddress("0xF2"),
common.HexToAddress("0xF3"),
common.HexToAddress("0xF4"),
common.HexToAddress("0xF5"),
common.HexToAddress("0xF6"),
common.HexToAddress("0xF7"),
common.HexToAddress("0xF8"),
common.HexToAddress("0xF9"),
common.HexToAddress("0xFA"),
}
nonGenesisAddresses := []common.Address{
common.HexToAddress("0x00"),
common.HexToAddress("0x01"),
common.HexToAddress("0x02"),
common.HexToAddress("0x03"),
common.HexToAddress("0x04"),
common.HexToAddress("0x05"),
common.HexToAddress("0x06"),
common.HexToAddress("0x07"),
common.HexToAddress("0x08"),
common.HexToAddress("0x09"),
common.HexToAddress("0x0A"),
common.HexToAddress("0x0B"),
common.HexToAddress("0x0C"),
common.HexToAddress("0x0D"),
common.HexToAddress("0x0E"),
}
var allAddrs []common.Address
allAddrs = append(allAddrs, addrs...)
allAddrs = append(allAddrs, nonGenesisAddresses...)
// make them exist in the state
for _, addr := range nonGenesisAddresses {
gst.AddAccount(addr, GenesisAccount{
Balance: new(big.Int).SetUint64(1),
Storage: make(map[common.Hash]common.Hash),
})
}
for _, addr := range addrs {
gst.AddAccount(addr, GenesisAccount{
Code: RandCallTStore(allAddrs),
Balance: new(big.Int),
Storage: RandStorage(15, 20),
})
}
// The transaction
{
tx := &StTransaction{
// 8M gaslimit
GasLimit: []uint64{16000000},
Nonce: 0,
Value: []string{randHex(4)},
Data: []string{randHex(100)},
GasPrice: big.NewInt(0x10),
To: addrs[0].Hex(),
Sender: sender,
PrivateKey: hexutil.MustDecode("0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8"),
}
gst.SetTx(tx)
}
}