From 46b79ea078fc77d5a43fc155d91a5899743762d2 Mon Sep 17 00:00:00 2001 From: cui Date: Thu, 2 Jul 2026 18:34:06 +0800 Subject: [PATCH] cmd/devp2p: fix test error message formats (#35138) 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 --- cmd/devp2p/internal/ethtest/suite.go | 6 +++--- cmd/devp2p/internal/v5test/discv5tests.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/devp2p/internal/ethtest/suite.go b/cmd/devp2p/internal/ethtest/suite.go index 6dc77941c1..fa883806c8 100644 --- a/cmd/devp2p/internal/ethtest/suite.go +++ b/cmd/devp2p/internal/ethtest/suite.go @@ -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()) diff --git a/cmd/devp2p/internal/v5test/discv5tests.go b/cmd/devp2p/internal/v5test/discv5tests.go index 4dc2507693..17d39d5ad0 100644 --- a/cmd/devp2p/internal/v5test/discv5tests.go +++ b/cmd/devp2p/internal/v5test/discv5tests.go @@ -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: