Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import tech.pegasys.teku.spec.datastructures.state.Fork;
import tech.pegasys.teku.spec.datastructures.state.ForkInfo;
import tech.pegasys.teku.spec.generator.AggregateGenerator;
import tech.pegasys.teku.statetransition.attestation.utils.AggregatingAttestationPoolProfiler;
import tech.pegasys.teku.statetransition.blobs.BlobSidecarManager;
import tech.pegasys.teku.statetransition.forkchoice.ForkChoice;
import tech.pegasys.teku.statetransition.forkchoice.MergeTransitionBlockValidator;
Expand Down Expand Up @@ -74,7 +75,11 @@ class AttestationManagerIntegrationTest {

private final AggregatingAttestationPool attestationPool =
new AggregatingAttestationPoolV1(
spec, recentChainData, new NoOpMetricsSystem(), DEFAULT_MAXIMUM_ATTESTATION_COUNT);
spec,
recentChainData,
new NoOpMetricsSystem(),
AggregatingAttestationPoolProfiler.NOOP,
DEFAULT_MAXIMUM_ATTESTATION_COUNT);
private final MergeTransitionBlockValidator transitionBlockValidator =
new MergeTransitionBlockValidator(spec, recentChainData);
private final ForkChoice forkChoice =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import tech.pegasys.teku.statetransition.attestation.AggregatingAttestationPool;
import tech.pegasys.teku.statetransition.attestation.AggregatingAttestationPoolV1;
import tech.pegasys.teku.statetransition.attestation.AttestationForkChecker;
import tech.pegasys.teku.statetransition.attestation.utils.AggregatingAttestationPoolProfiler;
import tech.pegasys.teku.storage.client.RecentChainData;

@Warmup(iterations = 5, time = 2000, timeUnit = TimeUnit.MILLISECONDS)
Expand Down Expand Up @@ -109,7 +110,11 @@ public void init() throws Exception {

this.pool =
new AggregatingAttestationPoolV1(
SPEC, recentChainData, new NoOpMetricsSystem(), DEFAULT_MAXIMUM_ATTESTATION_COUNT);
SPEC,
recentChainData,
new NoOpMetricsSystem(),
AggregatingAttestationPoolProfiler.NOOP,
DEFAULT_MAXIMUM_ATTESTATION_COUNT);
this.recentChainData = mock(RecentChainData.class);

try (final FileInputStream fileInputStream = new FileInputStream(STATE_PATH)) {
Expand Down Expand Up @@ -213,7 +218,11 @@ public void getAttestationsForBlock(final Blackhole bh) {
public void add(final Blackhole bh) {
var emptyPool =
new AggregatingAttestationPoolV1(
SPEC, recentChainData, new NoOpMetricsSystem(), DEFAULT_MAXIMUM_ATTESTATION_COUNT);
SPEC,
recentChainData,
new NoOpMetricsSystem(),
AggregatingAttestationPoolProfiler.NOOP,
DEFAULT_MAXIMUM_ATTESTATION_COUNT);
attestations.forEach(emptyPool::add);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.schemas.SchemaDefinitions;
import tech.pegasys.teku.statetransition.attestation.utils.AggregatingAttestationPoolProfiler;
import tech.pegasys.teku.storage.client.RecentChainData;

/**
Expand All @@ -68,12 +69,15 @@ public class AggregatingAttestationPoolV1 extends AggregatingAttestationPool {
private final SettableGauge sizeGauge;
private final int maximumAttestationCount;

private final AggregatingAttestationPoolProfiler aggregatingAttestationPoolProfiler;

private final AtomicInteger size = new AtomicInteger(0);

public AggregatingAttestationPoolV1(
final Spec spec,
final RecentChainData recentChainData,
final MetricsSystem metricsSystem,
final AggregatingAttestationPoolProfiler aggregatingAttestationPoolProfiler,
final int maximumAttestationCount) {
super(spec, recentChainData);
this.sizeGauge =
Expand All @@ -83,6 +87,7 @@ public AggregatingAttestationPoolV1(
"attestation_pool_size",
"The number of attestations available to be included in proposed blocks");
this.maximumAttestationCount = maximumAttestationCount;
this.aggregatingAttestationPoolProfiler = aggregatingAttestationPoolProfiler;
}

@Override
Expand Down Expand Up @@ -140,6 +145,8 @@ public synchronized void onSlot(final UInt64 slot) {
}
final UInt64 firstValidAttestationSlot = slot.minus(ATTESTATION_RETENTION_SLOTS);
removeAttestationsPriorToSlot(firstValidAttestationSlot);

aggregatingAttestationPoolProfiler.execute(spec, slot, recentChainData, this);
}

private void removeAttestationsPriorToSlot(final UInt64 firstValidAttestationSlot) {
Expand Down
Loading