mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-15 19:31:37 +00:00
core/types/bal: convert txIndex to uint32
This commit is contained in:
parent
6f02965aab
commit
59e90ca796
4 changed files with 46 additions and 46 deletions
|
|
@ -31,7 +31,7 @@ type ConstructionAccountAccess struct {
|
||||||
// StorageWrites is the post-state values of an account's storage slots
|
// StorageWrites is the post-state values of an account's storage slots
|
||||||
// that were modified in a block, keyed by the slot key and the tx index
|
// that were modified in a block, keyed by the slot key and the tx index
|
||||||
// where the modification occurred.
|
// where the modification occurred.
|
||||||
StorageWrites map[common.Hash]map[uint16]common.Hash `json:"storageWrites,omitempty"`
|
StorageWrites map[common.Hash]map[uint32]common.Hash `json:"storageWrites,omitempty"`
|
||||||
|
|
||||||
// StorageReads is the set of slot keys that were accessed during block
|
// StorageReads is the set of slot keys that were accessed during block
|
||||||
// execution.
|
// execution.
|
||||||
|
|
@ -42,25 +42,25 @@ type ConstructionAccountAccess struct {
|
||||||
|
|
||||||
// BalanceChanges contains the post-transaction balances of an account,
|
// BalanceChanges contains the post-transaction balances of an account,
|
||||||
// keyed by transaction indices where it was changed.
|
// keyed by transaction indices where it was changed.
|
||||||
BalanceChanges map[uint16]*uint256.Int `json:"balanceChanges,omitempty"`
|
BalanceChanges map[uint32]*uint256.Int `json:"balanceChanges,omitempty"`
|
||||||
|
|
||||||
// NonceChanges contains the post-state nonce values of an account keyed
|
// NonceChanges contains the post-state nonce values of an account keyed
|
||||||
// by tx index.
|
// by tx index.
|
||||||
NonceChanges map[uint16]uint64 `json:"nonceChanges,omitempty"`
|
NonceChanges map[uint32]uint64 `json:"nonceChanges,omitempty"`
|
||||||
|
|
||||||
// CodeChange contains the post-state contract code of an account keyed
|
// CodeChange contains the post-state contract code of an account keyed
|
||||||
// by tx index.
|
// by tx index.
|
||||||
CodeChange map[uint16][]byte `json:"codeChange,omitempty"`
|
CodeChange map[uint32][]byte `json:"codeChange,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewConstructionAccountAccess initializes the account access object.
|
// NewConstructionAccountAccess initializes the account access object.
|
||||||
func NewConstructionAccountAccess() *ConstructionAccountAccess {
|
func NewConstructionAccountAccess() *ConstructionAccountAccess {
|
||||||
return &ConstructionAccountAccess{
|
return &ConstructionAccountAccess{
|
||||||
StorageWrites: make(map[common.Hash]map[uint16]common.Hash),
|
StorageWrites: make(map[common.Hash]map[uint32]common.Hash),
|
||||||
StorageReads: make(map[common.Hash]struct{}),
|
StorageReads: make(map[common.Hash]struct{}),
|
||||||
BalanceChanges: make(map[uint16]*uint256.Int),
|
BalanceChanges: make(map[uint32]*uint256.Int),
|
||||||
NonceChanges: make(map[uint16]uint64),
|
NonceChanges: make(map[uint32]uint64),
|
||||||
CodeChange: make(map[uint16][]byte),
|
CodeChange: make(map[uint32][]byte),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,12 +97,12 @@ func (b *ConstructionBlockAccessList) StorageRead(address common.Address, key co
|
||||||
|
|
||||||
// StorageWrite records the post-transaction value of a mutated storage slot.
|
// StorageWrite records the post-transaction value of a mutated storage slot.
|
||||||
// The storage slot is removed from the list of read slots.
|
// The storage slot is removed from the list of read slots.
|
||||||
func (b *ConstructionBlockAccessList) StorageWrite(txIdx uint16, address common.Address, key, value common.Hash) {
|
func (b *ConstructionBlockAccessList) StorageWrite(txIdx uint32, address common.Address, key, value common.Hash) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewConstructionAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
if _, ok := b.Accounts[address].StorageWrites[key]; !ok {
|
if _, ok := b.Accounts[address].StorageWrites[key]; !ok {
|
||||||
b.Accounts[address].StorageWrites[key] = make(map[uint16]common.Hash)
|
b.Accounts[address].StorageWrites[key] = make(map[uint32]common.Hash)
|
||||||
}
|
}
|
||||||
b.Accounts[address].StorageWrites[key][txIdx] = value
|
b.Accounts[address].StorageWrites[key][txIdx] = value
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ func (b *ConstructionBlockAccessList) StorageWrite(txIdx uint16, address common.
|
||||||
}
|
}
|
||||||
|
|
||||||
// CodeChange records the code of a newly-created contract.
|
// CodeChange records the code of a newly-created contract.
|
||||||
func (b *ConstructionBlockAccessList) CodeChange(address common.Address, txIndex uint16, code []byte) {
|
func (b *ConstructionBlockAccessList) CodeChange(address common.Address, txIndex uint32, code []byte) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewConstructionAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +120,7 @@ func (b *ConstructionBlockAccessList) CodeChange(address common.Address, txIndex
|
||||||
|
|
||||||
// NonceChange records tx post-state nonce of any contract-like accounts whose
|
// NonceChange records tx post-state nonce of any contract-like accounts whose
|
||||||
// nonce was incremented.
|
// nonce was incremented.
|
||||||
func (b *ConstructionBlockAccessList) NonceChange(address common.Address, txIdx uint16, postNonce uint64) {
|
func (b *ConstructionBlockAccessList) NonceChange(address common.Address, txIdx uint32, postNonce uint64) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewConstructionAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ func (b *ConstructionBlockAccessList) NonceChange(address common.Address, txIdx
|
||||||
|
|
||||||
// BalanceChange records the post-transaction balance of an account whose
|
// BalanceChange records the post-transaction balance of an account whose
|
||||||
// balance changed.
|
// balance changed.
|
||||||
func (b *ConstructionBlockAccessList) BalanceChange(txIdx uint16, address common.Address, balance *uint256.Int) {
|
func (b *ConstructionBlockAccessList) BalanceChange(txIdx uint32, address common.Address, balance *uint256.Int) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewConstructionAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
|
|
@ -148,21 +148,21 @@ func (b *ConstructionBlockAccessList) Copy() *ConstructionBlockAccessList {
|
||||||
for addr, aa := range b.Accounts {
|
for addr, aa := range b.Accounts {
|
||||||
var aaCopy ConstructionAccountAccess
|
var aaCopy ConstructionAccountAccess
|
||||||
|
|
||||||
slotWrites := make(map[common.Hash]map[uint16]common.Hash, len(aa.StorageWrites))
|
slotWrites := make(map[common.Hash]map[uint32]common.Hash, len(aa.StorageWrites))
|
||||||
for key, m := range aa.StorageWrites {
|
for key, m := range aa.StorageWrites {
|
||||||
slotWrites[key] = maps.Clone(m)
|
slotWrites[key] = maps.Clone(m)
|
||||||
}
|
}
|
||||||
aaCopy.StorageWrites = slotWrites
|
aaCopy.StorageWrites = slotWrites
|
||||||
aaCopy.StorageReads = maps.Clone(aa.StorageReads)
|
aaCopy.StorageReads = maps.Clone(aa.StorageReads)
|
||||||
|
|
||||||
balances := make(map[uint16]*uint256.Int, len(aa.BalanceChanges))
|
balances := make(map[uint32]*uint256.Int, len(aa.BalanceChanges))
|
||||||
for index, balance := range aa.BalanceChanges {
|
for index, balance := range aa.BalanceChanges {
|
||||||
balances[index] = balance.Clone()
|
balances[index] = balance.Clone()
|
||||||
}
|
}
|
||||||
aaCopy.BalanceChanges = balances
|
aaCopy.BalanceChanges = balances
|
||||||
aaCopy.NonceChanges = maps.Clone(aa.NonceChanges)
|
aaCopy.NonceChanges = maps.Clone(aa.NonceChanges)
|
||||||
|
|
||||||
codes := make(map[uint16][]byte, len(aa.CodeChange))
|
codes := make(map[uint32][]byte, len(aa.CodeChange))
|
||||||
for index, code := range aa.CodeChange {
|
for index, code := range aa.CodeChange {
|
||||||
codes[index] = bytes.Clone(code)
|
codes[index] = bytes.Clone(code)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,19 +86,19 @@ func encodeBalance(val *uint256.Int) [16]byte {
|
||||||
|
|
||||||
// encodingBalanceChange is the encoding format of BalanceChange.
|
// encodingBalanceChange is the encoding format of BalanceChange.
|
||||||
type encodingBalanceChange struct {
|
type encodingBalanceChange struct {
|
||||||
TxIdx uint16 `ssz-size:"2"`
|
TxIdx uint32 `ssz-size:"2"`
|
||||||
Balance [16]byte `ssz-size:"16"`
|
Balance [16]byte `ssz-size:"16"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// encodingAccountNonce is the encoding format of NonceChange.
|
// encodingAccountNonce is the encoding format of NonceChange.
|
||||||
type encodingAccountNonce struct {
|
type encodingAccountNonce struct {
|
||||||
TxIdx uint16 `ssz-size:"2"`
|
TxIdx uint32 `ssz-size:"2"`
|
||||||
Nonce uint64 `ssz-size:"8"`
|
Nonce uint64 `ssz-size:"8"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// encodingStorageWrite is the encoding format of StorageWrites.
|
// encodingStorageWrite is the encoding format of StorageWrites.
|
||||||
type encodingStorageWrite struct {
|
type encodingStorageWrite struct {
|
||||||
TxIdx uint16
|
TxIdx uint32
|
||||||
ValueAfter [32]byte `ssz-size:"32"`
|
ValueAfter [32]byte `ssz-size:"32"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ type encodingSlotWrites struct {
|
||||||
// working representation.
|
// working representation.
|
||||||
func (e *encodingSlotWrites) validate() error {
|
func (e *encodingSlotWrites) validate() error {
|
||||||
if slices.IsSortedFunc(e.Accesses, func(a, b encodingStorageWrite) int {
|
if slices.IsSortedFunc(e.Accesses, func(a, b encodingStorageWrite) int {
|
||||||
return cmp.Compare[uint16](a.TxIdx, b.TxIdx)
|
return cmp.Compare[uint32](a.TxIdx, b.TxIdx)
|
||||||
}) {
|
}) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +122,7 @@ func (e *encodingSlotWrites) validate() error {
|
||||||
// encodingCodeChange contains the runtime bytecode deployed at an address
|
// encodingCodeChange contains the runtime bytecode deployed at an address
|
||||||
// and the transaction index where the deployment took place.
|
// and the transaction index where the deployment took place.
|
||||||
type encodingCodeChange struct {
|
type encodingCodeChange struct {
|
||||||
TxIndex uint16 `ssz-size:"2"`
|
TxIndex uint32 `ssz-size:"2"`
|
||||||
Code []byte `ssz-max:"300000"` // TODO(rjl493456442) shall we put the limit here? The limit will be increased gradually
|
Code []byte `ssz-max:"300000"` // TODO(rjl493456442) shall we put the limit here? The limit will be increased gradually
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,21 +161,21 @@ func (e *AccountAccess) validate() error {
|
||||||
|
|
||||||
// Check the balance changes are sorted in order
|
// Check the balance changes are sorted in order
|
||||||
if !slices.IsSortedFunc(e.BalanceChanges, func(a, b encodingBalanceChange) int {
|
if !slices.IsSortedFunc(e.BalanceChanges, func(a, b encodingBalanceChange) int {
|
||||||
return cmp.Compare[uint16](a.TxIdx, b.TxIdx)
|
return cmp.Compare[uint32](a.TxIdx, b.TxIdx)
|
||||||
}) {
|
}) {
|
||||||
return errors.New("balance changes not in ascending order by tx index")
|
return errors.New("balance changes not in ascending order by tx index")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the nonce changes are sorted in order
|
// Check the nonce changes are sorted in order
|
||||||
if !slices.IsSortedFunc(e.NonceChanges, func(a, b encodingAccountNonce) int {
|
if !slices.IsSortedFunc(e.NonceChanges, func(a, b encodingAccountNonce) int {
|
||||||
return cmp.Compare[uint16](a.TxIdx, b.TxIdx)
|
return cmp.Compare[uint32](a.TxIdx, b.TxIdx)
|
||||||
}) {
|
}) {
|
||||||
return errors.New("nonce changes not in ascending order by tx index")
|
return errors.New("nonce changes not in ascending order by tx index")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the code changes are sorted in order
|
// Check the code changes are sorted in order
|
||||||
if !slices.IsSortedFunc(e.CodeChanges, func(a, b encodingCodeChange) int {
|
if !slices.IsSortedFunc(e.CodeChanges, func(a, b encodingCodeChange) int {
|
||||||
return cmp.Compare[uint16](a.TxIndex, b.TxIndex)
|
return cmp.Compare[uint32](a.TxIndex, b.TxIndex)
|
||||||
}) {
|
}) {
|
||||||
return errors.New("code changes not in ascending order by tx index")
|
return errors.New("code changes not in ascending order by tx index")
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +244,7 @@ func (a *ConstructionAccountAccess) toEncodingObj(addr common.Address) AccountAc
|
||||||
obj.Accesses = make([]encodingStorageWrite, 0, len(slotWrites))
|
obj.Accesses = make([]encodingStorageWrite, 0, len(slotWrites))
|
||||||
|
|
||||||
indices := slices.Collect(maps.Keys(slotWrites))
|
indices := slices.Collect(maps.Keys(slotWrites))
|
||||||
slices.SortFunc(indices, cmp.Compare[uint16])
|
slices.SortFunc(indices, cmp.Compare[uint32])
|
||||||
for _, index := range indices {
|
for _, index := range indices {
|
||||||
obj.Accesses = append(obj.Accesses, encodingStorageWrite{
|
obj.Accesses = append(obj.Accesses, encodingStorageWrite{
|
||||||
TxIdx: index,
|
TxIdx: index,
|
||||||
|
|
@ -263,7 +263,7 @@ func (a *ConstructionAccountAccess) toEncodingObj(addr common.Address) AccountAc
|
||||||
|
|
||||||
// Convert balance changes
|
// Convert balance changes
|
||||||
balanceIndices := slices.Collect(maps.Keys(a.BalanceChanges))
|
balanceIndices := slices.Collect(maps.Keys(a.BalanceChanges))
|
||||||
slices.SortFunc(balanceIndices, cmp.Compare[uint16])
|
slices.SortFunc(balanceIndices, cmp.Compare[uint32])
|
||||||
for _, idx := range balanceIndices {
|
for _, idx := range balanceIndices {
|
||||||
res.BalanceChanges = append(res.BalanceChanges, encodingBalanceChange{
|
res.BalanceChanges = append(res.BalanceChanges, encodingBalanceChange{
|
||||||
TxIdx: idx,
|
TxIdx: idx,
|
||||||
|
|
@ -273,7 +273,7 @@ func (a *ConstructionAccountAccess) toEncodingObj(addr common.Address) AccountAc
|
||||||
|
|
||||||
// Convert nonce changes
|
// Convert nonce changes
|
||||||
nonceIndices := slices.Collect(maps.Keys(a.NonceChanges))
|
nonceIndices := slices.Collect(maps.Keys(a.NonceChanges))
|
||||||
slices.SortFunc(nonceIndices, cmp.Compare[uint16])
|
slices.SortFunc(nonceIndices, cmp.Compare[uint32])
|
||||||
for _, idx := range nonceIndices {
|
for _, idx := range nonceIndices {
|
||||||
res.NonceChanges = append(res.NonceChanges, encodingAccountNonce{
|
res.NonceChanges = append(res.NonceChanges, encodingAccountNonce{
|
||||||
TxIdx: idx,
|
TxIdx: idx,
|
||||||
|
|
@ -283,7 +283,7 @@ func (a *ConstructionAccountAccess) toEncodingObj(addr common.Address) AccountAc
|
||||||
|
|
||||||
// Convert code change
|
// Convert code change
|
||||||
codeIndices := slices.Collect(maps.Keys(a.CodeChange))
|
codeIndices := slices.Collect(maps.Keys(a.CodeChange))
|
||||||
slices.SortFunc(codeIndices, cmp.Compare[uint16])
|
slices.SortFunc(codeIndices, cmp.Compare[uint32])
|
||||||
for _, idx := range codeIndices {
|
for _, idx := range codeIndices {
|
||||||
res.CodeChanges = append(res.CodeChanges, encodingCodeChange{
|
res.CodeChanges = append(res.CodeChanges, encodingCodeChange{
|
||||||
TxIndex: idx,
|
TxIndex: idx,
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ func (obj *BlockAccessList) DecodeRLP(dec *rlp.Stream) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TxIdx:
|
// TxIdx:
|
||||||
_tmp9, err := dec.Uint16()
|
_tmp9, err := dec.Uint32()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +174,7 @@ func (obj *BlockAccessList) DecodeRLP(dec *rlp.Stream) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TxIdx:
|
// TxIdx:
|
||||||
_tmp15, err := dec.Uint16()
|
_tmp15, err := dec.Uint32()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +207,7 @@ func (obj *BlockAccessList) DecodeRLP(dec *rlp.Stream) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TxIdx:
|
// TxIdx:
|
||||||
_tmp19, err := dec.Uint16()
|
_tmp19, err := dec.Uint32()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@ func (obj *BlockAccessList) DecodeRLP(dec *rlp.Stream) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TxIndex:
|
// TxIndex:
|
||||||
_tmp23, err := dec.Uint16()
|
_tmp23, err := dec.Uint32()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func makeTestConstructionBAL() *ConstructionBlockAccessList {
|
||||||
return &ConstructionBlockAccessList{
|
return &ConstructionBlockAccessList{
|
||||||
map[common.Address]*ConstructionAccountAccess{
|
map[common.Address]*ConstructionAccountAccess{
|
||||||
common.BytesToAddress([]byte{0xff, 0xff}): {
|
common.BytesToAddress([]byte{0xff, 0xff}): {
|
||||||
StorageWrites: map[common.Hash]map[uint16]common.Hash{
|
StorageWrites: map[common.Hash]map[uint32]common.Hash{
|
||||||
common.BytesToHash([]byte{0x01}): {
|
common.BytesToHash([]byte{0x01}): {
|
||||||
1: common.BytesToHash([]byte{1, 2, 3, 4}),
|
1: common.BytesToHash([]byte{1, 2, 3, 4}),
|
||||||
2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}),
|
2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}),
|
||||||
|
|
@ -52,20 +52,20 @@ func makeTestConstructionBAL() *ConstructionBlockAccessList {
|
||||||
StorageReads: map[common.Hash]struct{}{
|
StorageReads: map[common.Hash]struct{}{
|
||||||
common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7}): {},
|
common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7}): {},
|
||||||
},
|
},
|
||||||
BalanceChanges: map[uint16]*uint256.Int{
|
BalanceChanges: map[uint32]*uint256.Int{
|
||||||
1: uint256.NewInt(100),
|
1: uint256.NewInt(100),
|
||||||
2: uint256.NewInt(500),
|
2: uint256.NewInt(500),
|
||||||
},
|
},
|
||||||
NonceChanges: map[uint16]uint64{
|
NonceChanges: map[uint32]uint64{
|
||||||
1: 2,
|
1: 2,
|
||||||
2: 6,
|
2: 6,
|
||||||
},
|
},
|
||||||
CodeChange: map[uint16][]byte{
|
CodeChange: map[uint32][]byte{
|
||||||
0: common.Hex2Bytes("deadbeef"),
|
0: common.Hex2Bytes("deadbeef"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
common.BytesToAddress([]byte{0xff, 0xff, 0xff}): {
|
common.BytesToAddress([]byte{0xff, 0xff, 0xff}): {
|
||||||
StorageWrites: map[common.Hash]map[uint16]common.Hash{
|
StorageWrites: map[common.Hash]map[uint32]common.Hash{
|
||||||
common.BytesToHash([]byte{0x01}): {
|
common.BytesToHash([]byte{0x01}): {
|
||||||
2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}),
|
2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}),
|
||||||
3: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}),
|
3: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}),
|
||||||
|
|
@ -77,14 +77,14 @@ func makeTestConstructionBAL() *ConstructionBlockAccessList {
|
||||||
StorageReads: map[common.Hash]struct{}{
|
StorageReads: map[common.Hash]struct{}{
|
||||||
common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}): {},
|
common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}): {},
|
||||||
},
|
},
|
||||||
BalanceChanges: map[uint16]*uint256.Int{
|
BalanceChanges: map[uint32]*uint256.Int{
|
||||||
2: uint256.NewInt(100),
|
2: uint256.NewInt(100),
|
||||||
3: uint256.NewInt(500),
|
3: uint256.NewInt(500),
|
||||||
},
|
},
|
||||||
NonceChanges: map[uint16]uint64{
|
NonceChanges: map[uint32]uint64{
|
||||||
1: 2,
|
1: 2,
|
||||||
},
|
},
|
||||||
CodeChange: map[uint16][]byte{
|
CodeChange: map[uint32][]byte{
|
||||||
0: common.Hex2Bytes("deadbeef"),
|
0: common.Hex2Bytes("deadbeef"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -125,13 +125,13 @@ func makeTestAccountAccess(sort bool) AccountAccess {
|
||||||
}
|
}
|
||||||
for j := 0; j < 3; j++ {
|
for j := 0; j < 3; j++ {
|
||||||
slot.Accesses = append(slot.Accesses, encodingStorageWrite{
|
slot.Accesses = append(slot.Accesses, encodingStorageWrite{
|
||||||
TxIdx: uint16(2 * j),
|
TxIdx: uint32(2 * j),
|
||||||
ValueAfter: testrand.Hash(),
|
ValueAfter: testrand.Hash(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if sort {
|
if sort {
|
||||||
slices.SortFunc(slot.Accesses, func(a, b encodingStorageWrite) int {
|
slices.SortFunc(slot.Accesses, func(a, b encodingStorageWrite) int {
|
||||||
return cmp.Compare[uint16](a.TxIdx, b.TxIdx)
|
return cmp.Compare[uint32](a.TxIdx, b.TxIdx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
storageWrites = append(storageWrites, slot)
|
storageWrites = append(storageWrites, slot)
|
||||||
|
|
@ -153,25 +153,25 @@ func makeTestAccountAccess(sort bool) AccountAccess {
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
balances = append(balances, encodingBalanceChange{
|
balances = append(balances, encodingBalanceChange{
|
||||||
TxIdx: uint16(2 * i),
|
TxIdx: uint32(2 * i),
|
||||||
Balance: [16]byte(testrand.Bytes(16)),
|
Balance: [16]byte(testrand.Bytes(16)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if sort {
|
if sort {
|
||||||
slices.SortFunc(balances, func(a, b encodingBalanceChange) int {
|
slices.SortFunc(balances, func(a, b encodingBalanceChange) int {
|
||||||
return cmp.Compare[uint16](a.TxIdx, b.TxIdx)
|
return cmp.Compare[uint32](a.TxIdx, b.TxIdx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
nonces = append(nonces, encodingAccountNonce{
|
nonces = append(nonces, encodingAccountNonce{
|
||||||
TxIdx: uint16(2 * i),
|
TxIdx: uint32(2 * i),
|
||||||
Nonce: uint64(i + 100),
|
Nonce: uint64(i + 100),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if sort {
|
if sort {
|
||||||
slices.SortFunc(nonces, func(a, b encodingAccountNonce) int {
|
slices.SortFunc(nonces, func(a, b encodingAccountNonce) int {
|
||||||
return cmp.Compare[uint16](a.TxIdx, b.TxIdx)
|
return cmp.Compare[uint32](a.TxIdx, b.TxIdx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue