use of com.hedera.services.bdd.spec.keys.KeyShape 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.KeyShape 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.KeyShape 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));
}
use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class CreateTopicPerfSuite method createTopicPerf.
private HapiApiSpec createTopicPerf() {
final int NUM_TOPICS = 100000;
KeyShape submitKeyShape = threshOf(2, SIMPLE, SIMPLE, listOf(2));
return defaultHapiSpec("createTopicPerf").given().when(startThroughputObs("createTopicThroughput").msToSaturateQueues(50L), inParallel(// only ask for record for the last transaction
asOpArray(NUM_TOPICS, i -> (i == (NUM_TOPICS - 1)) ? createTopic("testTopic" + i).submitKeyShape(submitKeyShape) : createTopic("testTopic" + i).submitKeyShape(submitKeyShape).deferStatusResolution()))).then(// wait until the record of the last transaction are ready
finishThroughputObs("createTopicThroughput").gatedByQuery(() -> getTopicInfo("testTopic" + (NUM_TOPICS - 1))).sleepMs(1_000L).expiryMs(300_000L));
}
use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class ContractUpdateSuite method fridayThe13thSpec.
HapiApiSpec fridayThe13thSpec() {
long newExpiry = Instant.now().getEpochSecond() + DEFAULT_PROPS.defaultExpirationSecs() * 2;
long betterExpiry = Instant.now().getEpochSecond() + DEFAULT_PROPS.defaultExpirationSecs() * 3;
final String INITIAL_MEMO = "This is a memo string with only Ascii characters";
final String NEW_MEMO = "Turning and turning in the widening gyre, the falcon cannot hear the falconer...";
final String BETTER_MEMO = "This was Mr. Bleaney's room...";
KeyShape initialKeyShape = KeyShape.SIMPLE;
KeyShape newKeyShape = listOf(3);
return defaultHapiSpec("FridayThe13thSpec").given(newKeyNamed("initialAdminKey").shape(initialKeyShape), newKeyNamed("newAdminKey").shape(newKeyShape), cryptoCreate("payer").balance(10 * ONE_HUNDRED_HBARS), fileCreate("bytecode").path(ContractResources.SIMPLE_STORAGE_BYTECODE_PATH).payingWith("payer")).when(contractCreate("immutableContract").payingWith("payer").omitAdminKey().bytecode("bytecode"), contractCreate("contract").payingWith("payer").adminKey("initialAdminKey").entityMemo(INITIAL_MEMO).bytecode("bytecode"), getContractInfo("contract").payingWith("payer").logged().has(contractWith().memo(INITIAL_MEMO).adminKey("initialAdminKey"))).then(contractUpdate("contract").payingWith("payer").newKey("newAdminKey").signedBy("payer", "initialAdminKey").hasKnownStatus(INVALID_SIGNATURE), contractUpdate("contract").payingWith("payer").newKey("newAdminKey").signedBy("payer", "newAdminKey").hasKnownStatus(INVALID_SIGNATURE), contractUpdate("contract").payingWith("payer").newKey("newAdminKey"), contractUpdate("contract").payingWith("payer").newExpirySecs(newExpiry).newMemo(NEW_MEMO), getContractInfo("contract").payingWith("payer").logged().has(contractWith().solidityAddress("contract").memo(NEW_MEMO).expiry(newExpiry)), contractUpdate("contract").payingWith("payer").newMemo(BETTER_MEMO), getContractInfo("contract").payingWith("payer").logged().has(contractWith().memo(BETTER_MEMO).expiry(newExpiry)), contractUpdate("contract").payingWith("payer").newExpirySecs(betterExpiry), getContractInfo("contract").payingWith("payer").logged().has(contractWith().memo(BETTER_MEMO).expiry(betterExpiry)), contractUpdate("contract").payingWith("payer").signedBy("payer").newExpirySecs(newExpiry).hasKnownStatus(EXPIRATION_REDUCTION_NOT_ALLOWED), contractUpdate("contract").payingWith("payer").signedBy("payer").newMemo(NEW_MEMO).hasKnownStatus(INVALID_SIGNATURE), contractUpdate("contract").payingWith("payer").signedBy("payer", "initialAdminKey").hasKnownStatus(INVALID_SIGNATURE), contractUpdate("immutableContract").payingWith("payer").newMemo(BETTER_MEMO).hasKnownStatus(MODIFYING_IMMUTABLE_CONTRACT), contractDelete("immutableContract").payingWith("payer").hasKnownStatus(MODIFYING_IMMUTABLE_CONTRACT), contractUpdate("immutableContract").payingWith("payer").newExpirySecs(betterExpiry), contractDelete("contract").payingWith("payer").signedBy("payer", "initialAdminKey").hasKnownStatus(INVALID_SIGNATURE), contractDelete("contract").payingWith("payer").signedBy("payer").hasKnownStatus(INVALID_SIGNATURE), contractDelete("contract").payingWith("payer").hasKnownStatus(SUCCESS));
}
Aggregations