chore(ci): check gencodec generated files are up to date

- fix generation of code using type aliases and Go 1.23
- reproducible generation locally (pin gencodec version)
- CI keeps generated Go files up to date with other source code
- Generate missing files

See original PR https://github.com/ava-labs/coreth/pull/856
This commit is contained in:
Quentin McGaw
2025-04-01 10:11:55 +02:00
committed by Quentin Mc Gaw
parent 2967749cb4
commit 8c6fac7b65
10 changed files with 419 additions and 11 deletions
+6
View File
@@ -57,6 +57,12 @@ jobs:
run: echo "TIMEOUT=1200s" >> "$GITHUB_ENV"
- run: go mod download
shell: bash
- name: fjl/gencodec generated files are up to date
run: |
grep -lr -E '^// Code generated by github\.com\/fjl\/gencodec\. DO NOT EDIT\.$' . | xargs -r rm
go generate -run "github.com/fjl/gencodec" ./...
git add --intent-to-add --all
git diff --exit-code
- name: Mocks are up to date
shell: bash
run: |
+5 -5
View File
@@ -7,10 +7,10 @@ import (
"errors"
"math/big"
"github.com/ava-labs/subnet-evm/core/types"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/common/hexutil"
"github.com/ava-labs/libevm/common/math"
types0 "github.com/ava-labs/subnet-evm/core/types"
)
var _ = (*headerMarshaling)(nil)
@@ -24,7 +24,7 @@ func (h header) MarshalJSON() ([]byte, error) {
Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash *common.Hash `json:"transactionsRoot"`
ReceiptHash *common.Hash `json:"receiptsRoot"`
Bloom types.Bloom `json:"logsBloom"`
Bloom types0.Bloom `json:"logsBloom"`
Difficulty *math.HexOrDecimal256 `json:"difficulty"`
Number *math.HexOrDecimal256 `json:"number" gencodec:"required"`
GasLimit math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"`
@@ -32,7 +32,7 @@ func (h header) MarshalJSON() ([]byte, error) {
Time math.HexOrDecimal64 `json:"timestamp" gencodec:"required"`
Extra hexutil.Bytes `json:"extraData"`
MixDigest common.Hash `json:"mixHash"`
Nonce *types.BlockNonce `json:"nonce"`
Nonce *types0.BlockNonce `json:"nonce"`
BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas" rlp:"optional"`
BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas" rlp:"optional"`
@@ -70,7 +70,7 @@ func (h *header) UnmarshalJSON(input []byte) error {
Root *common.Hash `json:"stateRoot" gencodec:"required"`
TxHash *common.Hash `json:"transactionsRoot"`
ReceiptHash *common.Hash `json:"receiptsRoot"`
Bloom *types.Bloom `json:"logsBloom"`
Bloom *types0.Bloom `json:"logsBloom"`
Difficulty *math.HexOrDecimal256 `json:"difficulty"`
Number *math.HexOrDecimal256 `json:"number" gencodec:"required"`
GasLimit *math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"`
@@ -78,7 +78,7 @@ func (h *header) UnmarshalJSON(input []byte) error {
Time *math.HexOrDecimal64 `json:"timestamp" gencodec:"required"`
Extra *hexutil.Bytes `json:"extraData"`
MixDigest *common.Hash `json:"mixHash"`
Nonce *types.BlockNonce `json:"nonce"`
Nonce *types0.BlockNonce `json:"nonce"`
BaseFee *math.HexOrDecimal256 `json:"baseFeePerGas" rlp:"optional"`
BlobGasUsed *math.HexOrDecimal64 `json:"blobGasUsed" rlp:"optional"`
ExcessBlobGas *math.HexOrDecimal64 `json:"excessBlobGas" rlp:"optional"`
+4 -4
View File
@@ -7,11 +7,11 @@ import (
"errors"
"math/big"
"github.com/ava-labs/subnet-evm/core/types"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/common/hexutil"
"github.com/ava-labs/libevm/common/math"
"github.com/ava-labs/libevm/params"
"github.com/ava-labs/subnet-evm/core/types"
params0 "github.com/ava-labs/subnet-evm/params"
)
var _ = (*genesisSpecMarshaling)(nil)
@@ -19,7 +19,7 @@ var _ = (*genesisSpecMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (g Genesis) MarshalJSON() ([]byte, error) {
type Genesis struct {
Config *params.ChainConfig `json:"config"`
Config *params0.ChainConfig `json:"config"`
Nonce math.HexOrDecimal64 `json:"nonce"`
Timestamp math.HexOrDecimal64 `json:"timestamp"`
ExtraData hexutil.Bytes `json:"extraData"`
@@ -68,7 +68,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
// UnmarshalJSON unmarshals from JSON.
func (g *Genesis) UnmarshalJSON(input []byte) error {
type Genesis struct {
Config *params.ChainConfig `json:"config"`
Config *params0.ChainConfig `json:"config"`
Nonce *math.HexOrDecimal64 `json:"nonce"`
Timestamp *math.HexOrDecimal64 `json:"timestamp"`
ExtraData *hexutil.Bytes `json:"extraData"`
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"github.com/ava-labs/libevm/common/math"
)
//go:generate go run github.com/fjl/gencodec@a3c3302847cea77ab534228aefa025992dc2c696 -type Account -field-override accountMarshaling -out gen_account.go
//go:generate go run github.com/fjl/gencodec -type Account -field-override accountMarshaling -out gen_account.go
// Account represents an Ethereum account and its attached data.
// This type is used to specify accounts in the genesis block state, and
+1 -1
View File
@@ -148,7 +148,7 @@ func (h *HeaderSerializable) updateToExtras(extras *HeaderExtra) {
extras.BlockGasCost = h.BlockGasCost
}
//go:generate go run github.com/fjl/gencodec@a3c3302847cea77ab534228aefa025992dc2c696 -type HeaderSerializable -field-override headerMarshaling -out gen_header_serializable_json.go
//go:generate go run github.com/fjl/gencodec -type HeaderSerializable -field-override headerMarshaling -out gen_header_serializable_json.go
//go:generate go run github.com/ava-labs/libevm/rlp/rlpgen@739ba847f6f407f63fd6a24175b24e56fea583a1 -type HeaderSerializable -out gen_header_serializable_rlp.go
// HeaderSerializable defines the header of a block in the Ethereum blockchain,
+273
View File
@@ -0,0 +1,273 @@
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package ethconfig
import (
"time"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/subnet-evm/core"
"github.com/ava-labs/subnet-evm/core/txpool/blobpool"
"github.com/ava-labs/subnet-evm/core/txpool/legacypool"
"github.com/ava-labs/subnet-evm/eth/gasprice"
"github.com/ava-labs/subnet-evm/miner"
)
// MarshalTOML marshals as TOML.
func (c Config) MarshalTOML() (interface{}, error) {
type Config struct {
Genesis *core.Genesis `toml:",omitempty"`
NetworkId uint64
Pruning bool
AcceptorQueueLimit int
CommitInterval uint64
PopulateMissingTries *uint64
PopulateMissingTriesParallelism int
AllowMissingTries bool
SnapshotDelayInit bool
SnapshotWait bool
SnapshotVerify bool
SkipSnapshotRebuild bool
SkipBcVersionCheck bool `toml:"-"`
TrieCleanCache int
TrieDirtyCache int
TrieDirtyCommitTarget int
TriePrefetcherParallelism int
SnapshotCache int
Preimages bool
AcceptedCacheSize int
Miner miner.Config
TxPool legacypool.Config
BlobPool blobpool.Config
GPO gasprice.Config
EnablePreimageRecording bool
RPCGasCap uint64 `toml:",omitempty"`
RPCEVMTimeout time.Duration
RPCTxFeeCap float64 `toml:",omitempty"`
AllowUnfinalizedQueries bool
HistoricalProofQueryWindow uint64
AllowUnprotectedTxs bool
AllowUnprotectedTxHashes []common.Hash
OfflinePruning bool
OfflinePruningBloomFilterSize uint64
OfflinePruningDataDirectory string
SkipUpgradeCheck bool
TransactionHistory uint64 `toml:",omitempty"`
StateHistory uint64 `toml:",omitempty"`
StateScheme string `toml:",omitempty"`
SkipTxIndexing bool
}
var enc Config
enc.Genesis = c.Genesis
enc.NetworkId = c.NetworkId
enc.Pruning = c.Pruning
enc.AcceptorQueueLimit = c.AcceptorQueueLimit
enc.CommitInterval = c.CommitInterval
enc.PopulateMissingTries = c.PopulateMissingTries
enc.PopulateMissingTriesParallelism = c.PopulateMissingTriesParallelism
enc.AllowMissingTries = c.AllowMissingTries
enc.SnapshotDelayInit = c.SnapshotDelayInit
enc.SnapshotWait = c.SnapshotWait
enc.SnapshotVerify = c.SnapshotVerify
enc.SkipSnapshotRebuild = c.SkipSnapshotRebuild
enc.SkipBcVersionCheck = c.SkipBcVersionCheck
enc.TrieCleanCache = c.TrieCleanCache
enc.TrieDirtyCache = c.TrieDirtyCache
enc.TrieDirtyCommitTarget = c.TrieDirtyCommitTarget
enc.TriePrefetcherParallelism = c.TriePrefetcherParallelism
enc.SnapshotCache = c.SnapshotCache
enc.Preimages = c.Preimages
enc.AcceptedCacheSize = c.AcceptedCacheSize
enc.Miner = c.Miner
enc.TxPool = c.TxPool
enc.BlobPool = c.BlobPool
enc.GPO = c.GPO
enc.EnablePreimageRecording = c.EnablePreimageRecording
enc.RPCGasCap = c.RPCGasCap
enc.RPCEVMTimeout = c.RPCEVMTimeout
enc.RPCTxFeeCap = c.RPCTxFeeCap
enc.AllowUnfinalizedQueries = c.AllowUnfinalizedQueries
enc.HistoricalProofQueryWindow = c.HistoricalProofQueryWindow
enc.AllowUnprotectedTxs = c.AllowUnprotectedTxs
enc.AllowUnprotectedTxHashes = c.AllowUnprotectedTxHashes
enc.OfflinePruning = c.OfflinePruning
enc.OfflinePruningBloomFilterSize = c.OfflinePruningBloomFilterSize
enc.OfflinePruningDataDirectory = c.OfflinePruningDataDirectory
enc.SkipUpgradeCheck = c.SkipUpgradeCheck
enc.TransactionHistory = c.TransactionHistory
enc.StateHistory = c.StateHistory
enc.StateScheme = c.StateScheme
enc.SkipTxIndexing = c.SkipTxIndexing
return &enc, nil
}
// UnmarshalTOML unmarshals from TOML.
func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
type Config struct {
Genesis *core.Genesis `toml:",omitempty"`
NetworkId *uint64
Pruning *bool
AcceptorQueueLimit *int
CommitInterval *uint64
PopulateMissingTries *uint64
PopulateMissingTriesParallelism *int
AllowMissingTries *bool
SnapshotDelayInit *bool
SnapshotWait *bool
SnapshotVerify *bool
SkipSnapshotRebuild *bool
SkipBcVersionCheck *bool `toml:"-"`
TrieCleanCache *int
TrieDirtyCache *int
TrieDirtyCommitTarget *int
TriePrefetcherParallelism *int
SnapshotCache *int
Preimages *bool
AcceptedCacheSize *int
Miner *miner.Config
TxPool *legacypool.Config
BlobPool *blobpool.Config
GPO *gasprice.Config
EnablePreimageRecording *bool
RPCGasCap *uint64 `toml:",omitempty"`
RPCEVMTimeout *time.Duration
RPCTxFeeCap *float64 `toml:",omitempty"`
AllowUnfinalizedQueries *bool
HistoricalProofQueryWindow *uint64
AllowUnprotectedTxs *bool
AllowUnprotectedTxHashes []common.Hash
OfflinePruning *bool
OfflinePruningBloomFilterSize *uint64
OfflinePruningDataDirectory *string
SkipUpgradeCheck *bool
TransactionHistory *uint64 `toml:",omitempty"`
StateHistory *uint64 `toml:",omitempty"`
StateScheme *string `toml:",omitempty"`
SkipTxIndexing *bool
}
var dec Config
if err := unmarshal(&dec); err != nil {
return err
}
if dec.Genesis != nil {
c.Genesis = dec.Genesis
}
if dec.NetworkId != nil {
c.NetworkId = *dec.NetworkId
}
if dec.Pruning != nil {
c.Pruning = *dec.Pruning
}
if dec.AcceptorQueueLimit != nil {
c.AcceptorQueueLimit = *dec.AcceptorQueueLimit
}
if dec.CommitInterval != nil {
c.CommitInterval = *dec.CommitInterval
}
if dec.PopulateMissingTries != nil {
c.PopulateMissingTries = dec.PopulateMissingTries
}
if dec.PopulateMissingTriesParallelism != nil {
c.PopulateMissingTriesParallelism = *dec.PopulateMissingTriesParallelism
}
if dec.AllowMissingTries != nil {
c.AllowMissingTries = *dec.AllowMissingTries
}
if dec.SnapshotDelayInit != nil {
c.SnapshotDelayInit = *dec.SnapshotDelayInit
}
if dec.SnapshotWait != nil {
c.SnapshotWait = *dec.SnapshotWait
}
if dec.SnapshotVerify != nil {
c.SnapshotVerify = *dec.SnapshotVerify
}
if dec.SkipSnapshotRebuild != nil {
c.SkipSnapshotRebuild = *dec.SkipSnapshotRebuild
}
if dec.SkipBcVersionCheck != nil {
c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
}
if dec.TrieCleanCache != nil {
c.TrieCleanCache = *dec.TrieCleanCache
}
if dec.TrieDirtyCache != nil {
c.TrieDirtyCache = *dec.TrieDirtyCache
}
if dec.TrieDirtyCommitTarget != nil {
c.TrieDirtyCommitTarget = *dec.TrieDirtyCommitTarget
}
if dec.TriePrefetcherParallelism != nil {
c.TriePrefetcherParallelism = *dec.TriePrefetcherParallelism
}
if dec.SnapshotCache != nil {
c.SnapshotCache = *dec.SnapshotCache
}
if dec.Preimages != nil {
c.Preimages = *dec.Preimages
}
if dec.AcceptedCacheSize != nil {
c.AcceptedCacheSize = *dec.AcceptedCacheSize
}
if dec.Miner != nil {
c.Miner = *dec.Miner
}
if dec.TxPool != nil {
c.TxPool = *dec.TxPool
}
if dec.BlobPool != nil {
c.BlobPool = *dec.BlobPool
}
if dec.GPO != nil {
c.GPO = *dec.GPO
}
if dec.EnablePreimageRecording != nil {
c.EnablePreimageRecording = *dec.EnablePreimageRecording
}
if dec.RPCGasCap != nil {
c.RPCGasCap = *dec.RPCGasCap
}
if dec.RPCEVMTimeout != nil {
c.RPCEVMTimeout = *dec.RPCEVMTimeout
}
if dec.RPCTxFeeCap != nil {
c.RPCTxFeeCap = *dec.RPCTxFeeCap
}
if dec.AllowUnfinalizedQueries != nil {
c.AllowUnfinalizedQueries = *dec.AllowUnfinalizedQueries
}
if dec.HistoricalProofQueryWindow != nil {
c.HistoricalProofQueryWindow = *dec.HistoricalProofQueryWindow
}
if dec.AllowUnprotectedTxs != nil {
c.AllowUnprotectedTxs = *dec.AllowUnprotectedTxs
}
if dec.AllowUnprotectedTxHashes != nil {
c.AllowUnprotectedTxHashes = dec.AllowUnprotectedTxHashes
}
if dec.OfflinePruning != nil {
c.OfflinePruning = *dec.OfflinePruning
}
if dec.OfflinePruningBloomFilterSize != nil {
c.OfflinePruningBloomFilterSize = *dec.OfflinePruningBloomFilterSize
}
if dec.OfflinePruningDataDirectory != nil {
c.OfflinePruningDataDirectory = *dec.OfflinePruningDataDirectory
}
if dec.SkipUpgradeCheck != nil {
c.SkipUpgradeCheck = *dec.SkipUpgradeCheck
}
if dec.TransactionHistory != nil {
c.TransactionHistory = *dec.TransactionHistory
}
if dec.StateHistory != nil {
c.StateHistory = *dec.StateHistory
}
if dec.StateScheme != nil {
c.StateScheme = *dec.StateScheme
}
if dec.SkipTxIndexing != nil {
c.SkipTxIndexing = *dec.SkipTxIndexing
}
return nil
}
+2
View File
@@ -10,6 +10,7 @@ require (
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set/v2 v2.1.0
github.com/fjl/gencodec v0.1.1
github.com/go-cmd/cmd v1.4.1
github.com/gorilla/rpc v1.2.0
github.com/gorilla/websocket v1.5.0
@@ -73,6 +74,7 @@ require (
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
+4
View File
@@ -193,6 +193,8 @@ github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fjl/gencodec v0.1.1 h1:DhQY29Q6JLXB/GgMqE86NbOEuvckiYcJCbXFu02toms=
github.com/fjl/gencodec v0.1.1/go.mod h1:chDHL3wKXuBgauP8x3XNZkl5EIAR5SoCTmmmDTZRzmw=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -200,6 +202,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 h1:IZqZOB2fydHte3kUgxrzK5E1fW7RQGeDwE8F/ZZnUYc=
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8=
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays=
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
+120
View File
@@ -0,0 +1,120 @@
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package tests
import (
"encoding/json"
"math/big"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/common/hexutil"
"github.com/ava-labs/libevm/common/math"
types0 "github.com/ava-labs/subnet-evm/core/types"
)
var _ = (*stTransactionMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (s stTransaction) MarshalJSON() ([]byte, error) {
type stTransaction struct {
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
Nonce math.HexOrDecimal64 `json:"nonce"`
To string `json:"to"`
Data []string `json:"data"`
AccessLists []*types0.AccessList `json:"accessLists,omitempty"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey hexutil.Bytes `json:"secretKey"`
Sender *common.Address `json:"sender"`
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
}
var enc stTransaction
enc.GasPrice = (*math.HexOrDecimal256)(s.GasPrice)
enc.MaxFeePerGas = (*math.HexOrDecimal256)(s.MaxFeePerGas)
enc.MaxPriorityFeePerGas = (*math.HexOrDecimal256)(s.MaxPriorityFeePerGas)
enc.Nonce = math.HexOrDecimal64(s.Nonce)
enc.To = s.To
enc.Data = s.Data
enc.AccessLists = s.AccessLists
if s.GasLimit != nil {
enc.GasLimit = make([]math.HexOrDecimal64, len(s.GasLimit))
for k, v := range s.GasLimit {
enc.GasLimit[k] = math.HexOrDecimal64(v)
}
}
enc.Value = s.Value
enc.PrivateKey = s.PrivateKey
enc.Sender = s.Sender
enc.BlobVersionedHashes = s.BlobVersionedHashes
enc.BlobGasFeeCap = (*math.HexOrDecimal256)(s.BlobGasFeeCap)
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (s *stTransaction) UnmarshalJSON(input []byte) error {
type stTransaction struct {
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
Nonce *math.HexOrDecimal64 `json:"nonce"`
To *string `json:"to"`
Data []string `json:"data"`
AccessLists []*types0.AccessList `json:"accessLists,omitempty"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey *hexutil.Bytes `json:"secretKey"`
Sender *common.Address `json:"sender"`
BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
BlobGasFeeCap *math.HexOrDecimal256 `json:"maxFeePerBlobGas,omitempty"`
}
var dec stTransaction
if err := json.Unmarshal(input, &dec); err != nil {
return err
}
if dec.GasPrice != nil {
s.GasPrice = (*big.Int)(dec.GasPrice)
}
if dec.MaxFeePerGas != nil {
s.MaxFeePerGas = (*big.Int)(dec.MaxFeePerGas)
}
if dec.MaxPriorityFeePerGas != nil {
s.MaxPriorityFeePerGas = (*big.Int)(dec.MaxPriorityFeePerGas)
}
if dec.Nonce != nil {
s.Nonce = uint64(*dec.Nonce)
}
if dec.To != nil {
s.To = *dec.To
}
if dec.Data != nil {
s.Data = dec.Data
}
if dec.AccessLists != nil {
s.AccessLists = dec.AccessLists
}
if dec.GasLimit != nil {
s.GasLimit = make([]uint64, len(dec.GasLimit))
for k, v := range dec.GasLimit {
s.GasLimit[k] = uint64(v)
}
}
if dec.Value != nil {
s.Value = dec.Value
}
if dec.PrivateKey != nil {
s.PrivateKey = *dec.PrivateKey
}
if dec.Sender != nil {
s.Sender = dec.Sender
}
if dec.BlobVersionedHashes != nil {
s.BlobVersionedHashes = dec.BlobVersionedHashes
}
if dec.BlobGasFeeCap != nil {
s.BlobGasFeeCap = (*big.Int)(dec.BlobGasFeeCap)
}
return nil
}
+3
View File
@@ -1,8 +1,11 @@
// (c) 2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build tools
package subnetevm
import (
_ "github.com/fjl/gencodec"
_ "golang.org/x/mod/modfile" // golang.org/x/mod to satisfy requirement for go.uber.org/mock/[email protected]
)