use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class PermissionSemanticsSpec method allowsDeleteWithOneTopLevelSig.
private HapiApiSpec allowsDeleteWithOneTopLevelSig() {
KeyShape wacl = KeyShape.listOf(KeyShape.SIMPLE, KeyShape.listOf(2));
var deleteSig = wacl.signedWith(sigs(ON, sigs(OFF, OFF)));
var failedDeleteSig = wacl.signedWith(sigs(OFF, sigs(OFF, ON)));
var updateSig = wacl.signedWith(sigs(ON, sigs(ON, ON)));
var failedUpdateSig = wacl.signedWith(sigs(ON, sigs(OFF, ON)));
return defaultHapiSpec("AllowsDeleteWithOneTopLevelSig").given(newKeyNamed("wacl").shape(wacl)).when(fileCreate("tbd").key("wacl")).then(fileUpdate("tbd").contents("Some more contents!").signedBy(GENESIS, "wacl").sigControl(ControlForKey.forKey("wacl", failedUpdateSig)).hasKnownStatus(INVALID_SIGNATURE), fileUpdate("tbd").contents("Some new contents!").signedBy(GENESIS, "wacl").sigControl(ControlForKey.forKey("wacl", updateSig)), fileDelete("tbd").signedBy(GENESIS, "wacl").sigControl(ControlForKey.forKey("wacl", failedDeleteSig)).hasKnownStatus(INVALID_SIGNATURE), fileDelete("tbd").signedBy(GENESIS, "wacl").sigControl(ControlForKey.forKey("wacl", deleteSig)));
}
use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class CryptoCreateSuite method createAnAccountEmptyKeyList.
private HapiApiSpec createAnAccountEmptyKeyList() {
KeyShape shape = listOf(0);
long initialBalance = 10_000L;
return defaultHapiSpec("createAnAccountEmptyKeyList").given().when().then(cryptoCreate("noKeys").keyShape(shape).balance(initialBalance).logged().hasPrecheck(KEY_REQUIRED));
}
use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class CryptoCreateSuite method createAnAccountEmptyNestedKey.
private HapiApiSpec createAnAccountEmptyNestedKey() {
KeyShape emptyThresholdShape = threshOf(0, 0);
KeyShape emptyListShape = listOf(0);
KeyShape shape = threshOf(2, emptyThresholdShape, emptyListShape);
long initialBalance = 10_000L;
return defaultHapiSpec("createAnAccountEmptyThresholdKey").given().when().then(cryptoCreate("noKeys").keyShape(shape).balance(initialBalance).logged().hasPrecheck(KEY_REQUIRED));
}
use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class CryptoCreateSuite method createAnAccountInvalidNestedKeyList.
// One of element in nested key list is not valid
private HapiApiSpec createAnAccountInvalidNestedKeyList() {
KeyShape invalidListShape = listOf(SIMPLE, SIMPLE, listOf(0));
KeyShape shape = listOf(SIMPLE, SIMPLE, invalidListShape);
long initialBalance = 10_000L;
return defaultHapiSpec("createAnAccountInvalidNestedKeyList").given().when().then(cryptoCreate("noKeys").keyShape(shape).balance(initialBalance).logged().hasPrecheck(BAD_ENCODING));
}
use of com.hedera.services.bdd.spec.keys.KeyShape in project hedera-services by hashgraph.
the class CryptoCreateSuite method createAnAccountThresholdKeyWithInvalidThreshold.
private HapiApiSpec createAnAccountThresholdKeyWithInvalidThreshold() {
KeyShape thresholdShape0 = threshOf(0, SIMPLE, SIMPLE, SIMPLE);
KeyShape thresholdShape4 = threshOf(4, SIMPLE, SIMPLE, SIMPLE);
long initialBalance = 10_000L;
return defaultHapiSpec("createAnAccountThresholdKeyWithInvalidThreshold").given().when().then(cryptoCreate("badThresholdKeyAccount1").keyShape(thresholdShape0).balance(initialBalance).logged().hasPrecheck(BAD_ENCODING), cryptoCreate("badThresholdKeyAccount2").keyShape(thresholdShape4).balance(initialBalance).logged().hasPrecheck(BAD_ENCODING));
}
Aggregations