cmd/devp2p: fix test error message formats (#35138)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

Include the actual and expected request IDs in the devp2p test 
response failure message. This also fixes the typo in the diagnostic so
mismatched responses report a useful error.

---------

Co-authored-by: Bosul Mun <bsbs8645@snu.ac.kr>
This commit is contained in:
cui 2026-07-02 18:34:06 +08:00 committed by GitHub
parent df51c49770
commit 46b79ea078
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -423,7 +423,7 @@ func (s *Suite) TestGetBlockBodies(t *utesting.T) {
t.Fatalf("error reading block bodies msg: %v", err)
}
if got, want := resp.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id in respond", got, want)
t.Fatalf("unexpected request id in response: got %d, want %d", got, want)
}
if resp.List.Len() != len(req.GetBlockBodiesRequest) {
t.Fatalf("wrong bodies in response: expected %d bodies, got %d", len(req.GetBlockBodiesRequest), resp.List.Len())
@ -467,7 +467,7 @@ func (s *Suite) TestGetReceipts(t *utesting.T) {
t.Fatalf("error reading block receipts msg: %v", err)
}
if got, want := resp.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id in respond", got, want)
t.Fatalf("unexpected request id in response: got %d, want %d", got, want)
}
if resp.List.Len() != len(req.GetReceiptsRequest) {
t.Fatalf("wrong receipts in response: expected %d receipts, got %d", len(req.GetReceiptsRequest), resp.List.Len())
@ -488,7 +488,7 @@ func (s *Suite) TestGetReceipts(t *utesting.T) {
t.Fatalf("error reading block receipts msg: %v", err)
}
if got, want := resp.RequestId, req.RequestId; got != want {
t.Fatalf("unexpected request id in respond", got, want)
t.Fatalf("unexpected request id in response: got %d, want %d", got, want)
}
if resp.List.Len() != len(req.GetReceiptsRequest) {
t.Fatalf("wrong receipts in response: expected %d receipts, got %d", len(req.GetReceiptsRequest), resp.List.Len())

View file

@ -186,7 +186,7 @@ func (s *Suite) TestHandshakeResend(t *utesting.T) {
t.Fatalf("wrong nonce %x in WHOAREYOU (want %x)", resp.Nonce[:], challenge1.Nonce[:])
}
if !bytes.Equal(resp.ChallengeData, challenge1.ChallengeData) {
t.Fatalf("wrong ChallengeData in resent WHOAREYOU (want %x)", resp.ChallengeData, challenge1.ChallengeData)
t.Fatalf("wrong ChallengeData in resent WHOAREYOU: got %x, want %x", resp.ChallengeData, challenge1.ChallengeData)
}
resp.Node = conn.remote
default: