Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance tracker #8851

Merged
merged 8 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor bits aggregator or operation
mehdi-aouadi committed Nov 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 786b9ddd31a9535fac9fafecb4587e5e0ab41f03
Original file line number Diff line number Diff line change
@@ -317,10 +317,7 @@ private AttestationPerformance calculateAttestationPerformance(
slotToBitlists.merge(
entry.getKey(),
AttestationBitsAggregator.of(attestation, committeesSize),
(firstBitsAggregator, secondBitAggregator) -> {
firstBitsAggregator.or(secondBitAggregator);
return firstBitsAggregator;
});
AttestationBitsAggregator::or);
}
}

Original file line number Diff line number Diff line change
@@ -278,8 +278,10 @@ void shouldClearOldSentObjects() {
chainUpdater.updateBestBlock(chainUpdater.advanceChainUntil(10));
performanceTracker.reportBlockProductionAttempt(spec.computeEpochAtSlot(UInt64.valueOf(1)));
performanceTracker.reportBlockProductionAttempt(spec.computeEpochAtSlot(UInt64.valueOf(2)));
performanceTracker.saveProducedBlock(chainUpdater.chainBuilder.getBlockAtSlot(1).getSlotAndBlockRoot());
performanceTracker.saveProducedBlock(chainUpdater.chainBuilder.getBlockAtSlot(2).getSlotAndBlockRoot());
performanceTracker.saveProducedBlock(
chainUpdater.chainBuilder.getBlockAtSlot(1).getSlotAndBlockRoot());
performanceTracker.saveProducedBlock(
chainUpdater.chainBuilder.getBlockAtSlot(2).getSlotAndBlockRoot());
performanceTracker.saveProducedAttestation(dataStructureUtil.randomAttestation(UInt64.ONE));
performanceTracker.onSlot(spec.computeStartSlotAtEpoch(UInt64.valueOf(2)));
assertThat(performanceTracker.producedAttestationsByEpoch).isEmpty();
@@ -312,8 +314,10 @@ void shouldClearObjectsAfterFailure() {
performanceTracker.start(UInt64.ZERO);
performanceTracker.reportBlockProductionAttempt(spec.computeEpochAtSlot(UInt64.valueOf(1)));
performanceTracker.reportBlockProductionAttempt(spec.computeEpochAtSlot(UInt64.valueOf(2)));
performanceTracker.saveProducedBlock(chainUpdater.chainBuilder.getBlockAtSlot(1));
performanceTracker.saveProducedBlock(chainUpdater.chainBuilder.getBlockAtSlot(2));
performanceTracker.saveProducedBlock(
chainUpdater.chainBuilder.getBlockAtSlot(1).getSlotAndBlockRoot());
performanceTracker.saveProducedBlock(
chainUpdater.chainBuilder.getBlockAtSlot(2).getSlotAndBlockRoot());
performanceTracker.saveProducedAttestation(dataStructureUtil.randomAttestation(UInt64.ZERO));
performanceTracker.saveProducedAttestation(dataStructureUtil.randomAttestation(UInt64.ONE));
performanceTracker.onSlot(spec.computeStartSlotAtEpoch(UInt64.valueOf(2)));
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ static AttestationBitsAggregator of(
.orElseGet(() -> new AttestationBitsAggregatorPhase0(attestation.getAggregationBits()));
}

void or(AttestationBitsAggregator other);
AttestationBitsAggregator or(AttestationBitsAggregator other);

boolean aggregateWith(Attestation other);

Original file line number Diff line number Diff line change
@@ -48,8 +48,9 @@ static AttestationBitsAggregator fromAttestationSchema(
}

@Override
public void or(final AttestationBitsAggregator other) {
public AttestationBitsAggregator or(final AttestationBitsAggregator other) {
or(other.getCommitteeBits(), other.getAggregationBits(), false);
return this;
}

@Override
Original file line number Diff line number Diff line change
@@ -33,8 +33,9 @@ static AttestationBitsAggregator fromAttestationSchema(
}

@Override
public void or(final AttestationBitsAggregator other) {
public AttestationBitsAggregator or(final AttestationBitsAggregator other) {
aggregationBits = aggregationBits.or(other.getAggregationBits());
return this;
}

@Override