Skip to content

Commit

Permalink
Access list state test format (ethereum#22290)
Browse files Browse the repository at this point in the history
  • Loading branch information
gzliudan committed Aug 12, 2024
1 parent ce65327 commit ab8456d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
2 changes: 2 additions & 0 deletions tests/gen_stenv.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 23 additions & 14 deletions tests/gen_sttransaction.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tests/gen_vmexec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions tests/state_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ type stEnvMarshaling struct {
//go:generate gencodec -type stTransaction -field-override stTransactionMarshaling -out gen_sttransaction.go

type stTransaction struct {
GasPrice *big.Int `json:"gasPrice"`
Nonce uint64 `json:"nonce"`
To string `json:"to"`
Data []string `json:"data"`
GasLimit []uint64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey []byte `json:"secretKey"`
GasPrice *big.Int `json:"gasPrice"`
Nonce uint64 `json:"nonce"`
To string `json:"to"`
Data []string `json:"data"`
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
GasLimit []uint64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey []byte `json:"secretKey"`
}

type stTransactionMarshaling struct {
Expand Down Expand Up @@ -240,7 +241,11 @@ func (tx *stTransaction) toMessage(ps stPostState, number *big.Int) (core.Messag
if err != nil {
return nil, fmt.Errorf("invalid tx data %q", dataHex)
}
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, nil, nil, data, nil, true, nil, number)
var accessList types.AccessList
if tx.AccessLists != nil && tx.AccessLists[ps.Indexes.Data] != nil {
accessList = *tx.AccessLists[ps.Indexes.Data]
}
msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, tx.GasPrice, nil, nil, data, accessList, true, nil, number)
return msg, nil
}

Expand Down

0 comments on commit ab8456d

Please sign in to comment.