use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class SyncCommitteeSchedulerTest method shouldNotRecalculateDutiesOnHeadUpdateWithSlotNonPriorToAltairActivation.
@Test
void shouldNotRecalculateDutiesOnHeadUpdateWithSlotNonPriorToAltairActivation() {
scheduler.onSlot(UInt64.ONE);
verify(dutyLoader).loadDutiesForEpoch(getRequestEpochForCommitteePeriod(0));
DataStructureUtil dataStructureUtil = new DataStructureUtil(spec);
scheduler.onHeadUpdate(UInt64.ZERO, dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes32());
verifyNoMoreInteractions(dutyLoader);
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class SyncCommitteeSchedulerTest method shouldRecalculateDutiesOnHeadUpdateWithSlotPriorToAltairActivation.
@Test
void shouldRecalculateDutiesOnHeadUpdateWithSlotPriorToAltairActivation() {
// simulates altair activation at slot 1
Spec mockedSpec = spy(spec);
SyncCommitteeScheduler schedulerWithMockedSpec = new SyncCommitteeScheduler(new StubMetricsSystem(), mockedSpec, dutyLoader, earlySubscribeRandomSource);
when(mockedSpec.getSyncCommitteeUtil(UInt64.ZERO)).thenReturn(Optional.empty());
schedulerWithMockedSpec.onSlot(UInt64.ONE);
verify(dutyLoader).loadDutiesForEpoch(getRequestEpochForCommitteePeriod(0));
DataStructureUtil dataStructureUtil = new DataStructureUtil(mockedSpec);
schedulerWithMockedSpec.onHeadUpdate(UInt64.ZERO, dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes32(), dataStructureUtil.randomBytes32());
verify(dutyLoader, times(2)).loadDutiesForEpoch(getRequestEpochForCommitteePeriod(0));
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class AbstractDatabaseTest method updateWeakSubjectivityState_setValue.
@Test
public void updateWeakSubjectivityState_setValue() {
final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec);
final Checkpoint checkpoint = dataStructureUtil.randomCheckpoint();
assertThat(database.getWeakSubjectivityState().getCheckpoint()).isEmpty();
final WeakSubjectivityUpdate update = WeakSubjectivityUpdate.setWeakSubjectivityCheckpoint(checkpoint);
database.updateWeakSubjectivityState(update);
assertThat(database.getWeakSubjectivityState().getCheckpoint()).contains(checkpoint);
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class AbstractDatabaseTest method updateWeakSubjectivityState_clearValue.
@Test
public void updateWeakSubjectivityState_clearValue() {
final DataStructureUtil dataStructureUtil = new DataStructureUtil(spec);
final Checkpoint checkpoint = dataStructureUtil.randomCheckpoint();
// Set an initial value
final WeakSubjectivityUpdate initUpdate = WeakSubjectivityUpdate.setWeakSubjectivityCheckpoint(checkpoint);
database.updateWeakSubjectivityState(initUpdate);
assertThat(database.getWeakSubjectivityState().getCheckpoint()).contains(checkpoint);
// Clear the checkpoint
final WeakSubjectivityUpdate update = WeakSubjectivityUpdate.clearWeakSubjectivityCheckpoint();
database.updateWeakSubjectivityState(update);
assertThat(database.getWeakSubjectivityState().getCheckpoint()).isEmpty();
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class SchemaObjectsTestFixture method beaconBlockAltair.
public BeaconBlock beaconBlockAltair() {
final Spec altairSpec = TestSpecFactory.createMainnetAltair();
final DataStructureUtil altairData = new DataStructureUtil(altairSpec);
final SchemaObjectProvider schemaObjectProvider = new SchemaObjectProvider(altairSpec);
return schemaObjectProvider.getBeaconBlock(altairData.randomBeaconBlock(UInt64.ONE));
}
Aggregations