Search in sources :

Example 1 with SignedContributionAndProof

use of tech.pegasys.teku.api.schema.altair.SignedContributionAndProof in project teku by ConsenSys.

the class EventSubscriptionManager method onSyncCommitteeContribution.

protected void onSyncCommitteeContribution(final tech.pegasys.teku.spec.datastructures.operations.versions.altair.SignedContributionAndProof proof, final InternalValidationResult result) {
    if (result.isAccept()) {
        final SignedContributionAndProof signedContributionAndProof = new SignedContributionAndProof(proof);
        notifySubscribersOfEvent(EventType.contribution_and_proof, signedContributionAndProof);
    }
}
Also used : SignedContributionAndProof(tech.pegasys.teku.api.schema.altair.SignedContributionAndProof)

Example 2 with SignedContributionAndProof

use of tech.pegasys.teku.api.schema.altair.SignedContributionAndProof in project teku by ConsenSys.

the class ValidatorDataProvider method asInternalContributionAndProofs.

private tech.pegasys.teku.spec.datastructures.operations.versions.altair.SignedContributionAndProof asInternalContributionAndProofs(final SignedContributionAndProof signedContributionAndProof) {
    final UInt64 slot = signedContributionAndProof.message.contribution.slot;
    final Bytes32 root = signedContributionAndProof.message.contribution.beaconBlockRoot;
    final UInt64 subcommitteeIndex = signedContributionAndProof.message.contribution.subcommitteeIndex;
    final IntIterable indices = getAggregationBits(signedContributionAndProof.message.contribution.aggregationBits, slot);
    final tech.pegasys.teku.bls.BLSSignature signature = signedContributionAndProof.message.contribution.signature.asInternalBLSSignature();
    final SyncCommitteeContribution contribution = spec.getSyncCommitteeUtilRequired(slot).createSyncCommitteeContribution(slot, root, subcommitteeIndex, indices, signature);
    final ContributionAndProof message = spec.getSyncCommitteeUtilRequired(slot).createContributionAndProof(signedContributionAndProof.message.aggregatorIndex, contribution, signedContributionAndProof.message.selectionProof.asInternalBLSSignature());
    return spec.getSyncCommitteeUtilRequired(slot).createSignedContributionAndProof(message, signedContributionAndProof.signature.asInternalBLSSignature());
}
Also used : SyncCommitteeContribution(tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeContribution) ContributionAndProof(tech.pegasys.teku.spec.datastructures.operations.versions.altair.ContributionAndProof) SignedContributionAndProof(tech.pegasys.teku.api.schema.altair.SignedContributionAndProof) UInt64(tech.pegasys.teku.infrastructure.unsigned.UInt64) Bytes32(org.apache.tuweni.bytes.Bytes32) IntIterable(it.unimi.dsi.fastutil.ints.IntIterable)

Aggregations

SignedContributionAndProof (tech.pegasys.teku.api.schema.altair.SignedContributionAndProof)2 IntIterable (it.unimi.dsi.fastutil.ints.IntIterable)1 Bytes32 (org.apache.tuweni.bytes.Bytes32)1 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)1 ContributionAndProof (tech.pegasys.teku.spec.datastructures.operations.versions.altair.ContributionAndProof)1 SyncCommitteeContribution (tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncCommitteeContribution)1