Search in sources :

Example 1 with SigControl

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)));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Example 2 with SigControl

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));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Example 3 with SigControl

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)));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape)

Example 4 with SigControl

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));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl) HapiPropertySource.asAccountString(com.hedera.services.bdd.spec.HapiPropertySource.asAccountString) ByteString(com.google.protobuf.ByteString) HapiPropertySource.asTopicString(com.hedera.services.bdd.spec.HapiPropertySource.asTopicString)

Example 5 with SigControl

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));
}
Also used : SigControl(com.hedera.services.bdd.spec.keys.SigControl)

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