Search in sources :

Example 1 with PojoSigMapPubKeyToSigBytes

use of com.hedera.services.sigs.sourcing.PojoSigMapPubKeyToSigBytes in project hedera-services by hashgraph.

the class SigOpsRegressionTest method setupFor.

private void setupFor(TxnHandlingScenario scenario) throws Throwable {
    hfs = scenario.hfs();
    aliasManager = mock(AliasManager.class);
    runningAvgs = mock(MiscRunningAvgs.class);
    speedometers = mock(MiscSpeedometers.class);
    accounts = scenario.accounts();
    platformTxn = scenario.platformTxn();
    expectedErrorStatus = null;
    final var hfsSigMetaLookup = new HfsSigMetaLookup(hfs, fileNumbers);
    signingOrder = new SigRequirements(defaultLookupsFor(aliasManager, hfsSigMetaLookup, () -> accounts, () -> null, ref -> null, ref -> null), mockSignatureWaivers);
    final var payerKeys = signingOrder.keysForPayer(platformTxn.getTxn(), CODE_ORDER_RESULT_FACTORY);
    expectedSigs = new ArrayList<>();
    if (payerKeys.hasErrorReport()) {
        expectedErrorStatus = payerKeys.getErrorReport();
    } else {
        PlatformSigsCreationResult payerResult = PlatformSigOps.createCryptoSigsFrom(payerKeys.getOrderedKeys(), new PojoSigMapPubKeyToSigBytes(platformTxn.getSigMap()), new ReusableBodySigningFactory(platformTxn));
        expectedSigs.addAll(payerResult.getPlatformSigs());
        SigningOrderResult<ResponseCodeEnum> otherKeys = signingOrder.keysForOtherParties(platformTxn.getTxn(), CODE_ORDER_RESULT_FACTORY);
        if (otherKeys.hasErrorReport()) {
            expectedErrorStatus = otherKeys.getErrorReport();
        } else {
            PlatformSigsCreationResult otherResult = PlatformSigOps.createCryptoSigsFrom(otherKeys.getOrderedKeys(), new PojoSigMapPubKeyToSigBytes(platformTxn.getSigMap()), new ReusableBodySigningFactory(platformTxn));
            if (!otherResult.hasFailed()) {
                expectedSigs.addAll(otherResult.getPlatformSigs());
            }
        }
    }
}
Also used : AliasManager(com.hedera.services.ledger.accounts.AliasManager) SigRequirements(com.hedera.services.sigs.order.SigRequirements) PojoSigMapPubKeyToSigBytes(com.hedera.services.sigs.sourcing.PojoSigMapPubKeyToSigBytes) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) MiscSpeedometers(com.hedera.services.stats.MiscSpeedometers) HfsSigMetaLookup(com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup) MiscRunningAvgs(com.hedera.services.stats.MiscRunningAvgs) ReusableBodySigningFactory(com.hedera.services.sigs.factories.ReusableBodySigningFactory)

Example 2 with PojoSigMapPubKeyToSigBytes

use of com.hedera.services.sigs.sourcing.PojoSigMapPubKeyToSigBytes in project hedera-services by hashgraph.

the class SigOpsRegressionTest method invokeExpansionScenario.

private void invokeExpansionScenario() {
    final var hfsSigMetaLookup = new HfsSigMetaLookup(hfs, fileNumbers);
    SigMetadataLookup sigMetaLookups = defaultLookupsFor(aliasManager, hfsSigMetaLookup, () -> accounts, () -> null, ref -> null, ref -> null);
    SigRequirements keyOrder = new SigRequirements(sigMetaLookups, mockSignatureWaivers);
    final var pkToSigFn = new PojoSigMapPubKeyToSigBytes(platformTxn.getSigMap());
    expandIn(platformTxn, keyOrder, pkToSigFn);
}
Also used : SigRequirements(com.hedera.services.sigs.order.SigRequirements) PojoSigMapPubKeyToSigBytes(com.hedera.services.sigs.sourcing.PojoSigMapPubKeyToSigBytes) HfsSigMetaLookup(com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup) SigMetadataLookup(com.hedera.services.sigs.metadata.SigMetadataLookup)

Aggregations

HfsSigMetaLookup (com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup)2 SigRequirements (com.hedera.services.sigs.order.SigRequirements)2 PojoSigMapPubKeyToSigBytes (com.hedera.services.sigs.sourcing.PojoSigMapPubKeyToSigBytes)2 AliasManager (com.hedera.services.ledger.accounts.AliasManager)1 ReusableBodySigningFactory (com.hedera.services.sigs.factories.ReusableBodySigningFactory)1 SigMetadataLookup (com.hedera.services.sigs.metadata.SigMetadataLookup)1 MiscRunningAvgs (com.hedera.services.stats.MiscRunningAvgs)1 MiscSpeedometers (com.hedera.services.stats.MiscSpeedometers)1 ResponseCodeEnum (com.hederahashgraph.api.proto.java.ResponseCodeEnum)1