Merge pull request #1025 from maticnetwork/shivam/POS-1733

Shanghai/Agra HF
This commit is contained in:
Arpit Temani 2023-10-17 14:21:51 +05:30 committed by GitHub
commit d104b38245
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 2766 additions and 2488 deletions

File diff suppressed because one or more lines are too long

View file

@ -157,7 +157,7 @@ func Transaction(ctx *cli.Context) error {
} }
// Check intrinsic gas // Check intrinsic gas
if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil, if gas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.To() == nil,
chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(0)); err != nil { chainConfig.IsHomestead(new(big.Int)), chainConfig.IsIstanbul(new(big.Int)), chainConfig.IsShanghai(new(big.Int))); err != nil {
r.Error = err r.Error = err
results = append(results, r) results = append(results, r)
@ -190,9 +190,8 @@ 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(0) && 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,8 +285,8 @@ 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(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

@ -18,6 +18,7 @@ package main
import ( import (
"fmt" "fmt"
"math/big"
"os" "os"
"time" "time"
@ -147,10 +148,9 @@ 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.Uint64(utils.OverrideShanghai.Name) v := ctx.Int64(utils.OverrideShanghai.Name)
cfg.Eth.OverrideShanghai = &v cfg.Eth.OverrideShanghai = new(big.Int).SetInt64(v)
} }
backend, eth := utils.RegisterEthService(stack, &cfg.Eth) backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

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,8 +283,7 @@ 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.Time)
if shanghai && header.WithdrawalsHash == nil { if shanghai && header.WithdrawalsHash == nil {
return errors.New("missing withdrawalsHash") return errors.New("missing withdrawalsHash")
} }
@ -293,7 +292,7 @@ func (beacon *Beacon) verifyHeader(chain consensus.ChainHeaderReader, header, pa
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash) return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
} }
// Verify the existence / non-existence of excessDataGas // Verify the existence / non-existence of excessDataGas
cancun := chain.Config().IsCancun(header.Time) cancun := chain.Config().IsCancun(header.Number)
if cancun && header.ExcessDataGas == nil { if cancun && header.ExcessDataGas == nil {
return errors.New("missing excessDataGas") return errors.New("missing excessDataGas")
} }
@ -391,8 +390,8 @@ 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.Time) 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.
if withdrawals == nil { if withdrawals == nil {

View file

@ -816,6 +816,16 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
headerNumber := header.Number.Uint64() headerNumber := header.Number.Uint64()
if len(withdrawals) > 0 {
log.Error("Bor does not support withdrawals", "number", headerNumber)
return
}
if header.WithdrawalsHash != nil {
log.Error("Bor does not support withdrawalHash", "number", headerNumber)
return
}
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) { if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
ctx := context.Background() ctx := context.Background()
cx := statefull.ChainContext{Chain: chain, Bor: c} cx := statefull.ChainContext{Chain: chain, Bor: c}
@ -888,6 +898,14 @@ func (c *Bor) FinalizeAndAssemble(ctx context.Context, chain consensus.ChainHead
finalizeCtx, finalizeSpan := tracing.StartSpan(ctx, "bor.FinalizeAndAssemble") finalizeCtx, finalizeSpan := tracing.StartSpan(ctx, "bor.FinalizeAndAssemble")
defer tracing.EndSpan(finalizeSpan) defer tracing.EndSpan(finalizeSpan)
if len(withdrawals) > 0 {
return nil, errors.New("Bor does not support withdrawals")
}
if header.WithdrawalsHash != nil {
return nil, errors.New("Bor does not support withdrawalHash")
}
stateSyncData := []*types.StateSyncData{} stateSyncData := []*types.StateSyncData{}
headerNumber := header.Number.Uint64() headerNumber := header.Number.Uint64()

View file

@ -308,12 +308,12 @@ 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.Time) { if chain.Config().IsShanghai(header.Number) {
return fmt.Errorf("clique does not support shanghai fork") return fmt.Errorf("clique does not support shanghai fork")
} }
if chain.Config().IsCancun(header.Time) { if chain.Config().IsCancun(header.Number) {
return fmt.Errorf("clique does not support cancun fork") return fmt.Errorf("clique does not support cancun fork")
} }
// All basic checks passed, verify cascading fields // All basic checks passed, verify cascading fields

View file

@ -333,12 +333,12 @@ 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.Time) { if chain.Config().IsShanghai(header.Number) {
return fmt.Errorf("ethash does not support shanghai fork") return fmt.Errorf("ethash does not support shanghai fork")
} }
if chain.Config().IsCancun(header.Time) { if chain.Config().IsCancun(header.Number) {
return fmt.Errorf("ethash does not support cancun fork") return fmt.Errorf("ethash does not support cancun fork")
} }
// Verify the engine specific seal securing the block // Verify the engine specific seal securing the block

View file

@ -4688,7 +4688,7 @@ func TestEIP3651(t *testing.T) {
gspec.Config.LondonBlock = common.Big0 gspec.Config.LondonBlock = common.Big0
gspec.Config.TerminalTotalDifficulty = common.Big0 gspec.Config.TerminalTotalDifficulty = common.Big0
gspec.Config.TerminalTotalDifficultyPassed = true gspec.Config.TerminalTotalDifficultyPassed = true
gspec.Config.ShanghaiTime = u64(0) gspec.Config.ShanghaiBlock = common.Big0
signer := types.LatestSigner(gspec.Config) signer := types.LatestSigner(gspec.Config)
_, blocks, _ := GenerateChainWithGenesis(gspec, engine, 1, func(i int, b *BlockGen) { _, blocks, _ := GenerateChainWithGenesis(gspec, engine, 1, func(i int, b *BlockGen) {

View file

@ -56,7 +56,7 @@ func TestGenerateWithdrawalChain(t *testing.T) {
config.TerminalTotalDifficultyPassed = true config.TerminalTotalDifficultyPassed = true
config.TerminalTotalDifficulty = common.Big0 config.TerminalTotalDifficulty = common.Big0
config.ShanghaiTime = u64(0) config.ShanghaiBlock = common.Big0
// init 0xaa with some storage elements // init 0xaa with some storage elements
storage := make(map[common.Hash]common.Hash) storage := make(map[common.Hash]common.Hash)

View file

@ -69,10 +69,6 @@ func TestCreation(t *testing.T) {
{13772999, 0, ID{Hash: checksumToBytes(0xb715077d), Next: 13773000}}, // Last London block {13772999, 0, ID{Hash: checksumToBytes(0xb715077d), Next: 13773000}}, // Last London block
{13773000, 0, ID{Hash: checksumToBytes(0x20c327fc), Next: 15050000}}, // First Arrow Glacier block {13773000, 0, ID{Hash: checksumToBytes(0x20c327fc), Next: 15050000}}, // First Arrow Glacier block
{15049999, 0, ID{Hash: checksumToBytes(0x20c327fc), Next: 15050000}}, // Last Arrow Glacier block {15049999, 0, ID{Hash: checksumToBytes(0x20c327fc), Next: 15050000}}, // Last Arrow Glacier block
{15050000, 0, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 1681338455}}, // First Gray Glacier block
{20000000, 1681338454, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 1681338455}}, // Last Gray Glacier block
{20000000, 1681338455, ID{Hash: checksumToBytes(0xdce96c2d), Next: 0}}, // First Shanghai block
{30000000, 2000000000, ID{Hash: checksumToBytes(0xdce96c2d), Next: 0}}, // Future Shanghai block
}, },
}, },
// Goerli test cases // Goerli test cases
@ -86,10 +82,6 @@ func TestCreation(t *testing.T) {
{4460643, 0, ID{Hash: checksumToBytes(0xc25efa5c), Next: 4460644}}, // Last Istanbul block {4460643, 0, ID{Hash: checksumToBytes(0xc25efa5c), Next: 4460644}}, // Last Istanbul block
{4460644, 0, ID{Hash: checksumToBytes(0x757a1c47), Next: 5062605}}, // First Berlin block {4460644, 0, ID{Hash: checksumToBytes(0x757a1c47), Next: 5062605}}, // First Berlin block
{5000000, 0, ID{Hash: checksumToBytes(0x757a1c47), Next: 5062605}}, // Last Berlin block {5000000, 0, ID{Hash: checksumToBytes(0x757a1c47), Next: 5062605}}, // Last Berlin block
{5062605, 0, ID{Hash: checksumToBytes(0xB8C6299D), Next: 1678832736}}, // First London block
{6000000, 1678832735, ID{Hash: checksumToBytes(0xB8C6299D), Next: 1678832736}}, // Last London block
{6000001, 1678832736, ID{Hash: checksumToBytes(0xf9843abf), Next: 0}}, // First Shanghai block
{6500000, 2678832736, ID{Hash: checksumToBytes(0xf9843abf), Next: 0}}, // Future Shanghai block
}, },
}, },
// Sepolia test cases // Sepolia test cases
@ -99,9 +91,6 @@ func TestCreation(t *testing.T) {
[]testcase{ []testcase{
{0, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople, Petersburg, Istanbul, Berlin and first London block {0, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Unsynced, last Frontier, Homestead, Tangerine, Spurious, Byzantium, Constantinople, Petersburg, Istanbul, Berlin and first London block
{1735370, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Last London block {1735370, 0, ID{Hash: checksumToBytes(0xfe3366e7), Next: 1735371}}, // Last London block
{1735371, 0, ID{Hash: checksumToBytes(0xb96cbd13), Next: 1677557088}}, // First MergeNetsplit block
{1735372, 1677557087, ID{Hash: checksumToBytes(0xb96cbd13), Next: 1677557088}}, // Last MergeNetsplit block
{1735372, 1677557088, ID{Hash: checksumToBytes(0xf7f9bc08), Next: 0}}, // First Shanghai block
}, },
}, },
} }
@ -119,7 +108,7 @@ func TestCreation(t *testing.T) {
func TestValidation(t *testing.T) { func TestValidation(t *testing.T) {
// Config that has not timestamp enabled // Config that has not timestamp enabled
legacyConfig := *params.MainnetChainConfig legacyConfig := *params.MainnetChainConfig
legacyConfig.ShanghaiTime = nil legacyConfig.ShanghaiBlock = nil
tests := []struct { tests := []struct {
config *params.ChainConfig config *params.ChainConfig
@ -221,29 +210,14 @@ func TestValidation(t *testing.T) {
// neither forks passed at neither nodes, they may mismatch, but we still connect for now. // neither forks passed at neither nodes, they may mismatch, but we still connect for now.
{params.MainnetChainConfig, 15050000, 0, ID{Hash: checksumToBytes(0xf0afd0e3), Next: math.MaxUint64}, nil}, {params.MainnetChainConfig, 15050000, 0, ID{Hash: checksumToBytes(0xf0afd0e3), Next: math.MaxUint64}, nil},
// Local is mainnet exactly on Shanghai, remote announces Gray Glacier + knowledge about Shanghai. Remote
// is simply out of sync, accept.
{params.MainnetChainConfig, 20000000, 1681338455, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 1681338455}, nil},
// Local is mainnet Shanghai, remote announces Gray Glacier + knowledge about Shanghai. Remote
// is simply out of sync, accept.
{params.MainnetChainConfig, 20123456, 1681338456, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 1681338455}, nil},
// Local is mainnet Shanghai, remote announces Arrow Glacier + knowledge about Gray Glacier. Remote // Local is mainnet Shanghai, remote announces Arrow Glacier + knowledge about Gray Glacier. Remote
// is definitely out of sync. It may or may not need the Shanghai update, we don't know yet. // is definitely out of sync. It may or may not need the Shanghai update, we don't know yet.
{params.MainnetChainConfig, 20000000, 1681338455, ID{Hash: checksumToBytes(0x20c327fc), Next: 15050000}, nil}, {params.MainnetChainConfig, 20000000, 1681338455, ID{Hash: checksumToBytes(0x20c327fc), Next: 15050000}, nil},
// Local is mainnet Gray Glacier, remote announces Shanghai. Local is out of sync, accept.
{params.MainnetChainConfig, 15050000, 0, ID{Hash: checksumToBytes(0xdce96c2d), Next: 0}, nil},
// Local is mainnet Arrow Glacier, remote announces Gray Glacier, but is not aware of Shanghai. Local // Local is mainnet Arrow Glacier, remote announces Gray Glacier, but is not aware of Shanghai. Local
// out of sync. Local also knows about a future fork, but that is uncertain yet. // out of sync. Local also knows about a future fork, but that is uncertain yet.
{params.MainnetChainConfig, 13773000, 0, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 0}, nil}, {params.MainnetChainConfig, 13773000, 0, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 0}, nil},
// Local is mainnet Shanghai. remote announces Gray Glacier but is not aware of further forks.
// Remote needs software update.
{params.MainnetChainConfig, 20000000, 1681338455, ID{Hash: checksumToBytes(0xf0afd0e3), Next: 0}, ErrRemoteStale},
// Local is mainnet Gray Glacier, and isn't aware of more forks. Remote announces Gray Glacier + // Local is mainnet Gray Glacier, and isn't aware of more forks. Remote announces Gray Glacier +
// 0xffffffff. Local needs software update, reject. // 0xffffffff. Local needs software update, reject.
{params.MainnetChainConfig, 15050000, 0, ID{Hash: checksumToBytes(checksumUpdate(0xf0afd0e3, math.MaxUint64)), Next: 0}, ErrLocalIncompatibleOrStale}, {params.MainnetChainConfig, 15050000, 0, ID{Hash: checksumToBytes(checksumUpdate(0xf0afd0e3, math.MaxUint64)), Next: 0}, ErrLocalIncompatibleOrStale},
@ -266,13 +240,6 @@ func TestValidation(t *testing.T) {
// Timestamp based tests // Timestamp based tests
//---------------------- //----------------------
// Local is mainnet Shanghai, remote announces the same. No future fork is announced.
{params.MainnetChainConfig, 20000000, 1681338455, ID{Hash: checksumToBytes(0xdce96c2d), Next: 0}, nil},
// Local is mainnet Shanghai, remote announces the same. Remote also announces a next fork
// at time 0xffffffff, but that is uncertain.
{params.MainnetChainConfig, 20000000, 1681338455, ID{Hash: checksumToBytes(0xdce96c2d), Next: math.MaxUint64}, nil},
// Local is mainnet currently in Shanghai only (so it's aware of Cancun), remote announces // Local is mainnet currently in Shanghai only (so it's aware of Cancun), remote announces
// also Shanghai, but it's not yet aware of Cancun (e.g. non updated node before the fork). // also Shanghai, but it's not yet aware of Cancun (e.g. non updated node before the fork).
// In this case we don't know if Cancun passed yet or not. // In this case we don't know if Cancun passed yet or not.

View file

@ -298,7 +298,7 @@ func (e *GenesisMismatchError) Error() string {
// ChainOverrides contains the changes to chain config. // ChainOverrides contains the changes to chain config.
type ChainOverrides struct { type ChainOverrides struct {
OverrideShanghai *uint64 OverrideShanghai *big.Int
} }
// SetupGenesisBlock writes or updates the genesis block in db. // SetupGenesisBlock writes or updates the genesis block in db.
@ -326,9 +326,8 @@ 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.ShanghaiTime = overrides.OverrideShanghai config.ShanghaiBlock = overrides.OverrideShanghai
} }
} }
} }
@ -529,7 +528,7 @@ func (g *Genesis) ToBlock() *types.Block {
var withdrawals []*types.Withdrawal var withdrawals []*types.Withdrawal
if g.Config != nil && g.Config.IsShanghai(g.Timestamp) { if g.Config != nil && g.Config.IsShanghai(new(big.Int).SetUint64(g.Number)) {
head.WithdrawalsHash = &types.EmptyWithdrawalsHash head.WithdrawalsHash = &types.EmptyWithdrawalsHash
withdrawals = make([]*types.Withdrawal, 0) withdrawals = make([]*types.Withdrawal, 0)
} }

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,8 +101,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 double check if len(withdrawals) > 0 && !p.config.IsShanghai(block.Number()) {
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")
} }
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards) // Finalize the block, applying any consensus engine specific extras (e.g. block rewards)

View file

@ -364,8 +364,7 @@ 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),
ShanghaiTime: u64(0),
Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}}, Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
}, },
Alloc: GenesisAlloc{ Alloc: GenesisAlloc{
@ -442,11 +441,12 @@ 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.Time) { if config.IsShanghai(header.Number) {
header.WithdrawalsHash = &types.EmptyWithdrawalsHash header.WithdrawalsHash = &types.EmptyWithdrawalsHash
} }
@ -471,8 +471,7 @@ 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.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))
} }

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

@ -1900,7 +1900,7 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
pool.istanbul.Store(pool.chainconfig.IsIstanbul(next)) pool.istanbul.Store(pool.chainconfig.IsIstanbul(next))
pool.eip2718.Store(pool.chainconfig.IsBerlin(next)) pool.eip2718.Store(pool.chainconfig.IsBerlin(next))
pool.eip1559.Store(pool.chainconfig.IsLondon(next)) pool.eip1559.Store(pool.chainconfig.IsLondon(next))
pool.shanghai.Store(pool.chainconfig.IsShanghai(uint64(time.Now().Unix()))) pool.shanghai.Store(pool.chainconfig.IsShanghai(next))
} }
// promoteExecutables moves transactions that have become processable from the // promoteExecutables moves transactions that have become processable from the

View file

@ -134,7 +134,6 @@ 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

@ -165,46 +165,46 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
// //
// If there are payloadAttributes: we try to assemble a block with the payloadAttributes // If there are payloadAttributes: we try to assemble a block with the payloadAttributes
// and return its payloadID. // and return its payloadID.
func (api *ConsensusAPI) ForkchoiceUpdatedV1(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) { // func (api *ConsensusAPI) ForkchoiceUpdatedV1(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) {
if payloadAttributes != nil { // if payloadAttributes != nil {
if payloadAttributes.Withdrawals != nil { // if payloadAttributes.Withdrawals != nil {
return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1")) // return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("withdrawals not supported in V1"))
} // }
if api.eth.BlockChain().Config().IsShanghai(payloadAttributes.Timestamp) { // if api.eth.BlockChain().Config().IsShanghai(payloadAttributes.Timestamp) {
return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("forkChoiceUpdateV1 called post-shanghai")) // return engine.STATUS_INVALID, engine.InvalidParams.With(fmt.Errorf("forkChoiceUpdateV1 called post-shanghai"))
} // }
} // }
return api.forkchoiceUpdated(update, payloadAttributes) // return api.forkchoiceUpdated(update, payloadAttributes)
} // }
// ForkchoiceUpdatedV2 is equivalent to V1 with the addition of withdrawals in the payload attributes. // ForkchoiceUpdatedV2 is equivalent to V1 with the addition of withdrawals in the payload attributes.
func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) { // func (api *ConsensusAPI) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) {
if payloadAttributes != nil { // if payloadAttributes != nil {
if err := api.verifyPayloadAttributes(payloadAttributes); err != nil { // if err := api.verifyPayloadAttributes(payloadAttributes); err != nil {
return engine.STATUS_INVALID, engine.InvalidParams.With(err) // return engine.STATUS_INVALID, engine.InvalidParams.With(err)
} // }
} // }
return api.forkchoiceUpdated(update, payloadAttributes) // return api.forkchoiceUpdated(update, payloadAttributes)
} // }
func (api *ConsensusAPI) verifyPayloadAttributes(attr *engine.PayloadAttributes) error { // func (api *ConsensusAPI) verifyPayloadAttributes(attr *engine.PayloadAttributes) error {
if !api.eth.BlockChain().Config().IsShanghai(attr.Timestamp) { // if !api.eth.BlockChain().Config().IsShanghai(attr.Timestamp) {
// Reject payload attributes with withdrawals before shanghai // // Reject payload attributes with withdrawals before shanghai
if attr.Withdrawals != nil { // if attr.Withdrawals != nil {
return errors.New("withdrawals before shanghai") // return errors.New("withdrawals before shanghai")
} // }
} else { // } else {
// Reject payload attributes with nil withdrawals after shanghai // // Reject payload attributes with nil withdrawals after shanghai
if attr.Withdrawals == nil { // if attr.Withdrawals == nil {
return errors.New("missing withdrawals list") // return errors.New("missing withdrawals list")
} // }
} // }
return nil // return nil
} // }
// nolint:gocognit // nolint:gocognit
func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) { func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) {
@ -454,18 +454,18 @@ func (api *ConsensusAPI) NewPayloadV1(params engine.ExecutableData) (engine.Payl
return api.newPayload(params) return api.newPayload(params)
} }
// NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain. // // NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.
func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error) { // func (api *ConsensusAPI) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error) {
if api.eth.BlockChain().Config().IsShanghai(params.Timestamp) { // if api.eth.BlockChain().Config().IsShanghai(params.Timestamp) {
if params.Withdrawals == nil { // if params.Withdrawals == nil {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("nil withdrawals post-shanghai")) // return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("nil withdrawals post-shanghai"))
} // }
} else if params.Withdrawals != nil { // } else if params.Withdrawals != nil {
return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("non-nil withdrawals pre-shanghai")) // return engine.PayloadStatusV1{Status: engine.INVALID}, engine.InvalidParams.With(fmt.Errorf("non-nil withdrawals pre-shanghai"))
} // }
return api.newPayload(params) // return api.newPayload(params)
} // }
func (api *ConsensusAPI) newPayload(params engine.ExecutableData) (engine.PayloadStatusV1, error) { func (api *ConsensusAPI) newPayload(params engine.ExecutableData) (engine.PayloadStatusV1, error) {
// The locking here is, strictly, not required. Without these locks, this can happen: // The locking here is, strictly, not required. Without these locks, this can happen:

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,7 @@
package ethconfig package ethconfig
import ( import (
"math/big"
"os" "os"
"os/user" "os/user"
"path/filepath" "path/filepath"
@ -224,9 +225,8 @@ 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 *uint64 `toml:",omitempty"` OverrideShanghai *big.Int `toml:",omitempty"`
// URL to connect to Heimdall node // URL to connect to Heimdall node
HeimdallURL string HeimdallURL string

View file

@ -3,6 +3,7 @@
package ethconfig package ethconfig
import ( import (
"math/big"
"time" "time"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -41,6 +42,10 @@ func (c Config) MarshalTOML() (interface{}, error) {
DatabaseHandles int `toml:"-"` DatabaseHandles int `toml:"-"`
DatabaseCache int DatabaseCache int
DatabaseFreezer string DatabaseFreezer string
LevelDbCompactionTableSize uint64
LevelDbCompactionTableSizeMultiplier float64
LevelDbCompactionTotalSize uint64
LevelDbCompactionTotalSizeMultiplier float64
TrieCleanCache int TrieCleanCache int
TrieCleanCacheJournal string `toml:",omitempty"` TrieCleanCacheJournal string `toml:",omitempty"`
TrieCleanCacheRejournal time.Duration `toml:",omitempty"` TrieCleanCacheRejournal time.Duration `toml:",omitempty"`
@ -48,6 +53,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
TrieTimeout time.Duration TrieTimeout time.Duration
SnapshotCache int SnapshotCache int
Preimages bool Preimages bool
TriesInMemory uint64
FilterLogCacheSize int FilterLogCacheSize int
Miner miner.Config Miner miner.Config
Ethash ethash.Config Ethash ethash.Config
@ -56,13 +62,22 @@ func (c Config) MarshalTOML() (interface{}, error) {
EnablePreimageRecording bool EnablePreimageRecording bool
DocRoot string `toml:"-"` DocRoot string `toml:"-"`
RPCGasCap uint64 RPCGasCap uint64
RPCReturnDataLimit uint64
RPCEVMTimeout time.Duration RPCEVMTimeout time.Duration
RPCTxFeeCap float64 RPCTxFeeCap float64
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"`
OverrideShanghai *uint64 `toml:",omitempty"` OverrideShanghai *big.Int `toml:",omitempty"`
HeimdallURL string
WithoutHeimdall bool
HeimdallgRPCAddress string
RunHeimdall bool
RunHeimdallArgs string
UseHeimdallApp bool
BorLogs bool
ParallelEVM core.ParallelEVMConfig `toml:",omitempty"`
DevFakeAuthor bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"`
} }
var enc Config var enc Config
enc.Genesis = c.Genesis enc.Genesis = c.Genesis
enc.NetworkId = c.NetworkId enc.NetworkId = c.NetworkId
@ -87,6 +102,10 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.DatabaseHandles = c.DatabaseHandles enc.DatabaseHandles = c.DatabaseHandles
enc.DatabaseCache = c.DatabaseCache enc.DatabaseCache = c.DatabaseCache
enc.DatabaseFreezer = c.DatabaseFreezer enc.DatabaseFreezer = c.DatabaseFreezer
enc.LevelDbCompactionTableSize = c.LevelDbCompactionTableSize
enc.LevelDbCompactionTableSizeMultiplier = c.LevelDbCompactionTableSizeMultiplier
enc.LevelDbCompactionTotalSize = c.LevelDbCompactionTotalSize
enc.LevelDbCompactionTotalSizeMultiplier = c.LevelDbCompactionTotalSizeMultiplier
enc.TrieCleanCache = c.TrieCleanCache enc.TrieCleanCache = c.TrieCleanCache
enc.TrieCleanCacheJournal = c.TrieCleanCacheJournal enc.TrieCleanCacheJournal = c.TrieCleanCacheJournal
enc.TrieCleanCacheRejournal = c.TrieCleanCacheRejournal enc.TrieCleanCacheRejournal = c.TrieCleanCacheRejournal
@ -94,6 +113,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.TrieTimeout = c.TrieTimeout enc.TrieTimeout = c.TrieTimeout
enc.SnapshotCache = c.SnapshotCache enc.SnapshotCache = c.SnapshotCache
enc.Preimages = c.Preimages enc.Preimages = c.Preimages
enc.TriesInMemory = c.TriesInMemory
enc.FilterLogCacheSize = c.FilterLogCacheSize enc.FilterLogCacheSize = c.FilterLogCacheSize
enc.Miner = c.Miner enc.Miner = c.Miner
enc.Ethash = c.Ethash enc.Ethash = c.Ethash
@ -102,12 +122,21 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.EnablePreimageRecording = c.EnablePreimageRecording enc.EnablePreimageRecording = c.EnablePreimageRecording
enc.DocRoot = c.DocRoot enc.DocRoot = c.DocRoot
enc.RPCGasCap = c.RPCGasCap enc.RPCGasCap = c.RPCGasCap
enc.RPCReturnDataLimit = c.RPCReturnDataLimit
enc.RPCEVMTimeout = c.RPCEVMTimeout enc.RPCEVMTimeout = c.RPCEVMTimeout
enc.RPCTxFeeCap = c.RPCTxFeeCap enc.RPCTxFeeCap = c.RPCTxFeeCap
enc.Checkpoint = c.Checkpoint enc.Checkpoint = c.Checkpoint
enc.CheckpointOracle = c.CheckpointOracle enc.CheckpointOracle = c.CheckpointOracle
enc.OverrideShanghai = c.OverrideShanghai enc.OverrideShanghai = c.OverrideShanghai
enc.HeimdallURL = c.HeimdallURL
enc.WithoutHeimdall = c.WithoutHeimdall
enc.HeimdallgRPCAddress = c.HeimdallgRPCAddress
enc.RunHeimdall = c.RunHeimdall
enc.RunHeimdallArgs = c.RunHeimdallArgs
enc.UseHeimdallApp = c.UseHeimdallApp
enc.BorLogs = c.BorLogs
enc.ParallelEVM = c.ParallelEVM
enc.DevFakeAuthor = c.DevFakeAuthor
return &enc, nil return &enc, nil
} }
@ -137,6 +166,10 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
DatabaseHandles *int `toml:"-"` DatabaseHandles *int `toml:"-"`
DatabaseCache *int DatabaseCache *int
DatabaseFreezer *string DatabaseFreezer *string
LevelDbCompactionTableSize *uint64
LevelDbCompactionTableSizeMultiplier *float64
LevelDbCompactionTotalSize *uint64
LevelDbCompactionTotalSizeMultiplier *float64
TrieCleanCache *int TrieCleanCache *int
TrieCleanCacheJournal *string `toml:",omitempty"` TrieCleanCacheJournal *string `toml:",omitempty"`
TrieCleanCacheRejournal *time.Duration `toml:",omitempty"` TrieCleanCacheRejournal *time.Duration `toml:",omitempty"`
@ -144,6 +177,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
TrieTimeout *time.Duration TrieTimeout *time.Duration
SnapshotCache *int SnapshotCache *int
Preimages *bool Preimages *bool
TriesInMemory *uint64
FilterLogCacheSize *int FilterLogCacheSize *int
Miner *miner.Config Miner *miner.Config
Ethash *ethash.Config Ethash *ethash.Config
@ -152,189 +186,199 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
EnablePreimageRecording *bool EnablePreimageRecording *bool
DocRoot *string `toml:"-"` DocRoot *string `toml:"-"`
RPCGasCap *uint64 RPCGasCap *uint64
RPCReturnDataLimit *uint64
RPCEVMTimeout *time.Duration RPCEVMTimeout *time.Duration
RPCTxFeeCap *float64 RPCTxFeeCap *float64
Checkpoint *params.TrustedCheckpoint `toml:",omitempty"` Checkpoint *params.TrustedCheckpoint `toml:",omitempty"`
CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"` CheckpointOracle *params.CheckpointOracleConfig `toml:",omitempty"`
OverrideShanghai *uint64 `toml:",omitempty"` OverrideShanghai *big.Int `toml:",omitempty"`
HeimdallURL *string
WithoutHeimdall *bool
HeimdallgRPCAddress *string
RunHeimdall *bool
RunHeimdallArgs *string
UseHeimdallApp *bool
BorLogs *bool
ParallelEVM *core.ParallelEVMConfig `toml:",omitempty"`
DevFakeAuthor *bool `hcl:"devfakeauthor,optional" toml:"devfakeauthor,optional"`
} }
var dec Config var dec Config
if err := unmarshal(&dec); err != nil { if err := unmarshal(&dec); err != nil {
return err return err
} }
if dec.Genesis != nil { if dec.Genesis != nil {
c.Genesis = dec.Genesis c.Genesis = dec.Genesis
} }
if dec.NetworkId != nil { if dec.NetworkId != nil {
c.NetworkId = *dec.NetworkId c.NetworkId = *dec.NetworkId
} }
if dec.SyncMode != nil { if dec.SyncMode != nil {
c.SyncMode = *dec.SyncMode c.SyncMode = *dec.SyncMode
} }
if dec.EthDiscoveryURLs != nil { if dec.EthDiscoveryURLs != nil {
c.EthDiscoveryURLs = dec.EthDiscoveryURLs c.EthDiscoveryURLs = dec.EthDiscoveryURLs
} }
if dec.SnapDiscoveryURLs != nil { if dec.SnapDiscoveryURLs != nil {
c.SnapDiscoveryURLs = dec.SnapDiscoveryURLs c.SnapDiscoveryURLs = dec.SnapDiscoveryURLs
} }
if dec.NoPruning != nil { if dec.NoPruning != nil {
c.NoPruning = *dec.NoPruning c.NoPruning = *dec.NoPruning
} }
if dec.NoPrefetch != nil { if dec.NoPrefetch != nil {
c.NoPrefetch = *dec.NoPrefetch c.NoPrefetch = *dec.NoPrefetch
} }
if dec.TxLookupLimit != nil { if dec.TxLookupLimit != nil {
c.TxLookupLimit = *dec.TxLookupLimit c.TxLookupLimit = *dec.TxLookupLimit
} }
if dec.RequiredBlocks != nil { if dec.RequiredBlocks != nil {
c.RequiredBlocks = dec.RequiredBlocks c.RequiredBlocks = dec.RequiredBlocks
} }
if dec.LightServ != nil { if dec.LightServ != nil {
c.LightServ = *dec.LightServ c.LightServ = *dec.LightServ
} }
if dec.LightIngress != nil { if dec.LightIngress != nil {
c.LightIngress = *dec.LightIngress c.LightIngress = *dec.LightIngress
} }
if dec.LightEgress != nil { if dec.LightEgress != nil {
c.LightEgress = *dec.LightEgress c.LightEgress = *dec.LightEgress
} }
if dec.LightPeers != nil { if dec.LightPeers != nil {
c.LightPeers = *dec.LightPeers c.LightPeers = *dec.LightPeers
} }
if dec.LightNoPrune != nil { if dec.LightNoPrune != nil {
c.LightNoPrune = *dec.LightNoPrune c.LightNoPrune = *dec.LightNoPrune
} }
if dec.LightNoSyncServe != nil { if dec.LightNoSyncServe != nil {
c.LightNoSyncServe = *dec.LightNoSyncServe c.LightNoSyncServe = *dec.LightNoSyncServe
} }
if dec.SyncFromCheckpoint != nil { if dec.SyncFromCheckpoint != nil {
c.SyncFromCheckpoint = *dec.SyncFromCheckpoint c.SyncFromCheckpoint = *dec.SyncFromCheckpoint
} }
if dec.UltraLightServers != nil { if dec.UltraLightServers != nil {
c.UltraLightServers = dec.UltraLightServers c.UltraLightServers = dec.UltraLightServers
} }
if dec.UltraLightFraction != nil { if dec.UltraLightFraction != nil {
c.UltraLightFraction = *dec.UltraLightFraction c.UltraLightFraction = *dec.UltraLightFraction
} }
if dec.UltraLightOnlyAnnounce != nil { if dec.UltraLightOnlyAnnounce != nil {
c.UltraLightOnlyAnnounce = *dec.UltraLightOnlyAnnounce c.UltraLightOnlyAnnounce = *dec.UltraLightOnlyAnnounce
} }
if dec.SkipBcVersionCheck != nil { if dec.SkipBcVersionCheck != nil {
c.SkipBcVersionCheck = *dec.SkipBcVersionCheck c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
} }
if dec.DatabaseHandles != nil { if dec.DatabaseHandles != nil {
c.DatabaseHandles = *dec.DatabaseHandles c.DatabaseHandles = *dec.DatabaseHandles
} }
if dec.DatabaseCache != nil { if dec.DatabaseCache != nil {
c.DatabaseCache = *dec.DatabaseCache c.DatabaseCache = *dec.DatabaseCache
} }
if dec.DatabaseFreezer != nil { if dec.DatabaseFreezer != nil {
c.DatabaseFreezer = *dec.DatabaseFreezer c.DatabaseFreezer = *dec.DatabaseFreezer
} }
if dec.LevelDbCompactionTableSize != nil {
c.LevelDbCompactionTableSize = *dec.LevelDbCompactionTableSize
}
if dec.LevelDbCompactionTableSizeMultiplier != nil {
c.LevelDbCompactionTableSizeMultiplier = *dec.LevelDbCompactionTableSizeMultiplier
}
if dec.LevelDbCompactionTotalSize != nil {
c.LevelDbCompactionTotalSize = *dec.LevelDbCompactionTotalSize
}
if dec.LevelDbCompactionTotalSizeMultiplier != nil {
c.LevelDbCompactionTotalSizeMultiplier = *dec.LevelDbCompactionTotalSizeMultiplier
}
if dec.TrieCleanCache != nil { if dec.TrieCleanCache != nil {
c.TrieCleanCache = *dec.TrieCleanCache c.TrieCleanCache = *dec.TrieCleanCache
} }
if dec.TrieCleanCacheJournal != nil { if dec.TrieCleanCacheJournal != nil {
c.TrieCleanCacheJournal = *dec.TrieCleanCacheJournal c.TrieCleanCacheJournal = *dec.TrieCleanCacheJournal
} }
if dec.TrieCleanCacheRejournal != nil { if dec.TrieCleanCacheRejournal != nil {
c.TrieCleanCacheRejournal = *dec.TrieCleanCacheRejournal c.TrieCleanCacheRejournal = *dec.TrieCleanCacheRejournal
} }
if dec.TrieDirtyCache != nil { if dec.TrieDirtyCache != nil {
c.TrieDirtyCache = *dec.TrieDirtyCache c.TrieDirtyCache = *dec.TrieDirtyCache
} }
if dec.TrieTimeout != nil { if dec.TrieTimeout != nil {
c.TrieTimeout = *dec.TrieTimeout c.TrieTimeout = *dec.TrieTimeout
} }
if dec.SnapshotCache != nil { if dec.SnapshotCache != nil {
c.SnapshotCache = *dec.SnapshotCache c.SnapshotCache = *dec.SnapshotCache
} }
if dec.Preimages != nil { if dec.Preimages != nil {
c.Preimages = *dec.Preimages c.Preimages = *dec.Preimages
} }
if dec.TriesInMemory != nil {
c.TriesInMemory = *dec.TriesInMemory
}
if dec.FilterLogCacheSize != nil { if dec.FilterLogCacheSize != nil {
c.FilterLogCacheSize = *dec.FilterLogCacheSize c.FilterLogCacheSize = *dec.FilterLogCacheSize
} }
if dec.Miner != nil { if dec.Miner != nil {
c.Miner = *dec.Miner c.Miner = *dec.Miner
} }
if dec.Ethash != nil { if dec.Ethash != nil {
c.Ethash = *dec.Ethash c.Ethash = *dec.Ethash
} }
if dec.TxPool != nil { if dec.TxPool != nil {
c.TxPool = *dec.TxPool c.TxPool = *dec.TxPool
} }
if dec.GPO != nil { if dec.GPO != nil {
c.GPO = *dec.GPO c.GPO = *dec.GPO
} }
if dec.EnablePreimageRecording != nil { if dec.EnablePreimageRecording != nil {
c.EnablePreimageRecording = *dec.EnablePreimageRecording c.EnablePreimageRecording = *dec.EnablePreimageRecording
} }
if dec.DocRoot != nil { if dec.DocRoot != nil {
c.DocRoot = *dec.DocRoot c.DocRoot = *dec.DocRoot
} }
if dec.RPCGasCap != nil { if dec.RPCGasCap != nil {
c.RPCGasCap = *dec.RPCGasCap c.RPCGasCap = *dec.RPCGasCap
} }
if dec.RPCReturnDataLimit != nil {
c.RPCReturnDataLimit = *dec.RPCReturnDataLimit
}
if dec.RPCEVMTimeout != nil { if dec.RPCEVMTimeout != nil {
c.RPCEVMTimeout = *dec.RPCEVMTimeout c.RPCEVMTimeout = *dec.RPCEVMTimeout
} }
if dec.RPCTxFeeCap != nil { if dec.RPCTxFeeCap != nil {
c.RPCTxFeeCap = *dec.RPCTxFeeCap c.RPCTxFeeCap = *dec.RPCTxFeeCap
} }
if dec.Checkpoint != nil { if dec.Checkpoint != nil {
c.Checkpoint = dec.Checkpoint c.Checkpoint = dec.Checkpoint
} }
if dec.CheckpointOracle != nil { if dec.CheckpointOracle != nil {
c.CheckpointOracle = dec.CheckpointOracle c.CheckpointOracle = dec.CheckpointOracle
} }
// TODO marcello double check
if dec.OverrideShanghai != nil { if dec.OverrideShanghai != nil {
c.OverrideShanghai = dec.OverrideShanghai c.OverrideShanghai = dec.OverrideShanghai
} }
if dec.HeimdallURL != nil {
c.HeimdallURL = *dec.HeimdallURL
}
if dec.WithoutHeimdall != nil {
c.WithoutHeimdall = *dec.WithoutHeimdall
}
if dec.HeimdallgRPCAddress != nil {
c.HeimdallgRPCAddress = *dec.HeimdallgRPCAddress
}
if dec.RunHeimdall != nil {
c.RunHeimdall = *dec.RunHeimdall
}
if dec.RunHeimdallArgs != nil {
c.RunHeimdallArgs = *dec.RunHeimdallArgs
}
if dec.UseHeimdallApp != nil {
c.UseHeimdallApp = *dec.UseHeimdallApp
}
if dec.BorLogs != nil {
c.BorLogs = *dec.BorLogs
}
if dec.ParallelEVM != nil {
c.ParallelEVM = *dec.ParallelEVM
}
if dec.DevFakeAuthor != nil {
c.DevFakeAuthor = *dec.DevFakeAuthor
}
return nil return nil
} }

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),
@ -94,7 +93,7 @@ func newTestBackendWithGenerator(blocks int, shanghai bool, generator func(int,
ArrowGlacierBlock: big.NewInt(0), ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0), GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0),
ShanghaiTime: u64(0), ShanghaiBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true, TerminalTotalDifficultyPassed: true,
Ethash: new(params.EthashConfig), Ethash: new(params.EthashConfig),

View file

@ -1425,18 +1425,18 @@ func overrideConfig(original *params.ChainConfig, override *params.ChainConfig)
canon = false canon = false
} }
if timestamp := override.ShanghaiTime; timestamp != nil { if timestamp := override.ShanghaiBlock; timestamp != nil {
chainConfigCopy.ShanghaiTime = timestamp chainConfigCopy.ShanghaiBlock = timestamp
canon = false canon = false
} }
if timestamp := override.CancunTime; timestamp != nil { if timestamp := override.CancunBlock; timestamp != nil {
chainConfigCopy.CancunTime = timestamp chainConfigCopy.CancunBlock = timestamp
canon = false canon = false
} }
if timestamp := override.PragueTime; timestamp != nil { if timestamp := override.PragueBlock; timestamp != nil {
chainConfigCopy.PragueTime = timestamp chainConfigCopy.PragueBlock = timestamp
canon = false canon = false
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -341,7 +341,7 @@ func (pool *TxPool) setNewHead(head *types.Header) {
next := new(big.Int).Add(head.Number, big.NewInt(1)) next := new(big.Int).Add(head.Number, big.NewInt(1))
pool.istanbul = pool.config.IsIstanbul(next) pool.istanbul = pool.config.IsIstanbul(next)
pool.eip2718 = pool.config.IsBerlin(next) pool.eip2718 = pool.config.IsBerlin(next)
pool.shanghai = pool.config.IsShanghai(uint64(time.Now().Unix())) pool.shanghai = pool.config.IsShanghai(next)
} }
// Stop stops the light transaction pool // Stop stops the light transaction pool

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.0.6 Version: 1.1.0
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.0.6 Version: 1.1.0
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.0.6 Version: 1.1.0
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.0.6 Version: 1.1.0
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.0.6 Version: 1.1.0
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.0.6 Version: 1.1.0
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

File diff suppressed because one or more lines are too long

View file

@ -94,22 +94,11 @@ func TestCheckCompatible(t *testing.T) {
}, },
}, },
{ {
stored: &ChainConfig{ShanghaiTime: newUint64(10)}, stored: &ChainConfig{ShanghaiBlock: big.NewInt(30)},
new: &ChainConfig{ShanghaiTime: newUint64(20)}, new: &ChainConfig{ShanghaiBlock: big.NewInt(30)},
headTimestamp: 9, headTimestamp: 9,
wantErr: nil, wantErr: nil,
}, },
{
stored: &ChainConfig{ShanghaiTime: newUint64(10)},
new: &ChainConfig{ShanghaiTime: newUint64(20)},
headTimestamp: 25,
wantErr: &ConfigCompatError{
What: "Shanghai fork timestamp",
StoredTime: newUint64(10),
NewTime: newUint64(20),
RewindToTime: 9,
},
},
} }
for _, test := range tests { for _, test := range tests {
@ -124,24 +113,24 @@ func TestConfigRules(t *testing.T) {
t.Parallel() t.Parallel()
c := &ChainConfig{ c := &ChainConfig{
ShanghaiTime: newUint64(500), ShanghaiBlock: big.NewInt(10),
} }
var stamp uint64 block := new(big.Int)
if r := c.Rules(big.NewInt(0), true, stamp); r.IsShanghai { if r := c.Rules(block, true, 0); r.IsShanghai {
t.Errorf("expected %v to not be shanghai", stamp) t.Errorf("expected %v to not be shanghai", 0)
} }
stamp = 500 block.SetInt64(10)
if r := c.Rules(big.NewInt(0), true, stamp); !r.IsShanghai { if r := c.Rules(block, true, 0); !r.IsShanghai {
t.Errorf("expected %v to be shanghai", stamp) t.Errorf("expected %v to be shanghai", 0)
} }
stamp = math.MaxInt64 block = block.SetInt64(math.MaxInt64)
if r := c.Rules(big.NewInt(0), true, stamp); !r.IsShanghai { if r := c.Rules(block, true, 0); !r.IsShanghai {
t.Errorf("expected %v to be shanghai", stamp) t.Errorf("expected %v to be shanghai", 0)
} }
} }

View file

@ -22,9 +22,9 @@ import (
const ( const (
VersionMajor = 1 // Major version component of the current release VersionMajor = 1 // Major version component of the current release
VersionMinor = 0 // Minor version component of the current release VersionMinor = 1 // Minor version component of the current release
VersionPatch = 6 // Patch version component of the current release VersionPatch = 0 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string VersionMeta = "beta" // Version metadata to append to the version string
) )
var GitCommit string var GitCommit string

View file

@ -969,6 +969,290 @@ func TestEIP1559Transition(t *testing.T) {
} }
} }
func TestBurnContract(t *testing.T) {
var (
aa = common.HexToAddress("0x000000000000000000000000000000000000aaaa")
// Generate a canonical chain to act as the main dataset
db = rawdb.NewMemoryDatabase()
engine = ethash.NewFaker()
// A sender who makes transactions, has some funds
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
key3, _ = crypto.HexToECDSA("225171aed3793cba1c029832886d69785b7e77a54a44211226b447aa2d16b058")
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
addr2 = crypto.PubkeyToAddress(key2.PublicKey)
addr3 = crypto.PubkeyToAddress(key3.PublicKey)
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
gspec = &core.Genesis{
Config: params.BorUnittestChainConfig,
Alloc: core.GenesisAlloc{
addr1: {Balance: funds},
addr2: {Balance: funds},
addr3: {Balance: funds},
// The address 0xAAAA sloads 0x00 and 0x01
aa: {
Code: []byte{
byte(vm.PC),
byte(vm.PC),
byte(vm.SLOAD),
byte(vm.SLOAD),
},
Nonce: 0,
Balance: big.NewInt(0),
},
},
}
)
gspec.Config.BerlinBlock = common.Big0
gspec.Config.LondonBlock = common.Big0
gspec.Config.Bor.BurntContract = map[string]string{
"0": "0x000000000000000000000000000000000000aaab",
"1": "0x000000000000000000000000000000000000aaac",
"2": "0x000000000000000000000000000000000000aaad",
"3": "0x000000000000000000000000000000000000aaae",
}
genesis := gspec.MustCommit(db)
signer := types.LatestSigner(gspec.Config)
blocks, _ := core.GenerateChain(gspec.Config, genesis, engine, db, 1, func(i int, b *core.BlockGen) {
b.SetCoinbase(common.Address{1})
// One transaction to 0xAAAA
accesses := types.AccessList{types.AccessTuple{
Address: aa,
StorageKeys: []common.Hash{{0}},
}}
txdata := &types.DynamicFeeTx{
ChainID: gspec.Config.ChainID,
Nonce: 0,
To: &aa,
Gas: 30000,
GasFeeCap: newGwei(5),
GasTipCap: big.NewInt(2),
AccessList: accesses,
Data: []byte{},
}
tx := types.NewTx(txdata)
tx, _ = types.SignTx(tx, signer, key1)
b.AddTx(tx)
})
diskdb := rawdb.NewMemoryDatabase()
gspec.MustCommit(diskdb)
chain, err := core.NewBlockChain(diskdb, nil, gspec, nil, engine, vm.Config{}, nil, nil, nil)
if err != nil {
t.Fatalf("failed to create tester chain: %v", err)
}
if n, err := chain.InsertChain(blocks); err != nil {
t.Fatalf("block %d: failed to insert into chain: %v", n, err)
}
block := chain.GetBlockByNumber(1)
// 1+2: Ensure EIP-1559 access lists are accounted for via gas usage.
expectedGas := params.TxGas + params.TxAccessListAddressGas + params.TxAccessListStorageKeyGas +
vm.GasQuickStep*2 + params.WarmStorageReadCostEIP2929 + params.ColdSloadCostEIP2929
if block.GasUsed() != expectedGas {
t.Fatalf("incorrect amount of gas spent: expected %d, got %d", expectedGas, block.GasUsed())
}
state, _ := chain.State()
// 3: Ensure that miner received only the tx's tip.
actual := state.GetBalance(block.Coinbase())
expected := new(big.Int).Add(
new(big.Int).SetUint64(block.GasUsed()*block.Transactions()[0].GasTipCap().Uint64()),
ethash.ConstantinopleBlockReward,
)
if actual.Cmp(expected) != 0 {
t.Fatalf("miner balance incorrect: expected %d, got %d", expected, actual)
}
// check burnt contract balance
actual = state.GetBalance(common.HexToAddress(gspec.Config.Bor.CalculateBurntContract(block.NumberU64())))
expected = new(big.Int).Mul(new(big.Int).SetUint64(block.GasUsed()), block.BaseFee())
if actual.Cmp(expected) != 0 {
t.Fatalf("burnt contract balance incorrect: expected %d, got %d", expected, actual)
}
// 4: Ensure the tx sender paid for the gasUsed * (tip + block baseFee).
actual = new(big.Int).Sub(funds, state.GetBalance(addr1))
expected = new(big.Int).SetUint64(block.GasUsed() * (block.Transactions()[0].GasTipCap().Uint64() + block.BaseFee().Uint64()))
if actual.Cmp(expected) != 0 {
t.Fatalf("sender balance incorrect: expected %d, got %d", expected, actual)
}
blocks, _ = core.GenerateChain(gspec.Config, block, engine, db, 1, func(i int, b *core.BlockGen) {
b.SetCoinbase(common.Address{2})
txdata := &types.LegacyTx{
Nonce: 0,
To: &aa,
Gas: 30000,
GasPrice: newGwei(5),
}
tx := types.NewTx(txdata)
tx, _ = types.SignTx(tx, signer, key2)
b.AddTx(tx)
})
if n, err := chain.InsertChain(blocks); err != nil {
t.Fatalf("block %d: failed to insert into chain: %v", n, err)
}
block = chain.GetBlockByNumber(2)
state, _ = chain.State()
effectiveTip := block.Transactions()[0].GasTipCap().Uint64() - block.BaseFee().Uint64()
// 6+5: Ensure that miner received only the tx's effective tip.
actual = state.GetBalance(block.Coinbase())
expected = new(big.Int).Add(
new(big.Int).SetUint64(block.GasUsed()*effectiveTip),
ethash.ConstantinopleBlockReward,
)
if actual.Cmp(expected) != 0 {
t.Fatalf("miner balance incorrect: expected %d, got %d", expected, actual)
}
// check burnt contract balance
actual = state.GetBalance(common.HexToAddress(gspec.Config.Bor.CalculateBurntContract(block.NumberU64())))
expected = new(big.Int).Mul(new(big.Int).SetUint64(block.GasUsed()), block.BaseFee())
if actual.Cmp(expected) != 0 {
t.Fatalf("burnt contract balance incorrect: expected %d, got %d", expected, actual)
}
// 4: Ensure the tx sender paid for the gasUsed * (effectiveTip + block baseFee).
actual = new(big.Int).Sub(funds, state.GetBalance(addr2))
expected = new(big.Int).SetUint64(block.GasUsed() * (effectiveTip + block.BaseFee().Uint64()))
if actual.Cmp(expected) != 0 {
t.Fatalf("sender balance incorrect: expected %d, got %d", expected, actual)
}
blocks, _ = core.GenerateChain(gspec.Config, block, engine, db, 1, func(i int, b *core.BlockGen) {
b.SetCoinbase(common.Address{3})
txdata := &types.LegacyTx{
Nonce: 0,
To: &aa,
Gas: 30000,
GasPrice: newGwei(5),
}
tx := types.NewTx(txdata)
tx, _ = types.SignTx(tx, signer, key3)
b.AddTx(tx)
})
if n, err := chain.InsertChain(blocks); err != nil {
t.Fatalf("block %d: failed to insert into chain: %v", n, err)
}
block = chain.GetBlockByNumber(3)
state, _ = chain.State()
effectiveTip = block.Transactions()[0].GasTipCap().Uint64() - block.BaseFee().Uint64()
// 6+5: Ensure that miner received only the tx's effective tip.
actual = state.GetBalance(block.Coinbase())
expected = new(big.Int).Add(
new(big.Int).SetUint64(block.GasUsed()*effectiveTip),
ethash.ConstantinopleBlockReward,
)
if actual.Cmp(expected) != 0 {
t.Fatalf("miner balance incorrect: expected %d, got %d", expected, actual)
}
// check burnt contract balance
actual = state.GetBalance(common.HexToAddress(gspec.Config.Bor.CalculateBurntContract(block.NumberU64())))
expected = new(big.Int).Mul(new(big.Int).SetUint64(block.GasUsed()), block.BaseFee())
if actual.Cmp(expected) != 0 {
t.Fatalf("burnt contract balance incorrect: expected %d, got %d", expected, actual)
}
// 4: Ensure the tx sender paid for the gasUsed * (effectiveTip + block baseFee).
actual = new(big.Int).Sub(funds, state.GetBalance(addr3))
expected = new(big.Int).SetUint64(block.GasUsed() * (effectiveTip + block.BaseFee().Uint64()))
if actual.Cmp(expected) != 0 {
t.Fatalf("sender balance incorrect: expected %d, got %d", expected, actual)
}
}
func TestBurnContractContractFetch(t *testing.T) {
config := params.BorUnittestChainConfig
config.Bor.BurntContract = map[string]string{
"10": "0x000000000000000000000000000000000000aaab",
"100": "0x000000000000000000000000000000000000aaad",
}
burnContractAddr10 := config.Bor.CalculateBurntContract(10)
burnContractAddr11 := config.Bor.CalculateBurntContract(11)
burnContractAddr99 := config.Bor.CalculateBurntContract(99)
burnContractAddr100 := config.Bor.CalculateBurntContract(100)
burnContractAddr101 := config.Bor.CalculateBurntContract(101)
if burnContractAddr10 != "0x000000000000000000000000000000000000aaab" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaab", burnContractAddr10)
}
if burnContractAddr11 != "0x000000000000000000000000000000000000aaab" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaab", burnContractAddr11)
}
if burnContractAddr99 != "0x000000000000000000000000000000000000aaab" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaab", burnContractAddr99)
}
if burnContractAddr100 != "0x000000000000000000000000000000000000aaad" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaad", burnContractAddr100)
}
if burnContractAddr101 != "0x000000000000000000000000000000000000aaad" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaad", burnContractAddr101)
}
config.Bor.BurntContract = map[string]string{
"10": "0x000000000000000000000000000000000000aaab",
"100": "0x000000000000000000000000000000000000aaad",
"1000": "0x000000000000000000000000000000000000aaae",
}
burnContractAddr10 = config.Bor.CalculateBurntContract(10)
burnContractAddr11 = config.Bor.CalculateBurntContract(11)
burnContractAddr99 = config.Bor.CalculateBurntContract(99)
burnContractAddr100 = config.Bor.CalculateBurntContract(100)
burnContractAddr101 = config.Bor.CalculateBurntContract(101)
burnContractAddr999 := config.Bor.CalculateBurntContract(999)
burnContractAddr1000 := config.Bor.CalculateBurntContract(1000)
burnContractAddr1001 := config.Bor.CalculateBurntContract(1001)
if burnContractAddr10 != "0x000000000000000000000000000000000000aaab" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaab", burnContractAddr10)
}
if burnContractAddr11 != "0x000000000000000000000000000000000000aaab" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaab", burnContractAddr11)
}
if burnContractAddr99 != "0x000000000000000000000000000000000000aaab" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaab", burnContractAddr99)
}
if burnContractAddr100 != "0x000000000000000000000000000000000000aaad" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaad", burnContractAddr100)
}
if burnContractAddr101 != "0x000000000000000000000000000000000000aaad" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaad", burnContractAddr101)
}
if burnContractAddr999 != "0x000000000000000000000000000000000000aaad" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaad", burnContractAddr999)
}
if burnContractAddr1000 != "0x000000000000000000000000000000000000aaae" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaae", burnContractAddr1000)
}
if burnContractAddr1001 != "0x000000000000000000000000000000000000aaae" {
t.Fatalf("incorrect burnt contract address: expected %s, got %s", "0x000000000000000000000000000000000000aaae", burnContractAddr1001)
}
}
// EIP1559 is not supported without EIP155. An error is expected // EIP1559 is not supported without EIP155. An error is expected
func TestEIP1559TransitionWithEIP155(t *testing.T) { func TestEIP1559TransitionWithEIP155(t *testing.T) {
var ( var (

View file

@ -302,7 +302,7 @@ var Forks = map[string]*params.ChainConfig{
ArrowGlacierBlock: big.NewInt(0), ArrowGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0),
ShanghaiTime: u64(0), ShanghaiBlock: big.NewInt(0),
Bor: params.BorUnittestChainConfig.Bor, Bor: params.BorUnittestChainConfig.Bor,
}, },
"MergeToShanghaiAtTime15k": { "MergeToShanghaiAtTime15k": {
@ -321,7 +321,7 @@ var Forks = map[string]*params.ChainConfig{
ArrowGlacierBlock: big.NewInt(0), ArrowGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0), MergeNetsplitBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0),
ShanghaiTime: u64(15_000), ShanghaiBlock: big.NewInt(0),
Bor: params.BorUnittestChainConfig.Bor, Bor: params.BorUnittestChainConfig.Bor,
}, },
} }