Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override TTD sometimes doesn't work #25133

Closed
MariusVanDerWijden opened this issue Jun 20, 2022 · 2 comments · Fixed by #25136
Closed

Override TTD sometimes doesn't work #25133

MariusVanDerWijden opened this issue Jun 20, 2022 · 2 comments · Fixed by #25136
Labels

Comments

@MariusVanDerWijden
Copy link
Member

No description provided.

@prestonvanloon
Copy link
Contributor

prestonvanloon commented Jun 20, 2022

We experienced this issue today when running with the following flags

            - '--datadir=/data'
            - '--sepolia'
            - '--http'
            - '--http.api=engine,net,eth'
            - '--http.addr=0.0.0.0'
            - '--http.vhosts='
            - '--http.port=8545'
            - '--authrpc.addr=0.0.0.0'
            - '--authrpc.vhosts='
            - '--authrpc.port=8551'
            - '--authrpc.jwtsecret=/secret/authrpc/jwt.hex'
            - '--ws'
            - '--ws.api=net,eth,engine'
            - '--override.terminaltotaldifficulty=100000000000000000000000'

Geth version 1.10.18

@leolara
Copy link

leolara commented Jun 22, 2022

@MariusVanDerWijden @prestonvanloon I experienced this, when the datadir is empty, after the genesis block has been inserted into the database, if you restart then the terminal difficulty override is used.

I have trace back the problem to here:

https://github.com/ethereum/go-ethereum/blob/master/core/genesis.go#L240-L254

	stored := rawdb.ReadCanonicalHash(db, 0)
	if (stored == common.Hash{}) {
		if genesis == nil {
			log.Info("Writing default main-net genesis block")
			genesis = DefaultGenesisBlock()
		} else {
			log.Info("Writing custom genesis block")
		}
		block, err := genesis.Commit(db)
		if err != nil {
			return genesis.Config, common.Hash{}, err
		}
		return genesis.Config, block.Hash(), nil
	}

if it does not find the genesis block in the DB, it stores it, and then returns its default config, without going through the lines bellow:

https://github.com/ethereum/go-ethereum/blob/master/core/genesis.go#L285-L287

	if overrideTerminalTotalDifficulty != nil {
		newcfg.TerminalTotalDifficulty = overrideTerminalTotalDifficulty
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants
@leolara @prestonvanloon @MariusVanDerWijden and others