From d6e56eabca044666771ee2cf779bfeac478a74ed Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 15 Sep 2025 23:19:29 -0300 Subject: [PATCH] fixed gaps --- src/state-manager/TransactionQueue.ts | 3 ++- src/utils/fastAggregatedCorrespondingTell.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/state-manager/TransactionQueue.ts b/src/state-manager/TransactionQueue.ts index 904e16311..64ae5da34 100644 --- a/src/state-manager/TransactionQueue.ts +++ b/src/state-manager/TransactionQueue.ts @@ -5133,7 +5133,7 @@ class TransactionQueue { /* prettier-ignore */ if (logFlags.verbose) this.mainLogger.debug(`factTellCorrespondingNodesFinalData: Using wrapped index ${wrappedIndex} instead of regular ${senderIndexInTxGroup}`) } - if (configContext.p2p.factv2) senderIndex = queueEntry.transactionGroup.findIndex((node) => node.id === Self.id) + if (configContext.p2p.factv2) senderIndex = queueEntry.executionGroup.findIndex((node) => node.id === Self.id) // Calculate corresponding nodes using the correct index that receivers will validate const correspondingIndices = getCorrespondingNodes( @@ -5314,6 +5314,7 @@ class TransactionQueue { let targetEndIndex = queueEntry.transactionGroup.length // end of tx group if (configContext.p2p.factv2) { + senderNodeIndex = queueEntry.executionGroup.findIndex((node) => node.id === senderNodeId) targetNodeIndex = queueEntry.transactionGroup.findIndex((node) => node.id === Self.id) targetEndIndex = targetEndIndex - 1 } else { diff --git a/src/utils/fastAggregatedCorrespondingTell.ts b/src/utils/fastAggregatedCorrespondingTell.ts index a11364864..9b3fdccac 100644 --- a/src/utils/fastAggregatedCorrespondingTell.ts +++ b/src/utils/fastAggregatedCorrespondingTell.ts @@ -52,7 +52,9 @@ export function getCorrespondingNodes( //this loop is at most O(k) where k is receiverGroupSize / sendGroupSize //effectively it is constant time it is required so that a smaller //group can send to a larger group - while (targetNumber < receiverGroupSize) { + let steps = 0 + const maxSteps = v2 ? Math.ceil(receiverGroupSize / sendGroupSize) : Infinity + while (v2 ? steps < maxSteps : targetNumber < receiverGroupSize) { //send all payload to this node const destinationNode = wrappedIndex @@ -77,6 +79,7 @@ export function getCorrespondingNodes( if (wrappedIndex >= transactionGroupSize) { wrappedIndex = wrappedIndex - transactionGroupSize } + steps++ if (!v2) { //wrap to front of receiver group if (wrappedIndex >= endTargetIndex) {