use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class AbstractDatabaseTest method shouldRecordAndRetrieveGenesisInformation.
@Test
public void shouldRecordAndRetrieveGenesisInformation() {
final DataStructureUtil util = new DataStructureUtil(spec);
final MinGenesisTimeBlockEvent event = new MinGenesisTimeBlockEvent(util.randomUInt64(), util.randomUInt64(), util.randomBytes32());
database.addMinGenesisTimeBlock(event);
final Optional<MinGenesisTimeBlockEvent> fetch = database.getMinGenesisTimeBlock();
assertThat(fetch.isPresent()).isTrue();
assertThat(fetch.get()).isEqualToComparingFieldByField(event);
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class WeakSubjectivityOptionsTest method weakSubjectivityCheckpoint_handleBadValue.
@Test
public void weakSubjectivityCheckpoint_handleBadValue() {
final DataStructureUtil dataStructureUtil = new DataStructureUtil();
final Checkpoint checkpoint = dataStructureUtil.randomCheckpoint();
final String checkpointParam = checkpoint.getRoot().toHexString() + ":";
final String[] args = { "--ws-checkpoint", checkpointParam };
final int result = beaconNodeCommand.parse(args);
String str = getCommandLineOutput();
assertThat(str).contains("Invalid value for option '--ws-checkpoint': " + CheckpointConverter.CHECKPOINT_ERROR);
assertThat(str).contains("To display full help:");
assertThat(str).contains("--help");
assertThat(result).isGreaterThan(0);
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class WeakSubjectivityOptionsTest method weakSubjectivityCheckpoint_shouldAcceptValue.
@Test
public void weakSubjectivityCheckpoint_shouldAcceptValue() {
final DataStructureUtil dataStructureUtil = new DataStructureUtil();
final Checkpoint checkpoint = dataStructureUtil.randomCheckpoint();
final String checkpointParam = checkpoint.getRoot().toHexString() + ":" + checkpoint.getEpoch();
final TekuConfiguration config = getTekuConfigurationFromArguments("--ws-checkpoint", checkpointParam);
assertThat(config.weakSubjectivity().getWeakSubjectivityCheckpoint()).contains(checkpoint);
assertThat(createConfigBuilder().weakSubjectivity(b -> b.weakSubjectivityCheckpoint(checkpoint)).build()).usingRecursiveComparison().isEqualTo(config);
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class SchemaObjectsTestFixture method syncCommitteeContribution.
public SyncCommitteeContribution syncCommitteeContribution(final UInt64 slot) {
final Spec altairSpec = TestSpecFactory.createMainnetAltair();
final DataStructureUtil altairData = new DataStructureUtil(altairSpec);
return new SyncCommitteeContribution(altairData.randomSyncCommitteeContribution(slot));
}
use of tech.pegasys.teku.spec.util.DataStructureUtil in project teku by ConsenSys.
the class ExternalSignerBlockRequestProviderTest method altairBlockGeneratesCorrectSignTypeAndMetadata.
@Test
void altairBlockGeneratesCorrectSignTypeAndMetadata() {
final Spec spec = TestSpecFactory.createMinimalAltair();
final BeaconBlock block = new DataStructureUtil(spec).randomBeaconBlock(10);
final ExternalSignerBlockRequestProvider externalSignerBlockRequestProvider = new ExternalSignerBlockRequestProvider(spec, block);
final SignType signType = externalSignerBlockRequestProvider.getSignType();
final Map<String, Object> blockMetadata = externalSignerBlockRequestProvider.getBlockMetadata(Map.of());
assertThat(signType).isEqualTo(SignType.BLOCK_V2);
assertThat(blockMetadata).containsKey("beacon_block");
assertThat(blockMetadata.get("beacon_block")).isExactlyInstanceOf(BlockRequestBody.class);
}
Aggregations