clean : shanghai changes

This commit is contained in:
Shivam Sharma 2023-10-06 12:06:46 +05:30
parent 558bb5433f
commit 1fc6354ab1
19 changed files with 138 additions and 173 deletions

View file

@ -190,7 +190,6 @@ func Transaction(ctx *cli.Context) error {
case new(big.Int).Mul(tx.GasFeeCap(), new(big.Int).SetUint64(tx.Gas())).BitLen() > 256: case new(big.Int).Mul(tx.GasFeeCap(), new(big.Int).SetUint64(tx.Gas())).BitLen() > 256:
r.Error = errors.New("gas * maxFeePerGas exceeds 256 bits") r.Error = errors.New("gas * maxFeePerGas exceeds 256 bits")
} }
// TODO marcello double check
// Check whether the init code size has been exceeded. // Check whether the init code size has been exceeded.
if chainConfig.IsShanghai(new(big.Int)) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize { if chainConfig.IsShanghai(new(big.Int)) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
r.Error = errors.New("max initcode size exceeded") r.Error = errors.New("max initcode size exceeded")

View file

@ -285,7 +285,7 @@ func Transition(ctx *cli.Context) error {
return NewError(ErrorConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section")) return NewError(ErrorConfig, errors.New("EIP-1559 config but missing 'currentBaseFee' in env section"))
} }
} }
// TODO marcello double check
if chainConfig.IsShanghai(big.NewInt(int64(prestate.Env.Number))) && prestate.Env.Withdrawals == nil { if chainConfig.IsShanghai(big.NewInt(int64(prestate.Env.Number))) && prestate.Env.Withdrawals == nil {
return NewError(ErrorConfig, errors.New("Shanghai config but missing 'withdrawals' in env section")) return NewError(ErrorConfig, errors.New("Shanghai config but missing 'withdrawals' in env section"))
} }

View file

@ -238,7 +238,6 @@ func TestT8n(t *testing.T) {
output: t8nOutput{result: true}, output: t8nOutput{result: true},
expOut: "exp.json", expOut: "exp.json",
}, },
// TODO marcello double check
{ // Test post-merge transition { // Test post-merge transition
base: "./testdata/24", base: "./testdata/24",
input: t8nInput{ input: t8nInput{

View file

@ -148,7 +148,6 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
// makeFullNode loads geth configuration and creates the Ethereum backend. // makeFullNode loads geth configuration and creates the Ethereum backend.
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
stack, cfg := makeConfigNode(ctx) stack, cfg := makeConfigNode(ctx)
// TODO marcello double check
if ctx.IsSet(utils.OverrideShanghai.Name) { if ctx.IsSet(utils.OverrideShanghai.Name) {
v := ctx.Int64(utils.OverrideShanghai.Name) v := ctx.Int64(utils.OverrideShanghai.Name)
cfg.Eth.OverrideShanghai = new(big.Int).SetInt64(v) cfg.Eth.OverrideShanghai = new(big.Int).SetInt64(v)

View file

@ -70,7 +70,6 @@ var (
utils.NoUSBFlag, utils.NoUSBFlag,
utils.USBFlag, utils.USBFlag,
utils.SmartCardDaemonPathFlag, utils.SmartCardDaemonPathFlag,
// TODO marcello double check
utils.OverrideShanghai, utils.OverrideShanghai,
utils.EnablePersonal, utils.EnablePersonal,
utils.EthashCacheDirFlag, utils.EthashCacheDirFlag,

View file

@ -283,7 +283,6 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return err return err
} }
// Verify existence / non-existence of withdrawalsHash. // Verify existence / non-existence of withdrawalsHash.
// TODO marcello double check
shanghai := chain.Config().IsShanghai(header.Number) shanghai := chain.Config().IsShanghai(header.Number)
if shanghai && header.WithdrawalsHash == nil { if shanghai && header.WithdrawalsHash == nil {
return errors.New("missing withdrawalsHash") return errors.New("missing withdrawalsHash")
@ -391,7 +390,7 @@ func (beacon *Beacon) FinalizeAndAssemble(ctx context.Context, chain consensus.C
if !beacon.IsPoSHeader(header) { if !beacon.IsPoSHeader(header) {
return beacon.ethone.FinalizeAndAssemble(ctx, chain, header, state, txs, uncles, receipts, nil) return beacon.ethone.FinalizeAndAssemble(ctx, chain, header, state, txs, uncles, receipts, nil)
} }
// TODO marcello double check
shanghai := chain.Config().IsShanghai(header.Number) shanghai := chain.Config().IsShanghai(header.Number)
if shanghai { if shanghai {
// All blocks after Shanghai must include a withdrawals root. // All blocks after Shanghai must include a withdrawals root.

View file

@ -308,7 +308,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
if header.GasLimit > params.MaxGasLimit { if header.GasLimit > params.MaxGasLimit {
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, params.MaxGasLimit) return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, params.MaxGasLimit)
} }
// TODO marcello double check
if chain.Config().IsShanghai(header.Number) { if chain.Config().IsShanghai(header.Number) {
return fmt.Errorf("clique does not support shanghai fork") return fmt.Errorf("clique does not support shanghai fork")
} }

View file

@ -333,7 +333,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 { if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 {
return consensus.ErrInvalidNumber return consensus.ErrInvalidNumber
} }
// TODO marcello double check
if chain.Config().IsShanghai(header.Number) { if chain.Config().IsShanghai(header.Number) {
return fmt.Errorf("ethash does not support shanghai fork") return fmt.Errorf("ethash does not support shanghai fork")
} }

View file

@ -326,7 +326,6 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
applyOverrides := func(config *params.ChainConfig) { applyOverrides := func(config *params.ChainConfig) {
if config != nil { if config != nil {
// TODO marcello double check
if overrides != nil && overrides.OverrideShanghai != nil { if overrides != nil && overrides.OverrideShanghai != nil {
config.ShanghaiBlock = overrides.OverrideShanghai config.ShanghaiBlock = overrides.OverrideShanghai
} }

View file

@ -1595,7 +1595,6 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
al.AddSlot(el.Address, key) al.AddSlot(el.Address, key)
} }
} }
// TODO marcello double check
if rules.IsShanghai { // EIP-3651: warm coinbase if rules.IsShanghai { // EIP-3651: warm coinbase
al.AddAddress(coinbase) al.AddAddress(coinbase)
} }

View file

@ -101,7 +101,6 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
} }
// Fail if Shanghai not enabled and len(withdrawals) is non-zero. // Fail if Shanghai not enabled and len(withdrawals) is non-zero.
withdrawals := block.Withdrawals() withdrawals := block.Withdrawals()
// TODO marcello double check
if len(withdrawals) > 0 && !p.config.IsShanghai(block.Number()) { if len(withdrawals) > 0 && !p.config.IsShanghai(block.Number()) {
return nil, nil, 0, fmt.Errorf("withdrawals before shanghai") return nil, nil, 0, fmt.Errorf("withdrawals before shanghai")
} }

View file

@ -364,9 +364,8 @@ func TestStateProcessorErrors(t *testing.T) {
MergeNetsplitBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true, TerminalTotalDifficultyPassed: true,
// TODO marcello double check ShanghaiBlock: big.NewInt(0),
ShanghaiBlock: big.NewInt(0), Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
}, },
Alloc: GenesisAlloc{ Alloc: GenesisAlloc{
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{ common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
@ -442,10 +441,11 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
Time: parent.Time() + 10, Time: parent.Time() + 10,
UncleHash: types.EmptyUncleHash, UncleHash: types.EmptyUncleHash,
} }
if config.IsLondon(header.Number) { if config.IsLondon(header.Number) {
header.BaseFee = misc.CalcBaseFee(config, parent.Header()) header.BaseFee = misc.CalcBaseFee(config, parent.Header())
} }
// TODO marcello double check
if config.IsShanghai(header.Number) { if config.IsShanghai(header.Number) {
header.WithdrawalsHash = &types.EmptyWithdrawalsHash header.WithdrawalsHash = &types.EmptyWithdrawalsHash
} }
@ -471,7 +471,6 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
header.Root = common.BytesToHash(hasher.Sum(nil)) header.Root = common.BytesToHash(hasher.Sum(nil))
// Assemble and return the final block for sealing // Assemble and return the final block for sealing
// TODO marcello double check
if config.IsShanghai(header.Number) { if config.IsShanghai(header.Number) {
return types.NewBlockWithWithdrawals(header, txs, nil, receipts, []*types.Withdrawal{}, trie.NewStackTrie(nil)) return types.NewBlockWithWithdrawals(header, txs, nil, receipts, []*types.Withdrawal{}, trie.NewStackTrie(nil))
} }

View file

@ -403,7 +403,6 @@ func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*Executio
} }
// Check whether the init code size has been exceeded. // Check whether the init code size has been exceeded.
// TODO marcello double check
if rules.IsShanghai && contractCreation && len(msg.Data) > params.MaxInitCodeSize { 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) return nil, fmt.Errorf("%w: code size %v limit %v", ErrMaxInitCodeSizeExceeded, len(msg.Data), params.MaxInitCodeSize)
} }

View file

@ -134,8 +134,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
StateDB: statedb, StateDB: statedb,
Config: config, Config: config,
chainConfig: chainConfig, chainConfig: chainConfig,
// TODO marcello double check chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time),
chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time),
} }
evm.interpreter = NewEVMInterpreter(evm) evm.interpreter = NewEVMInterpreter(evm)

View file

@ -132,7 +132,6 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter {
var table *JumpTable var table *JumpTable
switch { switch {
// TODO marcello double check
case evm.chainRules.IsShanghai: case evm.chainRules.IsShanghai:
table = &shanghaiInstructionSet table = &shanghaiInstructionSet
case evm.chainRules.IsMerge: case evm.chainRules.IsMerge:

View file

@ -16,35 +16,15 @@
package catalyst package catalyst
import ( // var (
"fmt" // // testKey is a private key to use for funding a tester account.
"math/big" // testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
"testing"
"time"
"github.com/ethereum/go-ethereum/beacon/engine" // // testAddr is the Ethereum address of the tester account.
"github.com/ethereum/go-ethereum/common" // testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/trie"
)
var ( // testBalance = big.NewInt(2e18)
// testKey is a private key to use for funding a tester account. // )
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
// testAddr is the Ethereum address of the tester account.
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
testBalance = big.NewInt(2e18)
)
// func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block) { // func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block) {
// config := *params.AllEthashProtocolChanges // config := *params.AllEthashProtocolChanges
@ -235,25 +215,25 @@ var (
// } // }
// } // }
func checkLogEvents(t *testing.T, logsCh <-chan []*types.Log, rmLogsCh <-chan core.RemovedLogsEvent, wantNew, wantRemoved int) { // func checkLogEvents(t *testing.T, logsCh <-chan []*types.Log, rmLogsCh <-chan core.RemovedLogsEvent, wantNew, wantRemoved int) {
t.Helper() // t.Helper()
if len(logsCh) != wantNew { // if len(logsCh) != wantNew {
t.Fatalf("wrong number of log events: got %d, want %d", len(logsCh), wantNew) // t.Fatalf("wrong number of log events: got %d, want %d", len(logsCh), wantNew)
} // }
if len(rmLogsCh) != wantRemoved { // if len(rmLogsCh) != wantRemoved {
t.Fatalf("wrong number of removed log events: got %d, want %d", len(rmLogsCh), wantRemoved) // t.Fatalf("wrong number of removed log events: got %d, want %d", len(rmLogsCh), wantRemoved)
} // }
// Drain events. // // Drain events.
for i := 0; i < len(logsCh); i++ { // for i := 0; i < len(logsCh); i++ {
<-logsCh // <-logsCh
} // }
for i := 0; i < len(rmLogsCh); i++ { // for i := 0; i < len(rmLogsCh); i++ {
<-rmLogsCh // <-rmLogsCh
} // }
} // }
// func TestInvalidPayloadTimestamp(t *testing.T) { // func TestInvalidPayloadTimestamp(t *testing.T) {
// genesis, preMergeBlocks := generateMergeChain(10, false) // genesis, preMergeBlocks := generateMergeChain(10, false)
@ -424,87 +404,87 @@ func checkLogEvents(t *testing.T, logsCh <-chan []*types.Log, rmLogsCh <-chan co
// } // }
// } // }
func TestEth2DeepReorg(t *testing.T) { // func TestEth2DeepReorg(t *testing.T) {
// TODO (MariusVanDerWijden) TestEth2DeepReorg is currently broken, because it tries to reorg // TODO (MariusVanDerWijden) TestEth2DeepReorg is currently broken, because it tries to reorg
// before the totalTerminalDifficulty threshold // before the totalTerminalDifficulty threshold
/* /*
genesis, preMergeBlocks := generateMergeChain(core.TriesInMemory * 2, false) genesis, preMergeBlocks := generateMergeChain(core.TriesInMemory * 2, false)
n, ethservice := startEthService(t, genesis, preMergeBlocks) n, ethservice := startEthService(t, genesis, preMergeBlocks)
defer n.Close() defer n.Close()
var ( var (
api = NewConsensusAPI(ethservice, nil) api = NewConsensusAPI(ethservice, nil)
parent = preMergeBlocks[len(preMergeBlocks)-core.TriesInMemory-1] parent = preMergeBlocks[len(preMergeBlocks)-core.TriesInMemory-1]
head = ethservice.BlockChain().CurrentBlock().Number.Uint64()() head = ethservice.BlockChain().CurrentBlock().Number.Uint64()()
) )
if ethservice.BlockChain().HasBlockAndState(parent.Hash(), parent.NumberU64()) { if ethservice.BlockChain().HasBlockAndState(parent.Hash(), parent.NumberU64()) {
t.Errorf("Block %d not pruned", parent.NumberU64()) t.Errorf("Block %d not pruned", parent.NumberU64())
}
for i := 0; i < 10; i++ {
execData, err := api.assembleBlock(AssembleBlockParams{
ParentHash: parent.Hash(),
Timestamp: parent.Time() + 5,
})
if err != nil {
t.Fatalf("Failed to create the executable data %v", err)
}
block, err := ExecutableDataToBlock(ethservice.BlockChain().Config(), parent.Header(), *execData)
if err != nil {
t.Fatalf("Failed to convert executable data to block %v", err)
}
newResp, err := api.ExecutePayload(*execData)
if err != nil || newResp.Status != "VALID" {
t.Fatalf("Failed to insert block: %v", err)
}
if ethservice.BlockChain().CurrentBlock().Number.Uint64()() != head {
t.Fatalf("Chain head shouldn't be updated")
}
if err := api.setHead(block.Hash()); err != nil {
t.Fatalf("Failed to set head: %v", err)
}
if ethservice.BlockChain().CurrentBlock().Number.Uint64()() != block.NumberU64() {
t.Fatalf("Chain head should be updated")
}
parent, head = block, block.NumberU64()
} }
*/ for i := 0; i < 10; i++ {
} execData, err := api.assembleBlock(AssembleBlockParams{
ParentHash: parent.Hash(),
Timestamp: parent.Time() + 5,
})
if err != nil {
t.Fatalf("Failed to create the executable data %v", err)
}
block, err := ExecutableDataToBlock(ethservice.BlockChain().Config(), parent.Header(), *execData)
if err != nil {
t.Fatalf("Failed to convert executable data to block %v", err)
}
newResp, err := api.ExecutePayload(*execData)
if err != nil || newResp.Status != "VALID" {
t.Fatalf("Failed to insert block: %v", err)
}
if ethservice.BlockChain().CurrentBlock().Number.Uint64()() != head {
t.Fatalf("Chain head shouldn't be updated")
}
if err := api.setHead(block.Hash()); err != nil {
t.Fatalf("Failed to set head: %v", err)
}
if ethservice.BlockChain().CurrentBlock().Number.Uint64()() != block.NumberU64() {
t.Fatalf("Chain head should be updated")
}
parent, head = block, block.NumberU64()
}
*/
// }
// startEthService creates a full node instance for testing. // startEthService creates a full node instance for testing.
func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block) (*node.Node, *eth.Ethereum) { // func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block) (*node.Node, *eth.Ethereum) {
t.Helper() // t.Helper()
n, err := node.New(&node.Config{ // n, err := node.New(&node.Config{
P2P: p2p.Config{ // P2P: p2p.Config{
ListenAddr: "0.0.0.0:0", // ListenAddr: "0.0.0.0:0",
NoDiscovery: true, // NoDiscovery: true,
MaxPeers: 25, // MaxPeers: 25,
}}) // }})
if err != nil { // if err != nil {
t.Fatal("can't create node:", err) // t.Fatal("can't create node:", err)
} // }
ethcfg := &ethconfig.Config{Genesis: genesis, Ethash: ethash.Config{PowMode: ethash.ModeFake}, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256} // ethcfg := &ethconfig.Config{Genesis: genesis, Ethash: ethash.Config{PowMode: ethash.ModeFake}, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256}
ethservice, err := eth.New(n, ethcfg) // ethservice, err := eth.New(n, ethcfg)
if err != nil { // if err != nil {
t.Fatal("can't create eth service:", err) // t.Fatal("can't create eth service:", err)
} // }
if err := n.Start(); err != nil { // if err := n.Start(); err != nil {
t.Fatal("can't start node:", err) // t.Fatal("can't start node:", err)
} // }
if _, err := ethservice.BlockChain().InsertChain(blocks); err != nil { // if _, err := ethservice.BlockChain().InsertChain(blocks); err != nil {
n.Close() // n.Close()
t.Fatal("can't import test blocks:", err) // t.Fatal("can't import test blocks:", err)
} // }
ethservice.SetEtherbase(testAddr) // ethservice.SetEtherbase(testAddr)
ethservice.SetSynced() // ethservice.SetSynced()
return n, ethservice // return n, ethservice
} // }
// func TestFullAPI(t *testing.T) { // func TestFullAPI(t *testing.T) {
// genesis, preMergeBlocks := generateMergeChain(10, false) // genesis, preMergeBlocks := generateMergeChain(10, false)
@ -848,48 +828,48 @@ We expect
// setBlockhash sets the blockhash of a modified ExecutableData. // setBlockhash sets the blockhash of a modified ExecutableData.
// Can be used to make modified payloads look valid. // Can be used to make modified payloads look valid.
func setBlockhash(data *engine.ExecutableData) *engine.ExecutableData { // func setBlockhash(data *engine.ExecutableData) *engine.ExecutableData {
txs, _ := decodeTransactions(data.Transactions) // txs, _ := decodeTransactions(data.Transactions)
number := big.NewInt(0) // number := big.NewInt(0)
number.SetUint64(data.Number) // number.SetUint64(data.Number)
header := &types.Header{ // header := &types.Header{
ParentHash: data.ParentHash, // ParentHash: data.ParentHash,
UncleHash: types.EmptyUncleHash, // UncleHash: types.EmptyUncleHash,
Coinbase: data.FeeRecipient, // Coinbase: data.FeeRecipient,
Root: data.StateRoot, // Root: data.StateRoot,
TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)), // TxHash: types.DeriveSha(types.Transactions(txs), trie.NewStackTrie(nil)),
ReceiptHash: data.ReceiptsRoot, // ReceiptHash: data.ReceiptsRoot,
Bloom: types.BytesToBloom(data.LogsBloom), // Bloom: types.BytesToBloom(data.LogsBloom),
Difficulty: common.Big0, // Difficulty: common.Big0,
Number: number, // Number: number,
GasLimit: data.GasLimit, // GasLimit: data.GasLimit,
GasUsed: data.GasUsed, // GasUsed: data.GasUsed,
Time: data.Timestamp, // Time: data.Timestamp,
BaseFee: data.BaseFeePerGas, // BaseFee: data.BaseFeePerGas,
Extra: data.ExtraData, // Extra: data.ExtraData,
MixDigest: data.Random, // MixDigest: data.Random,
} // }
block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */) // block := types.NewBlockWithHeader(header).WithBody(txs, nil /* uncles */)
data.BlockHash = block.Hash() // data.BlockHash = block.Hash()
return data // return data
} // }
func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) { // func decodeTransactions(enc [][]byte) ([]*types.Transaction, error) {
var txs = make([]*types.Transaction, len(enc)) // var txs = make([]*types.Transaction, len(enc))
for i, encTx := range enc { // for i, encTx := range enc {
var tx types.Transaction // var tx types.Transaction
if err := tx.UnmarshalBinary(encTx); err != nil { // if err := tx.UnmarshalBinary(encTx); err != nil {
return nil, fmt.Errorf("invalid transaction %d: %v", i, err) // return nil, fmt.Errorf("invalid transaction %d: %v", i, err)
} // }
txs[i] = &tx // txs[i] = &tx
} // }
return txs, nil // return txs, nil
} // }
// func TestTrickRemoteBlockCache(t *testing.T) { // func TestTrickRemoteBlockCache(t *testing.T) {
// t.Parallel() // t.Parallel()

View file

@ -225,7 +225,6 @@ type Config struct {
// CheckpointOracle is the configuration for checkpoint oracle. // CheckpointOracle is the configuration for checkpoint oracle.
CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"`
// TODO marcello double check
// OverrideShanghai (TODO: remove after the fork) // OverrideShanghai (TODO: remove after the fork)
OverrideShanghai *big.Int `toml:",omitempty"` OverrideShanghai *big.Int `toml:",omitempty"`

View file

@ -74,7 +74,6 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int,
engine consensus.Engine = ethash.NewFaker() engine consensus.Engine = ethash.NewFaker()
) )
// TODO marcello double check
if shanghai { if shanghai {
config = &params.ChainConfig{ config = &params.ChainConfig{
ChainID: big.NewInt(1), ChainID: big.NewInt(1),

View file

@ -998,7 +998,6 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi
} }
// IsShanghai returns whether time is either equal to the Shanghai fork time or greater. // IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
// TODO marcello double check
func (c *ChainConfig) IsShanghai(num *big.Int) bool { func (c *ChainConfig) IsShanghai(num *big.Int) bool {
return isBlockForked(c.ShanghaiBlock, num) return isBlockForked(c.ShanghaiBlock, num)
} }