use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.
the class SigningRootUtil method signingRootForSignAggregateAndProof.
public Bytes signingRootForSignAggregateAndProof(final AggregateAndProof aggregateAndProof, final ForkInfo forkInfo) {
final UInt64 slot = aggregateAndProof.getAggregate().getData().getSlot();
final SpecVersion specVersion = spec.atSlot(slot);
final Bytes32 domain = spec.getDomain(Domain.AGGREGATE_AND_PROOF, spec.computeEpochAtSlot(slot), forkInfo.getFork(), forkInfo.getGenesisValidatorsRoot());
return specVersion.miscHelpers().computeSigningRoot(aggregateAndProof, domain);
}
use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.
the class WeakSubjectivityCalculator method computeWeakSubjectivityPeriod.
/**
* @param checkpointState A trusted / effectively finalized checkpoint state
* @return The weak subjectivity period in epochs
*/
public UInt64 computeWeakSubjectivityPeriod(final CheckpointState checkpointState) {
final BeaconState state = checkpointState.getState();
final int activeValidators = stateCalculator.getActiveValidators(state);
final UInt64 totalActiveValidatorBalance = stateCalculator.getTotalActiveValidatorBalance(state, activeValidators);
final SpecVersion specVersion = spec.atEpoch(checkpointState.getEpoch());
return computeWeakSubjectivityPeriod(specVersion, activeValidators, totalActiveValidatorBalance);
}
use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.
the class DepositGenerator method createDepositData.
public DepositData createDepositData(final BLSKeyPair validatorKeyPair, final UInt64 amountInGwei, final BLSPublicKey withdrawalPublicKey) {
final Bytes32 withdrawalCredentials = createWithdrawalCredentials(withdrawalPublicKey);
final DepositMessage depositMessage = new DepositMessage(validatorKeyPair.getPublicKey(), withdrawalCredentials, amountInGwei);
final SpecVersion specVersion = spec.getGenesisSpec();
final Bytes32 depositDomain = specVersion.miscHelpers().computeDomain(Domain.DEPOSIT);
final BLSSignature signature = signDeposit ? BLS.sign(validatorKeyPair.getSecretKey(), specVersion.miscHelpers().computeSigningRoot(depositMessage, depositDomain)) : BLSSignature.empty();
return new DepositData(depositMessage, signature);
}
Aggregations