diff --git a/.github/workflows/conversion.yml b/.github/workflows/conversion.yml index b8441ffccc8a..08519fbb1b63 100644 --- a/.github/workflows/conversion.yml +++ b/.github/workflows/conversion.yml @@ -29,7 +29,7 @@ jobs: run: go run ./cmd/geth --dev --cache.preimages init genesis.json - name: Run geth in devmode - run: go run ./cmd/geth --dev --dev.period=5 --cache.preimages --http --datadir=.shadowfork --override.overlay-stride=10 --override.prague=$(($(date +%s) + 45)) --http.api=debug & + run: go run ./cmd/geth --dev --dev.period=5 --cache.preimages --http --datadir=.shadowfork --override.overlay-stride=10 --override.verkle=$(($(date +%s) + 45)) --http.api=debug & - name: Wait for the transition to start run: | diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index ce59d378ad34..609716dbbf3a 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -163,7 +163,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, return h } var ( - statedb = MakePreState(rawdb.NewMemoryDatabase(), chainConfig, pre, chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp)) + statedb = MakePreState(rawdb.NewMemoryDatabase(), chainConfig, pre, chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp)) vtrpre *trie.VerkleTrie signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp) gaspool = new(core.GasPool) @@ -225,7 +225,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, chainConfig.DAOForkBlock.Cmp(new(big.Int).SetUint64(pre.Env.Number)) == 0 { misc.ApplyDAOHardFork(statedb) } - if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { + if chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { // insert the parent hash in the contract parentNum := pre.Env.Number - 1 core.ProcessParentBlockHash(statedb, parentNum, pre.Env.BlockHashes[math.HexOrDecimal64(parentNum)]) @@ -345,7 +345,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, amount := new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(params.GWei)) statedb.AddBalance(w.Address, amount) } - if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { + if chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { if err := overlay.OverlayVerkleTransition(statedb, common.Hash{}, chainConfig.OverlayStride); err != nil { return nil, nil, fmt.Errorf("error performing the transition, err=%w", err) } @@ -359,7 +359,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, // Add the witness to the execution result var vktProof *verkle.VerkleProof var vktStateDiff verkle.StateDiff - if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { + if chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { keys := statedb.Witness().Keys() if len(keys) > 0 && vtrpre != nil { var proofTrie *trie.VerkleTrie @@ -400,7 +400,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, execRs.CurrentExcessBlobGas = (*math.HexOrDecimal64)(vmContext.ExcessBlobGas) execRs.CurrentBlobGasUsed = (*math.HexOrDecimal64)(&blobGasUsed) } - if chainConfig.IsPrague(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { + if chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp) { sdb := statedb.Database() ended := sdb.Transitioned() if !ended { @@ -482,7 +482,7 @@ func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prest // start the conversion on the first block log.Info("starting verkle transition?", "in transition", sdb.InTransition(), "transitioned", sdb.Transitioned(), "mpt root", mptRoot) if !sdb.InTransition() && !sdb.Transitioned() { - sdb.StartVerkleTransition(mptRoot, mptRoot, chainConfig, chainConfig.PragueTime, mptRoot) + sdb.StartVerkleTransition(mptRoot, mptRoot, chainConfig, chainConfig.VerkleTime, mptRoot) } // create the state database without the snapshot, so that it's not overwritten diff --git a/cmd/evm/internal/t8ntool/transition.go b/cmd/evm/internal/t8ntool/transition.go index e066463116e6..d525a68c0650 100644 --- a/cmd/evm/internal/t8ntool/transition.go +++ b/cmd/evm/internal/t8ntool/transition.go @@ -314,7 +314,7 @@ func Transition(ctx *cli.Context) error { // Dump the excution result collector := make(Alloc) var vktleaves map[common.Hash]hexutil.Bytes - if !chainConfig.IsPrague(big.NewInt(int64(prestate.Env.Number)), prestate.Env.Timestamp) { + if !chainConfig.IsVerkle(big.NewInt(int64(prestate.Env.Number)), prestate.Env.Timestamp) { // Only dump accounts in MPT mode, verkle does not have the // concept of an alloc. s.DumpToCollector(collector, nil) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 2179b61032b6..e3b8575a3624 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -49,7 +49,7 @@ var ( Name: "init", Usage: "Bootstrap and initialize a new genesis block", ArgsUsage: "", - Flags: flags.Merge([]cli.Flag{utils.CachePreimagesFlag, utils.OverridePrague}, utils.DatabasePathFlags), + Flags: flags.Merge([]cli.Flag{utils.CachePreimagesFlag, utils.OverrideVerkle}, utils.DatabasePathFlags), Description: ` The init command initializes a new genesis block and definition for the network. This is a destructive action and changes the network in which you will be @@ -202,9 +202,9 @@ func initGenesis(ctx *cli.Context) error { defer stack.Close() var overrides core.ChainOverrides - if ctx.IsSet(utils.OverridePrague.Name) { - v := ctx.Uint64(utils.OverridePrague.Name) - overrides.OverridePrague = &v + if ctx.IsSet(utils.OverrideVerkle.Name) { + v := ctx.Uint64(utils.OverrideVerkle.Name) + overrides.OverrideVerkle = &v } for _, name := range []string{"chaindata", "lightchaindata"} { diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 4184290e86c6..96ef125f3d42 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -171,9 +171,9 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { v := ctx.Uint64(utils.OverrideCancun.Name) cfg.Eth.OverrideCancun = &v } - if ctx.IsSet(utils.OverridePrague.Name) { - v := ctx.Uint64(utils.OverridePrague.Name) - cfg.Eth.OverridePrague = &v + if ctx.IsSet(utils.OverrideVerkle.Name) { + v := ctx.Uint64(utils.OverrideVerkle.Name) + cfg.Eth.OverrideVerkle = &v } if ctx.IsSet(utils.OverrideProofInBlock.Name) { v := ctx.Bool(utils.OverrideProofInBlock.Name) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 5cb1580df3d1..50c0a0428742 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -69,7 +69,7 @@ var ( utils.SmartCardDaemonPathFlag, utils.OverrideOverlayStride, utils.OverrideCancun, - utils.OverridePrague, + utils.OverrideVerkle, utils.OverrideProofInBlock, utils.ClearVerkleCosts, utils.EnablePersonal, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 18c7c396e4b5..e92a0f331fc9 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -274,8 +274,8 @@ var ( Usage: "Manually specify the Cancun fork timestamp, overriding the bundled setting", Category: flags.EthCategory, } - OverridePrague = &cli.Uint64Flag{ - Name: "override.prague", + OverrideVerkle = &cli.Uint64Flag{ + Name: "override.verkle", Usage: "Manually specify the Verkle fork timestamp, overriding the bundled setting", Category: flags.EthCategory, } diff --git a/consensus/beacon/consensus.go b/consensus/beacon/consensus.go index c602a7364071..75729721cd71 100644 --- a/consensus/beacon/consensus.go +++ b/consensus/beacon/consensus.go @@ -361,7 +361,7 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types. state.Witness().TouchFullAccount(w.Address[:], true) } - if chain.Config().IsPrague(header.Number, header.Time) { + if chain.Config().IsVerkle(header.Number, header.Time) { // uncomment when debugging // fmt.Println("at block", header.Number, "performing transition?", state.Database().InTransition()) parent := chain.GetHeaderByHash(header.ParentHash) @@ -403,7 +403,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea keys = state.Witness().Keys() proot common.Hash ) - if chain.Config().IsPrague(header.Number, header.Time) { + if chain.Config().IsVerkle(header.Number, header.Time) { // Open the pre-tree to prove the pre-state against parent := chain.GetHeaderByNumber(header.Number.Uint64() - 1) if parent == nil { @@ -468,7 +468,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea // Assemble and return the final block. block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, trie.NewStackTrie(nil)) - if chain.Config().IsPrague(header.Number, header.Time) && chain.Config().ProofInBlocks { + if chain.Config().IsVerkle(header.Number, header.Time) && chain.Config().ProofInBlocks { block.SetVerkleProof(p, k, proot) } return block, nil diff --git a/core/blockchain.go b/core/blockchain.go index d3ad0dc6d338..e6b9c5901a26 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -320,7 +320,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis head := bc.CurrentBlock() // Declare the end of the verkle transition if need be - if bc.chainConfig.IsPrague(head.Number, head.Time) { + if bc.chainConfig.IsVerkle(head.Number, head.Time) { // TODO this only works when resuming a chain that has already gone // through the conversion. All pointers should be saved to the DB // for it to be able to recover if interrupted during the transition @@ -426,7 +426,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis Recovery: recover, NoBuild: bc.cacheConfig.SnapshotNoBuild, AsyncBuild: !bc.cacheConfig.SnapshotWait, - Verkle: chainConfig.IsPrague(head.Number, head.Time), + Verkle: chainConfig.IsVerkle(head.Number, head.Time), } bc.snaps, _ = snapshot.New(snapconfig, bc.db, bc.triedb, head.Root) } @@ -1760,13 +1760,13 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) parent = bc.GetHeader(block.ParentHash(), block.NumberU64()-1) } - if bc.Config().IsPrague(block.Number(), block.Time()) { + if bc.Config().IsVerkle(block.Number(), block.Time()) { bc.stateCache.LoadTransitionState(parent.Root) - // pragueTime has been reached. If the transition isn't active, it means this + // verkleTime has been reached. If the transition isn't active, it means this // is the fork block and that the conversion needs to be marked at started. if !bc.stateCache.InTransition() && !bc.stateCache.Transitioned() { - bc.stateCache.StartVerkleTransition(parent.Root, emptyVerkleRoot, bc.Config(), bc.Config().PragueTime, parent.Root) + bc.stateCache.StartVerkleTransition(parent.Root, emptyVerkleRoot, bc.Config(), bc.Config().VerkleTime, parent.Root) } } else { // If the verkle activation time hasn't started, declare it as "not started". @@ -2562,8 +2562,8 @@ func (bc *BlockChain) GetTrieFlushInterval() time.Duration { return time.Duration(bc.flushInterval.Load()) } -func (bc *BlockChain) StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, pragueTime *uint64, root common.Hash) { - bc.stateCache.StartVerkleTransition(originalRoot, translatedRoot, chainConfig, pragueTime, root) +func (bc *BlockChain) StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, verkleTime *uint64, root common.Hash) { + bc.stateCache.StartVerkleTransition(originalRoot, translatedRoot, chainConfig, verkleTime, root) } func (bc *BlockChain) ReorgThroughVerkleTransition() { bc.stateCache.ReorgThroughVerkleTransition() diff --git a/core/chain_makers.go b/core/chain_makers.go index 7111d3644917..0194f6d3983a 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -357,7 +357,7 @@ func GenerateChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, if err != nil { panic(err) } - if genesis.Config != nil && genesis.Config.IsPrague(genesis.ToBlock().Number(), genesis.ToBlock().Time()) { + if genesis.Config != nil && genesis.Config.IsVerkle(genesis.ToBlock().Number(), genesis.ToBlock().Time()) { blocks, receipts, _, _, _ := GenerateVerkleChain(genesis.Config, genesis.ToBlock(), engine, db, n, gen) return db, blocks, receipts } @@ -386,8 +386,8 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine preState := statedb.Copy() fmt.Println("prestate", preState.GetTrie().(*trie.VerkleTrie).ToDot()) - if config.IsPrague(b.header.Number, b.header.Time) { - if !config.IsPrague(b.parent.Number(), b.parent.Time()) { + if config.IsVerkle(b.header.Number, b.header.Time) { + if !config.IsVerkle(b.parent.Number(), b.parent.Time()) { // Transition case: insert all 256 ancestors InsertBlockHashHistoryAtEip2935Fork(statedb, b.header.Number.Uint64()-1, b.header.ParentHash, chainreader) } else { @@ -437,7 +437,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine } var snaps *snapshot.Tree db := state.NewDatabaseWithConfig(diskdb, nil) - db.StartVerkleTransition(common.Hash{}, common.Hash{}, config, config.PragueTime, common.Hash{}) + db.StartVerkleTransition(common.Hash{}, common.Hash{}, config, config.VerkleTime, common.Hash{}) db.EndVerkleTransition() db.SaveTransitionState(parent.Root()) for i := 0; i < n; i++ { diff --git a/core/genesis.go b/core/genesis.go index a2a331d1fe33..a5803644f4fe 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -125,7 +125,7 @@ func (ga *GenesisAlloc) deriveHash(cfg *params.ChainConfig, timestamp uint64) (c // Create an ephemeral in-memory database for computing hash, // all the derived states will be discarded to not pollute disk. db := state.NewDatabase(rawdb.NewMemoryDatabase()) - if cfg.IsPrague(big.NewInt(int64(0)), timestamp) { + if cfg.IsVerkle(big.NewInt(int64(0)), timestamp) { db.StartVerkleTransition(common.Hash{}, common.Hash{}, cfg, ×tamp, common.Hash{}) db.EndVerkleTransition() } @@ -150,7 +150,7 @@ func (ga *GenesisAlloc) deriveHash(cfg *params.ChainConfig, timestamp uint64) (c func (ga *GenesisAlloc) flush(db ethdb.Database, triedb *trie.Database, blockhash common.Hash, cfg *params.ChainConfig, timestamp *uint64) error { database := state.NewDatabaseWithNodeDB(db, triedb) // End the verkle conversion at genesis if the fork block is 0 - if timestamp != nil && cfg.IsPrague(big.NewInt(int64(0)), *timestamp) { + if timestamp != nil && cfg.IsVerkle(big.NewInt(int64(0)), *timestamp) { database.StartVerkleTransition(common.Hash{}, common.Hash{}, cfg, timestamp, common.Hash{}) database.EndVerkleTransition() } @@ -292,7 +292,7 @@ func (e *GenesisMismatchError) Error() string { // ChainOverrides contains the changes to chain config. type ChainOverrides struct { OverrideCancun *uint64 - OverridePrague *uint64 + OverrideVerkle *uint64 OverrideProofInBlock *bool OverrideOverlayStride *uint64 } @@ -323,8 +323,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen if overrides != nil && overrides.OverrideCancun != nil { config.CancunTime = overrides.OverrideCancun } - if overrides != nil && overrides.OverridePrague != nil { - config.PragueTime = overrides.OverridePrague + if overrides != nil && overrides.OverrideVerkle != nil { + config.VerkleTime = overrides.OverrideVerkle } } } @@ -375,7 +375,7 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen newcfg := genesis.configOrDefault(stored) applyOverrides(newcfg) // WORKAROUND it looks like this is broken, because overriding - // pragueTime will cause an error here, claiming that shanghaiTime + // verkleTime will cause an error here, claiming that shanghaiTime // wasn't set (it is). // if err := newcfg.CheckConfigForkOrder(); err != nil { // return newcfg, common.Hash{}, err @@ -464,7 +464,7 @@ func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { // IsVerkle indicates whether the state is already stored in a verkle // tree at genesis time. func (g *Genesis) IsVerkle() bool { - return g.Config.IsPrague(new(big.Int).SetUint64(g.Number), g.Timestamp) + return g.Config.IsVerkle(new(big.Int).SetUint64(g.Number), g.Timestamp) } // ToBlock returns the genesis block according to genesis specification. @@ -560,7 +560,7 @@ func (g *Genesis) Commit(db ethdb.Database, triedb *trie.Database) (*types.Block // Note the state changes will be committed in hash-based scheme, use Commit // if path-scheme is preferred. func (g *Genesis) MustCommit(db ethdb.Database) *types.Block { - triedb := trie.NewDatabaseWithConfig(db, &trie.Config{Verkle: g.Config != nil && g.Config.IsPrague(big.NewInt(int64(g.Number)), g.Timestamp)}) + triedb := trie.NewDatabaseWithConfig(db, &trie.Config{Verkle: g.Config != nil && g.Config.IsVerkle(big.NewInt(int64(g.Number)), g.Timestamp)}) block, err := g.Commit(db, triedb) if err != nil { panic(err) diff --git a/core/state/database.go b/core/state/database.go index d8208e49d264..fa10ca839c3b 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -74,7 +74,7 @@ type Database interface { // TrieDB retrieves the low level trie database used for data storage. TrieDB() *trie.Database - StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, pragueTime *uint64, root common.Hash) + StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, verkleTime *uint64, root common.Hash) ReorgThroughVerkleTransition() @@ -232,7 +232,7 @@ func (db *cachingDB) Transitioned() bool { } // Fork implements the fork -func (db *cachingDB) StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, pragueTime *uint64, root common.Hash) { +func (db *cachingDB) StartVerkleTransition(originalRoot, translatedRoot common.Hash, chainConfig *params.ChainConfig, verkleTime *uint64, root common.Hash) { if useBanner { fmt.Println(` __________.__ .__ .__ __ .__ .__ ____ @@ -251,8 +251,8 @@ func (db *cachingDB) StartVerkleTransition(originalRoot, translatedRoot common.H db.baseRoot = originalRoot // Reinitialize values in case of a reorg - if pragueTime != nil { - chainConfig.PragueTime = pragueTime + if verkleTime != nil { + chainConfig.VerkleTime = verkleTime } } diff --git a/core/state_processor.go b/core/state_processor.go index 68193b3d0982..baf60a5525b7 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -78,7 +78,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vmenv = vm.NewEVM(context, vm.TxContext{}, statedb, p.config, cfg) signer = types.MakeSigner(p.config, header.Number, header.Time) ) - if p.config.IsPrague(block.Number(), block.Time()) { + if p.config.IsVerkle(block.Number(), block.Time()) { ProcessParentBlockHash(statedb, block.NumberU64()-1, block.ParentHash()) } // Iterate over and process the individual transactions diff --git a/core/state_processor_test.go b/core/state_processor_test.go index b3d513388586..a29252598f2b 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -458,7 +458,7 @@ func TestProcessVerkle(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -603,7 +603,7 @@ func TestProcessVerkleInvalidContractCreation(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -761,7 +761,7 @@ func TestProcessVerkleContractWithEmptyCode(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -854,7 +854,7 @@ func TestProcessVerklExtCodeHashOpcode(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -985,7 +985,7 @@ func TestProcessVerkleBalanceOpcode(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -1080,7 +1080,7 @@ func TestProcessVerkleSelfDestructInSeparateTx(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -1227,7 +1227,7 @@ func TestProcessVerkleSelfDestructInSameTx(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -1351,7 +1351,7 @@ func TestProcessVerkleSelfDestructInSeparateTxWithSelfBeneficiary(t *testing.T) LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, @@ -1472,7 +1472,7 @@ func TestProcessVerkleSelfDestructInSameTxWithSelfBeneficiary(t *testing.T) { LondonBlock: big.NewInt(0), Ethash: new(params.EthashConfig), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), TerminalTotalDifficulty: common.Big0, TerminalTotalDifficultyPassed: true, ProofInBlocks: true, diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 036d18a078fe..2942755f3fae 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -150,7 +150,7 @@ func init() { // ActivePrecompiles returns the precompiles enabled with the current configuration. func ActivePrecompiles(rules params.Rules) []common.Address { switch { - case rules.IsPrague: + case rules.IsVerkle: return PrecompiledAddressesBerlin case rules.IsCancun: return PrecompiledAddressesCancun diff --git a/core/vm/evm.go b/core/vm/evm.go index e036d2661768..a0c84fff2245 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -41,7 +41,7 @@ type ( func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) { var precompiles map[common.Address]PrecompiledContract switch { - case evm.chainRules.IsPrague: + case evm.chainRules.IsVerkle: precompiles = PrecompiledContractsBerlin case evm.chainRules.IsCancun: precompiles = PrecompiledContractsCancun @@ -137,7 +137,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig chainConfig: chainConfig, chainRules: chainConfig.Rules(blockCtx.BlockNumber, blockCtx.Random != nil, blockCtx.Time), } - if txCtx.Accesses == nil && chainConfig.IsPrague(blockCtx.BlockNumber, blockCtx.Time) { + if txCtx.Accesses == nil && chainConfig.IsVerkle(blockCtx.BlockNumber, blockCtx.Time) { evm.Accesses = evm.StateDB.(*state.StateDB).NewAccessWitness() } evm.interpreter = NewEVMInterpreter(evm) @@ -147,7 +147,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig // Reset resets the EVM with a new transaction context.Reset // This is not threadsafe and should only be done very cautiously. func (evm *EVM) Reset(txCtx TxContext, statedb StateDB) { - if txCtx.Accesses == nil && evm.chainRules.IsPrague { + if txCtx.Accesses == nil && evm.chainRules.IsVerkle { txCtx.Accesses = evm.StateDB.(*state.StateDB).NewAccessWitness() } evm.TxContext = txCtx diff --git a/core/vm/gas_table.go b/core/vm/gas_table.go index 5f8183801f1c..80a128407aea 100644 --- a/core/vm/gas_table.go +++ b/core/vm/gas_table.go @@ -506,7 +506,7 @@ func gasSelfdestruct(evm *EVM, contract *Contract, stack *Stack, mem *Memory, me } } - if evm.chainRules.IsPrague { + if evm.chainRules.IsVerkle { // TODO turn this into a panic (when we are sure this method // will never execute when verkle is enabled) log.Warn("verkle witness accumulation not supported for selfdestruct") diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 7a6db2e8eaaa..8f45be3d02c9 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -484,8 +484,8 @@ func opBlockhash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ( lower = upper - 256 } if num64 >= lower && num64 < upper { - // if Prague is active, read it from the history contract (EIP 2935). - if evm.chainRules.IsPrague { + // if Verkle is active, read it from the history contract (EIP 2935). + if evm.chainRules.IsVerkle { blockHash, statelessGas := getBlockHashFromContract(num64, evm.StateDB, evm.Accesses) if interpreter.evm.chainRules.IsEIP4762 { if !scope.Contract.UseGas(statelessGas) { @@ -955,7 +955,7 @@ func opPush1(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by if *pc < codeLen { scope.Stack.push(integer.SetUint64(uint64(scope.Contract.Code[*pc]))) - if !scope.Contract.IsDeployment && interpreter.evm.chainRules.IsPrague && *pc%31 == 0 { + if !scope.Contract.IsDeployment && interpreter.evm.chainRules.IsVerkle && *pc%31 == 0 { // touch next chunk if PUSH1 is at the boundary. if so, *pc has // advanced past this boundary. contractAddr := scope.Contract.Address() @@ -986,7 +986,7 @@ func makePush(size uint64, pushByteSize int) executionFunc { endMin = startMin + pushByteSize } - if !scope.Contract.IsDeployment && interpreter.evm.chainRules.IsPrague { + if !scope.Contract.IsDeployment && interpreter.evm.chainRules.IsVerkle { contractAddr := scope.Contract.Address() statelessGas := interpreter.evm.Accesses.TouchCodeChunksRangeAndChargeGas(contractAddr[:], uint64(startMin), uint64(pushByteSize), uint64(len(scope.Contract.Code)), false) if !scope.Contract.UseGas(statelessGas) { diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index 427ac4e44fc5..f355bb68a030 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -56,9 +56,9 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter { // If jump table was not initialised we set the default one. var table *JumpTable switch { - case evm.chainRules.IsPrague: + case evm.chainRules.IsVerkle: // TODO replace with prooper instruction set when fork is specified - table = &pragueInstructionSet + table = &verkleInstructionSet case evm.chainRules.IsCancun: table = &cancunInstructionSet case evm.chainRules.IsShanghai: diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index 11a04a201317..04e26f6c1656 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -57,7 +57,7 @@ var ( mergeInstructionSet = newMergeInstructionSet() shanghaiInstructionSet = newShanghaiInstructionSet() cancunInstructionSet = newCancunInstructionSet() - pragueInstructionSet = newPragueInstructionSet() + verkleInstructionSet = newVerkleInstructionSet() ) // JumpTable contains the EVM opcodes supported at a given fork. @@ -81,7 +81,7 @@ func validate(jt JumpTable) JumpTable { return jt } -func newPragueInstructionSet() JumpTable { +func newVerkleInstructionSet() JumpTable { instructionSet := newShanghaiInstructionSet() enable6780(&instructionSet) enable4762(&instructionSet) diff --git a/core/vm/jump_table_export.go b/core/vm/jump_table_export.go index 2ceb75e73273..a28247d452b7 100644 --- a/core/vm/jump_table_export.go +++ b/core/vm/jump_table_export.go @@ -26,8 +26,8 @@ import ( // the rules. func LookupInstructionSet(rules params.Rules) (JumpTable, error) { switch { - case rules.IsPrague: - return newShanghaiInstructionSet(), errors.New("prague-fork not defined yet") + case rules.IsVerkle: + return newShanghaiInstructionSet(), errors.New("verkle-fork not defined yet") case rules.IsCancun: return newCancunInstructionSet(), nil case rules.IsShanghai: diff --git a/eth/backend.go b/eth/backend.go index c47bc6b5bb35..d4e8f11bcea8 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -198,8 +198,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { if config.OverrideCancun != nil { overrides.OverrideCancun = config.OverrideCancun } - if config.OverridePrague != nil { - overrides.OverridePrague = config.OverridePrague + if config.OverrideVerkle != nil { + overrides.OverrideVerkle = config.OverrideVerkle } if config.OverrideProofInBlock != nil { overrides.OverrideProofInBlock = config.OverrideProofInBlock diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 925494a74d5f..486950849928 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -529,9 +529,9 @@ func (api *ConsensusAPI) newPayload(params engine.ExecutableData, versionedHashe return api.invalid(errors.New("invalid timestamp"), parent.Header()), nil } // Trigger the start of the verkle conversion if we're at the right block - if api.eth.BlockChain().Config().IsPrague(block.Number(), block.Time()) && !api.eth.BlockChain().Config().IsPrague(parent.Number(), parent.Time()) { + if api.eth.BlockChain().Config().IsVerkle(block.Number(), block.Time()) && !api.eth.BlockChain().Config().IsVerkle(parent.Number(), parent.Time()) { parent := api.eth.BlockChain().GetHeaderByNumber(block.NumberU64() - 1) - if !api.eth.BlockChain().Config().IsPrague(parent.Number, parent.Time) { + if !api.eth.BlockChain().Config().IsVerkle(parent.Number, parent.Time) { api.eth.BlockChain().StartVerkleTransition(parent.Root, common.Hash{}, api.eth.BlockChain().Config(), nil, parent.Root) } } diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index fc9550147bcc..a1b2677ccf7e 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -157,7 +157,7 @@ type Config struct { OverrideCancun *uint64 `toml:",omitempty"` // OverrideVerkle (TODO: remove after the fork) - OverridePrague *uint64 `toml:",omitempty"` + OverrideVerkle *uint64 `toml:",omitempty"` // OverrideProofInBlock OverrideProofInBlock *bool `toml:",omitempty"` diff --git a/eth/ethconfig/gen_config.go b/eth/ethconfig/gen_config.go index 2ad499a53485..324fbe380ea3 100644 --- a/eth/ethconfig/gen_config.go +++ b/eth/ethconfig/gen_config.go @@ -52,7 +52,7 @@ func (c Config) MarshalTOML() (interface{}, error) { RPCEVMTimeout time.Duration RPCTxFeeCap float64 OverrideCancun *uint64 `toml:",omitempty"` - OverridePrague *uint64 `toml:",omitempty"` + OverrideVerkle *uint64 `toml:",omitempty"` } var enc Config enc.Genesis = c.Genesis @@ -90,7 +90,7 @@ func (c Config) MarshalTOML() (interface{}, error) { enc.RPCEVMTimeout = c.RPCEVMTimeout enc.RPCTxFeeCap = c.RPCTxFeeCap enc.OverrideCancun = c.OverrideCancun - enc.OverridePrague = c.OverridePrague + enc.OverrideVerkle = c.OverrideVerkle return &enc, nil } @@ -132,7 +132,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { RPCEVMTimeout *time.Duration RPCTxFeeCap *float64 OverrideCancun *uint64 `toml:",omitempty"` - OverridePrague *uint64 `toml:",omitempty"` + OverrideVerkle *uint64 `toml:",omitempty"` } var dec Config if err := unmarshal(&dec); err != nil { @@ -243,8 +243,8 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.OverrideCancun != nil { c.OverrideCancun = dec.OverrideCancun } - if dec.OverridePrague != nil { - c.OverridePrague = dec.OverridePrague + if dec.OverrideVerkle != nil { + c.OverrideVerkle = dec.OverrideVerkle } return nil } diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 5e90180df8d5..1b650bc9f1ee 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -1016,8 +1016,8 @@ func overrideConfig(original *params.ChainConfig, override *params.ChainConfig) copy.CancunTime = timestamp canon = false } - if timestamp := override.PragueTime; timestamp != nil { - copy.PragueTime = timestamp + if timestamp := override.VerkleTime; timestamp != nil { + copy.VerkleTime = timestamp canon = false } diff --git a/les/client.go b/les/client.go index 691635be0c59..132c857aa529 100644 --- a/les/client.go +++ b/les/client.go @@ -95,8 +95,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { if config.OverrideCancun != nil { overrides.OverrideCancun = config.OverrideCancun } - if config.OverridePrague != nil { - overrides.OverridePrague = config.OverridePrague + if config.OverrideVerkle != nil { + overrides.OverrideVerkle = config.OverrideVerkle } chainConfig, genesisHash, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, trie.NewDatabase(chainDb), config.Genesis, &overrides) if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat { diff --git a/miner/worker.go b/miner/worker.go index 651424b06364..39980f245b9b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -891,10 +891,10 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { } // Trigger the start of the verkle conversion if we're at the right block - if w.chain.Config().IsPrague(header.Number, header.Time) { + if w.chain.Config().IsVerkle(header.Number, header.Time) { parent := w.chain.GetHeaderByNumber(header.Number.Uint64() - 1) - if !w.chain.Config().IsPrague(parent.Number, parent.Time) { - w.chain.StartVerkleTransition(parent.Root, common.Hash{}, w.chain.Config(), w.chain.Config().PragueTime, parent.Root) + if !w.chain.Config().IsVerkle(parent.Number, parent.Time) { + w.chain.StartVerkleTransition(parent.Root, common.Hash{}, w.chain.Config(), w.chain.Config().VerkleTime, parent.Root) } } @@ -917,7 +917,7 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { log.Error("Failed to create sealing context", "err", err) return nil, err } - if w.chainConfig.IsPrague(header.Number, header.Time) { + if w.chainConfig.IsVerkle(header.Number, header.Time) { core.ProcessParentBlockHash(env.state, header.Number.Uint64()-1, header.ParentHash) } return env, nil diff --git a/params/config.go b/params/config.go index 5b55c5197700..d702304d4597 100644 --- a/params/config.go +++ b/params/config.go @@ -127,7 +127,7 @@ var ( MergeNetsplitBlock: nil, ShanghaiTime: nil, CancunTime: nil, - PragueTime: nil, + VerkleTime: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: true, Ethash: new(EthashConfig), @@ -177,7 +177,7 @@ var ( MergeNetsplitBlock: nil, ShanghaiTime: nil, CancunTime: nil, - PragueTime: nil, + VerkleTime: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Ethash: nil, @@ -206,7 +206,7 @@ var ( MergeNetsplitBlock: nil, ShanghaiTime: nil, CancunTime: nil, - PragueTime: nil, + VerkleTime: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Ethash: new(EthashConfig), @@ -235,7 +235,7 @@ var ( MergeNetsplitBlock: nil, ShanghaiTime: nil, CancunTime: nil, - PragueTime: nil, + VerkleTime: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Ethash: new(EthashConfig), @@ -284,7 +284,7 @@ type ChainConfig struct { ShanghaiTime *uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai) CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun) - PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague) + VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle) // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. @@ -407,8 +407,8 @@ func (c *ChainConfig) Description() string { if c.CancunTime != nil { banner += fmt.Sprintf(" - Cancun: @%-10v\n", *c.CancunTime) } - if c.PragueTime != nil { - banner += fmt.Sprintf(" - Prague: @%-10v\n", *c.PragueTime) + if c.VerkleTime != nil { + banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime) } return banner } @@ -503,9 +503,9 @@ func (c *ChainConfig) IsCancun(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.CancunTime, time) } -// IsPrague returns whether num is either equal to the Prague fork time or greater. -func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool { - return c.IsLondon(num) && isTimestampForked(c.PragueTime, time) +// IsVerkle returns whether num is either equal to the Verkle fork time or greater. +func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool { + return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time) } // CheckCompatible checks whether scheduled fork transitions have been imported @@ -561,7 +561,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true}, {name: "shanghaiTime", timestamp: c.ShanghaiTime}, {name: "cancunTime", timestamp: c.CancunTime, optional: true}, - {name: "pragueTime", timestamp: c.PragueTime, optional: true}, + {name: "verkleTime", timestamp: c.VerkleTime, optional: true}, } { if lastFork.name != "" { switch { @@ -662,8 +662,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkTimestampIncompatible(c.CancunTime, newcfg.CancunTime, headTimestamp) { return newTimestampCompatError("Cancun fork timestamp", c.CancunTime, newcfg.CancunTime) } - if isForkTimestampIncompatible(c.PragueTime, newcfg.PragueTime, headTimestamp) { - return newTimestampCompatError("Prague fork timestamp", c.PragueTime, newcfg.PragueTime) + if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) { + return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime) } return nil } @@ -810,7 +810,7 @@ type Rules struct { IsEIP2929, IsEIP4762 bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon bool - IsMerge, IsShanghai, IsCancun, IsPrague bool + IsMerge, IsShanghai, IsCancun, IsVerkle bool } // Rules ensures c's ChainID is not nil. @@ -830,12 +830,12 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsPetersburg: c.IsPetersburg(num), IsIstanbul: c.IsIstanbul(num), IsBerlin: c.IsBerlin(num), - IsEIP2929: c.IsBerlin(num) && !c.IsPrague(num, timestamp), - IsEIP4762: c.IsPrague(num, timestamp), + IsEIP2929: c.IsBerlin(num) && !c.IsVerkle(num, timestamp), + IsEIP4762: c.IsVerkle(num, timestamp), IsLondon: c.IsLondon(num), IsMerge: isMerge, IsShanghai: c.IsShanghai(num, timestamp), IsCancun: c.IsCancun(num, timestamp), - IsPrague: c.IsPrague(num, timestamp), + IsVerkle: c.IsVerkle(num, timestamp), } } diff --git a/tests/init.go b/tests/init.go index 8fb3c3eea258..c65c4cff147d 100644 --- a/tests/init.go +++ b/tests/init.go @@ -318,7 +318,7 @@ var Forks = map[string]*params.ChainConfig{ ShanghaiTime: u64(0), CancunTime: u64(0), }, - "Prague": { + "Verkle": { ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), @@ -335,9 +335,9 @@ var Forks = map[string]*params.ChainConfig{ MergeNetsplitBlock: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0), ShanghaiTime: u64(0), - PragueTime: u64(0), + VerkleTime: u64(0), }, - "ShanghaiToPragueAtTime32": { + "ShanghaiToVerkleAtTime32": { ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), @@ -354,7 +354,7 @@ var Forks = map[string]*params.ChainConfig{ MergeNetsplitBlock: big.NewInt(0), TerminalTotalDifficulty: big.NewInt(0), ShanghaiTime: u64(0), - PragueTime: u64(32), + VerkleTime: u64(32), }, }