Search in sources :

Example 1 with ForkInfo

use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo in project web3signer by ConsenSys.

the class Eth2RequestUtils method createSyncCommitteeMessageRequest.

private static Eth2SigningRequestBody createSyncCommitteeMessageRequest() {
    final ForkInfo forkInfo = forkInfo();
    final Bytes signingRoot;
    try {
        signingRoot = signingRootFromSyncCommitteeUtils(slot, utils -> utils.getSyncCommitteeMessageSigningRoot(beaconBlockRoot, altairSpec.computeEpochAtSlot(slot), forkInfo.asInternalForkInfo())).get();
    } catch (final InterruptedException | ExecutionException e) {
        throw new RuntimeException(e);
    }
    final SyncCommitteeMessage syncCommitteeMessage = new SyncCommitteeMessage(beaconBlockRoot, slot);
    return new Eth2SigningRequestBody(ArtifactType.SYNC_COMMITTEE_MESSAGE, signingRoot, forkInfo, null, null, null, null, null, null, null, null, syncCommitteeMessage, null, null);
}
Also used : Bytes(org.apache.tuweni.bytes.Bytes) ForkInfo(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo) Eth2SigningRequestBody(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody) ExecutionException(java.util.concurrent.ExecutionException) SyncCommitteeMessage(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.SyncCommitteeMessage)

Example 2 with ForkInfo

use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo in project web3signer by ConsenSys.

the class Eth2RequestUtils method forkInfo.

public static ForkInfo forkInfo(long epoch) {
    final Fork fork = new Fork(Bytes4.fromHexString("0x00000001"), Bytes4.fromHexString("0x00000001"), UInt64.valueOf(epoch));
    final Bytes32 genesisValidatorsRoot = Bytes32.fromHexString(GENESIS_VALIDATORS_ROOT);
    return new ForkInfo(fork, genesisValidatorsRoot);
}
Also used : Fork(tech.pegasys.teku.api.schema.Fork) ForkInfo(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo) Bytes32(org.apache.tuweni.bytes.Bytes32)

Example 3 with ForkInfo

use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo in project web3signer by ConsenSys.

the class Eth2RequestUtils method createRandaoReveal.

private static Eth2SigningRequestBody createRandaoReveal() {
    final ForkInfo forkInfo = forkInfo();
    final RandaoReveal randaoReveal = new RandaoReveal(UInt64.valueOf(3));
    final Bytes signingRoot = signingRootUtil.signingRootForRandaoReveal(randaoReveal.getEpoch(), forkInfo.asInternalForkInfo());
    return new Eth2SigningRequestBody(ArtifactType.RANDAO_REVEAL, signingRoot, forkInfo, null, null, null, null, null, null, randaoReveal, null, null, null, null);
}
Also used : Bytes(org.apache.tuweni.bytes.Bytes) RandaoReveal(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.RandaoReveal) ForkInfo(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo) Eth2SigningRequestBody(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody)

Example 4 with ForkInfo

use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo in project web3signer by ConsenSys.

the class Eth2RequestUtils method createVoluntaryExit.

private static Eth2SigningRequestBody createVoluntaryExit() {
    final ForkInfo forkInfo = forkInfo();
    final VoluntaryExit voluntaryExit = new VoluntaryExit(UInt64.valueOf(119), UInt64.ZERO);
    final Bytes signingRoot = signingRootUtil.signingRootForSignVoluntaryExit(voluntaryExit.asInternalVoluntaryExit(), forkInfo.asInternalForkInfo());
    return new Eth2SigningRequestBody(ArtifactType.VOLUNTARY_EXIT, signingRoot, forkInfo, null, null, null, null, null, voluntaryExit, null, null, null, null, null);
}
Also used : Bytes(org.apache.tuweni.bytes.Bytes) ForkInfo(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo) VoluntaryExit(tech.pegasys.teku.api.schema.VoluntaryExit) Eth2SigningRequestBody(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody)

Example 5 with ForkInfo

use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo in project web3signer by ConsenSys.

the class Eth2RequestUtils method forkInfo.

public static ForkInfo forkInfo() {
    final Fork fork = new Fork(Bytes4.fromHexString("0x00000001"), Bytes4.fromHexString("0x00000001"), UInt64.valueOf(1));
    final Bytes32 genesisValidatorsRoot = Bytes32.fromHexString(GENESIS_VALIDATORS_ROOT);
    return new ForkInfo(fork, genesisValidatorsRoot);
}
Also used : Fork(tech.pegasys.teku.api.schema.Fork) ForkInfo(tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo) Bytes32(org.apache.tuweni.bytes.Bytes32)

Aggregations

ForkInfo (tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.ForkInfo)11 Bytes (org.apache.tuweni.bytes.Bytes)9 Eth2SigningRequestBody (tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody)9 ExecutionException (java.util.concurrent.ExecutionException)3 Bytes32 (org.apache.tuweni.bytes.Bytes32)2 AttestationData (tech.pegasys.teku.api.schema.AttestationData)2 Checkpoint (tech.pegasys.teku.api.schema.Checkpoint)2 Fork (tech.pegasys.teku.api.schema.Fork)2 AggregateAndProof (tech.pegasys.teku.api.schema.AggregateAndProof)1 Attestation (tech.pegasys.teku.api.schema.Attestation)1 BLSSignature (tech.pegasys.teku.api.schema.BLSSignature)1 BeaconBlock (tech.pegasys.teku.api.schema.BeaconBlock)1 BeaconBlockBody (tech.pegasys.teku.api.schema.BeaconBlockBody)1 Eth1Data (tech.pegasys.teku.api.schema.Eth1Data)1 VoluntaryExit (tech.pegasys.teku.api.schema.VoluntaryExit)1 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)1 SyncAggregatorSelectionData (tech.pegasys.teku.spec.datastructures.operations.versions.altair.SyncAggregatorSelectionData)1 AggregationSlot (tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.AggregationSlot)1 RandaoReveal (tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.RandaoReveal)1 SyncCommitteeMessage (tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.SyncCommitteeMessage)1