diff --git a/ethergo/backends/anvil/hardfork.go b/ethergo/backends/anvil/hardfork.go index ef72a931a8..cc2bae1dcd 100644 --- a/ethergo/backends/anvil/hardfork.go +++ b/ethergo/backends/anvil/hardfork.go @@ -70,7 +70,6 @@ func (h Hardfork) ToChainConfig(chainID *big.Int) *params.ChainConfig { // https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/tangerine-whistle.md if h >= Tangerine { baseConfig.EIP150Block = big.NewInt(0) - baseConfig.EIP150Hash = params.MainnetChainConfig.EIP150Hash } // https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md diff --git a/ethergo/backends/simulated/multibackend/chainid.go b/ethergo/backends/simulated/multibackend/chainid.go index ae0468f54c..d6ef687968 100644 --- a/ethergo/backends/simulated/multibackend/chainid.go +++ b/ethergo/backends/simulated/multibackend/chainid.go @@ -21,7 +21,6 @@ func NewConfigWithChainID(chainID *big.Int) *params.ChainConfig { DAOForkBlock: util.CopyBigInt(params.AllEthashProtocolChanges.DAOForkBlock), DAOForkSupport: params.AllEthashProtocolChanges.DAOForkSupport, EIP150Block: util.CopyBigInt(params.AllEthashProtocolChanges.EIP150Block), - EIP150Hash: params.AllEthashProtocolChanges.EIP150Hash, EIP155Block: util.CopyBigInt(params.AllEthashProtocolChanges.EIP155Block), EIP158Block: util.CopyBigInt(params.AllEthashProtocolChanges.EIP158Block), ByzantiumBlock: util.CopyBigInt(params.AllEthashProtocolChanges.ByzantiumBlock), @@ -62,6 +61,6 @@ func NewSimulatedBackendWithConfig(alloc core.GenesisAlloc, gasLimit uint64, con backend.filterSystem = filters.NewFilterSystem(filterBackend, filters.Config{}) backend.events = filters.NewEventSystem(backend.filterSystem, false) - backend.rollback(blockchain.CurrentBlock()) + backend.rollback(blockchain.GetBlock(blockchain.CurrentBlock().Hash(), blockchain.CurrentBlock().Number.Uint64())) return backend } diff --git a/ethergo/chain/client/config.go b/ethergo/chain/client/config.go index 86294b0f7c..c529ba8df4 100644 --- a/ethergo/chain/client/config.go +++ b/ethergo/chain/client/config.go @@ -133,7 +133,6 @@ var ( DAOForkBlock: big.NewInt(0), DAOForkSupport: true, EIP150Block: big.NewInt(0), - EIP150Hash: ethCommon.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), @@ -151,7 +150,6 @@ var ( DAOForkBlock: big.NewInt(0), DAOForkSupport: true, EIP150Block: big.NewInt(0), - EIP150Hash: ethCommon.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), diff --git a/ethergo/chain/gas/londinium/config_test.go b/ethergo/chain/gas/londinium/config_test.go index b1e3068749..5b7dc949f8 100644 --- a/ethergo/chain/gas/londinium/config_test.go +++ b/ethergo/chain/gas/londinium/config_test.go @@ -14,8 +14,8 @@ func (l LondoniumSuite) TestLondoniumConfig() { newConfig := gasprice.Config{ Blocks: int(gofakeit.Int64()), Percentile: gofakeit.Number(1, 100), - MaxHeaderHistory: int(gofakeit.Int64()), - MaxBlockHistory: int(gofakeit.Int64()), + MaxHeaderHistory: gofakeit.Uint64(), + MaxBlockHistory: gofakeit.Uint64(), Default: defaultPrice, MaxPrice: big.NewInt(0).Mul(defaultPrice, big.NewInt(2)), IgnorePrice: big.NewInt(0).Div(defaultPrice, big.NewInt(2)), diff --git a/ethergo/chain/gas/londinium/gasprice_test.go b/ethergo/chain/gas/londinium/gasprice_test.go index cc32789aec..63422bcd93 100644 --- a/ethergo/chain/gas/londinium/gasprice_test.go +++ b/ethergo/chain/gas/londinium/gasprice_test.go @@ -42,14 +42,14 @@ type testBackend struct { func (b *testBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) { if number == rpc.LatestBlockNumber { - return b.chain.CurrentBlock().Header(), nil + return b.chain.CurrentBlock(), nil } return b.chain.GetHeaderByNumber(uint64(number)), nil } func (b *testBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) { if number == rpc.LatestBlockNumber { - return b.chain.CurrentBlock(), nil + return b.chain.GetBlockByHash(b.chain.CurrentBlock().Hash()), nil } return b.chain.GetBlockByNumber(uint64(number)), nil } diff --git a/ethergo/chain/gas/london/oracle_backend.go b/ethergo/chain/gas/london/oracle_backend.go index 1e640da284..8b4574943e 100644 --- a/ethergo/chain/gas/london/oracle_backend.go +++ b/ethergo/chain/gas/london/oracle_backend.go @@ -64,7 +64,7 @@ func (h HeightOracleBackend) GetReceipts(ctx context.Context, hash common.Hash) var receipts types.Receipts - err = receipts.DeriveFields(h.ChainConfig(), hash, block.NumberU64(), block.Transactions()) + err = receipts.DeriveFields(h.ChainConfig(), hash, block.NumberU64(), block.BaseFee(), block.Transactions()) if err != nil { return nil, fmt.Errorf("could not derive receipts from block: %w", err) } diff --git a/ethergo/submitter/db/txdb/store.go b/ethergo/submitter/db/txdb/store.go index 7e98130ba3..2fef1cee08 100644 --- a/ethergo/submitter/db/txdb/store.go +++ b/ethergo/submitter/db/txdb/store.go @@ -261,7 +261,10 @@ func (s Store) PutTXS(ctx context.Context, txs ...db.TX) error { return fmt.Errorf("could not marshall tx to json: %w", err) } - msg, err := util.TxToCall(tx) + newTX := new(types.Transaction) + err = newTX.UnmarshalBinary(marshalledTX) + + msg, err := util.TxToCall(newTX) if err != nil { return fmt.Errorf("could not recover signer from tx: %w", err) } diff --git a/ethergo/util/converter.go b/ethergo/util/converter.go index a7f125d986..3167aa1cf2 100644 --- a/ethergo/util/converter.go +++ b/ethergo/util/converter.go @@ -2,16 +2,14 @@ package util import ( "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/common" ethCore "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/pkg/errors" - "math/big" ) // TxToCall converts a transaction to a call. -func TxToCall(transaction Transaction) (*ethereum.CallMsg, error) { - rawMsg, err := ethCore.TransactionToMessage(&transaction, types.LatestSignerForChainID(transaction.ChainId()), nil) +func TxToCall(transaction *types.Transaction) (*ethereum.CallMsg, error) { + rawMsg, err := ethCore.TransactionToMessage(transaction, types.LatestSignerForChainID(transaction.ChainId()), nil) if err != nil { return nil, errors.Wrap(err, "could not convert to call") } @@ -27,27 +25,3 @@ func TxToCall(transaction Transaction) (*ethereum.CallMsg, error) { Data: transaction.Data(), }, nil } - -// Transaction is an interface for everything needed to convert a transaction to a call. -type Transaction interface { - // ChainId returns the chain id. - ChainId() *big.Int - // To returns the to address. - To() *common.Address - // GasPrice returns the gas price. - GasPrice() *big.Int - // GasFeeCap returns the gas fee cap. - GasFeeCap() *big.Int - // GasTipCap returns the gas tip cap. - GasTipCap() *big.Int - // Gas returns the gas limit. - Gas() uint64 - // Value returns the value of the tx. - Value() *big.Int - // Data returns the data of the tx. - Data() []byte - // AsMessage converts the transaction to a message. - AsMessage(s types.Signer, baseFee *big.Int) (types.Message, error) -} - -var _ Transaction = &types.Transaction{}