Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added simulators/devp2p/devp2p
Binary file not shown.
19 changes: 18 additions & 1 deletion simulators/devp2p/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func main() {
},
AlwaysRun: true,
Run: func(t *hivesim.T, c *hivesim.Client) {
runDiscv5Test(t, c, (*hivesim.Client).EnodeURL)
runDiscv5Test(t, c, getEth1ENR)
},
},
hivesim.ClientTestSpec{
Expand Down Expand Up @@ -337,3 +337,20 @@ func getPortalENR(c *hivesim.Client) (string, error) {
}
return nodeInfoResult.ENR, nil
}

// getEth1ENR returns the client's signed ENR via admin_nodeInfo. The discv5
// endpoint must be read from the ENR rather than the enode URL, because the
// enode URL only describes the discv4/RLPx endpoint and some clients (e.g.
// reth) bind discv5 to a different UDP port.
func getEth1ENR(c *hivesim.Client) (string, error) {
var nodeInfoResult struct {
ENR string `json:"enr"`
}
if err := c.RPC().Call(&nodeInfoResult, "admin_nodeInfo"); err != nil {
return "", err
}
if nodeInfoResult.ENR == "" {
return "", fmt.Errorf("missing 'enr' in admin_nodeInfo response")
}
return nodeInfoResult.ENR, nil
}