all: remove ethash pow, only retain shims needed for consensus and tests (#27178)
* all: remove ethash pow, only retain shims needed for consensus and tests * all: thank you linter * all: disallow launching Geth in legacy PoW mode * cmd/env/internal/t8ntool: remove dangling ethash flag
This commit is contained in:
+4
-115
@@ -39,7 +39,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/fdlimit"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
@@ -325,54 +324,6 @@ var (
|
||||
Usage: "Enables serving light clients before syncing",
|
||||
Category: flags.LightCategory,
|
||||
}
|
||||
|
||||
// Ethash settings
|
||||
EthashCacheDirFlag = &flags.DirectoryFlag{
|
||||
Name: "ethash.cachedir",
|
||||
Usage: "Directory to store the ethash verification caches (default = inside the datadir)",
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashCachesInMemoryFlag = &cli.IntFlag{
|
||||
Name: "ethash.cachesinmem",
|
||||
Usage: "Number of recent ethash caches to keep in memory (16MB each)",
|
||||
Value: ethconfig.Defaults.Ethash.CachesInMem,
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashCachesOnDiskFlag = &cli.IntFlag{
|
||||
Name: "ethash.cachesondisk",
|
||||
Usage: "Number of recent ethash caches to keep on disk (16MB each)",
|
||||
Value: ethconfig.Defaults.Ethash.CachesOnDisk,
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashCachesLockMmapFlag = &cli.BoolFlag{
|
||||
Name: "ethash.cacheslockmmap",
|
||||
Usage: "Lock memory maps of recent ethash caches",
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashDatasetDirFlag = &flags.DirectoryFlag{
|
||||
Name: "ethash.dagdir",
|
||||
Usage: "Directory to store the ethash mining DAGs",
|
||||
Value: flags.DirectoryString(ethconfig.Defaults.Ethash.DatasetDir),
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashDatasetsInMemoryFlag = &cli.IntFlag{
|
||||
Name: "ethash.dagsinmem",
|
||||
Usage: "Number of recent ethash mining DAGs to keep in memory (1+GB each)",
|
||||
Value: ethconfig.Defaults.Ethash.DatasetsInMem,
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashDatasetsOnDiskFlag = &cli.IntFlag{
|
||||
Name: "ethash.dagsondisk",
|
||||
Usage: "Number of recent ethash mining DAGs to keep on disk (1+GB each)",
|
||||
Value: ethconfig.Defaults.Ethash.DatasetsOnDisk,
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
EthashDatasetsLockMmapFlag = &cli.BoolFlag{
|
||||
Name: "ethash.dagslockmmap",
|
||||
Usage: "Lock memory maps for recent ethash mining DAGs",
|
||||
Category: flags.EthashCategory,
|
||||
}
|
||||
|
||||
// Transaction pool settings
|
||||
TxPoolLocalsFlag = &cli.StringFlag{
|
||||
Name: "txpool.locals",
|
||||
@@ -510,22 +461,6 @@ var (
|
||||
Usage: "Enable mining",
|
||||
Category: flags.MinerCategory,
|
||||
}
|
||||
MinerThreadsFlag = &cli.IntFlag{
|
||||
Name: "miner.threads",
|
||||
Usage: "Number of CPU threads to use for mining",
|
||||
Value: 0,
|
||||
Category: flags.MinerCategory,
|
||||
}
|
||||
MinerNotifyFlag = &cli.StringFlag{
|
||||
Name: "miner.notify",
|
||||
Usage: "Comma separated HTTP URL list to notify of new work packages",
|
||||
Category: flags.MinerCategory,
|
||||
}
|
||||
MinerNotifyFullFlag = &cli.BoolFlag{
|
||||
Name: "miner.notify.full",
|
||||
Usage: "Notify with pending block headers instead of work packages",
|
||||
Category: flags.MinerCategory,
|
||||
}
|
||||
MinerGasLimitFlag = &cli.Uint64Flag{
|
||||
Name: "miner.gaslimit",
|
||||
Usage: "Target gas ceiling for mined blocks",
|
||||
@@ -554,11 +489,6 @@ var (
|
||||
Value: ethconfig.Defaults.Miner.Recommit,
|
||||
Category: flags.MinerCategory,
|
||||
}
|
||||
MinerNoVerifyFlag = &cli.BoolFlag{
|
||||
Name: "miner.noverify",
|
||||
Usage: "Disable remote sealing verification",
|
||||
Category: flags.MinerCategory,
|
||||
}
|
||||
MinerNewPayloadTimeout = &cli.DurationFlag{
|
||||
Name: "miner.newpayload-timeout",
|
||||
Usage: "Specify the maximum time allowance for creating a new payload",
|
||||
@@ -648,11 +578,6 @@ var (
|
||||
Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
|
||||
Category: flags.MetricsCategory,
|
||||
}
|
||||
FakePoWFlag = &cli.BoolFlag{
|
||||
Name: "fakepow",
|
||||
Usage: "Disables proof-of-work verification",
|
||||
Category: flags.LoggingCategory,
|
||||
}
|
||||
NoCompactionFlag = &cli.BoolFlag{
|
||||
Name: "nocompaction",
|
||||
Usage: "Disables db compaction after import",
|
||||
@@ -1604,38 +1529,7 @@ func setTxPool(ctx *cli.Context, cfg *txpool.Config) {
|
||||
}
|
||||
}
|
||||
|
||||
func setEthash(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||
if ctx.IsSet(EthashCacheDirFlag.Name) {
|
||||
cfg.Ethash.CacheDir = ctx.String(EthashCacheDirFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashDatasetDirFlag.Name) {
|
||||
cfg.Ethash.DatasetDir = ctx.String(EthashDatasetDirFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashCachesInMemoryFlag.Name) {
|
||||
cfg.Ethash.CachesInMem = ctx.Int(EthashCachesInMemoryFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashCachesOnDiskFlag.Name) {
|
||||
cfg.Ethash.CachesOnDisk = ctx.Int(EthashCachesOnDiskFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashCachesLockMmapFlag.Name) {
|
||||
cfg.Ethash.CachesLockMmap = ctx.Bool(EthashCachesLockMmapFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashDatasetsInMemoryFlag.Name) {
|
||||
cfg.Ethash.DatasetsInMem = ctx.Int(EthashDatasetsInMemoryFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashDatasetsOnDiskFlag.Name) {
|
||||
cfg.Ethash.DatasetsOnDisk = ctx.Int(EthashDatasetsOnDiskFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(EthashDatasetsLockMmapFlag.Name) {
|
||||
cfg.Ethash.DatasetsLockMmap = ctx.Bool(EthashDatasetsLockMmapFlag.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func setMiner(ctx *cli.Context, cfg *miner.Config) {
|
||||
if ctx.IsSet(MinerNotifyFlag.Name) {
|
||||
cfg.Notify = strings.Split(ctx.String(MinerNotifyFlag.Name), ",")
|
||||
}
|
||||
cfg.NotifyFull = ctx.Bool(MinerNotifyFullFlag.Name)
|
||||
if ctx.IsSet(MinerExtraDataFlag.Name) {
|
||||
cfg.ExtraData = []byte(ctx.String(MinerExtraDataFlag.Name))
|
||||
}
|
||||
@@ -1648,9 +1542,6 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
|
||||
if ctx.IsSet(MinerRecommitIntervalFlag.Name) {
|
||||
cfg.Recommit = ctx.Duration(MinerRecommitIntervalFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(MinerNoVerifyFlag.Name) {
|
||||
cfg.Noverify = ctx.Bool(MinerNoVerifyFlag.Name)
|
||||
}
|
||||
if ctx.IsSet(MinerNewPayloadTimeout.Name) {
|
||||
cfg.NewPayloadTimeout = ctx.Duration(MinerNewPayloadTimeout.Name)
|
||||
}
|
||||
@@ -1741,7 +1632,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||
setEtherbase(ctx, cfg)
|
||||
setGPO(ctx, &cfg.GPO, ctx.String(SyncModeFlag.Name) == "light")
|
||||
setTxPool(ctx, &cfg.TxPool)
|
||||
setEthash(ctx, cfg)
|
||||
setMiner(ctx, &cfg.Miner)
|
||||
setRequiredBlocks(ctx, cfg)
|
||||
setLes(ctx, cfg)
|
||||
@@ -2226,15 +2116,14 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
||||
gspec = MakeGenesis(ctx)
|
||||
chainDb = MakeChainDatabase(ctx, stack, readonly)
|
||||
)
|
||||
cliqueConfig, err := core.LoadCliqueConfig(chainDb, gspec)
|
||||
config, err := core.LoadChainConfig(chainDb, gspec)
|
||||
if err != nil {
|
||||
Fatalf("%v", err)
|
||||
}
|
||||
ethashConfig := ethconfig.Defaults.Ethash
|
||||
if ctx.Bool(FakePoWFlag.Name) {
|
||||
ethashConfig.PowMode = ethash.ModeFake
|
||||
engine, err := ethconfig.CreateConsensusEngine(config, chainDb)
|
||||
if err != nil {
|
||||
Fatalf("%v", err)
|
||||
}
|
||||
engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, nil, false, chainDb)
|
||||
if gcmode := ctx.String(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" {
|
||||
Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user