From dbd6bf9f7adaf0e411870ca443ae6c0c13de50b9 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:53:32 +0100 Subject: [PATCH 1/3] add a switch to force proof in blocks --- cmd/geth/config.go | 4 ++++ cmd/utils/flags.go | 5 +++++ core/blockchain.go | 7 +++++-- core/genesis.go | 5 +++-- eth/backend.go | 3 +++ eth/ethconfig/config.go | 3 +++ 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cmd/geth/config.go b/cmd/geth/config.go index bf01c6f91857..4e861d75350b 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -175,6 +175,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { v := ctx.Uint64(utils.OverridePrague.Name) cfg.Eth.OverridePrague = &v } + if ctx.IsSet(utils.OverrideProofInBlock.Name) { + v := ctx.Bool(utils.OverrideProofInBlock.Name) + cfg.Eth.OverrideProofInBlock = &v + } backend, eth := utils.RegisterEthService(stack, &cfg.Eth) // Configure log filter RPC API. diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index b927d0f94f83..225f9e0468d9 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -273,6 +273,11 @@ var ( Usage: "Manually specify the Verkle fork timestamp, overriding the bundled setting", Category: flags.EthCategory, } + OverrideProofInBlock = &cli.Uint64Flag{ + Name: "override.blockproof", + Usage: "Manually specify the proof-in-block setting", + Category: flags.EthCategory, + } // Light server and client settings LightServeFlag = &cli.IntFlag{ Name: "light.serve", diff --git a/core/blockchain.go b/core/blockchain.go index e39cccad5b79..462eba746938 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -250,6 +250,9 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis if _, ok := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !ok { return nil, genesisErr } + if overrides.OverrideProofInBlock != nil { + chainConfig.ProofInBlocks = *overrides.OverrideProofInBlock + } log.Info("") log.Info(strings.Repeat("-", 153)) for _, line := range strings.Split(chainConfig.Description(), "\n") { @@ -315,8 +318,8 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis // 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 - // but that's left out to a later PR since there's not really a need - // right now. + // but that's left out to a later PR since there's not really a need + // right now. bc.stateCache.InitTransitionStatus(true, true) bc.stateCache.EndVerkleTransition() } diff --git a/core/genesis.go b/core/genesis.go index efa339024c7e..1a63062c308a 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -291,8 +291,9 @@ func (e *GenesisMismatchError) Error() string { // ChainOverrides contains the changes to chain config. type ChainOverrides struct { - OverrideCancun *uint64 - OverridePrague *uint64 + OverrideCancun *uint64 + OverridePrague *uint64 + OverrideProofInBlock *bool } // SetupGenesisBlock writes or updates the genesis block in db. diff --git a/eth/backend.go b/eth/backend.go index a6c80159077d..c5be460c0d91 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -201,6 +201,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { if config.OverridePrague != nil { overrides.OverridePrague = config.OverridePrague } + if config.OverrideProofInBlock != nil { + overrides.OverrideProofInBlock = config.OverrideProofInBlock + } eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit) if err != nil { return nil, err diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index 4606b60408dd..b9660f5c60b3 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -158,6 +158,9 @@ type Config struct { // OverrideVerkle (TODO: remove after the fork) OverridePrague *uint64 `toml:",omitempty"` + + // OverrideProofInBlock + OverrideProofInBlock *bool `toml:",omitempty"` } // CreateConsensusEngine creates a consensus engine for the given chain config. From 851cdfb173aacc541ed232d8085c56f9ec7f93b3 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:08:28 +0000 Subject: [PATCH 2/3] activate switch --- cmd/geth/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 38fb755b4b5a..2945a3c4b1f9 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -69,6 +69,7 @@ var ( utils.SmartCardDaemonPathFlag, utils.OverrideCancun, utils.OverridePrague, + utils.OverrideProofInBlock, utils.EnablePersonal, utils.TxPoolLocalsFlag, utils.TxPoolNoLocalsFlag, From 4932a12f1bbf250d04b2feb22d52de0e6d640114 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Tue, 5 Dec 2023 16:13:58 +0000 Subject: [PATCH 3/3] fix switch type --- cmd/utils/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 225f9e0468d9..5f071d0a7479 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -273,7 +273,7 @@ var ( Usage: "Manually specify the Verkle fork timestamp, overriding the bundled setting", Category: flags.EthCategory, } - OverrideProofInBlock = &cli.Uint64Flag{ + OverrideProofInBlock = &cli.BoolFlag{ Name: "override.blockproof", Usage: "Manually specify the proof-in-block setting", Category: flags.EthCategory,