Skip to content

Commit 1451f38

Browse files
committed
Access list state test format (ethereum#22290)
1 parent c257fa0 commit 1451f38

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

tests/gen_stenv.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/gen_sttransaction.go

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/gen_vmexec.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/state_test_util.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ type stEnvMarshaling struct {
9393
//go:generate gencodec -type stTransaction -field-override stTransactionMarshaling -out gen_sttransaction.go
9494

9595
type stTransaction struct {
96-
GasPrice *big.Int `json:"gasPrice"`
97-
Nonce uint64 `json:"nonce"`
98-
To string `json:"to"`
99-
Data []string `json:"data"`
100-
GasLimit []uint64 `json:"gasLimit"`
101-
Value []string `json:"value"`
102-
PrivateKey []byte `json:"secretKey"`
96+
GasPrice *big.Int `json:"gasPrice"`
97+
Nonce uint64 `json:"nonce"`
98+
To string `json:"to"`
99+
Data []string `json:"data"`
100+
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
101+
GasLimit []uint64 `json:"gasLimit"`
102+
Value []string `json:"value"`
103+
PrivateKey []byte `json:"secretKey"`
103104
}
104105

105106
type stTransactionMarshaling struct {
@@ -241,7 +242,11 @@ func (tx *stTransaction) toMessage(ps stPostState, number *big.Int) (core.Messag
241242
if err != nil {
242243
return nil, fmt.Errorf("invalid tx data %q", dataHex)
243244
}
244-
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, nil, nil, data, nil, true, nil, number)
245+
var accessList types.AccessList
246+
if tx.AccessLists != nil && tx.AccessLists[ps.Indexes.Data] != nil {
247+
accessList = *tx.AccessLists[ps.Indexes.Data]
248+
}
249+
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, nil, nil, data, accessList, true, nil, number)
245250
return msg, nil
246251
}
247252

0 commit comments

Comments
 (0)