Skip to content

Commit fb58483

Browse files
committed
Access list state test format (ethereum#22290)
1 parent ed03056 commit fb58483

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 {
@@ -240,7 +241,11 @@ func (tx *stTransaction) toMessage(ps stPostState, number *big.Int) (core.Messag
240241
if err != nil {
241242
return nil, fmt.Errorf("invalid tx data %q", dataHex)
242243
}
243-
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, nil, nil, data, nil, true, nil, number)
244+
var accessList types.AccessList
245+
if tx.AccessLists != nil && tx.AccessLists[ps.Indexes.Data] != nil {
246+
accessList = *tx.AccessLists[ps.Indexes.Data]
247+
}
248+
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, nil, nil, data, accessList, true, nil, number)
244249
return msg, nil
245250
}
246251

0 commit comments

Comments
 (0)