mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
remove encoder -> construction conversion. change encoder object name to BlockAccessList
This commit is contained in:
parent
ef5206359b
commit
6b4a72749c
5 changed files with 128 additions and 158 deletions
|
|
@ -31,9 +31,10 @@ type CodeChange struct {
|
||||||
Code []byte `json:"code,omitempty"`
|
Code []byte `json:"code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccountAccess contains post-block account state for mutations as well as
|
// ConstructionAccountAccess contains post-block account state for mutations as well as
|
||||||
// all storage keys that were read during execution.
|
// all storage keys that were read during execution. It is used when building block
|
||||||
type AccountAccess struct {
|
// access list during execution.
|
||||||
|
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.
|
||||||
|
|
@ -59,9 +60,9 @@ type AccountAccess struct {
|
||||||
CodeChange *CodeChange `json:"codeChange,omitempty"`
|
CodeChange *CodeChange `json:"codeChange,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAccountAccess initializes the account access object.
|
// NewConstructionAccountAccess initializes the account access object.
|
||||||
func NewAccountAccess() *AccountAccess {
|
func NewConstructionAccountAccess() *ConstructionAccountAccess {
|
||||||
return &AccountAccess{
|
return &ConstructionAccountAccess{
|
||||||
StorageWrites: make(map[common.Hash]map[uint16]common.Hash),
|
StorageWrites: make(map[common.Hash]map[uint16]common.Hash),
|
||||||
StorageReads: make(map[common.Hash]struct{}),
|
StorageReads: make(map[common.Hash]struct{}),
|
||||||
BalanceChanges: make(map[uint16]*uint256.Int),
|
BalanceChanges: make(map[uint16]*uint256.Int),
|
||||||
|
|
@ -69,30 +70,30 @@ func NewAccountAccess() *AccountAccess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlockAccessList contains post-block modified state and some state accessed
|
// ConstructionBlockAccessList contains post-block modified state and some state accessed
|
||||||
// in execution (account addresses and storage keys).
|
// in execution (account addresses and storage keys).
|
||||||
type BlockAccessList struct {
|
type ConstructionBlockAccessList struct {
|
||||||
Accounts map[common.Address]*AccountAccess
|
Accounts map[common.Address]*ConstructionAccountAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBlockAccessList instantiates an empty access list.
|
// NewBlockAccessList instantiates an empty access list.
|
||||||
func NewBlockAccessList() BlockAccessList {
|
func NewBlockAccessList() ConstructionBlockAccessList {
|
||||||
return BlockAccessList{
|
return ConstructionBlockAccessList{
|
||||||
Accounts: make(map[common.Address]*AccountAccess),
|
Accounts: make(map[common.Address]*ConstructionAccountAccess),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccountRead records the address of an account that has been read during execution.
|
// AccountRead records the address of an account that has been read during execution.
|
||||||
func (b *BlockAccessList) AccountRead(addr common.Address) {
|
func (b *ConstructionBlockAccessList) AccountRead(addr common.Address) {
|
||||||
if _, ok := b.Accounts[addr]; !ok {
|
if _, ok := b.Accounts[addr]; !ok {
|
||||||
b.Accounts[addr] = NewAccountAccess()
|
b.Accounts[addr] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StorageRead records a storage key read during execution.
|
// StorageRead records a storage key read during execution.
|
||||||
func (b *BlockAccessList) StorageRead(address common.Address, key common.Hash) {
|
func (b *ConstructionBlockAccessList) StorageRead(address common.Address, key common.Hash) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
if _, ok := b.Accounts[address].StorageWrites[key]; ok {
|
if _, ok := b.Accounts[address].StorageWrites[key]; ok {
|
||||||
return
|
return
|
||||||
|
|
@ -102,9 +103,9 @@ func (b *BlockAccessList) StorageRead(address common.Address, key common.Hash) {
|
||||||
|
|
||||||
// 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 *BlockAccessList) StorageWrite(txIdx uint16, address common.Address, key, value common.Hash) {
|
func (b *ConstructionBlockAccessList) StorageWrite(txIdx uint16, address common.Address, key, value common.Hash) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewAccountAccess()
|
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[uint16]common.Hash)
|
||||||
|
|
@ -115,9 +116,9 @@ func (b *BlockAccessList) StorageWrite(txIdx uint16, address common.Address, key
|
||||||
}
|
}
|
||||||
|
|
||||||
// CodeChange records the code of a newly-created contract.
|
// CodeChange records the code of a newly-created contract.
|
||||||
func (b *BlockAccessList) CodeChange(address common.Address, txIndex uint16, code []byte) {
|
func (b *ConstructionBlockAccessList) CodeChange(address common.Address, txIndex uint16, code []byte) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
b.Accounts[address].CodeChange = &CodeChange{
|
b.Accounts[address].CodeChange = &CodeChange{
|
||||||
TxIndex: txIndex,
|
TxIndex: txIndex,
|
||||||
|
|
@ -127,30 +128,30 @@ func (b *BlockAccessList) CodeChange(address common.Address, txIndex uint16, cod
|
||||||
|
|
||||||
// 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 *BlockAccessList) NonceChange(address common.Address, txIdx uint16, postNonce uint64) {
|
func (b *ConstructionBlockAccessList) NonceChange(address common.Address, txIdx uint16, postNonce uint64) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
b.Accounts[address].NonceChanges[txIdx] = postNonce
|
b.Accounts[address].NonceChanges[txIdx] = postNonce
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 *BlockAccessList) BalanceChange(txIdx uint16, address common.Address, balance *uint256.Int) {
|
func (b *ConstructionBlockAccessList) BalanceChange(txIdx uint16, address common.Address, balance *uint256.Int) {
|
||||||
if _, ok := b.Accounts[address]; !ok {
|
if _, ok := b.Accounts[address]; !ok {
|
||||||
b.Accounts[address] = NewAccountAccess()
|
b.Accounts[address] = NewConstructionAccountAccess()
|
||||||
}
|
}
|
||||||
b.Accounts[address].BalanceChanges[txIdx] = balance.Clone()
|
b.Accounts[address].BalanceChanges[txIdx] = balance.Clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrettyPrint returns a human-readable representation of the access list
|
// PrettyPrint returns a human-readable representation of the access list
|
||||||
func (b *BlockAccessList) PrettyPrint() string {
|
func (b *ConstructionBlockAccessList) PrettyPrint() string {
|
||||||
enc := b.toEncodingObj()
|
enc := b.toEncodingObj()
|
||||||
return enc.prettyPrint()
|
return enc.PrettyPrint()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash computes the SSZ hash of the access list
|
// Hash computes the SSZ hash of the access list
|
||||||
func (b *BlockAccessList) Hash() common.Hash {
|
func (b *ConstructionBlockAccessList) Hash() common.Hash {
|
||||||
hash, err := b.toEncodingObj().HashTreeRoot()
|
hash, err := b.toEncodingObj().HashTreeRoot()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// errors here are related to BAL values exceeding maximum size defined
|
// errors here are related to BAL values exceeding maximum size defined
|
||||||
|
|
@ -162,10 +163,10 @@ func (b *BlockAccessList) Hash() common.Hash {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy returns a deep copy of the access list.
|
// Copy returns a deep copy of the access list.
|
||||||
func (b *BlockAccessList) Copy() *BlockAccessList {
|
func (b *ConstructionBlockAccessList) Copy() *ConstructionBlockAccessList {
|
||||||
res := NewBlockAccessList()
|
res := NewBlockAccessList()
|
||||||
for addr, aa := range b.Accounts {
|
for addr, aa := range b.Accounts {
|
||||||
var aaCopy AccountAccess
|
var aaCopy ConstructionAccountAccess
|
||||||
|
|
||||||
slotWrites := make(map[common.Hash]map[uint16]common.Hash, len(aa.StorageWrites))
|
slotWrites := make(map[common.Hash]map[uint16]common.Hash, len(aa.StorageWrites))
|
||||||
for key, m := range aa.StorageWrites {
|
for key, m := range aa.StorageWrites {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"cmp"
|
"cmp"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"io"
|
"io"
|
||||||
"maps"
|
"maps"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
@ -36,39 +37,30 @@ import (
|
||||||
// These are objects used as input for the access list encoding. They mirror
|
// These are objects used as input for the access list encoding. They mirror
|
||||||
// the spec format.
|
// the spec format.
|
||||||
|
|
||||||
// encodingBlockAccessList is the encoding format of BlockAccessList.
|
// BlockAccessList is the encoding format of ConstructionBlockAccessList.
|
||||||
type encodingBlockAccessList struct {
|
type BlockAccessList struct {
|
||||||
Accesses []encodingAccountAccess `ssz-max:"300000"`
|
Accesses []AccountAccess `ssz-max:"300000"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// toBlockAccessList converts out of the encoding format, returning an error if
|
// validate returns an error if the contents of the access list are not ordered
|
||||||
// values in the encoder object are not properly ordered according to the spec.
|
// according to the spec or any code changes are contained which exceed protocol
|
||||||
func (e *encodingBlockAccessList) toBlockAccessList() (*BlockAccessList, error) {
|
// max code size.
|
||||||
|
func (e *BlockAccessList) validate() error {
|
||||||
var (
|
var (
|
||||||
obj = NewBlockAccessList()
|
|
||||||
prev *[20]byte
|
prev *[20]byte
|
||||||
)
|
)
|
||||||
for _, entry := range e.Accesses {
|
for _, entry := range e.Accesses {
|
||||||
if prev != nil {
|
if prev != nil {
|
||||||
if bytes.Compare(entry.Address[:], (*prev)[:]) <= 0 {
|
if bytes.Compare(entry.Address[:], (*prev)[:]) <= 0 {
|
||||||
return nil, fmt.Errorf("block access list accounts not in lexicographic order")
|
return fmt.Errorf("block access list accounts not in lexicographic order")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prev = &entry.Address
|
if err := entry.validate(); err != nil {
|
||||||
|
return err
|
||||||
aa, err := entry.toAccountAccess()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
obj.Accounts[entry.Address] = aa
|
prev = &entry.Address
|
||||||
}
|
}
|
||||||
return &obj, nil
|
return nil
|
||||||
}
|
|
||||||
|
|
||||||
// encodingCodeChange is the encoding format of CodeChange.
|
|
||||||
type encodingCodeChange struct {
|
|
||||||
TxIndex uint16
|
|
||||||
Code []byte `ssz-max:"24576"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// encodeBalance encodes the provided balance into 16-bytes.
|
// encodeBalance encodes the provided balance into 16-bytes.
|
||||||
|
|
@ -106,62 +98,48 @@ type encodingSlotWrites struct {
|
||||||
Accesses []encodingStorageWrite `ssz-max:"300000"`
|
Accesses []encodingStorageWrite `ssz-max:"300000"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// toSlotWrites returns an instance of the encoding-representation slot writes in
|
// validate returns an instance of the encoding-representation slot writes in
|
||||||
// working representation.
|
// working representation.
|
||||||
func (e *encodingSlotWrites) toSlotWrites() (map[uint16]common.Hash, error) {
|
func (e *encodingSlotWrites) validate() error {
|
||||||
var (
|
var prev *uint16
|
||||||
prev *uint16
|
|
||||||
obj = make(map[uint16]common.Hash)
|
|
||||||
)
|
|
||||||
for _, write := range e.Accesses {
|
for _, write := range e.Accesses {
|
||||||
if prev != nil {
|
if prev != nil {
|
||||||
if *prev >= write.TxIdx {
|
if *prev >= write.TxIdx {
|
||||||
return nil, fmt.Errorf("storage write tx indices not in order")
|
return fmt.Errorf("storage write tx indices not in order")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prev = &write.TxIdx
|
prev = &write.TxIdx
|
||||||
obj[write.TxIdx] = write.ValueAfter
|
|
||||||
}
|
}
|
||||||
return obj, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// encodingAccountAccess is the encoding format of AccountAccess.
|
// AccountAccess is the encoding format of ConstructionAccountAccess.
|
||||||
type encodingAccountAccess struct {
|
type AccountAccess struct {
|
||||||
Address [20]byte `ssz-size:"20"` // 20-byte Ethereum address
|
Address [20]byte `ssz-size:"20"` // 20-byte Ethereum address
|
||||||
StorageWrites []encodingSlotWrites `ssz-max:"300000"` // Storage changes (slot -> [tx_index -> new_value])
|
StorageWrites []encodingSlotWrites `ssz-max:"300000"` // Storage changes (slot -> [tx_index -> new_value])
|
||||||
StorageReads [][32]byte `ssz-max:"300000"` // Read-only storage keys
|
StorageReads [][32]byte `ssz-max:"300000"` // Read-only storage keys
|
||||||
BalanceChanges []encodingBalanceChange `ssz-max:"300000"` // Balance changes ([tx_index -> post_balance])
|
BalanceChanges []encodingBalanceChange `ssz-max:"300000"` // Balance changes ([tx_index -> post_balance])
|
||||||
NonceChanges []encodingAccountNonce `ssz-max:"300000"` // Nonce changes ([tx_index -> new_nonce])
|
NonceChanges []encodingAccountNonce `ssz-max:"300000"` // Nonce changes ([tx_index -> new_nonce])
|
||||||
Code []encodingCodeChange `ssz-max:"1"` // Code changes ([tx_index -> new_code])
|
Code []CodeChange `ssz-max:"1"` // Code changes ([tx_index -> new_code])
|
||||||
}
|
}
|
||||||
|
|
||||||
// toAccountAccess converts the account accesses out of encoding format.
|
// validate converts the account accesses out of encoding format.
|
||||||
// If any of the keys in the encoding object are not ordered according to the
|
// If any of the keys in the encoding object are not ordered according to the
|
||||||
// spec, an error is returned.
|
// spec, an error is returned.
|
||||||
func (e *encodingAccountAccess) toAccountAccess() (*AccountAccess, error) {
|
func (e *AccountAccess) validate() error {
|
||||||
res := AccountAccess{
|
|
||||||
StorageWrites: make(map[common.Hash]map[uint16]common.Hash),
|
|
||||||
StorageReads: make(map[common.Hash]struct{}),
|
|
||||||
BalanceChanges: make(map[uint16]*uint256.Int),
|
|
||||||
NonceChanges: make(map[uint16]uint64),
|
|
||||||
CodeChange: nil,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert slot writes
|
// Convert slot writes
|
||||||
var prevSlotWrite *[32]byte
|
var prevSlotWrite *[32]byte
|
||||||
for _, write := range e.StorageWrites {
|
for _, write := range e.StorageWrites {
|
||||||
if prevSlotWrite != nil {
|
if prevSlotWrite != nil {
|
||||||
if bytes.Compare((*prevSlotWrite)[:], write.Slot[:]) >= 0 {
|
if bytes.Compare((*prevSlotWrite)[:], write.Slot[:]) >= 0 {
|
||||||
return nil, fmt.Errorf("storage writes slots not in lexicographic order")
|
return fmt.Errorf("storage writes slots not in lexicographic order")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevSlotWrite = &write.Slot
|
prevSlotWrite = &write.Slot
|
||||||
|
|
||||||
wr, err := write.toSlotWrites()
|
if err := write.validate(); err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
res.StorageWrites[write.Slot] = wr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert slot reads
|
// Convert slot reads
|
||||||
|
|
@ -169,11 +147,10 @@ func (e *encodingAccountAccess) toAccountAccess() (*AccountAccess, error) {
|
||||||
for _, read := range e.StorageReads {
|
for _, read := range e.StorageReads {
|
||||||
if prevSlotRead != nil {
|
if prevSlotRead != nil {
|
||||||
if bytes.Compare((*prevSlotRead)[:], read[:]) >= 0 {
|
if bytes.Compare((*prevSlotRead)[:], read[:]) >= 0 {
|
||||||
return nil, fmt.Errorf("storage read slots not in lexicographic order")
|
return fmt.Errorf("storage read slots not in lexicographic order")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevSlotRead = &read
|
prevSlotRead = &read
|
||||||
res.StorageReads[read] = struct{}{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert balance changes
|
// Convert balance changes
|
||||||
|
|
@ -181,11 +158,10 @@ func (e *encodingAccountAccess) toAccountAccess() (*AccountAccess, error) {
|
||||||
for _, balanceChange := range e.BalanceChanges {
|
for _, balanceChange := range e.BalanceChanges {
|
||||||
if prevBalanceIndex != nil {
|
if prevBalanceIndex != nil {
|
||||||
if *prevBalanceIndex >= balanceChange.TxIdx {
|
if *prevBalanceIndex >= balanceChange.TxIdx {
|
||||||
return nil, fmt.Errorf("balance changes not in ascending order by tx index")
|
return fmt.Errorf("balance changes not in ascending order by tx index")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevBalanceIndex = &balanceChange.TxIdx
|
prevBalanceIndex = &balanceChange.TxIdx
|
||||||
res.BalanceChanges[balanceChange.TxIdx] = new(uint256.Int).SetBytes(balanceChange.Balance[:])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert nonce changes
|
// Convert nonce changes
|
||||||
|
|
@ -193,25 +169,23 @@ func (e *encodingAccountAccess) toAccountAccess() (*AccountAccess, error) {
|
||||||
for _, nonceChange := range e.NonceChanges {
|
for _, nonceChange := range e.NonceChanges {
|
||||||
if prevNonceIndex != nil {
|
if prevNonceIndex != nil {
|
||||||
if *prevNonceIndex >= nonceChange.TxIdx {
|
if *prevNonceIndex >= nonceChange.TxIdx {
|
||||||
return nil, fmt.Errorf("nonce diffs not in ascending order by tx index")
|
return fmt.Errorf("nonce diffs not in ascending order by tx index")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prevNonceIndex = &nonceChange.TxIdx
|
prevNonceIndex = &nonceChange.TxIdx
|
||||||
res.NonceChanges[nonceChange.TxIdx] = nonceChange.Nonce
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert code change
|
// Convert code change
|
||||||
if len(e.Code) == 1 {
|
if len(e.Code) == 1 {
|
||||||
res.CodeChange = &CodeChange{
|
if len(e.Code[0].Code) > params.MaxCodeSize {
|
||||||
TxIndex: e.Code[0].TxIndex,
|
return fmt.Errorf("code change contained oversized code")
|
||||||
Code: bytes.Clone(e.Code[0].Code),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &res, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeRLP returns the SSZ-encoded access list wrapped into RLP bytes.
|
// EncodeRLP returns the SSZ-encoded access list wrapped into RLP bytes.
|
||||||
func (b *BlockAccessList) EncodeRLP(wr io.Writer) error {
|
func (b *ConstructionBlockAccessList) EncodeRLP(wr io.Writer) error {
|
||||||
w := rlp.NewEncoderBuffer(wr)
|
w := rlp.NewEncoderBuffer(wr)
|
||||||
buf, err := b.encodeSSZ()
|
buf, err := b.encodeSSZ()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -222,7 +196,7 @@ func (b *BlockAccessList) EncodeRLP(wr io.Writer) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeRLP decodes the bloc accessList.
|
// DecodeRLP decodes the bloc accessList.
|
||||||
func (b *BlockAccessList) DecodeRLP(s *rlp.Stream) error {
|
func (b *BlockAccessList) DecodeSSZRLP(s *rlp.Stream) error {
|
||||||
encBytes, err := s.Bytes()
|
encBytes, err := s.Bytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -231,31 +205,29 @@ func (b *BlockAccessList) DecodeRLP(s *rlp.Stream) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// EncodeFullRLP returns the RLP-encoded access list wrapped into RLP bytes.
|
// EncodeFullRLP returns the RLP-encoded access list wrapped into RLP bytes.
|
||||||
func (b *BlockAccessList) EncodeFullRLP(wr io.Writer) error {
|
func (b *ConstructionBlockAccessList) EncodeFullRLP(wr io.Writer) error {
|
||||||
return b.toEncodingObj().EncodeRLP(wr)
|
return b.toEncodingObj().EncodeRLP(wr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DecodeFullRLP decodes the block accessList with full RLP format.
|
// DecodeFullRLP decodes the block accessList with full RLP format.
|
||||||
func (b *BlockAccessList) DecodeFullRLP(s *rlp.Stream) error {
|
func (b *BlockAccessList) DecodeFullRLP(s *rlp.Stream) error {
|
||||||
var obj encodingBlockAccessList
|
var obj BlockAccessList
|
||||||
if err := obj.DecodeRLP(s); err != nil {
|
if err := obj.DecodeRLP(s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
al, err := obj.toBlockAccessList()
|
if err := obj.validate(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
*b = *al
|
*b = obj
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ rlp.Encoder = &BlockAccessList{}
|
var _ rlp.Encoder = &ConstructionBlockAccessList{}
|
||||||
var _ rlp.Decoder = &BlockAccessList{}
|
|
||||||
|
|
||||||
// toEncodingObj creates an instance of the AccountAccess of the type that is
|
// toEncodingObj creates an instance of the ConstructionAccountAccess of the type that is
|
||||||
// used as input for the encoding.
|
// used as input for the encoding.
|
||||||
func (a *AccountAccess) toEncodingObj(addr common.Address) encodingAccountAccess {
|
func (a *ConstructionAccountAccess) toEncodingObj(addr common.Address) AccountAccess {
|
||||||
res := encodingAccountAccess{
|
res := AccountAccess{
|
||||||
Address: addr,
|
Address: addr,
|
||||||
StorageWrites: make([]encodingSlotWrites, 0),
|
StorageWrites: make([]encodingSlotWrites, 0),
|
||||||
StorageReads: make([][32]byte, 0),
|
StorageReads: make([][32]byte, 0),
|
||||||
|
|
@ -314,7 +286,7 @@ func (a *AccountAccess) toEncodingObj(addr common.Address) encodingAccountAccess
|
||||||
|
|
||||||
// Convert code change
|
// Convert code change
|
||||||
if a.CodeChange != nil {
|
if a.CodeChange != nil {
|
||||||
res.Code = []encodingCodeChange{
|
res.Code = []CodeChange{
|
||||||
{
|
{
|
||||||
a.CodeChange.TxIndex,
|
a.CodeChange.TxIndex,
|
||||||
bytes.Clone(a.CodeChange.Code),
|
bytes.Clone(a.CodeChange.Code),
|
||||||
|
|
@ -326,21 +298,21 @@ func (a *AccountAccess) toEncodingObj(addr common.Address) encodingAccountAccess
|
||||||
|
|
||||||
// toEncodingObj returns an instance of the access list expressed as the type
|
// toEncodingObj returns an instance of the access list expressed as the type
|
||||||
// which is used as input for the encoding/decoding.
|
// which is used as input for the encoding/decoding.
|
||||||
func (b *BlockAccessList) toEncodingObj() *encodingBlockAccessList {
|
func (b *ConstructionBlockAccessList) toEncodingObj() *BlockAccessList {
|
||||||
var addresses []common.Address
|
var addresses []common.Address
|
||||||
for addr := range b.Accounts {
|
for addr := range b.Accounts {
|
||||||
addresses = append(addresses, addr)
|
addresses = append(addresses, addr)
|
||||||
}
|
}
|
||||||
slices.SortFunc(addresses, common.Address.Cmp)
|
slices.SortFunc(addresses, common.Address.Cmp)
|
||||||
|
|
||||||
var res encodingBlockAccessList
|
var res BlockAccessList
|
||||||
for _, addr := range addresses {
|
for _, addr := range addresses {
|
||||||
res.Accesses = append(res.Accesses, b.Accounts[addr].toEncodingObj(addr))
|
res.Accesses = append(res.Accesses, b.Accounts[addr].toEncodingObj(addr))
|
||||||
}
|
}
|
||||||
return &res
|
return &res
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BlockAccessList) encodeSSZ() ([]byte, error) {
|
func (b *ConstructionBlockAccessList) encodeSSZ() ([]byte, error) {
|
||||||
encoderObj := b.toEncodingObj()
|
encoderObj := b.toEncodingObj()
|
||||||
dst, err := encoderObj.MarshalSSZTo(nil)
|
dst, err := encoderObj.MarshalSSZTo(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -350,19 +322,16 @@ func (b *BlockAccessList) encodeSSZ() ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BlockAccessList) decodeSSZ(buf []byte) error {
|
func (b *BlockAccessList) decodeSSZ(buf []byte) error {
|
||||||
var enc encodingBlockAccessList
|
if err := b.UnmarshalSSZ(buf); err != nil {
|
||||||
if err := enc.UnmarshalSSZ(buf); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
res, err := enc.toBlockAccessList()
|
if err := b.validate(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
*b = *res
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *encodingBlockAccessList) prettyPrint() string {
|
func (e *BlockAccessList) PrettyPrint() string {
|
||||||
var res bytes.Buffer
|
var res bytes.Buffer
|
||||||
printWithIndent := func(indent int, text string) {
|
printWithIndent := func(indent int, text string) {
|
||||||
fmt.Fprintf(&res, "%s%s\n", strings.Repeat(" ", indent), text)
|
fmt.Fprintf(&res, "%s%s\n", strings.Repeat(" ", indent), text)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ package bal
|
||||||
import "github.com/ethereum/go-ethereum/rlp"
|
import "github.com/ethereum/go-ethereum/rlp"
|
||||||
import "io"
|
import "io"
|
||||||
|
|
||||||
func (obj *encodingBlockAccessList) EncodeRLP(_w io.Writer) error {
|
func (obj *BlockAccessList) EncodeRLP(_w io.Writer) error {
|
||||||
w := rlp.NewEncoderBuffer(_w)
|
w := rlp.NewEncoderBuffer(_w)
|
||||||
_tmp0 := w.List()
|
_tmp0 := w.List()
|
||||||
_tmp1 := w.List()
|
_tmp1 := w.List()
|
||||||
|
|
@ -63,19 +63,19 @@ func (obj *encodingBlockAccessList) EncodeRLP(_w io.Writer) error {
|
||||||
return w.Flush()
|
return w.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (obj *encodingBlockAccessList) DecodeRLP(dec *rlp.Stream) error {
|
func (obj *BlockAccessList) DecodeRLP(dec *rlp.Stream) error {
|
||||||
var _tmp0 encodingBlockAccessList
|
var _tmp0 BlockAccessList
|
||||||
{
|
{
|
||||||
if _, err := dec.List(); err != nil {
|
if _, err := dec.List(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Accesses:
|
// Accesses:
|
||||||
var _tmp1 []encodingAccountAccess
|
var _tmp1 []AccountAccess
|
||||||
if _, err := dec.List(); err != nil {
|
if _, err := dec.List(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for dec.MoreDataInList() {
|
for dec.MoreDataInList() {
|
||||||
var _tmp2 encodingAccountAccess
|
var _tmp2 AccountAccess
|
||||||
{
|
{
|
||||||
if _, err := dec.List(); err != nil {
|
if _, err := dec.List(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ import (
|
||||||
ssz "github.com/ferranbt/fastssz"
|
ssz "github.com/ferranbt/fastssz"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MarshalSSZ ssz marshals the encodingBlockAccessList object
|
// MarshalSSZ ssz marshals the BlockAccessList object
|
||||||
func (e *encodingBlockAccessList) MarshalSSZ() ([]byte, error) {
|
func (e *BlockAccessList) MarshalSSZ() ([]byte, error) {
|
||||||
return ssz.MarshalSSZ(e)
|
return ssz.MarshalSSZ(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalSSZTo ssz marshals the encodingBlockAccessList object to a target array
|
// MarshalSSZTo ssz marshals the BlockAccessList object to a target array
|
||||||
func (e *encodingBlockAccessList) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
func (e *BlockAccessList) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||||
dst = buf
|
dst = buf
|
||||||
offset := int(4)
|
offset := int(4)
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ func (e *encodingBlockAccessList) MarshalSSZTo(buf []byte) (dst []byte, err erro
|
||||||
|
|
||||||
// Field (0) 'Accesses'
|
// Field (0) 'Accesses'
|
||||||
if size := len(e.Accesses); size > 300000 {
|
if size := len(e.Accesses); size > 300000 {
|
||||||
err = ssz.ErrListTooBigFn("encodingBlockAccessList.Accesses", size, 300000)
|
err = ssz.ErrListTooBigFn("BlockAccessList.Accesses", size, 300000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -41,8 +41,8 @@ func (e *encodingBlockAccessList) MarshalSSZTo(buf []byte) (dst []byte, err erro
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalSSZ ssz unmarshals the encodingBlockAccessList object
|
// UnmarshalSSZ ssz unmarshals the BlockAccessList object
|
||||||
func (e *encodingBlockAccessList) UnmarshalSSZ(buf []byte) error {
|
func (e *BlockAccessList) UnmarshalSSZ(buf []byte) error {
|
||||||
var err error
|
var err error
|
||||||
size := uint64(len(buf))
|
size := uint64(len(buf))
|
||||||
if size < 4 {
|
if size < 4 {
|
||||||
|
|
@ -68,7 +68,7 @@ func (e *encodingBlockAccessList) UnmarshalSSZ(buf []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
e.Accesses = make([]encodingAccountAccess, num)
|
e.Accesses = make([]AccountAccess, num)
|
||||||
err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
|
err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
|
||||||
if err = e.Accesses[indx].UnmarshalSSZ(buf); err != nil {
|
if err = e.Accesses[indx].UnmarshalSSZ(buf); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -82,8 +82,8 @@ func (e *encodingBlockAccessList) UnmarshalSSZ(buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// SizeSSZ returns the ssz encoded size in bytes for the encodingBlockAccessList object
|
// SizeSSZ returns the ssz encoded size in bytes for the BlockAccessList object
|
||||||
func (e *encodingBlockAccessList) SizeSSZ() (size int) {
|
func (e *BlockAccessList) SizeSSZ() (size int) {
|
||||||
size = 4
|
size = 4
|
||||||
|
|
||||||
// Field (0) 'Accesses'
|
// Field (0) 'Accesses'
|
||||||
|
|
@ -95,13 +95,13 @@ func (e *encodingBlockAccessList) SizeSSZ() (size int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// HashTreeRoot ssz hashes the encodingBlockAccessList object
|
// HashTreeRoot ssz hashes the BlockAccessList object
|
||||||
func (e *encodingBlockAccessList) HashTreeRoot() ([32]byte, error) {
|
func (e *BlockAccessList) HashTreeRoot() ([32]byte, error) {
|
||||||
return ssz.HashWithDefaultHasher(e)
|
return ssz.HashWithDefaultHasher(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HashTreeRootWith ssz hashes the encodingBlockAccessList object with a hasher
|
// HashTreeRootWith ssz hashes the BlockAccessList object with a hasher
|
||||||
func (e *encodingBlockAccessList) HashTreeRootWith(hh ssz.HashWalker) (err error) {
|
func (e *BlockAccessList) HashTreeRootWith(hh ssz.HashWalker) (err error) {
|
||||||
indx := hh.Index()
|
indx := hh.Index()
|
||||||
|
|
||||||
// Field (0) 'Accesses'
|
// Field (0) 'Accesses'
|
||||||
|
|
@ -124,8 +124,8 @@ func (e *encodingBlockAccessList) HashTreeRootWith(hh ssz.HashWalker) (err error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTree ssz hashes the encodingBlockAccessList object
|
// GetTree ssz hashes the BlockAccessList object
|
||||||
func (e *encodingBlockAccessList) GetTree() (*ssz.Node, error) {
|
func (e *BlockAccessList) GetTree() (*ssz.Node, error) {
|
||||||
return ssz.ProofTree(e)
|
return ssz.ProofTree(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -547,13 +547,13 @@ func (e *encodingSlotWrites) GetTree() (*ssz.Node, error) {
|
||||||
return ssz.ProofTree(e)
|
return ssz.ProofTree(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalSSZ ssz marshals the encodingAccountAccess object
|
// MarshalSSZ ssz marshals the AccountAccess object
|
||||||
func (e *encodingAccountAccess) MarshalSSZ() ([]byte, error) {
|
func (e *AccountAccess) MarshalSSZ() ([]byte, error) {
|
||||||
return ssz.MarshalSSZ(e)
|
return ssz.MarshalSSZ(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalSSZTo ssz marshals the encodingAccountAccess object to a target array
|
// MarshalSSZTo ssz marshals the AccountAccess object to a target array
|
||||||
func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
func (e *AccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
||||||
dst = buf
|
dst = buf
|
||||||
offset := int(40)
|
offset := int(40)
|
||||||
|
|
||||||
|
|
@ -584,7 +584,7 @@ func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||||
|
|
||||||
// Field (1) 'StorageWrites'
|
// Field (1) 'StorageWrites'
|
||||||
if size := len(e.StorageWrites); size > 300000 {
|
if size := len(e.StorageWrites); size > 300000 {
|
||||||
err = ssz.ErrListTooBigFn("encodingAccountAccess.StorageWrites", size, 300000)
|
err = ssz.ErrListTooBigFn("AccountAccess.StorageWrites", size, 300000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -602,7 +602,7 @@ func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||||
|
|
||||||
// Field (2) 'StorageReads'
|
// Field (2) 'StorageReads'
|
||||||
if size := len(e.StorageReads); size > 300000 {
|
if size := len(e.StorageReads); size > 300000 {
|
||||||
err = ssz.ErrListTooBigFn("encodingAccountAccess.StorageReads", size, 300000)
|
err = ssz.ErrListTooBigFn("AccountAccess.StorageReads", size, 300000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for ii := 0; ii < len(e.StorageReads); ii++ {
|
for ii := 0; ii < len(e.StorageReads); ii++ {
|
||||||
|
|
@ -611,7 +611,7 @@ func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||||
|
|
||||||
// Field (3) 'BalanceChanges'
|
// Field (3) 'BalanceChanges'
|
||||||
if size := len(e.BalanceChanges); size > 300000 {
|
if size := len(e.BalanceChanges); size > 300000 {
|
||||||
err = ssz.ErrListTooBigFn("encodingAccountAccess.BalanceChanges", size, 300000)
|
err = ssz.ErrListTooBigFn("AccountAccess.BalanceChanges", size, 300000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for ii := 0; ii < len(e.BalanceChanges); ii++ {
|
for ii := 0; ii < len(e.BalanceChanges); ii++ {
|
||||||
|
|
@ -622,7 +622,7 @@ func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||||
|
|
||||||
// Field (4) 'NonceChanges'
|
// Field (4) 'NonceChanges'
|
||||||
if size := len(e.NonceChanges); size > 300000 {
|
if size := len(e.NonceChanges); size > 300000 {
|
||||||
err = ssz.ErrListTooBigFn("encodingAccountAccess.NonceChanges", size, 300000)
|
err = ssz.ErrListTooBigFn("AccountAccess.NonceChanges", size, 300000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for ii := 0; ii < len(e.NonceChanges); ii++ {
|
for ii := 0; ii < len(e.NonceChanges); ii++ {
|
||||||
|
|
@ -633,7 +633,7 @@ func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||||
|
|
||||||
// Field (5) 'Code'
|
// Field (5) 'Code'
|
||||||
if size := len(e.Code); size > 1 {
|
if size := len(e.Code); size > 1 {
|
||||||
err = ssz.ErrListTooBigFn("encodingAccountAccess.Code", size, 1)
|
err = ssz.ErrListTooBigFn("AccountAccess.Code", size, 1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
@ -652,8 +652,8 @@ func (e *encodingAccountAccess) MarshalSSZTo(buf []byte) (dst []byte, err error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalSSZ ssz unmarshals the encodingAccountAccess object
|
// UnmarshalSSZ ssz unmarshals the AccountAccess object
|
||||||
func (e *encodingAccountAccess) UnmarshalSSZ(buf []byte) error {
|
func (e *AccountAccess) UnmarshalSSZ(buf []byte) error {
|
||||||
var err error
|
var err error
|
||||||
size := uint64(len(buf))
|
size := uint64(len(buf))
|
||||||
if size < 40 {
|
if size < 40 {
|
||||||
|
|
@ -778,8 +778,8 @@ func (e *encodingAccountAccess) UnmarshalSSZ(buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// SizeSSZ returns the ssz encoded size in bytes for the encodingAccountAccess object
|
// SizeSSZ returns the ssz encoded size in bytes for the AccountAccess object
|
||||||
func (e *encodingAccountAccess) SizeSSZ() (size int) {
|
func (e *AccountAccess) SizeSSZ() (size int) {
|
||||||
size = 40
|
size = 40
|
||||||
|
|
||||||
// Field (1) 'StorageWrites'
|
// Field (1) 'StorageWrites'
|
||||||
|
|
@ -806,13 +806,13 @@ func (e *encodingAccountAccess) SizeSSZ() (size int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// HashTreeRoot ssz hashes the encodingAccountAccess object
|
// HashTreeRoot ssz hashes the AccountAccess object
|
||||||
func (e *encodingAccountAccess) HashTreeRoot() ([32]byte, error) {
|
func (e *AccountAccess) HashTreeRoot() ([32]byte, error) {
|
||||||
return ssz.HashWithDefaultHasher(e)
|
return ssz.HashWithDefaultHasher(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HashTreeRootWith ssz hashes the encodingAccountAccess object with a hasher
|
// HashTreeRootWith ssz hashes the AccountAccess object with a hasher
|
||||||
func (e *encodingAccountAccess) HashTreeRootWith(hh ssz.HashWalker) (err error) {
|
func (e *AccountAccess) HashTreeRootWith(hh ssz.HashWalker) (err error) {
|
||||||
indx := hh.Index()
|
indx := hh.Index()
|
||||||
|
|
||||||
// Field (0) 'Address'
|
// Field (0) 'Address'
|
||||||
|
|
@ -837,7 +837,7 @@ func (e *encodingAccountAccess) HashTreeRootWith(hh ssz.HashWalker) (err error)
|
||||||
// Field (2) 'StorageReads'
|
// Field (2) 'StorageReads'
|
||||||
{
|
{
|
||||||
if size := len(e.StorageReads); size > 300000 {
|
if size := len(e.StorageReads); size > 300000 {
|
||||||
err = ssz.ErrListTooBigFn("encodingAccountAccess.StorageReads", size, 300000)
|
err = ssz.ErrListTooBigFn("AccountAccess.StorageReads", size, 300000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
subIndx := hh.Index()
|
subIndx := hh.Index()
|
||||||
|
|
@ -900,7 +900,7 @@ func (e *encodingAccountAccess) HashTreeRootWith(hh ssz.HashWalker) (err error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTree ssz hashes the encodingAccountAccess object
|
// GetTree ssz hashes the AccountAccess object
|
||||||
func (e *encodingAccountAccess) GetTree() (*ssz.Node, error) {
|
func (e *AccountAccess) GetTree() (*ssz.Node, error) {
|
||||||
return ssz.ProofTree(e)
|
return ssz.ProofTree(e)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import (
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
)
|
)
|
||||||
|
|
||||||
func equalBALs(a *BlockAccessList, b *BlockAccessList) bool {
|
func equalBALs(a *ConstructionBlockAccessList, b *ConstructionBlockAccessList) bool {
|
||||||
if len(a.Accounts) != len(b.Accounts) {
|
if len(a.Accounts) != len(b.Accounts) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -57,9 +57,9 @@ func equalBALs(a *BlockAccessList, b *BlockAccessList) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeTestBAL() *BlockAccessList {
|
func makeTestBAL() *ConstructionBlockAccessList {
|
||||||
return &BlockAccessList{
|
return &ConstructionBlockAccessList{
|
||||||
map[common.Address]*AccountAccess{
|
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[uint16]common.Hash{
|
||||||
common.BytesToHash([]byte{0x01}): {
|
common.BytesToHash([]byte{0x01}): {
|
||||||
|
|
@ -119,7 +119,7 @@ func TestBALEncoding(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("encoding failed: %v\n", err)
|
t.Fatalf("encoding failed: %v\n", err)
|
||||||
}
|
}
|
||||||
var dec BlockAccessList
|
var dec ConstructionBlockAccessList
|
||||||
if err := dec.DecodeRLP(rlp.NewStream(bytes.NewReader(buf.Bytes()), 10000000)); err != nil {
|
if err := dec.DecodeRLP(rlp.NewStream(bytes.NewReader(buf.Bytes()), 10000000)); err != nil {
|
||||||
t.Fatalf("decoding failed: %v\n", err)
|
t.Fatalf("decoding failed: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +139,7 @@ func TestBALFullRLPEncoding(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("encoding failed: %v\n", err)
|
t.Fatalf("encoding failed: %v\n", err)
|
||||||
}
|
}
|
||||||
var dec BlockAccessList
|
var dec ConstructionBlockAccessList
|
||||||
if err := dec.DecodeFullRLP(rlp.NewStream(bytes.NewReader(buf.Bytes()), 10000000)); err != nil {
|
if err := dec.DecodeFullRLP(rlp.NewStream(bytes.NewReader(buf.Bytes()), 10000000)); err != nil {
|
||||||
t.Fatalf("decoding failed: %v\n", err)
|
t.Fatalf("decoding failed: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +165,7 @@ func TestBALDecoding(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
var b BlockAccessList
|
var b ConstructionBlockAccessList
|
||||||
if err := b.decodeSSZ(data); err != nil {
|
if err := b.decodeSSZ(data); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +185,7 @@ func TestBALEncodeSizeDifference(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
var b BlockAccessList
|
var b ConstructionBlockAccessList
|
||||||
if err := b.decodeSSZ(data); err != nil {
|
if err := b.decodeSSZ(data); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue