From 32de571acd49009bd5ce7d38fcbdc0309c8d4b34 Mon Sep 17 00:00:00 2001 From: healthykim Date: Sat, 29 Nov 2025 00:38:17 +0900 Subject: [PATCH] fix: fix test error --- eth/protocols/eth/peer.go | 5 +++-- eth/protocols/eth/peer_test.go | 29 ++--------------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index d6a8614cc2..5566a01e0a 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -395,7 +395,6 @@ func (p *Peer) requestPartialReceipts(id uint64) error { GetReceiptsRequest: p.receiptBuffer[id].request[lastBlock:], FirstBlockReceiptIndex: uint64(lastReceipt), }, - continued: true, } return p.dispatchRequest(req) @@ -480,7 +479,9 @@ func (p *Peer) validateLastBlockReceipt(receiptLists []*ReceiptList69, id uint64 // should be dropped, don't clear the buffer return 0, fmt.Errorf("total number of tx exceeded limit") } - + for _, rc := range lastReceipts.items { + log += uint64(len(rc.Logs)) + } // Verify that the overall downloaded receipt size does not exceed the block gas limit. if previousLog+log > header.GasUsed/params.LogDataGas { return 0, fmt.Errorf("total download receipt size exceeded the limit") diff --git a/eth/protocols/eth/peer_test.go b/eth/protocols/eth/peer_test.go index bb5744ae01..994e82acb3 100644 --- a/eth/protocols/eth/peer_test.go +++ b/eth/protocols/eth/peer_test.go @@ -366,32 +366,7 @@ func TestPartialReceiptFailure(t *testing.T) { t.Fatal("Response with the excessive number of receipts should fail the validation") } - // Case 2 ) The size of each receipt exceeds maximum log size against the max tx size - req, err = peer.RequestReceipts(hashes, sink) - if err != nil { - t.Fatalf("RequestReceipts failed: %v", err) - } - select { - case _ = <-packetCh: - case <-time.After(2 * time.Second): - t.Fatalf("timeout waiting for request packet") - } - maxLogSize := params.MaxTxGas / params.LogDataGas - delivery = &ReceiptsPacket70{ - RequestId: req.id, - LastBlockIncomplete: true, - List: []*ReceiptList69{{ - items: []Receipt{ - {Logs: rlp.RawValue(make([]byte, maxLogSize+1))}, - }, - }}, - } - err = peer.bufferReceiptsPacket(delivery, backend) - if err == nil { - t.Fatal("Response with the excessive number of receipts should fail the validation") - } - - // Case 3 ) Total receipt size exceeds the block gas limit + // Case 2 ) Total receipt size exceeds the block gas limit req, err = peer.RequestReceipts(hashes, sink) if err != nil { t.Fatalf("RequestReceipts failed: %v", err) @@ -413,6 +388,6 @@ func TestPartialReceiptFailure(t *testing.T) { } err = peer.bufferReceiptsPacket(delivery, backend) if err == nil { - t.Fatal("Response with the excessive number of receipts should fail the validation") + t.Fatal("Response with the large log size should fail the validation") } }