From 693d721dbacf872bbc7cb5429bb6e6318ab9d5ac Mon Sep 17 00:00:00 2001 From: andrepatta <9854773+andrepatta@users.noreply.github.com> Date: Thu, 18 Sep 2025 08:25:29 -0300 Subject: [PATCH 1/3] prl: fix block fetcher --- prl/downloader/fetchers_concurrent_bodies.go | 4 ++-- prl/downloader/queue.go | 3 +-- prl/fetcher/block_fetcher.go | 22 +++++++++----------- prl/protocols/prl/protocol.go | 9 +++----- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/prl/downloader/fetchers_concurrent_bodies.go b/prl/downloader/fetchers_concurrent_bodies.go index cff5ce0..9012159 100644 --- a/prl/downloader/fetchers_concurrent_bodies.go +++ b/prl/downloader/fetchers_concurrent_bodies.go @@ -89,10 +89,10 @@ func (q *bodyQueue) request(peer *peerConnection, req *fetchRequest, resCh chan // deliver is responsible for taking a generic response packet from the concurrent // fetcher, unpacking the body data and delivering it to the downloader's queue. func (q *bodyQueue) deliver(peer *peerConnection, packet *prl.Response) (int, error) { - txs, uncles := packet.Res.(*prl.BlockBodiesPacket).Unpack() + txs := packet.Res.(*prl.BlockBodiesPacket).Unpack() hashsets := packet.Meta.([][]common.Hash) // {txs hashes, uncle hashes} - accepted, err := q.queue.DeliverBodies(peer.id, txs, hashsets[0], uncles, hashsets[1]) + accepted, err := q.queue.DeliverBodies(peer.id, txs, hashsets[0]) switch { case err == nil && len(txs) == 0: peer.log.Trace("Requested bodies delivered") diff --git a/prl/downloader/queue.go b/prl/downloader/queue.go index 6f75cfd..1273b05 100644 --- a/prl/downloader/queue.go +++ b/prl/downloader/queue.go @@ -765,7 +765,7 @@ func (q *queue) DeliverHeaders(id string, headers []*types.Header, hashes []comm // DeliverBodies injects a block body retrieval response into the results queue. // The method returns the number of blocks bodies accepted from the delivery and // also wakes any threads waiting for data delivery. -func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListHashes []common.Hash, uncleLists [][]*types.Header, uncleListHashes []common.Hash) (int, error) { +func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListHashes []common.Hash) (int, error) { q.lock.Lock() defer q.lock.Unlock() @@ -778,7 +778,6 @@ func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListH reconstruct := func(index int, result *fetchResult) { result.Transactions = txLists[index] - result.Uncles = uncleLists[index] result.SetBodyDone() } return q.deliver(id, q.blockTaskPool, q.blockTaskQueue, q.blockPendPool, diff --git a/prl/fetcher/block_fetcher.go b/prl/fetcher/block_fetcher.go index f2ee7d3..5070248 100644 --- a/prl/fetcher/block_fetcher.go +++ b/prl/fetcher/block_fetcher.go @@ -124,7 +124,6 @@ type headerFilterTask struct { type bodyFilterTask struct { peer string // The source peer of block bodies transactions [][]*types.Transaction // Collection of transactions per block bodies - uncles [][]*types.Header // Collection of uncles per block bodies time time.Time // Arrival time of the blocks' contents } @@ -303,8 +302,8 @@ func (f *BlockFetcher) FilterHeaders(peer string, headers []*types.Header, time // FilterBodies extracts all the block bodies that were explicitly requested by // the fetcher, returning those that should be handled differently. -func (f *BlockFetcher) FilterBodies(peer string, transactions [][]*types.Transaction, uncles [][]*types.Header, time time.Time) ([][]*types.Transaction, [][]*types.Header) { - log.Trace("Filtering bodies", "peer", peer, "txs", len(transactions), "uncles", len(uncles)) +func (f *BlockFetcher) FilterBodies(peer string, transactions [][]*types.Transaction, time time.Time) [][]*types.Transaction { + log.Trace("Filtering bodies", "peer", peer, "txs", len(transactions)) // Send the filter channel to the fetcher filter := make(chan *bodyFilterTask) @@ -312,20 +311,20 @@ func (f *BlockFetcher) FilterBodies(peer string, transactions [][]*types.Transac select { case f.bodyFilter <- filter: case <-f.quit: - return nil, nil + return nil } // Request the filtering of the body list select { - case filter <- &bodyFilterTask{peer: peer, transactions: transactions, uncles: uncles, time: time}: + case filter <- &bodyFilterTask{peer: peer, transactions: transactions, time: time}: case <-f.quit: - return nil, nil + return nil } // Retrieve the bodies remaining after filtering select { case task := <-filter: - return task.transactions, task.uncles + return task.transactions case <-f.quit: - return nil, nil + return nil } } @@ -542,8 +541,8 @@ func (f *BlockFetcher) loop() { case res := <-resCh: res.Done <- nil - txs, uncles := res.Res.(*prl.BlockBodiesPacket).Unpack() - f.FilterBodies(peer, txs, uncles, time.Now()) + txs := res.Res.(*prl.BlockBodiesPacket).Unpack() + f.FilterBodies(peer, txs, time.Now()) case <-timeout.C: // The peer didn't respond in time. The request @@ -661,7 +660,7 @@ func (f *BlockFetcher) loop() { blocks := []*types.Block{} // abort early if there's nothing explicitly requested if len(f.completing) > 0 { - for i := 0; i < len(task.transactions) && i < len(task.uncles); i++ { + for i := 0; i < len(task.transactions); i++ { // Match up a body to any possible completion request var ( matched = false @@ -690,7 +689,6 @@ func (f *BlockFetcher) loop() { } if matched { task.transactions = append(task.transactions[:i], task.transactions[i+1:]...) - task.uncles = append(task.uncles[:i], task.uncles[i+1:]...) i-- continue } diff --git a/prl/protocols/prl/protocol.go b/prl/protocols/prl/protocol.go index 706cc95..25a2faa 100644 --- a/prl/protocols/prl/protocol.go +++ b/prl/protocols/prl/protocol.go @@ -240,15 +240,12 @@ type BlockBody struct { // Unpack retrieves the transactions and uncles from the range packet and returns // them in a split flat format that's more consistent with the internal data structures. -func (p *BlockBodiesPacket) Unpack() ([][]*types.Transaction, [][]*types.Header) { - var ( - txset = make([][]*types.Transaction, len(*p)) - uncleset = make([][]*types.Header, len(*p)) - ) +func (p *BlockBodiesPacket) Unpack() [][]*types.Transaction { + txset := make([][]*types.Transaction, len(*p)) for i, body := range *p { txset[i] = body.Transactions } - return txset, uncleset + return txset } // GetNodeDataPacket represents a trie node data query. From b634069711c14ddb5c71719d772c22dc5dab1e30 Mon Sep 17 00:00:00 2001 From: andrepatta <9854773+andrepatta@users.noreply.github.com> Date: Thu, 18 Sep 2025 08:51:20 -0300 Subject: [PATCH 2/3] params/bootnode: additional testnet bootnode --- params/bootnodes.go | 1 + 1 file changed, 1 insertion(+) diff --git a/params/bootnodes.go b/params/bootnodes.go index 16862dd..45929bd 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -29,6 +29,7 @@ var MainnetBootnodes = []string{ // test network. var TestnetBootnodes = []string{ "enode://d3440cdb8f942e1f01dac2292b7a8f886831800e301c41cf943a4ba4c68e37513920cd94c421fa5e073ed7329d9c3194e3911c857b9ded1677a5234441d9950d@54.94.191.104:32110", + "enode://c8d58742fef51a70267a916949cefd0d7ba5bdb75393bbfcbcbc959b3eebf16353ac15d1f7493d749f7f452ff2bec894b8a8c469306e247d265f4f305c5740f7@127.0.0.1:32110", } var V5Bootnodes = []string{ From 78d2f22bdadc45d0697939af00cb9dfb90b4f019 Mon Sep 17 00:00:00 2001 From: andrepatta <9854773+andrepatta@users.noreply.github.com> Date: Thu, 18 Sep 2025 08:51:45 -0300 Subject: [PATCH 3/3] bump version to v0.1.1 --- params/bootnodes.go | 2 +- params/version.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/params/bootnodes.go b/params/bootnodes.go index 45929bd..0ea6f2c 100644 --- a/params/bootnodes.go +++ b/params/bootnodes.go @@ -29,7 +29,7 @@ var MainnetBootnodes = []string{ // test network. var TestnetBootnodes = []string{ "enode://d3440cdb8f942e1f01dac2292b7a8f886831800e301c41cf943a4ba4c68e37513920cd94c421fa5e073ed7329d9c3194e3911c857b9ded1677a5234441d9950d@54.94.191.104:32110", - "enode://c8d58742fef51a70267a916949cefd0d7ba5bdb75393bbfcbcbc959b3eebf16353ac15d1f7493d749f7f452ff2bec894b8a8c469306e247d265f4f305c5740f7@127.0.0.1:32110", + "enode://c8d58742fef51a70267a916949cefd0d7ba5bdb75393bbfcbcbc959b3eebf16353ac15d1f7493d749f7f452ff2bec894b8a8c469306e247d265f4f305c5740f7@69.62.94.166:32110", } var V5Bootnodes = []string{ diff --git a/params/version.go b/params/version.go index e423c63..73b16f4 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 0 // Major version component of the current release VersionMinor = 1 // Minor version component of the current release - VersionPatch = 0 // Patch version component of the current release + VersionPatch = 1 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )