mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
updated upstream HFs from time based to block number based
This commit is contained in:
parent
5dc90b6a0d
commit
cf3caca17c
20 changed files with 46 additions and 49 deletions
|
|
@ -364,7 +364,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
|
|
||||||
// Gather the execution-layer triggered requests.
|
// Gather the execution-layer triggered requests.
|
||||||
var requests [][]byte
|
var requests [][]byte
|
||||||
if chainConfig.IsPrague(vmContext.BlockNumber, vmContext.Time) && chainConfig.Bor == nil {
|
if chainConfig.IsPrague(vmContext.BlockNumber) && chainConfig.Bor == nil {
|
||||||
requests = [][]byte{}
|
requests = [][]byte{}
|
||||||
// EIP-6110
|
// EIP-6110
|
||||||
var allLogs []*types.Log
|
var allLogs []*types.Log
|
||||||
|
|
@ -381,7 +381,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit block
|
// Commit block
|
||||||
root, err := statedb.Commit(vmContext.BlockNumber.Uint64(), chainConfig.IsEIP158(vmContext.BlockNumber), chainConfig.IsCancun(vmContext.BlockNumber, vmContext.Time))
|
root, err := statedb.Commit(vmContext.BlockNumber.Uint64(), chainConfig.IsEIP158(vmContext.BlockNumber), chainConfig.IsCancun(vmContext.BlockNumber))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not commit state: %v", err))
|
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not commit state: %v", err))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func isPostMerge(config *params.ChainConfig, blockNum uint64, timestamp uint64)
|
||||||
mergedAtGenesis := config.TerminalTotalDifficulty != nil && config.TerminalTotalDifficulty.Sign() == 0
|
mergedAtGenesis := config.TerminalTotalDifficulty != nil && config.TerminalTotalDifficulty.Sign() == 0
|
||||||
return mergedAtGenesis ||
|
return mergedAtGenesis ||
|
||||||
config.MergeNetsplitBlock != nil && blockNum >= config.MergeNetsplitBlock.Uint64() ||
|
config.MergeNetsplitBlock != nil && blockNum >= config.MergeNetsplitBlock.Uint64() ||
|
||||||
config.ShanghaiTime != nil && timestamp >= *config.ShanghaiTime
|
config.ShanghaiBlock != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Author implements consensus.Engine, returning the verified author of the block.
|
// Author implements consensus.Engine, returning the verified author of the block.
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header, headTim
|
||||||
parentBlobGasUsed = *parent.BlobGasUsed
|
parentBlobGasUsed = *parent.BlobGasUsed
|
||||||
}
|
}
|
||||||
excessBlobGas := parentExcessBlobGas + parentBlobGasUsed
|
excessBlobGas := parentExcessBlobGas + parentBlobGasUsed
|
||||||
targetGas := uint64(targetBlobsPerBlock(config, headTimestamp)) * params.BlobTxBlobGasPerBlob
|
targetGas := uint64(targetBlobsPerBlock(config, uint64(0))) * params.BlobTxBlobGasPerBlob
|
||||||
if excessBlobGas < targetGas {
|
if excessBlobGas < targetGas {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -105,11 +105,11 @@ func MaxBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
|
||||||
s = cfg.BlobScheduleConfig
|
s = cfg.BlobScheduleConfig
|
||||||
)
|
)
|
||||||
switch {
|
switch {
|
||||||
case cfg.IsOsaka(london, time) && s.Osaka != nil:
|
case cfg.IsOsaka(london) && s.Osaka != nil:
|
||||||
return s.Osaka.Max
|
return s.Osaka.Max
|
||||||
case cfg.IsPrague(london, time) && s.Prague != nil:
|
case cfg.IsPrague(london) && s.Prague != nil:
|
||||||
return s.Prague.Max
|
return s.Prague.Max
|
||||||
case cfg.IsCancun(london, time) && s.Cancun != nil:
|
case cfg.IsCancun(london) && s.Cancun != nil:
|
||||||
return s.Cancun.Max
|
return s.Cancun.Max
|
||||||
default:
|
default:
|
||||||
return 0
|
return 0
|
||||||
|
|
@ -150,11 +150,11 @@ func targetBlobsPerBlock(cfg *params.ChainConfig, time uint64) int {
|
||||||
s = cfg.BlobScheduleConfig
|
s = cfg.BlobScheduleConfig
|
||||||
)
|
)
|
||||||
switch {
|
switch {
|
||||||
case cfg.IsOsaka(london, time) && s.Osaka != nil:
|
case cfg.IsOsaka(london) && s.Osaka != nil:
|
||||||
return s.Osaka.Target
|
return s.Osaka.Target
|
||||||
case cfg.IsPrague(london, time) && s.Prague != nil:
|
case cfg.IsPrague(london) && s.Prague != nil:
|
||||||
return s.Prague.Target
|
return s.Prague.Target
|
||||||
case cfg.IsCancun(london, time) && s.Cancun != nil:
|
case cfg.IsCancun(london) && s.Cancun != nil:
|
||||||
return s.Cancun.Target
|
return s.Cancun.Target
|
||||||
default:
|
default:
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import (
|
||||||
func TestCalcExcessBlobGas(t *testing.T) {
|
func TestCalcExcessBlobGas(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
config = params.MainnetChainConfig
|
config = params.MainnetChainConfig
|
||||||
targetBlobs = targetBlobsPerBlock(config, *config.CancunTime)
|
targetBlobs = targetBlobsPerBlock(config, uint64(0))
|
||||||
targetBlobGas = uint64(targetBlobs) * params.BlobTxBlobGasPerBlob
|
targetBlobGas = uint64(targetBlobs) * params.BlobTxBlobGasPerBlob
|
||||||
)
|
)
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
|
|
@ -61,7 +61,7 @@ func TestCalcExcessBlobGas(t *testing.T) {
|
||||||
ExcessBlobGas: &tt.excess,
|
ExcessBlobGas: &tt.excess,
|
||||||
BlobGasUsed: &blobGasUsed,
|
BlobGasUsed: &blobGasUsed,
|
||||||
}
|
}
|
||||||
result := CalcExcessBlobGas(config, header, *config.CancunTime)
|
result := CalcExcessBlobGas(config, header, uint64(0))
|
||||||
if result != tt.want {
|
if result != tt.want {
|
||||||
t.Errorf("test %d: excess blob gas mismatch: have %v, want %v", i, result, tt.want)
|
t.Errorf("test %d: excess blob gas mismatch: have %v, want %v", i, result, tt.want)
|
||||||
}
|
}
|
||||||
|
|
@ -71,8 +71,6 @@ func TestCalcExcessBlobGas(t *testing.T) {
|
||||||
func TestCalcBlobFee(t *testing.T) {
|
func TestCalcBlobFee(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
zero := uint64(0)
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
excessBlobGas uint64
|
excessBlobGas uint64
|
||||||
blobfee int64
|
blobfee int64
|
||||||
|
|
@ -83,7 +81,7 @@ func TestCalcBlobFee(t *testing.T) {
|
||||||
{10 * 1024 * 1024, 23},
|
{10 * 1024 * 1024, 23},
|
||||||
}
|
}
|
||||||
for i, tt := range tests {
|
for i, tt := range tests {
|
||||||
config := ¶ms.ChainConfig{LondonBlock: big.NewInt(0), CancunTime: &zero, BlobScheduleConfig: params.DefaultBlobSchedule}
|
config := ¶ms.ChainConfig{LondonBlock: big.NewInt(0), CancunBlock: big.NewInt(0), BlobScheduleConfig: params.DefaultBlobSchedule}
|
||||||
header := &types.Header{ExcessBlobGas: &tt.excessBlobGas}
|
header := &types.Header{ExcessBlobGas: &tt.excessBlobGas}
|
||||||
have := CalcBlobFee(config, header)
|
have := CalcBlobFee(config, header)
|
||||||
if have.Int64() != tt.blobfee {
|
if have.Int64() != tt.blobfee {
|
||||||
|
|
|
||||||
|
|
@ -1862,7 +1862,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
||||||
log.Crit("Failed to write block into disk", "err", err)
|
log.Crit("Failed to write block into disk", "err", err)
|
||||||
}
|
}
|
||||||
// Commit all cached state changes into underlying memory database.
|
// Commit all cached state changes into underlying memory database.
|
||||||
root, err := statedb.Commit(block.NumberU64(), bc.chainConfig.IsEIP158(block.Number()), bc.chainConfig.IsCancun(block.Number(), block.Time()))
|
root, err := statedb.Commit(block.NumberU64(), bc.chainConfig.IsEIP158(block.Number()), bc.chainConfig.IsCancun(block.Number()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []*types.Log{}, err
|
return []*types.Log{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ func (b *BlockGen) collectRequests(readonly bool) (requests [][]byte) {
|
||||||
statedb = statedb.Copy()
|
statedb = statedb.Copy()
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.cm.config.IsPrague(b.header.Number, b.header.Time) {
|
if b.cm.config.IsPrague(b.header.Number) {
|
||||||
requests = [][]byte{}
|
requests = [][]byte{}
|
||||||
// EIP-6110 deposits
|
// EIP-6110 deposits
|
||||||
var blockLogs []*types.Log
|
var blockLogs []*types.Log
|
||||||
|
|
@ -397,7 +397,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
misc.ApplyDAOHardFork(statedb)
|
misc.ApplyDAOHardFork(statedb)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.IsPrague(b.header.Number, b.header.Time) || config.IsVerkle(b.header.Number, b.header.Time) {
|
if config.IsPrague(b.header.Number) || config.IsVerkle(b.header.Number) {
|
||||||
// EIP-2935
|
// EIP-2935
|
||||||
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
|
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
|
||||||
blockContext.Random = &common.Hash{} // enable post-merge instruction set
|
blockContext.Random = &common.Hash{} // enable post-merge instruction set
|
||||||
|
|
@ -423,7 +423,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write state changes to db
|
// Write state changes to db
|
||||||
root, err := statedb.Commit(b.header.Number.Uint64(), config.IsEIP158(b.header.Number), config.IsCancun(b.header.Number, b.header.Time))
|
root, err := statedb.Commit(b.header.Number.Uint64(), config.IsEIP158(b.header.Number), config.IsCancun(b.header.Number))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("state write error: %v", err))
|
panic(fmt.Sprintf("state write error: %v", err))
|
||||||
}
|
}
|
||||||
|
|
@ -535,7 +535,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write state changes to DB.
|
// Write state changes to DB.
|
||||||
root, err := statedb.Commit(b.header.Number.Uint64(), config.IsEIP158(b.header.Number), config.IsCancun(b.header.Number, b.header.Time))
|
root, err := statedb.Commit(b.header.Number.Uint64(), config.IsEIP158(b.header.Number), config.IsCancun(b.header.Number))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("state write error: %v", err))
|
panic(fmt.Sprintf("state write error: %v", err))
|
||||||
}
|
}
|
||||||
|
|
@ -620,7 +620,7 @@ func (cm *chainMaker) makeHeader(parent *types.Block, state *state.StateDB, engi
|
||||||
header.GasLimit = CalcGasLimit(parentGasLimit, parentGasLimit)
|
header.GasLimit = CalcGasLimit(parentGasLimit, parentGasLimit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cm.config.IsCancun(header.Number, header.Time) {
|
if cm.config.IsCancun(header.Number) {
|
||||||
excessBlobGas := eip4844.CalcExcessBlobGas(cm.config, parentHeader, time)
|
excessBlobGas := eip4844.CalcExcessBlobGas(cm.config, parentHeader, time)
|
||||||
header.ExcessBlobGas = &excessBlobGas
|
header.ExcessBlobGas = &excessBlobGas
|
||||||
header.BlobGasUsed = new(uint64)
|
header.BlobGasUsed = new(uint64)
|
||||||
|
|
|
||||||
|
|
@ -284,10 +284,10 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if o.OverridePrague != nil {
|
if o.OverridePrague != nil {
|
||||||
cfg.PragueTime = o.OverridePrague
|
cfg.PragueBlock = o.OverridePrague
|
||||||
}
|
}
|
||||||
if o.OverrideVerkle != nil {
|
if o.OverrideVerkle != nil {
|
||||||
cfg.VerkleTime = o.OverrideVerkle
|
cfg.VerkleBlock = o.OverrideVerkle
|
||||||
}
|
}
|
||||||
return cfg.CheckConfigForkOrder()
|
return cfg.CheckConfigForkOrder()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ func TestVerkleGenesisCommit(t *testing.T) {
|
||||||
ShanghaiBlock: big.NewInt(0),
|
ShanghaiBlock: big.NewInt(0),
|
||||||
CancunBlock: big.NewInt(0),
|
CancunBlock: big.NewInt(0),
|
||||||
PragueBlock: big.NewInt(0),
|
PragueBlock: big.NewInt(0),
|
||||||
OsakaTime: big.NewInt(0),
|
OsakaBlock: big.NewInt(0),
|
||||||
VerkleBlock: big.NewInt(0),
|
VerkleBlock: big.NewInt(0),
|
||||||
TerminalTotalDifficulty: big.NewInt(0),
|
TerminalTotalDifficulty: big.NewInt(0),
|
||||||
EnableVerkleAtGenesis: true,
|
EnableVerkleAtGenesis: true,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
||||||
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
|
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
|
||||||
ProcessBeaconBlockRoot(*beaconRoot, evm)
|
ProcessBeaconBlockRoot(*beaconRoot, evm)
|
||||||
}
|
}
|
||||||
if p.config.IsPrague(block.Number()) || p.config.IsVerkle(block.Number(), block.Time()) {
|
if p.config.IsPrague(block.Number()) || p.config.IsVerkle(block.Number()) {
|
||||||
ProcessParentBlockHash(block.ParentHash(), evm)
|
ProcessParentBlockHash(block.ParentHash(), evm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1094,12 +1094,11 @@ func TestChangingSlotterSize(t *testing.T) {
|
||||||
statedb.Commit(0, true, false)
|
statedb.Commit(0, true, false)
|
||||||
|
|
||||||
// Make custom chain config where the max blob count changes based on the loop variable.
|
// Make custom chain config where the max blob count changes based on the loop variable.
|
||||||
cancunTime := uint64(0)
|
|
||||||
config := ¶ms.ChainConfig{
|
config := ¶ms.ChainConfig{
|
||||||
ChainID: big.NewInt(1),
|
ChainID: big.NewInt(1),
|
||||||
LondonBlock: big.NewInt(0),
|
LondonBlock: big.NewInt(0),
|
||||||
BerlinBlock: big.NewInt(0),
|
BerlinBlock: big.NewInt(0),
|
||||||
CancunTime: &cancunTime,
|
CancunBlock: big.NewInt(0),
|
||||||
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
||||||
Cancun: ¶ms.BlobConfig{
|
Cancun: ¶ms.BlobConfig{
|
||||||
Target: maxBlobs / 2,
|
Target: maxBlobs / 2,
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
return fmt.Errorf("%w: gas %v, minimum needed %v", core.ErrIntrinsicGas, tx.Gas(), intrGas)
|
return fmt.Errorf("%w: gas %v, minimum needed %v", core.ErrIntrinsicGas, tx.Gas(), intrGas)
|
||||||
}
|
}
|
||||||
// Ensure the transaction can cover floor data gas.
|
// Ensure the transaction can cover floor data gas.
|
||||||
if opts.Config.IsPrague(head.Number, head.Time) {
|
if opts.Config.IsPrague(head.Number) {
|
||||||
floorDataGas, err := core.FloorDataGas(tx.Data())
|
floorDataGas, err := core.FloorDataGas(tx.Data())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ type sigCache struct {
|
||||||
func MakeSigner(config *params.ChainConfig, blockNumber *big.Int, blockTime uint64) Signer {
|
func MakeSigner(config *params.ChainConfig, blockNumber *big.Int, blockTime uint64) Signer {
|
||||||
var signer Signer
|
var signer Signer
|
||||||
switch {
|
switch {
|
||||||
case config.IsPrague(blockNumber, blockTime):
|
case config.IsPrague(blockNumber):
|
||||||
signer = NewPragueSigner(config.ChainID)
|
signer = NewPragueSigner(config.ChainID)
|
||||||
case config.IsCancun(blockNumber):
|
case config.IsCancun(blockNumber):
|
||||||
signer = NewCancunSigner(config.ChainID)
|
signer = NewCancunSigner(config.ChainID)
|
||||||
|
|
@ -71,7 +71,7 @@ func LatestSigner(config *params.ChainConfig) Signer {
|
||||||
var signer Signer
|
var signer Signer
|
||||||
if config.ChainID != nil {
|
if config.ChainID != nil {
|
||||||
switch {
|
switch {
|
||||||
case config.PragueTime != nil:
|
case config.PragueBlock != nil:
|
||||||
signer = NewPragueSigner(config.ChainID)
|
signer = NewPragueSigner(config.ChainID)
|
||||||
case config.CancunBlock != nil:
|
case config.CancunBlock != nil:
|
||||||
signer = NewCancunSigner(config.ChainID)
|
signer = NewCancunSigner(config.ChainID)
|
||||||
|
|
|
||||||
|
|
@ -1533,10 +1533,11 @@ func TestParentBeaconBlockRoot(t *testing.T) {
|
||||||
|
|
||||||
genesis, blocks := generateMergeChain(10, true)
|
genesis, blocks := generateMergeChain(10, true)
|
||||||
|
|
||||||
|
// Bor doesn't allow timebased hardforks
|
||||||
// Set cancun time to last block + 5 seconds
|
// Set cancun time to last block + 5 seconds
|
||||||
time := blocks[len(blocks)-1].Time() + 5
|
// time := blocks[len(blocks)-1].Time() + 5
|
||||||
genesis.Config.ShanghaiTime = &time
|
// genesis.Config.ShanghaiTime = &time
|
||||||
genesis.Config.CancunTime = &time
|
// genesis.Config.CancunTime = &time
|
||||||
genesis.Config.BlobScheduleConfig = params.DefaultBlobSchedule
|
genesis.Config.BlobScheduleConfig = params.DefaultBlobSchedule
|
||||||
|
|
||||||
n, ethservice := startEthService(t, genesis, blocks)
|
n, ethservice := startEthService(t, genesis, blocks)
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ func (eth *Ethereum) hashState(ctx context.Context, block *types.Block, reexec u
|
||||||
return nil, nil, fmt.Errorf("processing block %d failed: %v", current.NumberU64(), err)
|
return nil, nil, fmt.Errorf("processing block %d failed: %v", current.NumberU64(), err)
|
||||||
}
|
}
|
||||||
// Finalize the state so any modifications are written to the trie
|
// Finalize the state so any modifications are written to the trie
|
||||||
root, err := statedb.Commit(current.NumberU64(), eth.blockchain.Config().IsEIP158(current.Number()), eth.blockchain.Config().IsCancun(current.Number(), current.Time()))
|
root, err := statedb.Commit(current.NumberU64(), eth.blockchain.Config().IsEIP158(current.Number()), eth.blockchain.Config().IsCancun(current.Number()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("stateAtBlock commit failed, number %d root %v: %w",
|
return nil, nil, fmt.Errorf("stateAtBlock commit failed, number %d root %v: %w",
|
||||||
current.NumberU64(), current.Root().Hex(), err)
|
current.NumberU64(), current.Root().Hex(), err)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ func (c *traceContext) toBlockContext(genesis *core.Genesis) vm.BlockContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
if genesis.ExcessBlobGas != nil && genesis.BlobGasUsed != nil {
|
if genesis.ExcessBlobGas != nil && genesis.BlobGasUsed != nil {
|
||||||
header := &types.Header{Number: genesis.Config.LondonBlock, Time: *genesis.Config.CancunTime}
|
header := &types.Header{Number: genesis.Config.LondonBlock}
|
||||||
excess := eip4844.CalcExcessBlobGas(genesis.Config, header, genesis.Timestamp)
|
excess := eip4844.CalcExcessBlobGas(genesis.Config, header, genesis.Timestamp)
|
||||||
header.ExcessBlobGas = &excess
|
header.ExcessBlobGas = &excess
|
||||||
context.BlobBaseFee = eip4844.CalcBlobFee(genesis.Config, header)
|
context.BlobBaseFee = eip4844.CalcBlobFee(genesis.Config, header)
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
if precompiles != nil {
|
if precompiles != nil {
|
||||||
evm.SetPrecompiles(precompiles)
|
evm.SetPrecompiles(precompiles)
|
||||||
}
|
}
|
||||||
if sim.chainConfig.IsPrague(header.Number, header.Time) || sim.chainConfig.IsVerkle(header.Number, header.Time) {
|
if sim.chainConfig.IsPrague(header.Number) || sim.chainConfig.IsVerkle(header.Number) {
|
||||||
core.ProcessParentBlockHash(header.ParentHash, evm)
|
core.ProcessParentBlockHash(header.ParentHash, evm)
|
||||||
}
|
}
|
||||||
if header.ParentBeaconRoot != nil {
|
if header.ParentBeaconRoot != nil {
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,6 @@ func newBackendMock() *backendMock {
|
||||||
MuirGlacierBlock: big.NewInt(0),
|
MuirGlacierBlock: big.NewInt(0),
|
||||||
BerlinBlock: big.NewInt(0),
|
BerlinBlock: big.NewInt(0),
|
||||||
LondonBlock: big.NewInt(1000),
|
LondonBlock: big.NewInt(1000),
|
||||||
CancunTime: &cancunTime,
|
|
||||||
BlobScheduleConfig: params.DefaultBlobSchedule,
|
BlobScheduleConfig: params.DefaultBlobSchedule,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1102,12 +1102,12 @@ func (c *ChainConfig) IsPrague(num *big.Int) bool {
|
||||||
return isBlockForked(c.PragueBlock, num)
|
return isBlockForked(c.PragueBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsVerkle returns whether num is either equal to the Verkle fork time or greater.
|
// IsVerkle returns whether num is either equal to the Verkle fork block or greater.
|
||||||
func (c *ChainConfig) IsVerkle(num *big.Int) bool {
|
func (c *ChainConfig) IsVerkle(num *big.Int) bool {
|
||||||
return c.IsLondon(num) && isBlockForked(c.VerkleBlock, num)
|
return c.IsLondon(num) && isBlockForked(c.VerkleBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsOsaka returns whether time is either equal to the Osaka fork time or greater.
|
// IsOsaka returns whether num is either equal to the Osaka fork block or greater.
|
||||||
func (c *ChainConfig) IsOsaka(num *big.Int) bool {
|
func (c *ChainConfig) IsOsaka(num *big.Int) bool {
|
||||||
return c.IsLondon(num) && isBlockForked(c.OsakaBlock, num)
|
return c.IsLondon(num) && isBlockForked(c.OsakaBlock, num)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -449,10 +449,10 @@ 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),
|
||||||
CancunTime: u64(0),
|
CancunBlock: big.NewInt(0),
|
||||||
PragueTime: u64(0),
|
PragueBlock: big.NewInt(0),
|
||||||
OsakaTime: u64(0),
|
OsakaBlock: big.NewInt(0),
|
||||||
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
|
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
|
||||||
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
||||||
Cancun: params.DefaultCancunBlobConfig,
|
Cancun: params.DefaultCancunBlobConfig,
|
||||||
|
|
@ -476,10 +476,10 @@ 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),
|
||||||
CancunTime: u64(0),
|
CancunBlock: big.NewInt(0),
|
||||||
PragueTime: u64(0),
|
PragueBlock: big.NewInt(0),
|
||||||
OsakaTime: u64(15_000),
|
OsakaBlock: big.NewInt(0),
|
||||||
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
|
DepositContractAddress: params.MainnetChainConfig.DepositContractAddress,
|
||||||
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
BlobScheduleConfig: ¶ms.BlobScheduleConfig{
|
||||||
Cancun: params.DefaultCancunBlobConfig,
|
Cancun: params.DefaultCancunBlobConfig,
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
||||||
// - the block body is verified against the header in block_validator.go:ValidateBody
|
// - the block body is verified against the header in block_validator.go:ValidateBody
|
||||||
// Here, we just do this shortcut smaller fix, since state tests do not
|
// Here, we just do this shortcut smaller fix, since state tests do not
|
||||||
// utilize those codepaths.
|
// utilize those codepaths.
|
||||||
if config.IsCancun(new(big.Int), block.Time()) {
|
if config.IsCancun(new(big.Int)) {
|
||||||
if len(msg.BlobHashes) > eip4844.MaxBlobsPerBlock(config, block.Time()) {
|
if len(msg.BlobHashes) > eip4844.MaxBlobsPerBlock(config, block.Time()) {
|
||||||
return st, common.Hash{}, 0, errors.New("blob gas exceeds maximum")
|
return st, common.Hash{}, 0, errors.New("blob gas exceeds maximum")
|
||||||
}
|
}
|
||||||
|
|
@ -363,7 +363,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
||||||
st.StateDB.AddBalance(block.Coinbase(), new(uint256.Int), tracing.BalanceChangeUnspecified)
|
st.StateDB.AddBalance(block.Coinbase(), new(uint256.Int), tracing.BalanceChangeUnspecified)
|
||||||
|
|
||||||
// Commit state mutations into database.
|
// Commit state mutations into database.
|
||||||
root, _ = st.StateDB.Commit(block.NumberU64(), config.IsEIP158(block.Number()), config.IsCancun(block.Number(), block.Time()))
|
root, _ = st.StateDB.Commit(block.NumberU64(), config.IsEIP158(block.Number()), config.IsCancun(block.Number()))
|
||||||
if tracer := evm.Config.Tracer; tracer != nil && tracer.OnTxEnd != nil {
|
if tracer := evm.Config.Tracer; tracer != nil && tracer.OnTxEnd != nil {
|
||||||
receipt := &types.Receipt{GasUsed: vmRet.UsedGas}
|
receipt := &types.Receipt{GasUsed: vmRet.UsedGas}
|
||||||
tracer.OnTxEnd(receipt, nil)
|
tracer.OnTxEnd(receipt, nil)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue