use of com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup 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());
}
}
}
}
use of com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup in project hedera-services by hashgraph.
the class SigOpsRegressionTest method invokeRationalizationScenario.
private Rationalization invokeRationalizationScenario() {
// setup:
SyncVerifier syncVerifier = new CryptoEngine()::verifySync;
final var hfsSigMetaLookup = new HfsSigMetaLookup(hfs, fileNumbers);
SigMetadataLookup sigMetaLookups = defaultLookupsFor(aliasManager, hfsSigMetaLookup, () -> accounts, () -> null, ref -> null, ref -> null);
SigRequirements keyOrder = new SigRequirements(sigMetaLookups, mockSignatureWaivers);
// given:
final var rationalization = new Rationalization(syncVerifier, keyOrder, new ReusableBodySigningFactory());
rationalization.performFor(platformTxn);
return rationalization;
}
use of com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup 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);
}
use of com.hedera.services.sigs.metadata.lookups.HfsSigMetaLookup in project hedera-services by hashgraph.
the class SigOpsRegressionTest method invokeOtherPartySigActivationScenario.
private boolean invokeOtherPartySigActivationScenario(List<TransactionSignature> knownSigs) {
platformTxn.getPlatformTxn().clear();
platformTxn.getPlatformTxn().addAll(knownSigs.toArray(new TransactionSignature[0]));
final var hfsSigMetaLookup = new HfsSigMetaLookup(hfs, fileNumbers);
SigRequirements keysOrder = new SigRequirements(defaultLookupsFor(aliasManager, hfsSigMetaLookup, () -> accounts, null, ref -> null, ref -> null), mockSignatureWaivers);
return otherPartySigsAreActive(platformTxn, keysOrder, CODE_ORDER_RESULT_FACTORY);
}
Aggregations