Skip to content

Commit 3b2a6b3

Browse files
cmd/geth: eth/catalyst: enable authrpc by default (#25152)
* cmd/geth: eth/catalyst: enable authrpc by default * eth/catalyst: rename catalyst -> Engine API in logs * eth/catalyst: don't panic
1 parent 22d71af commit 3b2a6b3

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

cmd/geth/consolecmd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func runMinimalGeth(t *testing.T, args ...string) *testgeth {
4141
// --ropsten to make the 'writing genesis to disk' faster (no accounts)
4242
// --networkid=1337 to avoid cache bump
4343
// --syncmode=full to avoid allocating fast sync bloom
44-
allArgs := []string{"--ropsten", "--networkid", "1337", "--syncmode=full", "--port", "0",
44+
allArgs := []string{"--ropsten", "--networkid", "1337", "--authrpc.port", "0", "--syncmode=full", "--port", "0",
4545
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--cache", "64",
4646
"--datadir.minfreedisk", "0"}
4747
return runGeth(t, append(allArgs, args...)...)

cmd/geth/genesis_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestCustomGenesis(t *testing.T) {
8383

8484
// Query the custom genesis block
8585
geth := runGeth(t, "--networkid", "1337", "--syncmode=full", "--cache", "16",
86-
"--datadir", datadir, "--maxpeers", "0", "--port", "0",
86+
"--datadir", datadir, "--maxpeers", "0", "--port", "0", "--authrpc.port", "0",
8787
"--nodiscover", "--nat", "none", "--ipcdisable",
8888
"--exec", tt.query, "console")
8989
geth.ExpectRegexp(tt.result)

cmd/geth/les_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ var nextIPC = uint32(0)
111111

112112
func startGethWithIpc(t *testing.T, name string, args ...string) *gethrpc {
113113
ipcName := fmt.Sprintf("geth-%d.ipc", atomic.AddUint32(&nextIPC, 1))
114-
args = append([]string{"--networkid=42", "--port=0", "--ipcpath", ipcName}, args...)
114+
args = append([]string{"--networkid=42", "--port=0", "--authrpc.port", "0", "--ipcpath", ipcName}, args...)
115115
t.Logf("Starting %v with rpc: %v", name, args)
116116

117117
g := &gethrpc{

cmd/utils/flags.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,10 +1993,8 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend
19931993
Fatalf("Failed to register the Ethereum service: %v", err)
19941994
}
19951995
stack.RegisterAPIs(tracers.APIs(backend.ApiBackend))
1996-
if backend.BlockChain().Config().TerminalTotalDifficulty != nil {
1997-
if err := lescatalyst.Register(stack, backend); err != nil {
1998-
Fatalf("Failed to register the catalyst service: %v", err)
1999-
}
1996+
if err := lescatalyst.Register(stack, backend); err != nil {
1997+
Fatalf("Failed to register the Engine API service: %v", err)
20001998
}
20011999
return backend.ApiBackend, nil
20022000
}
@@ -2010,10 +2008,8 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend
20102008
Fatalf("Failed to create the LES server: %v", err)
20112009
}
20122010
}
2013-
if backend.BlockChain().Config().TerminalTotalDifficulty != nil {
2014-
if err := ethcatalyst.Register(stack, backend); err != nil {
2015-
Fatalf("Failed to register the catalyst service: %v", err)
2016-
}
2011+
if err := ethcatalyst.Register(stack, backend); err != nil {
2012+
Fatalf("Failed to register the Engine API service: %v", err)
20172013
}
20182014
stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
20192015
return backend.APIBackend, backend

eth/catalyst/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import (
3737
"github.com/ethereum/go-ethereum/rpc"
3838
)
3939

40-
// Register adds catalyst APIs to the full node.
40+
// Register adds the engine API to the full node.
4141
func Register(stack *node.Node, backend *eth.Ethereum) error {
42-
log.Warn("Catalyst mode enabled", "protocol", "eth")
42+
log.Warn("Engine API enabled", "protocol", "eth")
4343
stack.RegisterAPIs([]rpc.API{
4444
{
4545
Namespace: "engine",
@@ -62,7 +62,7 @@ type ConsensusAPI struct {
6262
// The underlying blockchain needs to have a valid terminal total difficulty set.
6363
func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
6464
if eth.BlockChain().Config().TerminalTotalDifficulty == nil {
65-
panic("Catalyst started without valid total difficulty")
65+
log.Warn("Engine API started without valid total difficulty")
6666
}
6767
return &ConsensusAPI{
6868
eth: eth,
@@ -73,7 +73,7 @@ func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI {
7373

7474
// ForkchoiceUpdatedV1 has several responsibilities:
7575
// If the method is called with an empty head block:
76-
// we return success, which can be used to check if the catalyst mode is enabled
76+
// we return success, which can be used to check if the engine API is enabled
7777
// If the total difficulty was not reached:
7878
// we return INVALID
7979
// If the finalizedBlockHash is set:
@@ -223,7 +223,7 @@ func (api *ConsensusAPI) ExchangeTransitionConfigurationV1(config beacon.Transit
223223
return nil, errors.New("invalid terminal total difficulty")
224224
}
225225
ttd := api.eth.BlockChain().Config().TerminalTotalDifficulty
226-
if ttd.Cmp(config.TerminalTotalDifficulty.ToInt()) != 0 {
226+
if ttd == nil || ttd.Cmp(config.TerminalTotalDifficulty.ToInt()) != 0 {
227227
log.Warn("Invalid TTD configured", "geth", ttd, "beacon", config.TerminalTotalDifficulty)
228228
return nil, fmt.Errorf("invalid ttd: execution %v consensus %v", ttd, config.TerminalTotalDifficulty)
229229
}

les/catalyst/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type ConsensusAPI struct {
5050
// The underlying blockchain needs to have a valid terminal total difficulty set.
5151
func NewConsensusAPI(les *les.LightEthereum) *ConsensusAPI {
5252
if les.BlockChain().Config().TerminalTotalDifficulty == nil {
53-
panic("Catalyst started without valid total difficulty")
53+
log.Warn("Catalyst started without valid total difficulty")
5454
}
5555
return &ConsensusAPI{les: les}
5656
}

0 commit comments

Comments
 (0)