go-ethereum/p2p/discover
Ocenka 276ed4848c
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled
p2p/discover: add discv5 invalid findnodes result test cases (#32481)
Supersedes #32470.

### What
- snap: shorten stall watchdog in `eth/protocols/snap/sync_test.go` from
1m to 10s.
- discover/v5: consolidate FINDNODE negative tests into a single
table-driven test:
  - `TestUDPv5_findnodeCall_InvalidNodes` covers:
    - invalid IP (unspecified `0.0.0.0`) → ignored
    - low UDP port (`<=1024`) → ignored

### Why
- Addresses TODOs:
  - “Make tests smaller” (reduce long 1m timeout).
- “check invalid IPs”; also cover low port per `verifyResponseNode`
rules (UDP must be >1024).

### How it’s validated
- Test-only changes; no production code touched.
- Local runs:
  - `go test ./p2p/discover -count=1 -timeout=300s` → ok
  - `go test ./eth/protocols/snap -count=1 -timeout=600s` → ok
- Lint:
  - `go run build/ci.go lint` → 0 issues on modified files.

### Notes
- The test harness uses `enode.ValidSchemesForTesting` (which includes
the “null” scheme), so records signed with `enode.SignNull` are
signature-valid; failures here are due to IP/port validation in
`verifyResponseNode` and `netutil.CheckRelayAddr`.
- Tests are written as a single table-driven function for clarity; no
helpers or environment switching.

---------

Co-authored-by: lightclient <lightclient@protonmail.com>
2025-08-22 11:44:11 -06:00
..
v4wire p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v5wire p2p/discover: pass node instead of node ID to TALKREQ handler (#31075) 2025-04-02 14:56:21 +02:00
common.go p2p/discover: make discv5 response timeout configurable (#31119) 2025-02-11 13:52:43 +01:00
lookup.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
metrics.go metrics, cmd/geth: change init-process of metrics (#30814) 2024-12-10 13:27:29 +01:00
node.go p2p/discover: remove type encPubkey (#30172) 2024-07-18 11:09:02 +02:00
ntp.go all: remove dependency on golang.org/exp (#29314) 2024-03-25 07:50:18 +01:00
table.go eth/protocols/snap, p2p/discover: improve zero time checks (#32214) 2025-07-15 14:20:45 +08:00
table_reval.go p2p/discover: remove unused parameter in revalidationList.get (#31155) 2025-02-11 13:45:44 +01:00
table_reval_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
table_test.go p2p/discover: improve flaky revalidation tests (#30023) 2024-06-21 15:29:07 +02:00
table_util_test.go p2p/discover: remove type encPubkey (#30172) 2024-07-18 11:09:02 +02:00
v4_lookup_test.go p2p/discover: fix flaky tests writing to test.log after completion (#30506) 2024-09-26 08:12:12 +02:00
v4_udp.go p2p/discover: expose discv5 functions for portal JSON-RPC interface (#31117) 2025-03-13 15:16:01 +01:00
v4_udp_test.go p2p/discover: remove type encPubkey (#30172) 2024-07-18 11:09:02 +02:00
v5_talk.go p2p/discover: pass node instead of node ID to TALKREQ handler (#31075) 2025-04-02 14:56:21 +02:00
v5_udp.go p2p/discover: pass node instead of node ID to TALKREQ handler (#31075) 2025-04-02 14:56:21 +02:00
v5_udp_test.go p2p/discover: add discv5 invalid findnodes result test cases (#32481) 2025-08-22 11:44:11 -06:00