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));
}
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)));
}
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)));
}
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)));
}
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));
}
Aggregations