Search in sources :

Example 6 with SigControl

use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.

the class CryptoUpdateSuite method updateWithEmptyKeyFails.

private HapiApiSpec updateWithEmptyKeyFails() {
    SigControl origKeySigs = KeyShape.SIMPLE;
    SigControl updKeySigs = threshOf(0, 0);
    return defaultHapiSpec("UpdateWithEmptyKey").given(newKeyNamed("origKey").shape(origKeySigs), newKeyNamed("updKey").shape(updKeySigs)).when(cryptoCreate("testAccount").key("origKey")).then(cryptoUpdate("testAccount").key("updKey").hasPrecheck(BAD_ENCODING));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl)

Example 7 with SigControl

use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.

the class GuidedTourRemoteSuite method topLevelListBehavesAsRevocationService.

/* Feature is pending; top-level KeyList should allow deletion with an active
	   signature for any ONE of its child keys active. (I.e. a top-level KeyList
	   behaves as a revocation service.)

	   NOTE: KeyLists lower in the key hierarchy still require all child keys
	   to have active signatures.
	 */
private HapiApiSpec topLevelListBehavesAsRevocationService() {
    KeyShape waclShape = listOf(SIMPLE, threshOf(2, 3));
    SigControl deleteSigControl = waclShape.signedWith(sigs(OFF, sigs(ON, ON, OFF)));
    return customFailingHapiSpec("TopLevelListBehavesAsRevocationService").withProperties(Map.of("host", "34.74.191.8")).given(fileCreate("target").waclShape(waclShape)).when().then(fileDelete("target").sigControl(ControlForKey.forKey("target", deleteSigControl)));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Example 8 with SigControl

use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.

the class Issue2150Spec method multiKeyNonPayerEntityVerifiedAsync.

private HapiApiSpec multiKeyNonPayerEntityVerifiedAsync() {
    KeyShape LARGE_THRESH_SHAPE = KeyShape.threshOf(1, 10);
    SigControl firstOnly = LARGE_THRESH_SHAPE.signedWith(sigs(ON, OFF, OFF, OFF, OFF, OFF, OFF, OFF, OFF, OFF));
    return defaultHapiSpec("MultiKeyNonPayerEntityVerifiedAsync").given(newKeyNamed("payerKey").shape(LARGE_THRESH_SHAPE), newKeyNamed("receiverKey").shape(LARGE_THRESH_SHAPE), cryptoCreate("payer").keyShape(LARGE_THRESH_SHAPE), cryptoCreate("receiver").keyShape(LARGE_THRESH_SHAPE).receiverSigRequired(true)).when().then(cryptoTransfer(tinyBarsFromTo("payer", "receiver", 1L)).sigControl(forKey("payer", firstOnly), forKey("receiver", firstOnly)));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Example 9 with SigControl

use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.

the class ContractCreateSuite method createFailsIfMissingSigs.

private HapiApiSpec createFailsIfMissingSigs() {
    KeyShape shape = listOf(SIMPLE, threshOf(2, 3), threshOf(1, 3));
    SigControl validSig = shape.signedWith(sigs(ON, sigs(ON, ON, OFF), sigs(OFF, OFF, ON)));
    SigControl invalidSig = shape.signedWith(sigs(OFF, sigs(ON, ON, OFF), sigs(OFF, OFF, ON)));
    return defaultHapiSpec("CreateFailsIfMissingSigs").given(fileCreate("contractFile").path(ContractResources.VALID_BYTECODE_PATH)).when().then(contractCreate("testContract").adminKeyShape(shape).bytecode("contractFile").sigControl(forKey("testContract", invalidSig)).hasKnownStatus(INVALID_SIGNATURE), contractCreate("testContract").adminKeyShape(shape).bytecode("contractFile").sigControl(forKey("testContract", validSig)));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Example 10 with SigControl

use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.

the class ScheduleCreateSpecs method preservesRevocationServiceSemanticsForFileDelete.

private HapiApiSpec preservesRevocationServiceSemanticsForFileDelete() {
    KeyShape waclShape = listOf(SIMPLE, threshOf(2, 3));
    SigControl adequateSigs = waclShape.signedWith(sigs(OFF, sigs(ON, ON, OFF)));
    SigControl inadequateSigs = waclShape.signedWith(sigs(OFF, sigs(ON, OFF, OFF)));
    SigControl compensatorySigs = waclShape.signedWith(sigs(OFF, sigs(OFF, OFF, ON)));
    String shouldBeInstaDeleted = "tbd";
    String shouldBeDeletedEventually = "tbdl";
    return defaultHapiSpec("PreservesRevocationServiceSemanticsForFileDelete").given(overriding("scheduling.whitelist", "FileDelete"), fileCreate(shouldBeInstaDeleted).waclShape(waclShape), fileCreate(shouldBeDeletedEventually).waclShape(waclShape)).when(scheduleCreate("validRevocation", fileDelete(shouldBeInstaDeleted)).alsoSigningWith(shouldBeInstaDeleted).sigControl(forKey(shouldBeInstaDeleted, adequateSigs)), sleepFor(1_000L), getFileInfo(shouldBeInstaDeleted).hasDeleted(true)).then(scheduleCreate("notYetValidRevocation", fileDelete(shouldBeDeletedEventually)).alsoSigningWith(shouldBeDeletedEventually).sigControl(forKey(shouldBeDeletedEventually, inadequateSigs)), getFileInfo(shouldBeDeletedEventually).hasDeleted(false), scheduleSign("notYetValidRevocation").alsoSigningWith(shouldBeDeletedEventually).sigControl(forKey(shouldBeDeletedEventually, compensatorySigs)), sleepFor(1_000L), getFileInfo(shouldBeDeletedEventually).hasDeleted(true), overriding("scheduling.whitelist", defaultWhitelist));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Aggregations

SigControl (com.hedera.services.bdd.spec.keys.SigControl)19 KeyShape (com.hedera.services.bdd.spec.keys.KeyShape)11 ByteString (com.google.protobuf.ByteString)2 KeyLabel (com.hedera.services.bdd.spec.keys.KeyLabel)2 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 HapiApiSpec.defaultHapiSpec (com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec)1 HapiPropertySource (com.hedera.services.bdd.spec.HapiPropertySource)1 HapiPropertySource.asAccountString (com.hedera.services.bdd.spec.HapiPropertySource.asAccountString)1 HapiPropertySource.asTopicString (com.hedera.services.bdd.spec.HapiPropertySource.asTopicString)1 HapiSpecOperation (com.hedera.services.bdd.spec.HapiSpecOperation)1 AccountInfoAsserts.changeFromSnapshot (com.hedera.services.bdd.spec.assertions.AccountInfoAsserts.changeFromSnapshot)1 ContractFnResultAsserts.isLiteralResult (com.hedera.services.bdd.spec.assertions.ContractFnResultAsserts.isLiteralResult)1 ContractFnResultAsserts.resultWith (com.hedera.services.bdd.spec.assertions.ContractFnResultAsserts.resultWith)1 ContractResources (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources)1 ControlForKey (com.hedera.services.bdd.spec.keys.ControlForKey)1 KeyGenerator (com.hedera.services.bdd.spec.keys.KeyGenerator)1 SIMPLE (com.hedera.services.bdd.spec.keys.KeyShape.SIMPLE)1 KeyShape.listOf (com.hedera.services.bdd.spec.keys.KeyShape.listOf)1 KeyShape.sigs (com.hedera.services.bdd.spec.keys.KeyShape.sigs)1 KeyShape.threshOf (com.hedera.services.bdd.spec.keys.KeyShape.threshOf)1