use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody in project web3signer by ConsenSys.
the class Eth2AltairBlockSigningAcceptanceTest method signAndVerifyLegacyBlockSignature.
@Test
void signAndVerifyLegacyBlockSignature() throws Exception {
final Eth2BlockSigningRequestUtil util = new Eth2BlockSigningRequestUtil(SpecMilestone.PHASE0);
setupEth2SignerMinimalWithoutAltairFork();
final Eth2SigningRequestBody request = util.createLegacyBlockRequest();
final Response response = signer.eth2Sign(keyPair.getPublicKey().toString(), request, ContentType.JSON);
final Bytes signature = verifyAndGetSignatureResponse(response, ContentType.JSON);
final BLSSignature expectedSignature = BLS.sign(keyPair.getSecretKey(), request.getSigningRoot());
assertThat(signature).isEqualTo(expectedSignature.toBytesCompressed());
}
use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody 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);
}
use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody 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);
}
use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody 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);
}
use of tech.pegasys.web3signer.core.service.http.handlers.signing.eth2.Eth2SigningRequestBody in project web3signer by ConsenSys.
the class Eth2RequestUtils method createSyncCommitteeContributionAndProofRequest.
private static Eth2SigningRequestBody createSyncCommitteeContributionAndProofRequest() {
final ForkInfo forkInfo = forkInfo();
final Bytes signingRoot;
try {
signingRoot = signingRootFromSyncCommitteeUtils(slot, utils -> utils.getContributionAndProofSigningRoot(contributionAndProof, forkInfo.asInternalForkInfo())).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
return new Eth2SigningRequestBody(ArtifactType.SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF, signingRoot, forkInfo, null, null, null, null, null, null, null, null, null, null, getContributionAndProof());
}
Aggregations