Skip to content

Commit 116c916

Browse files
authored
cmd/devp2p: distinguish the jwt in devp2p and geth (#32972)
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.
1 parent 3b80752 commit 116c916

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

cmd/devp2p/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ with our test chain. The chain files are located in `./cmd/devp2p/internal/ethte
121121
--nat=none \
122122
--networkid 3503995874084926 \
123123
--verbosity 5 \
124-
--authrpc.jwtsecret 0x7365637265747365637265747365637265747365637265747365637265747365
124+
--authrpc.jwtsecret jwt.secret
125125

126126
Note that the tests also require access to the engine API.
127127
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.
130130
--chain internal/ethtest/testdata \
131131
--node enode://.... \
132132
--engineapi http://127.0.0.1:8551 \
133-
--jwtsecret 0x7365637265747365637265747365637265747365637265747365637265747365
133+
--jwtsecret $(cat jwt.secret)
134134

135135
Repeat the above process (re-initialising the node) in order to run the Eth Protocol test suite again.
136136

cmd/devp2p/rlpxcmd.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ type testParams struct {
143143

144144
func cliTestParams(ctx *cli.Context) *testParams {
145145
nodeStr := ctx.String(testNodeFlag.Name)
146-
if nodeStr == "" {
147-
exit(fmt.Errorf("missing -%s", testNodeFlag.Name))
148-
}
149146
node, err := parseNode(nodeStr)
150147
if err != nil {
151148
exit(err)
@@ -156,14 +153,5 @@ func cliTestParams(ctx *cli.Context) *testParams {
156153
jwt: ctx.String(testNodeJWTFlag.Name),
157154
chainDir: ctx.String(testChainDirFlag.Name),
158155
}
159-
if p.engineAPI == "" {
160-
exit(fmt.Errorf("missing -%s", testNodeEngineFlag.Name))
161-
}
162-
if p.jwt == "" {
163-
exit(fmt.Errorf("missing -%s", testNodeJWTFlag.Name))
164-
}
165-
if p.chainDir == "" {
166-
exit(fmt.Errorf("missing -%s", testChainDirFlag.Name))
167-
}
168156
return &p
169157
}

cmd/devp2p/runtest.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,29 @@ var (
3939
}
4040

4141
// for eth/snap tests
42-
testChainDirFlag = &cli.StringFlag{
42+
testChainDirFlag = &cli.PathFlag{
4343
Name: "chain",
4444
Usage: "Test chain directory (required)",
4545
Category: flags.TestingCategory,
46+
Required: true,
4647
}
4748
testNodeFlag = &cli.StringFlag{
4849
Name: "node",
4950
Usage: "Peer-to-Peer endpoint (ENR) of the test node (required)",
5051
Category: flags.TestingCategory,
52+
Required: true,
5153
}
5254
testNodeJWTFlag = &cli.StringFlag{
5355
Name: "jwtsecret",
5456
Usage: "JWT secret for the engine API of the test node (required)",
5557
Category: flags.TestingCategory,
56-
Value: "0x7365637265747365637265747365637265747365637265747365637265747365",
58+
Required: true,
5759
}
5860
testNodeEngineFlag = &cli.StringFlag{
5961
Name: "engineapi",
6062
Usage: "Engine API endpoint of the test node (required)",
6163
Category: flags.TestingCategory,
64+
Required: true,
6265
}
6366

6467
// These two are specific to the discovery tests.

0 commit comments

Comments
 (0)