From cd9483648eb8d16cb28f8b4957e009d6d064f291 Mon Sep 17 00:00:00 2001 From: healthykim Date: Tue, 16 Dec 2025 17:07:14 +0900 Subject: [PATCH] test: make LargeReceiptBlock as a pointer --- cmd/devp2p/internal/ethtest/chain.go | 2 +- cmd/devp2p/internal/ethtest/suite.go | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cmd/devp2p/internal/ethtest/chain.go b/cmd/devp2p/internal/ethtest/chain.go index 7a96460dd5..b44e6aa36a 100644 --- a/cmd/devp2p/internal/ethtest/chain.go +++ b/cmd/devp2p/internal/ethtest/chain.go @@ -56,7 +56,7 @@ type Chain struct { } type txInfo struct { - LargeReceiptBlock uint64 `json:"tx-largereceipt"` + LargeReceiptBlock *uint64 `json:"tx-largereceipt"` } // NewChain takes the given chain.rlp file, and decodes and returns diff --git a/cmd/devp2p/internal/ethtest/suite.go b/cmd/devp2p/internal/ethtest/suite.go index dda01e8d3b..e4f8a223c2 100644 --- a/cmd/devp2p/internal/ethtest/suite.go +++ b/cmd/devp2p/internal/ethtest/suite.go @@ -426,7 +426,7 @@ func (s *Suite) TestGetReceipts(t *utesting.T) { // Find some blocks containing receipts. var hashes = make([]common.Hash, 0, 3) for i := range s.chain.Len() { - if uint64(i) == s.chain.txInfo.LargeReceiptBlock && conn.negotiatedProtoVersion < eth.ETH70 { + if s.chain.txInfo.LargeReceiptBlock != nil && uint64(i) == *s.chain.txInfo.LargeReceiptBlock { continue } block := s.chain.GetBlock(i) @@ -484,37 +484,36 @@ func (s *Suite) TestGetReceipts(t *utesting.T) { func (s *Suite) TestGetLargeReceipts(t *utesting.T) { t.Log(`This test sends GetReceipts requests to the node for large receipt (>10MiB) in the test chain. - This test is meaningful only if the client supports protocol version greater than or equal to ETH70.`) + This test is meaningful only if the client supports protocol version ETH70 or higher + and LargeReceiptBlock is configured in txInfo.json.`) conn, err := s.dialAndPeer(nil) if err != nil { t.Fatalf("peering failed: %v", err) } defer conn.Close() - if conn.negotiatedProtoVersion < eth.ETH70 { + if conn.negotiatedProtoVersion < eth.ETH70 || s.chain.txInfo.LargeReceiptBlock == nil { return } // Find block with large receipt. // Place the large receipt block hash in the middle of the query - start := max(s.chain.txInfo.LargeReceiptBlock-2, 0) - end := min(s.chain.txInfo.LargeReceiptBlock+2, uint64(len(s.chain.blocks))) + start := max(int(*s.chain.txInfo.LargeReceiptBlock)-2, 0) + end := min(*s.chain.txInfo.LargeReceiptBlock+2, uint64(len(s.chain.blocks))) var blocks []common.Hash var receiptHashes []common.Hash + var receipts []*eth.ReceiptList69 - for i := start; i < end; i++ { + for i := uint64(start); i < end; i++ { block := s.chain.GetBlock(int(i)) blocks = append(blocks, block.Hash()) receiptHashes = append(receiptHashes, block.Header().ReceiptHash) + receipts = append(receipts, ð.ReceiptList69{}) } incomplete := false lastBlock := 0 - receipts := make([]*eth.ReceiptList69, len(blocks)) - for i := range receipts { - receipts[i] = ð.ReceiptList69{} - } for incomplete || lastBlock != len(blocks)-1 { // Create get receipt request.