use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class FileCreateSuite method createFailsWithMissingSigs.
private HapiApiSpec createFailsWithMissingSigs() {
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("CreateFailsWithMissingSigs").given().when().then(fileCreate("test").waclShape(shape).sigControl(forKey("test", invalidSig)).hasKnownStatus(INVALID_SIGNATURE), fileCreate("test").waclShape(shape).sigControl(forKey("test", validSig)));
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class FileCreateSuite method createFailsWithPayerAccountNotFound.
private HapiApiSpec createFailsWithPayerAccountNotFound() {
KeyShape shape = listOf(SIMPLE, threshOf(2, 3), threshOf(1, 3));
SigControl validSig = shape.signedWith(sigs(ON, sigs(ON, ON, OFF), sigs(OFF, OFF, ON)));
return defaultHapiSpec("CreateFailsWithPayerAccountNotFound").given().when().then(fileCreate("test").withLegacyProtoStructure().waclShape(shape).sigControl(forKey("test", validSig)).scrambleTxnBody(FileCreateSuite::replaceTxnNodeAccount).hasPrecheckFrom(INVALID_NODE_ACCOUNT));
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class FileDeleteSuite method canDeleteWithAnyOneOfTopLevelKeyList.
private HapiApiSpec canDeleteWithAnyOneOfTopLevelKeyList() {
KeyShape shape = listOf(SIMPLE, threshOf(1, 2), listOf(2));
SigControl deleteSigs = shape.signedWith(sigs(ON, sigs(OFF, OFF), sigs(ON, OFF)));
return defaultFailingHapiSpec("CanDeleteWithAnyOneOfTopLevelKeyList").given(fileCreate("test").waclShape(shape)).when().then(fileDelete("test").sigControl(forKey("test", deleteSigs)));
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class CryptoTransferSuite method complexKeyAcctPaysForOwnTransfer.
private HapiApiSpec complexKeyAcctPaysForOwnTransfer() {
SigControl ENOUGH_UNIQUE_SIGS = KeyShape.threshSigs(2, KeyShape.threshSigs(1, OFF, OFF, OFF, OFF, OFF, OFF, ON), KeyShape.threshSigs(3, ON, ON, ON, OFF, OFF, OFF, OFF));
String NODE = HapiSpecSetup.getDefaultInstance().defaultNodeName();
return defaultHapiSpec("ComplexKeyAcctPaysForOwnTransfer").given(newKeyNamed("complexKey").shape(ENOUGH_UNIQUE_SIGS), cryptoCreate("payer").key("complexKey").balance(1_000_000_000L)).when().then(cryptoTransfer(tinyBarsFromTo("payer", NODE, 1_000_000L)).payingWith("payer").numPayerSigs(14).fee(ONE_HUNDRED_HBARS));
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class CryptoTransferSuite method twoComplexKeysRequired.
private HapiApiSpec twoComplexKeysRequired() {
SigControl PAYER_SHAPE = threshOf(2, threshOf(1, 7), threshOf(3, 7));
SigControl RECEIVER_SHAPE = KeyShape.threshSigs(3, threshOf(2, 2), threshOf(3, 5), ON);
SigControl payerSigs = KeyShape.threshSigs(2, KeyShape.threshSigs(1, ON, OFF, OFF, OFF, OFF, OFF, OFF), KeyShape.threshSigs(3, ON, ON, ON, OFF, OFF, OFF, OFF));
SigControl receiverSigs = KeyShape.threshSigs(3, KeyShape.threshSigs(2, ON, ON), KeyShape.threshSigs(3, OFF, OFF, ON, ON, ON), ON);
return defaultHapiSpec("TwoComplexKeysRequired").given(newKeyNamed("payerKey").shape(PAYER_SHAPE), newKeyNamed("receiverKey").shape(RECEIVER_SHAPE), cryptoCreate("payer").key("payerKey").balance(100_000_000_000L), cryptoCreate("receiver").receiverSigRequired(true).key("receiverKey").payingWith("payer")).when().then(cryptoTransfer(tinyBarsFromTo(GENESIS, "receiver", 1_000L)).payingWith("payer").sigControl(forKey("payer", payerSigs), forKey("receiver", receiverSigs)).hasKnownStatus(SUCCESS).fee(ONE_HUNDRED_HBARS));
}
Aggregations