diff --git a/core/types/imports.go b/core/types/imports.go index e286bc9b4c..552a501f30 100644 --- a/core/types/imports.go +++ b/core/types/imports.go @@ -11,23 +11,24 @@ import ( // So we list them all here to avoid having many individual files. type ( AccessList = ethtypes.AccessList - AccessTuple = ethtypes.AccessTuple AccessListTx = ethtypes.AccessListTx + AccessTuple = ethtypes.AccessTuple + BlobTx = ethtypes.BlobTx + BlobTxSidecar = ethtypes.BlobTxSidecar Bloom = ethtypes.Bloom + DynamicFeeTx = ethtypes.DynamicFeeTx + HomesteadSigner = ethtypes.HomesteadSigner + LegacyTx = ethtypes.LegacyTx Receipt = ethtypes.Receipt - Receipts = ethtypes.Receipts ReceiptForStorage = ethtypes.ReceiptForStorage - LegacyTx = ethtypes.LegacyTx - DynamicFeeTx = ethtypes.DynamicFeeTx - BlobTx = ethtypes.BlobTx - BlobTxSidecar = ethtypes.BlobTxSidecar + Receipts = ethtypes.Receipts Signer = ethtypes.Signer - HomesteadSigner = ethtypes.HomesteadSigner - - Transaction = ethtypes.Transaction - Transactions = ethtypes.Transactions - TxByNonce = ethtypes.TxByNonce - TxData = ethtypes.TxData + SlimAccount = ethtypes.SlimAccount + StateAccount = ethtypes.StateAccount + Transaction = ethtypes.Transaction + Transactions = ethtypes.Transactions + TxByNonce = ethtypes.TxByNonce + TxData = ethtypes.TxData ) // The following constants are used directly as their upstream definitions. @@ -38,39 +39,43 @@ const ( ReceiptStatusSuccessful = ethtypes.ReceiptStatusSuccessful // Transaction types. - LegacyTxType = ethtypes.LegacyTxType AccessListTxType = ethtypes.AccessListTxType - DynamicFeeTxType = ethtypes.DynamicFeeTxType BlobTxType = ethtypes.BlobTxType + DynamicFeeTxType = ethtypes.DynamicFeeTxType + LegacyTxType = ethtypes.LegacyTxType ) // The following functions are used directly as their upstream definitions. var ( - BloomLookup = ethtypes.BloomLookup - BytesToBloom = ethtypes.BytesToBloom - CreateBloom = ethtypes.CreateBloom - NewReceipt = ethtypes.NewReceipt - NewContractCreation = ethtypes.NewContractCreation - NewTransaction = ethtypes.NewTransaction + BloomLookup = ethtypes.BloomLookup + BytesToBloom = ethtypes.BytesToBloom + CreateBloom = ethtypes.CreateBloom + FullAccount = ethtypes.FullAccount + FullAccountRLP = ethtypes.FullAccountRLP + NewContractCreation = ethtypes.NewContractCreation + NewEmptyStateAccount = ethtypes.NewEmptyStateAccount + NewReceipt = ethtypes.NewReceipt + NewTransaction = ethtypes.NewTransaction + SlimAccountRLP = ethtypes.SlimAccountRLP // Signers - NewEIP155Signer = ethtypes.NewEIP155Signer - NewEIP2930Signer = ethtypes.NewEIP2930Signer - NewLondonSigner = ethtypes.NewLondonSigner - NewCancunSigner = ethtypes.NewCancunSigner - MakeSigner = ethtypes.MakeSigner LatestSigner = ethtypes.LatestSigner LatestSignerForChainID = ethtypes.LatestSignerForChainID - SignTx = ethtypes.SignTx - SignNewTx = ethtypes.SignNewTx + MakeSigner = ethtypes.MakeSigner MustSignNewTx = ethtypes.MustSignNewTx + NewCancunSigner = ethtypes.NewCancunSigner + NewEIP155Signer = ethtypes.NewEIP155Signer + NewEIP2930Signer = ethtypes.NewEIP2930Signer + NewLondonSigner = ethtypes.NewLondonSigner Sender = ethtypes.Sender + SignNewTx = ethtypes.SignNewTx + SignTx = ethtypes.SignTx // Transactions NewTx = ethtypes.NewTx TxDifference = ethtypes.TxDifference // Errors - ErrTxTypeNotSupported = ethtypes.ErrTxTypeNotSupported ErrGasFeeCapTooLow = ethtypes.ErrGasFeeCapTooLow + ErrTxTypeNotSupported = ethtypes.ErrTxTypeNotSupported ) diff --git a/core/types/libevm.go b/core/types/libevm.go new file mode 100644 index 0000000000..31a603d421 --- /dev/null +++ b/core/types/libevm.go @@ -0,0 +1,14 @@ +// (c) 2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package types + +import ( + ethtypes "github.com/ava-labs/libevm/core/types" +) + +var extras = ethtypes.RegisterExtras[ + ethtypes.NOOPHeaderHooks, *ethtypes.NOOPHeaderHooks, + ethtypes.NOOPBlockBodyHooks, *ethtypes.NOOPBlockBodyHooks, + isMultiCoin, +]() diff --git a/core/types/state_account.go b/core/types/state_account.go index 8fe2edf2ff..fe080c144b 100644 --- a/core/types/state_account.go +++ b/core/types/state_account.go @@ -1,4 +1,4 @@ -// (c) 2019-2021, Ava Labs, Inc. +// (c) 2019-2025, Ava Labs, Inc. // // This file is a derived work, based on the go-ethereum library whose original // notices appear below. @@ -30,30 +30,9 @@ import ( ethtypes "github.com/ava-labs/libevm/core/types" ) -type ( - // Import these types from the go-ethereum package - StateAccount = ethtypes.StateAccount - SlimAccount = ethtypes.SlimAccount -) - -var ( - // Import these functions from the go-ethereum package - NewEmptyStateAccount = ethtypes.NewEmptyStateAccount - SlimAccountRLP = ethtypes.SlimAccountRLP - FullAccount = ethtypes.FullAccount - FullAccountRLP = ethtypes.FullAccountRLP -) - type isMultiCoin bool -var ( - extras = ethtypes.RegisterExtras[ - ethtypes.NOOPHeaderHooks, *ethtypes.NOOPHeaderHooks, - ethtypes.NOOPBlockBodyHooks, *ethtypes.NOOPBlockBodyHooks, - isMultiCoin, - ]() - IsMultiCoinPayloads = extras.StateAccount -) +var IsMultiCoinPayloads = extras.StateAccount func IsMultiCoin(s ethtypes.StateOrSlimAccount) bool { return bool(IsMultiCoinPayloads.Get(s))