use of com.hedera.services.legacy.core.jproto.JKey in project hedera-services by hashgraph.
the class CodeOrderResultFactoryTest method createsNewResultForValidOrder.
@Test
void createsNewResultForValidOrder() {
// given:
final List<JKey> pretendKeys = List.of(new JEd25519Key("IMAGINARY".getBytes(StandardCharsets.UTF_8)));
// when:
final var ans = subject.forValidOrder(pretendKeys);
// then:
assertSame(pretendKeys, ans.getOrderedKeys());
}
use of com.hedera.services.legacy.core.jproto.JKey in project hedera-services by hashgraph.
the class SigOpsRegressionTest method otherPartySigsAreActive.
static boolean otherPartySigsAreActive(PlatformTxnAccessor accessor, SigRequirements keyOrder, SigningOrderResultFactory<ResponseCodeEnum> summaryFactory, KeyActivationCharacteristics characteristics) {
TransactionBody txn = accessor.getTxn();
Function<byte[], TransactionSignature> sigsFn = HederaKeyActivation.pkToSigMapFrom(accessor.getPlatformTxn().getSignatures());
final var othersResult = keyOrder.keysForOtherParties(txn, summaryFactory);
for (JKey otherKey : othersResult.getOrderedKeys()) {
if (!HederaKeyActivation.isActive(otherKey, sigsFn, HederaKeyActivation.ONLY_IF_SIG_IS_VALID, characteristics)) {
return false;
}
}
return true;
}
use of com.hedera.services.legacy.core.jproto.JKey in project hedera-services by hashgraph.
the class PlatformSigOpsTest method doesntIgnoreUnrecognizedProblemForScheduledSig.
@Test
void doesntIgnoreUnrecognizedProblemForScheduledSig() throws Throwable {
final JKey scheduledKey = new JEd25519Key("01234578901234578901234578901".getBytes());
scheduledKey.setForScheduledTxn(true);
given(sigBytes.sigBytesFor(any())).willThrow(IllegalStateException.class);
final var result = createCryptoSigsFrom(List.of(scheduledKey), sigBytes, sigFactory);
assertTrue(result.hasFailed());
}
Aggregations