cmd/devp2p: distinguish the jwt in devp2p and geth (#32972)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

This PR fixes some docs for the devp2p suite and uses the CLI library's required value instead of manually checking if required flags are passed.
This commit is contained in:
Delweng 2025-10-23 00:24:40 +08:00 committed by GitHub
parent 3b8075234e
commit 116c916753
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 16 deletions

View file

@ -121,7 +121,7 @@ with our test chain. The chain files are located in `./cmd/devp2p/internal/ethte
--nat=none \ --nat=none \
--networkid 3503995874084926 \ --networkid 3503995874084926 \
--verbosity 5 \ --verbosity 5 \
--authrpc.jwtsecret 0x7365637265747365637265747365637265747365637265747365637265747365 --authrpc.jwtsecret jwt.secret
Note that the tests also require access to the engine API. Note that the tests also require access to the engine API.
The test suite can now be executed using the devp2p tool. The test suite can now be executed using the devp2p tool.
@ -130,7 +130,7 @@ The test suite can now be executed using the devp2p tool.
--chain internal/ethtest/testdata \ --chain internal/ethtest/testdata \
--node enode://.... \ --node enode://.... \
--engineapi http://127.0.0.1:8551 \ --engineapi http://127.0.0.1:8551 \
--jwtsecret 0x7365637265747365637265747365637265747365637265747365637265747365 --jwtsecret $(cat jwt.secret)
Repeat the above process (re-initialising the node) in order to run the Eth Protocol test suite again. Repeat the above process (re-initialising the node) in order to run the Eth Protocol test suite again.

View file

@ -143,9 +143,6 @@ type testParams struct {
func cliTestParams(ctx *cli.Context) *testParams { func cliTestParams(ctx *cli.Context) *testParams {
nodeStr := ctx.String(testNodeFlag.Name) nodeStr := ctx.String(testNodeFlag.Name)
if nodeStr == "" {
exit(fmt.Errorf("missing -%s", testNodeFlag.Name))
}
node, err := parseNode(nodeStr) node, err := parseNode(nodeStr)
if err != nil { if err != nil {
exit(err) exit(err)
@ -156,14 +153,5 @@ func cliTestParams(ctx *cli.Context) *testParams {
jwt: ctx.String(testNodeJWTFlag.Name), jwt: ctx.String(testNodeJWTFlag.Name),
chainDir: ctx.String(testChainDirFlag.Name), chainDir: ctx.String(testChainDirFlag.Name),
} }
if p.engineAPI == "" {
exit(fmt.Errorf("missing -%s", testNodeEngineFlag.Name))
}
if p.jwt == "" {
exit(fmt.Errorf("missing -%s", testNodeJWTFlag.Name))
}
if p.chainDir == "" {
exit(fmt.Errorf("missing -%s", testChainDirFlag.Name))
}
return &p return &p
} }

View file

@ -39,26 +39,29 @@ var (
} }
// for eth/snap tests // for eth/snap tests
testChainDirFlag = &cli.StringFlag{ testChainDirFlag = &cli.PathFlag{
Name: "chain", Name: "chain",
Usage: "Test chain directory (required)", Usage: "Test chain directory (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Required: true,
} }
testNodeFlag = &cli.StringFlag{ testNodeFlag = &cli.StringFlag{
Name: "node", Name: "node",
Usage: "Peer-to-Peer endpoint (ENR) of the test node (required)", Usage: "Peer-to-Peer endpoint (ENR) of the test node (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Required: true,
} }
testNodeJWTFlag = &cli.StringFlag{ testNodeJWTFlag = &cli.StringFlag{
Name: "jwtsecret", Name: "jwtsecret",
Usage: "JWT secret for the engine API of the test node (required)", Usage: "JWT secret for the engine API of the test node (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Value: "0x7365637265747365637265747365637265747365637265747365637265747365", Required: true,
} }
testNodeEngineFlag = &cli.StringFlag{ testNodeEngineFlag = &cli.StringFlag{
Name: "engineapi", Name: "engineapi",
Usage: "Engine API endpoint of the test node (required)", Usage: "Engine API endpoint of the test node (required)",
Category: flags.TestingCategory, Category: flags.TestingCategory,
Required: true,
} }
// These two are specific to the discovery tests. // These two are specific to the discovery tests.