mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
dev: chg: solve some TODOs
This commit is contained in:
parent
a85addd30b
commit
dda0d1163f
24 changed files with 33 additions and 40 deletions
|
|
@ -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:
|
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 remove?
|
// 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(0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
|
if chainConfig.IsShanghai(0) && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
|
||||||
r.Error = errors.New("max initcode size exceeded")
|
r.Error = errors.New("max initcode size exceeded")
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,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 remove?
|
// TODO marcello double check
|
||||||
if chainConfig.IsShanghai(prestate.Env.Number) && prestate.Env.Withdrawals == nil {
|
if chainConfig.IsShanghai(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"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ func TestT8n(t *testing.T) {
|
||||||
output: t8nOutput{result: true},
|
output: t8nOutput{result: true},
|
||||||
expOut: "exp.json",
|
expOut: "exp.json",
|
||||||
},
|
},
|
||||||
// TODO marcello remove?
|
// TODO marcello double check
|
||||||
{ // Test post-merge transition
|
{ // Test post-merge transition
|
||||||
base: "./testdata/24",
|
base: "./testdata/24",
|
||||||
input: t8nInput{
|
input: t8nInput{
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ 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 Shanghai?
|
// TODO marcello double check
|
||||||
if ctx.IsSet(utils.OverrideShanghai.Name) {
|
if ctx.IsSet(utils.OverrideShanghai.Name) {
|
||||||
v := ctx.Uint64(utils.OverrideShanghai.Name)
|
v := ctx.Uint64(utils.OverrideShanghai.Name)
|
||||||
cfg.Eth.OverrideShanghai = &v
|
cfg.Eth.OverrideShanghai = &v
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ var (
|
||||||
utils.NoUSBFlag,
|
utils.NoUSBFlag,
|
||||||
utils.USBFlag,
|
utils.USBFlag,
|
||||||
utils.SmartCardDaemonPathFlag,
|
utils.SmartCardDaemonPathFlag,
|
||||||
// TODO marcello Shanghai
|
// TODO marcello double check
|
||||||
utils.OverrideShanghai,
|
utils.OverrideShanghai,
|
||||||
utils.EnablePersonal,
|
utils.EnablePersonal,
|
||||||
utils.EthashCacheDirFlag,
|
utils.EthashCacheDirFlag,
|
||||||
|
|
|
||||||
|
|
@ -261,8 +261,8 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
|
||||||
if err := misc.VerifyEip1559Header(chain.Config(), parent, header); err != nil {
|
if err := misc.VerifyEip1559Header(chain.Config(), parent, header); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TODO marcello isShangai?
|
|
||||||
// Verify existence / non-existence of withdrawalsHash.
|
// Verify existence / non-existence of withdrawalsHash.
|
||||||
|
// TODO marcello double check
|
||||||
shanghai := chain.Config().IsShanghai(header.Time)
|
shanghai := chain.Config().IsShanghai(header.Time)
|
||||||
if shanghai && header.WithdrawalsHash == nil {
|
if shanghai && header.WithdrawalsHash == nil {
|
||||||
return errors.New("missing withdrawalsHash")
|
return errors.New("missing withdrawalsHash")
|
||||||
|
|
@ -358,7 +358,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 isShangai?
|
// TODO marcello double check
|
||||||
shanghai := chain.Config().IsShanghai(header.Time)
|
shanghai := chain.Config().IsShanghai(header.Time)
|
||||||
if shanghai {
|
if shanghai {
|
||||||
// All blocks after Shanghai must include a withdrawals root.
|
// All blocks after Shanghai must include a withdrawals root.
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,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 isShangai?
|
// TODO marcello double check
|
||||||
if chain.Config().IsShanghai(header.Time) {
|
if chain.Config().IsShanghai(header.Time) {
|
||||||
return fmt.Errorf("clique does not support shanghai fork")
|
return fmt.Errorf("clique does not support shanghai fork")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 {
|
||||||
return consensus.ErrInvalidNumber
|
return consensus.ErrInvalidNumber
|
||||||
}
|
}
|
||||||
// TODO marcello remove?
|
// TODO marcello double check
|
||||||
if chain.Config().IsShanghai(header.Time) {
|
if chain.Config().IsShanghai(header.Time) {
|
||||||
return fmt.Errorf("ethash does not support shanghai fork")
|
return fmt.Errorf("ethash does not support shanghai fork")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ 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 Shanghai?
|
// TODO marcello double check
|
||||||
if overrides != nil && overrides.OverrideShanghai != nil {
|
if overrides != nil && overrides.OverrideShanghai != nil {
|
||||||
config.ShanghaiTime = overrides.OverrideShanghai
|
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 {
|
func DefaultBorMainnetGenesisBlock() *Genesis {
|
||||||
return &Genesis{
|
return &Genesis{
|
||||||
Config: params.BorMainnetChainConfig,
|
Config: params.BorMainnetChainConfig,
|
||||||
|
|
|
||||||
|
|
@ -732,7 +732,6 @@ func ReadLogs(db ethdb.Reader, hash common.Hash, number uint64, config *params.C
|
||||||
}
|
}
|
||||||
receipts := []*receiptLogs{}
|
receipts := []*receiptLogs{}
|
||||||
if err := rlp.DecodeBytes(data, &receipts); err != nil {
|
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.
|
// Receipts might be in the legacy format, try decoding that.
|
||||||
// TODO: to be removed after users migrated
|
// TODO: to be removed after users migrated
|
||||||
if logs := readLegacyLogs(db, hash, number, config); logs != nil {
|
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
|
return logs
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO marcello remove this? (waiting for answer from Arpit)
|
|
||||||
// readLegacyLogs is a temporary workaround for when trying to read logs
|
// 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
|
// from a block which has its receipt stored in the legacy format. It'll
|
||||||
// be removed after users have migrated their freezer databases.
|
// be removed after users have migrated their freezer databases.
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
|
||||||
stateObjectsPending: make(map[common.Address]struct{}),
|
stateObjectsPending: make(map[common.Address]struct{}),
|
||||||
stateObjectsDirty: make(map[common.Address]struct{}),
|
stateObjectsDirty: make(map[common.Address]struct{}),
|
||||||
stateObjectsDestruct: 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),
|
logs: make(map[common.Hash][]*types.Log),
|
||||||
preimages: make(map[common.Hash][]byte),
|
preimages: make(map[common.Hash][]byte),
|
||||||
journal: newJournal(),
|
journal: newJournal(),
|
||||||
|
|
@ -928,26 +928,26 @@ func (s *StateDB) getDeletedStateObject(addr common.Address) *stateObject {
|
||||||
Root: common.BytesToHash(acc.Root),
|
Root: common.BytesToHash(acc.Root),
|
||||||
}
|
}
|
||||||
if len(data.CodeHash) == 0 {
|
if len(data.CodeHash) == 0 {
|
||||||
data.CodeHash = types.EmptyCodeHash.Bytes()
|
data.CodeHash = types.EmptyCodeHash.Bytes()
|
||||||
}
|
}
|
||||||
if data.Root == (common.Hash{}) {
|
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 snapshot unavailable or reading from it failed, load from the database
|
||||||
if data == nil {
|
if data == nil {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
var err error
|
var err error
|
||||||
data, err = s.trie.GetAccount(addr)
|
data, err = s.trie.GetAccount(addr)
|
||||||
if metrics.EnabledExpensive {
|
if metrics.EnabledExpensive {
|
||||||
s.AccountReads += time.Since(start)
|
s.AccountReads += time.Since(start)
|
||||||
}
|
}
|
||||||
if err != nil {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1083,7 +1083,7 @@ func (s *StateDB) Copy() *StateDB {
|
||||||
stateObjectsPending: make(map[common.Address]struct{}, len(s.stateObjectsPending)),
|
stateObjectsPending: make(map[common.Address]struct{}, len(s.stateObjectsPending)),
|
||||||
stateObjectsDirty: make(map[common.Address]struct{}, len(s.journal.dirties)),
|
stateObjectsDirty: make(map[common.Address]struct{}, len(s.journal.dirties)),
|
||||||
stateObjectsDestruct: make(map[common.Address]struct{}, len(s.stateObjectsDestruct)),
|
stateObjectsDestruct: make(map[common.Address]struct{}, len(s.stateObjectsDestruct)),
|
||||||
revertedKeys: make(map[blockstm.Key]struct{}),
|
revertedKeys: make(map[blockstm.Key]struct{}),
|
||||||
refund: s.refund,
|
refund: s.refund,
|
||||||
logs: make(map[common.Hash][]*types.Log, len(s.logs)),
|
logs: make(map[common.Hash][]*types.Log, len(s.logs)),
|
||||||
logSize: s.logSize,
|
logSize: s.logSize,
|
||||||
|
|
@ -1498,7 +1498,7 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d
|
||||||
al.AddSlot(el.Address, key)
|
al.AddSlot(el.Address, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO marcello Shanghai?
|
// TODO marcello double check
|
||||||
if rules.IsShanghai { // EIP-3651: warm coinbase
|
if rules.IsShanghai { // EIP-3651: warm coinbase
|
||||||
al.AddAddress(coinbase)
|
al.AddAddress(coinbase)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
// Fail if Shanghai not enabled and len(withdrawals) is non-zero.
|
||||||
withdrawals := block.Withdrawals()
|
withdrawals := block.Withdrawals()
|
||||||
// TODO marcello IsShanghai
|
// TODO marcello double check
|
||||||
if len(withdrawals) > 0 && !p.config.IsShanghai(block.Time()) {
|
if len(withdrawals) > 0 && !p.config.IsShanghai(block.Time()) {
|
||||||
return nil, nil, 0, fmt.Errorf("withdrawals before shanghai")
|
return nil, nil, 0, fmt.Errorf("withdrawals before shanghai")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,6 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO marcello Shanghai?
|
|
||||||
// ErrMaxInitCodeSizeExceeded, for this we need extra Shanghai (EIP-3860) enabled.
|
// ErrMaxInitCodeSizeExceeded, for this we need extra Shanghai (EIP-3860) enabled.
|
||||||
{
|
{
|
||||||
var (
|
var (
|
||||||
|
|
@ -345,7 +344,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,
|
||||||
ShanghaiTime: u64(0),
|
// TODO marcello double check
|
||||||
|
ShanghaiTime: u64(0),
|
||||||
},
|
},
|
||||||
Alloc: GenesisAlloc{
|
Alloc: GenesisAlloc{
|
||||||
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
|
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
|
||||||
|
|
@ -422,7 +422,7 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
|
||||||
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 Shanghai?
|
// TODO marcello double check
|
||||||
if config.IsShanghai(header.Time) {
|
if config.IsShanghai(header.Time) {
|
||||||
header.WithdrawalsHash = &types.EmptyWithdrawalsHash
|
header.WithdrawalsHash = &types.EmptyWithdrawalsHash
|
||||||
}
|
}
|
||||||
|
|
@ -442,8 +442,8 @@ func GenerateBadBlock(parent *types.Block, engine consensus.Engine, txs types.Tr
|
||||||
cumulativeGas += tx.Gas()
|
cumulativeGas += tx.Gas()
|
||||||
}
|
}
|
||||||
header.Root = common.BytesToHash(hasher.Sum(nil))
|
header.Root = common.BytesToHash(hasher.Sum(nil))
|
||||||
// TODO marcello Shanghai?
|
|
||||||
// Assemble and return the final block for sealing
|
// Assemble and return the final block for sealing
|
||||||
|
// TODO marcello double check
|
||||||
if config.IsShanghai(header.Time) {
|
if config.IsShanghai(header.Time) {
|
||||||
return types.NewBlockWithWithdrawals(header, txs, nil, receipts, []*types.Withdrawal{}, trie.NewStackTrie(nil))
|
return types.NewBlockWithWithdrawals(header, txs, nil, receipts, []*types.Withdrawal{}, trie.NewStackTrie(nil))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,7 @@ 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 IsShanghai?
|
// 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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
|
||||||
StateDB: statedb,
|
StateDB: statedb,
|
||||||
Config: config,
|
Config: config,
|
||||||
chainConfig: chainConfig,
|
chainConfig: chainConfig,
|
||||||
// TODO marcello Shanghai (this enables shanghai based on timestamps)
|
// 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)
|
||||||
return evm
|
return evm
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter {
|
||||||
// If jump table was not initialised we set the default one.
|
// If jump table was not initialised we set the default one.
|
||||||
var table *JumpTable
|
var table *JumpTable
|
||||||
switch {
|
switch {
|
||||||
// TODO marcello Shanghai
|
// TODO marcello double check
|
||||||
case evm.chainRules.IsShanghai:
|
case evm.chainRules.IsShanghai:
|
||||||
table = &shanghaiInstructionSet
|
table = &shanghaiInstructionSet
|
||||||
case evm.chainRules.IsMerge:
|
case evm.chainRules.IsMerge:
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ 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 Shanghai
|
// TODO marcello double check
|
||||||
// OverrideShanghai (TODO: remove after the fork)
|
// OverrideShanghai (TODO: remove after the fork)
|
||||||
OverrideShanghai *uint64 `toml:",omitempty"`
|
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
|
// 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.
|
// 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 != "" {
|
if chainConfig.Bor != nil && chainConfig.Bor.ValidatorContract != "" {
|
||||||
genesisContractsClient := contract.NewGenesisContractsClient(chainConfig, chainConfig.Bor.ValidatorContract, chainConfig.Bor.StateReceiverContract, blockchainAPI)
|
genesisContractsClient := contract.NewGenesisContractsClient(chainConfig, chainConfig.Bor.ValidatorContract, chainConfig.Bor.StateReceiverContract, blockchainAPI)
|
||||||
spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract))
|
spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract))
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
||||||
if dec.CheckpointOracle != nil {
|
if dec.CheckpointOracle != nil {
|
||||||
c.CheckpointOracle = dec.CheckpointOracle
|
c.CheckpointOracle = dec.CheckpointOracle
|
||||||
}
|
}
|
||||||
// TODO marcello OverrideShanghai
|
// TODO marcello double check
|
||||||
if dec.OverrideShanghai != nil {
|
if dec.OverrideShanghai != nil {
|
||||||
c.OverrideShanghai = dec.OverrideShanghai
|
c.OverrideShanghai = dec.OverrideShanghai
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ func TestBorFilters(t *testing.T) {
|
||||||
// Block 1
|
// Block 1
|
||||||
backend.expectBorReceiptsFromMock([]*common.Hash{nil, &hash1, &hash2, &hash3, &hash4})
|
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}})
|
filter := NewBorBlockLogsRangeFilter(backend, testBorConfig, 0, 18, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}})
|
||||||
logs, err := filter.Logs(context.Background())
|
logs, err := filter.Logs(context.Background())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int,
|
||||||
engine consensus.Engine = ethash.NewFaker()
|
engine consensus.Engine = ethash.NewFaker()
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO marcello Shanghai
|
// TODO marcello double check
|
||||||
if shanghai {
|
if shanghai {
|
||||||
config = ¶ms.ChainConfig{
|
config = ¶ms.ChainConfig{
|
||||||
ChainID: big.NewInt(1),
|
ChainID: big.NewInt(1),
|
||||||
|
|
|
||||||
|
|
@ -1067,7 +1067,6 @@ func (c *CallResult) Status() Long {
|
||||||
func (b *Block) Call(ctx context.Context, args struct {
|
func (b *Block) Call(ctx context.Context, args struct {
|
||||||
Data ethapi.TransactionArgs
|
Data ethapi.TransactionArgs
|
||||||
}) (*CallResult, error) {
|
}) (*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())
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -1267,7 +1267,6 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) {
|
||||||
}
|
}
|
||||||
// Set baseFee and GasLimit if we are on an EIP-1559 chain
|
// Set baseFee and GasLimit if we are on an EIP-1559 chain
|
||||||
if w.chainConfig.IsLondon(header.Number) {
|
if w.chainConfig.IsLondon(header.Number) {
|
||||||
// TODO marcello check ToBig()
|
|
||||||
header.BaseFee = misc.CalcBaseFeeUint(w.chainConfig, parent).ToBig()
|
header.BaseFee = misc.CalcBaseFeeUint(w.chainConfig, parent).ToBig()
|
||||||
if !w.chainConfig.IsLondon(parent.Number) {
|
if !w.chainConfig.IsLondon(parent.Number) {
|
||||||
parentGasLimit := parent.GasLimit * w.chainConfig.ElasticityMultiplier()
|
parentGasLimit := parent.GasLimit * w.chainConfig.ElasticityMultiplier()
|
||||||
|
|
|
||||||
|
|
@ -959,8 +959,8 @@ func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *bi
|
||||||
return parentTotalDiff.Cmp(c.TerminalTotalDifficulty) < 0 && totalDiff.Cmp(c.TerminalTotalDifficulty) >= 0
|
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.
|
// 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 {
|
func (c *ChainConfig) IsShanghai(time uint64) bool {
|
||||||
return isTimestampForked(c.ShanghaiTime, time)
|
return isTimestampForked(c.ShanghaiTime, time)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,6 @@ func (t *BlockTest) Run(snapshotter bool) error {
|
||||||
engine = ethash.NewShared()
|
engine = ethash.NewShared()
|
||||||
}
|
}
|
||||||
// Wrap the original engine within the beacon-engine
|
// Wrap the original engine within the beacon-engine
|
||||||
// TODO marcello check everything "beacon" related
|
|
||||||
engine = beacon.New(engine)
|
engine = beacon.New(engine)
|
||||||
|
|
||||||
cache := &core.CacheConfig{TrieCleanLimit: 0}
|
cache := &core.CacheConfig{TrieCleanLimit: 0}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue