use of com.hedera.services.sigs.order.SigRequirements 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.order.SigRequirements 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.order.SigRequirements in project hedera-services by hashgraph.
the class SigVerifierRegressionTest method setupFor.
private void setupFor(TxnHandlingScenario scenario) throws Throwable {
accounts = scenario.accounts();
platformTxn = scenario.platformTxn();
aliasManager = mock(AliasManager.class);
keyOrder = new SigRequirements(defaultLookupsFor(aliasManager, null, () -> accounts, () -> null, ref -> null, ref -> null), mockSignatureWaivers);
final var nodeInfo = mock(NodeInfo.class);
given(nodeInfo.selfAccount()).willReturn(DEFAULT_NODE);
isQueryPayment = PrecheckUtils.queryPaymentTestFor(nodeInfo);
SyncVerifier syncVerifier = new CryptoEngine()::verifySync;
precheckKeyReqs = new PrecheckKeyReqs(keyOrder, isQueryPayment);
precheckVerifier = new PrecheckVerifier(syncVerifier, precheckKeyReqs);
}
use of com.hedera.services.sigs.order.SigRequirements 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.order.SigRequirements in project hedera-services by hashgraph.
the class SigOpsRegressionTest method invokePayerSigActivationScenario.
private boolean invokePayerSigActivationScenario(List<TransactionSignature> knownSigs) {
SigRequirements keysOrder = new SigRequirements(defaultLookupsFor(aliasManager, null, () -> accounts, () -> null, ref -> null, ref -> null), mockSignatureWaivers);
final var impliedOrdering = keysOrder.keysForPayer(platformTxn.getTxn(), CODE_ORDER_RESULT_FACTORY);
final var impliedKey = impliedOrdering.getPayerKey();
platformTxn.setSigMeta(RationalizedSigMeta.forPayerOnly(impliedKey, new ArrayList<>(knownSigs)));
return payerSigIsActive(platformTxn, ONLY_IF_SIG_IS_VALID);
}
Aggregations