Search in sources :

Example 1 with SpecVersion

use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.

the class SigningRootUtil method signingRootForSignAttestationData.

public Bytes signingRootForSignAttestationData(final AttestationData attestationData, final ForkInfo forkInfo) {
    final SpecVersion specVersion = spec.atSlot(attestationData.getSlot());
    final Bytes32 domain = spec.getDomain(Domain.BEACON_ATTESTER, attestationData.getTarget().getEpoch(), forkInfo.getFork(), forkInfo.getGenesisValidatorsRoot());
    return specVersion.miscHelpers().computeSigningRoot(attestationData, domain);
}
Also used : SpecVersion(tech.pegasys.teku.spec.SpecVersion) Bytes32(org.apache.tuweni.bytes.Bytes32)

Example 2 with SpecVersion

use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.

the class SigningRootUtil method signingRootForSignAggregationSlot.

public Bytes signingRootForSignAggregationSlot(final UInt64 slot, final ForkInfo forkInfo) {
    final SpecVersion specVersion = spec.atSlot(slot);
    final Bytes32 domain = spec.getDomain(Domain.SELECTION_PROOF, spec.computeEpochAtSlot(slot), forkInfo.getFork(), forkInfo.getGenesisValidatorsRoot());
    return specVersion.miscHelpers().computeSigningRoot(slot, domain);
}
Also used : SpecVersion(tech.pegasys.teku.spec.SpecVersion) Bytes32(org.apache.tuweni.bytes.Bytes32)

Example 3 with SpecVersion

use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.

the class SigningRootUtil method signingRootForRandaoReveal.

public Bytes signingRootForRandaoReveal(final UInt64 epoch, final ForkInfo forkInfo) {
    final SpecVersion specVersion = spec.atEpoch(epoch);
    Bytes32 domain = spec.getDomain(Domain.RANDAO, epoch, forkInfo.getFork(), forkInfo.getGenesisValidatorsRoot());
    return specVersion.miscHelpers().computeSigningRoot(epoch, domain);
}
Also used : SpecVersion(tech.pegasys.teku.spec.SpecVersion) Bytes32(org.apache.tuweni.bytes.Bytes32)

Example 4 with SpecVersion

use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.

the class SigningRootUtil method signingRootForSignVoluntaryExit.

public Bytes signingRootForSignVoluntaryExit(final VoluntaryExit voluntaryExit, final ForkInfo forkInfo) {
    final SpecVersion specVersion = spec.atEpoch(voluntaryExit.getEpoch());
    final Bytes32 domain = spec.getDomain(Domain.VOLUNTARY_EXIT, voluntaryExit.getEpoch(), forkInfo.getFork(), forkInfo.getGenesisValidatorsRoot());
    return specVersion.miscHelpers().computeSigningRoot(voluntaryExit, domain);
}
Also used : SpecVersion(tech.pegasys.teku.spec.SpecVersion) Bytes32(org.apache.tuweni.bytes.Bytes32)

Example 5 with SpecVersion

use of tech.pegasys.teku.spec.SpecVersion in project teku by ConsenSys.

the class BeaconStateTestBuilder method build.

public BeaconState build() {
    final SpecVersion specVersion = dataStructureUtil.getSpec().atSlot(slot);
    return specVersion.getSchemaDefinitions().getBeaconStateSchema().createEmpty().updated(state -> {
        state.setSlot(slot);
        state.setFork(fork);
        state.getValidators().appendAll(validators);
        state.getBalances().appendAllElements(balances);
    });
}
Also used : SpecVersion(tech.pegasys.teku.spec.SpecVersion)

Aggregations

SpecVersion (tech.pegasys.teku.spec.SpecVersion)23 Bytes32 (org.apache.tuweni.bytes.Bytes32)12 BeaconState (tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState)7 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)6 Bytes4 (tech.pegasys.teku.infrastructure.bytes.Bytes4)4 LogManager (org.apache.logging.log4j.LogManager)3 Logger (org.apache.logging.log4j.Logger)3 ValidatorStatusFactory (tech.pegasys.teku.spec.logic.common.statetransition.epoch.status.ValidatorStatusFactory)3 Optional (java.util.Optional)2 Bytes (org.apache.tuweni.bytes.Bytes)2 BLSSignature (tech.pegasys.teku.bls.BLSSignature)2 SafeFuture (tech.pegasys.teku.infrastructure.async.SafeFuture)2 Spec (tech.pegasys.teku.spec.Spec)2 EnrForkId (tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.EnrForkId)2 ValidatorStatuses (tech.pegasys.teku.spec.logic.common.statetransition.epoch.status.ValidatorStatuses)2 RecentChainData (tech.pegasys.teku.storage.client.RecentChainData)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 IntList (it.unimi.dsi.fastutil.ints.IntList)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1