diff --git a/cmd/evm/internal/t8ntool/transaction.go b/cmd/evm/internal/t8ntool/transaction.go index 671cb040ed..945a9b53be 100644 --- a/cmd/evm/internal/t8ntool/transaction.go +++ b/cmd/evm/internal/t8ntool/transaction.go @@ -171,7 +171,7 @@ func Transaction(ctx *cli.Context) error { case new(big.Int).Mul(tx.GasFeeCap(), new(big.Int).SetUint64(tx.Gas())).BitLen() > 256: r.Error = errors.New("gas * maxFeePerGas exceeds 256 bits") } - // TODO marcello remove? + // TODO marcello double check // Check whether the init code size has been exceeded. if chainConfig.IsShanghai(0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize { r.Error = errors.New("max initcode size exceeded") diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index 4b8bc3e7fe..c34eb76a08 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -261,7 +261,7 @@ func Transition(ctx *cli.Context) error { return NewError(ErrorConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section")) } } - // TODO marcello remove? + // TODO marcello double check if chainConfig.IsShanghai(prestate.Env.Number) && prestate.Env.Withdrawals == nil { return NewError(ErrorConfig, errors.New("Shanghai config but missing 'withdrawals' in env section")) } diff --git a/cmd/evm/t8n_test.go b/cmd/evm/t8n_test.go index 9f06292826..de4ad11d7d 100644 --- a/cmd/evm/t8n_test.go +++ b/cmd/evm/t8n_test.go @@ -227,7 +227,7 @@ func TestT8n(t *testing.T) { output: t8nOutput{result: true}, expOut: "exp.json", }, - // TODO marcello remove? + // TODO marcello double check { // Test post-merge transition base: "./testdata/24", input: t8nInput{ diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 93d0eaa639..c9dfc59f8b 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -143,7 +143,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) { // makeFullNode loads geth configuration and creates the Ethereum backend. func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { stack, cfg := makeConfigNode(ctx) - // TODO marcello Shanghai? + // TODO marcello double check if ctx.IsSet(utils.OverrideShanghai.Name) { v := ctx.Uint64(utils.OverrideShanghai.Name) cfg.Eth.OverrideShanghai = &v diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 17fc9be260..5d7a0600f1 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -70,7 +70,7 @@ var ( utils.NoUSBFlag, utils.USBFlag, utils.SmartCardDaemonPathFlag, - // TODO marcello Shanghai + // TODO marcello double check utils.OverrideShanghai, utils.EnablePersonal, utils.EthashCacheDirFlag, diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index 3bc8f1be04..5ccf7d5073 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -261,8 +261,8 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa if err := misc.VerifyEip1559Header(chain.Config(), parent, header); err != nil { return err } - // TODO marcello isShangai? // Verify existence / non-existence of withdrawalsHash. + // TODO marcello double check shanghai := chain.Config().IsShanghai(header.Time) if shanghai && header.WithdrawalsHash == nil { return errors.New("missing withdrawalsHash") @@ -358,7 +358,7 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C if !beacon.IsPoSHeader(header) { return beacon.ethone.FinalizeAndAssemble(ctx, chain, header, state, txs, uncles, receipts, nil) } - // TODO marcello isShangai? + // TODO marcello double check shanghai := chain.Config().IsShanghai(header.Time) if shanghai { // All blocks after Shanghai must include a withdrawals root. diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 06d6cc0097..8edf8632b5 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -299,7 +299,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H if header.GasLimit > params.MaxGasLimit { return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, params.MaxGasLimit) } - // TODO marcello isShangai? + // TODO marcello double check if chain.Config().IsShanghai(header.Time) { return fmt.Errorf("clique does not support shanghai fork") } diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 2d3e43dfdb..a3d2626ff6 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -311,7 +311,7 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 { return consensus.ErrInvalidNumber } - // TODO marcello remove? + // TODO marcello double check if chain.Config().IsShanghai(header.Time) { return fmt.Errorf("ethash does not support shanghai fork") } diff --git a/core/genesis.go b/core/genesis.go index 8cb0213f90..073f5ecf2e 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -297,7 +297,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen } applyOverrides := func(config *params.ChainConfig) { if config != nil { - // TODO marcello Shanghai? + // TODO marcello double check if overrides != nil && overrides.OverrideShanghai != nil { config.ShanghaiTime = overrides.OverrideShanghai } @@ -593,7 +593,7 @@ func DefaultMumbaiGenesisBlock() *Genesis { } } -//DefaultBorMainnet returns the Bor Mainnet network gensis block. +// DefaultBorMainnet returns the Bor Mainnet network gensis block. func DefaultBorMainnetGenesisBlock() *Genesis { return &Genesis{ Config: params.BorMainnetChainConfig, diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 8567f5d576..463eb9d4f0 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -732,7 +732,6 @@ func ReadLogs(db ethdb.Reader, hash common.Hash, number uint64, config *params.C } receipts := []*receiptLogs{} if err := rlp.DecodeBytes(data, &receipts); err != nil { - // TODO marcello remove this? (waiting for answer from Arpit) // Receipts might be in the legacy format, try decoding that. // TODO: to be removed after users migrated if logs := readLegacyLogs(db, hash, number, config); logs != nil { @@ -749,7 +748,6 @@ func ReadLogs(db ethdb.Reader, hash common.Hash, number uint64, config *params.C return logs } -// TODO marcello remove this? (waiting for answer from Arpit) // readLegacyLogs is a temporary workaround for when trying to read logs // from a block which has its receipt stored in the legacy format. It'll // be removed after users have migrated their freezer databases. diff --git a/core/state/statedb.go b/core/state/statedb.go index b68480989e..fe910e889a 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -153,7 +153,7 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error) stateObjectsPending: make(map[common.Address]struct{}), stateObjectsDirty: make(map[common.Address]struct{}), stateObjectsDestruct: make(map[common.Address]struct{}), - revertedKeys: make(map[blockstm.Key]struct{}), + revertedKeys: make(map[blockstm.Key]struct{}), logs: make(map[common.Hash][]*types.Log), preimages: make(map[common.Hash][]byte), journal: newJournal(), @@ -928,26 +928,26 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject { Root: common.BytesToHash(acc.Root), } if len(data.CodeHash) == 0 { - data.CodeHash = types.EmptyCodeHash.Bytes() + data.CodeHash = types.EmptyCodeHash.Bytes() } if data.Root == (common.Hash{}) { - data.Root = types.EmptyRootHash + data.Root = types.EmptyRootHash } } } // If snapshot unavailable or reading from it failed, load from the database if data == nil { start := time.Now() - var err error - data, err = s.trie.GetAccount(addr) + var err error + data, err = s.trie.GetAccount(addr) if metrics.EnabledExpensive { s.AccountReads += time.Since(start) } if err != nil { - s.setError(fmt.Errorf("getDeleteStateObject (%x) error: %w", addr.Bytes(), err)) + s.setError(fmt.Errorf("getDeleteStateObject (%x) error: %w", addr.Bytes(), err)) return nil } - if data == nil { + if data == nil { return nil } } @@ -1083,7 +1083,7 @@ func (s *StateDB) Copy() *StateDB { stateObjectsPending: make(map[common.Address]struct{}, len(s.stateObjectsPending)), stateObjectsDirty: make(map[common.Address]struct{}, len(s.journal.dirties)), stateObjectsDestruct: make(map[common.Address]struct{}, len(s.stateObjectsDestruct)), - revertedKeys: make(map[blockstm.Key]struct{}), + revertedKeys: make(map[blockstm.Key]struct{}), refund: s.refund, logs: make(map[common.Hash][]*types.Log, len(s.logs)), logSize: s.logSize, @@ -1498,7 +1498,7 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d al.AddSlot(el.Address, key) } } - // TODO marcello Shanghai? + // TODO marcello double check if rules.IsShanghai { // EIP-3651: warm coinbase al.AddAddress(coinbase) } diff --git a/core/state_processor.go b/core/state_processor.go index a02bfea9ec..af45ea1e27 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -96,7 +96,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg } // Fail if Shanghai not enabled and len(withdrawals) is non-zero. withdrawals := block.Withdrawals() - // TODO marcello IsShanghai + // TODO marcello double check if len(withdrawals) > 0 && !p.config.IsShanghai(block.Time()) { return nil, nil, 0, fmt.Errorf("withdrawals before shanghai") } diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 4f06d39410..ae9802893b 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -321,7 +321,6 @@ func TestStateProcessorErrors(t *testing.T) { } } - // TODO marcello Shanghai? // ErrMaxInitCodeSizeExceeded, for this we need extra Shanghai (EIP-3860) enabled. { var ( @@ -345,7 +344,8 @@ func TestStateProcessorErrors(t *testing.T) { MergeNetsplitBlock: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficultyPassed: true, - ShanghaiTime: u64(0), + // TODO marcello double check + ShanghaiTime: u64(0), }, Alloc: GenesisAlloc{ common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{ @@ -422,7 +422,7 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr if config.IsLondon(header.Number) { header.BaseFee = misc.CalcBaseFee(config, parent.Header()) } - // TODO marcello Shanghai? + // TODO marcello double check if config.IsShanghai(header.Time) { header.WithdrawalsHash = &types.EmptyWithdrawalsHash } @@ -442,8 +442,8 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr cumulativeGas += tx.Gas() } header.Root = common.BytesToHash(hasher.Sum(nil)) - // TODO marcello Shanghai? // Assemble and return the final block for sealing + // TODO marcello double check if config.IsShanghai(header.Time) { return types.NewBlockWithWithdrawals(header, txs, nil, receipts, []*types.Withdrawal{}, trie.NewStackTrie(nil)) } diff --git a/core/state_transition.go b/core/state_transition.go index cbfd865746..87490a9bf4 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -376,7 +376,7 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio } // Check whether the init code size has been exceeded. - // TODO marcello IsShanghai? + // TODO marcello double check if rules.IsShanghai && contractCreation && len(msg.Data) > params.MaxInitCodeSize { return nil, fmt.Errorf("%w: code size %v limit %v", ErrMaxInitCodeSizeExceeded, len(msg.Data), params.MaxInitCodeSize) } diff --git a/core/vm/evm.go b/core/vm/evm.go index 78b1d36202..aa601f812b 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -131,8 +131,8 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig StateDB: statedb, Config: config, chainConfig: chainConfig, - // TODO marcello Shanghai (this enables shanghai based on timestamps) - chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time), + // TODO marcello double check + chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time), } evm.interpreter = NewEVMInterpreter(evm) return evm diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 0e99230009..b87ccbd28d 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -131,7 +131,7 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter { // If jump table was not initialised we set the default one. var table *JumpTable switch { - // TODO marcello Shanghai + // TODO marcello double check case evm.chainRules.IsShanghai: table = &shanghaiInstructionSet case evm.chainRules.IsMerge: diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 850fb820d6..d156b9f14f 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -217,7 +217,7 @@ type Config struct { // CheckpointOracle is the configuration for checkpoint oracle. CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` - // TODO marcello Shanghai + // TODO marcello double check // OverrideShanghai (TODO: remove after the fork) OverrideShanghai *uint64 `toml:",omitempty"` @@ -261,7 +261,6 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et // In order to pass the ethereum transaction tests, we need to set the burn contract which is in the bor config // Then, bor != nil will also be enabled for ethash and clique. Only enable Bor for real if there is a validator contract present. - // TODO marcello FIXME based on proper ethConfig for Bor (ideally ethashConfig) and blockchainAPI if chainConfig.Bor != nil && chainConfig.Bor.ValidatorContract != "" { genesisContractsClient := contract.NewGenesisContractsClient(chainConfig, chainConfig.Bor.ValidatorContract, chainConfig.Bor.StateReceiverContract, blockchainAPI) spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract)) diff --git a/eth/ethconfig/gen_config.go b/eth/ethconfig/gen_config.go index ee75760827..7a21ccd40e 100644 --- a/eth/ethconfig/gen_config.go +++ b/eth/ethconfig/gen_config.go @@ -286,7 +286,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.CheckpointOracle != nil { c.CheckpointOracle = dec.CheckpointOracle } - // TODO marcello OverrideShanghai + // TODO marcello double check if dec.OverrideShanghai != nil { c.OverrideShanghai = dec.OverrideShanghai } diff --git a/eth/filters/bor_filter_test.go b/eth/filters/bor_filter_test.go index 3c7b0583b7..1848648beb 100644 --- a/eth/filters/bor_filter_test.go +++ b/eth/filters/bor_filter_test.go @@ -74,7 +74,6 @@ func TestBorFilters(t *testing.T) { // Block 1 backend.expectBorReceiptsFromMock([]*common.Hash{nil, &hash1, &hash2, &hash3, &hash4}) - // TODO marcello regenerate ctrls for gomock to include the new methods filter := NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, 18, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) logs, err := filter.Logs(context.Background()) diff --git a/eth/protocols/eth/handler_test.go b/eth/protocols/eth/handler_test.go index 18ab98e002..730c3d840f 100644 --- a/eth/protocols/eth/handler_test.go +++ b/eth/protocols/eth/handler_test.go @@ -73,7 +73,7 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int, engine consensus.Engine = ethash.NewFaker() ) - // TODO marcello Shanghai + // TODO marcello double check if shanghai { config = ¶ms.ChainConfig{ ChainID: big.NewInt(1), diff --git a/graphql/graphql.go b/graphql/graphql.go index f2cba8f381..3421d98467 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -1067,7 +1067,6 @@ func (c *CallResult) Status() Long { func (b *Block) Call(ctx context.Context, args struct { Data ethapi.TransactionArgs }) (*CallResult, error) { - // TODO marcello check args number result, err := ethapi.DoCall(ctx, b.r.backend, args.Data, *b.numberOrHash, nil, nil, b.r.backend.RPCEVMTimeout(), b.r.backend.RPCGasCap()) if err != nil { return nil, err diff --git a/miner/worker.go b/miner/worker.go index f5bb3b9362..7894ed71f6 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1267,7 +1267,6 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { } // Set baseFee and GasLimit if we are on an EIP-1559 chain if w.chainConfig.IsLondon(header.Number) { - // TODO marcello check ToBig() header.BaseFee = misc.CalcBaseFeeUint(w.chainConfig, parent).ToBig() if !w.chainConfig.IsLondon(parent.Number) { parentGasLimit := parent.GasLimit * w.chainConfig.ElasticityMultiplier() diff --git a/params/config.go b/params/config.go index cc7afe5537..dfa303cbd6 100644 --- a/params/config.go +++ b/params/config.go @@ -959,8 +959,8 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi return parentTotalDiff.Cmp(c.TerminalTotalDifficulty) < 0 && totalDiff.Cmp(c.TerminalTotalDifficulty) >= 0 } -// TODO marcello Shanghai // IsShanghai returns whether time is either equal to the Shanghai fork time or greater. +// TODO marcello double check func (c *ChainConfig) IsShanghai(time uint64) bool { return isTimestampForked(c.ShanghaiTime, time) } diff --git a/tests/block_test_util.go b/tests/block_test_util.go index ea64881f97..161b0efb77 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -124,7 +124,6 @@ func (t *BlockTest) Run(snapshotter bool) error { engine = ethash.NewShared() } // Wrap the original engine within the beacon-engine - // TODO marcello check everything "beacon" related engine = beacon.New(engine) cache := &core.CacheConfig{TrieCleanLimit: 0}