Search in sources :

Example 1 with AUTORENEW_DURATION_NOT_IN_RANGE

use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.AUTORENEW_DURATION_NOT_IN_RANGE in project hedera-services by hashgraph.

the class UpdateAllProtectedFilesDuringReconnect method updateAllProtectedFilesDuringReconnect.

private HapiApiSpec updateAllProtectedFilesDuringReconnect() {
    final String fileInfoRegistry = "apiPermissionsReconnect";
    final String nonUpdatableFile = "nonUpdatableFile";
    return customHapiSpec("UpdateAllProtectedFilesDuringReconnect").withProperties(Map.of("txn.start.offset.secs", "-5")).given(saveFileToRegistry(APP_PROPERTIES, APP_FILE_REGISTRY), saveFileToRegistry(API_PERMISSIONS, API_FILE_REGISTRY), saveFileToRegistry(EXCHANGE_RATES, RATES_FILE_REGISTRY), saveFileToRegistry(FEE_SCHEDULE, FEES_FILE_REGISTRY), sleepFor(Duration.ofSeconds(25).toMillis()), getAccountBalance(GENESIS).setNode("0.0.8").unavailableNode()).when(fileUpdate(APP_PROPERTIES).payingWith(GENESIS).overridingProps(Map.of("ledger.autoRenewPeriod.minDuration", "20")).erasingProps(Set.of("minimumAutoRenewDuration")), fileUpdate(API_PERMISSIONS).payingWith(GENESIS).overridingProps(Map.of("updateFile", "2-50")), fileCreate(nonUpdatableFile).contents("Cannot update file because of the new api permissions"), fileUpdate(EXCHANGE_RATES).contents(spec -> {
        ByteString newRates = spec.ratesProvider().rateSetWith(100, 1).toByteString();
        spec.registry().saveBytes("newRates", newRates);
        return newRates;
    }).payingWith(GENESIS), makeFree(CryptoGetInfo), getAccountBalance(GENESIS).setNode("0.0.8").unavailableNode()).then(withLiveNode("0.0.8").within(5 * 60, TimeUnit.SECONDS).loggingAvailabilityEvery(30).sleepingBetweenRetriesFor(10), UtilVerbs.sleepFor(30 * 1000), withLiveNode("0.0.8").within(5 * 60, TimeUnit.SECONDS).loggingAvailabilityEvery(30).sleepingBetweenRetriesFor(10), getFileContents(API_PERMISSIONS).logged().setNode("0.0.3").payingWith(GENESIS).saveToRegistry(fileInfoRegistry), getFileContents(API_PERMISSIONS).logged().setNode("0.0.8").payingWith(GENESIS).hasContents(fileInfoRegistry), fileUpdate(nonUpdatableFile).setNode("0.0.8").fee(ONE_MILLION_HBARS).hasPrecheck(NOT_SUPPORTED), fileCreate("contractFile").setNode("0.0.8").payingWith(GENESIS).path(ContractResources.VALID_BYTECODE_PATH), contractCreate("testContract").bytecode("contractFile").autoRenewSecs(15).setNode("0.0.8").hasPrecheck(AUTORENEW_DURATION_NOT_IN_RANGE), cryptoCreate("civilian").setNode("0.0.8").fee(ONE_HUNDRED_HBARS).hasPrecheck(INSUFFICIENT_TX_FEE), cryptoCreate("civilian").setNode("0.0.8"), getAccountInfo("0.0.2").payingWith("civilian").nodePayment(0L).setNode("0.0.8").hasAnswerOnlyPrecheck(OK), restoreFileFromRegistry(APP_PROPERTIES, APP_FILE_REGISTRY), restoreFileFromRegistry(API_PERMISSIONS, API_FILE_REGISTRY), restoreFileFromRegistry(EXCHANGE_RATES, RATES_FILE_REGISTRY), restoreFileFromRegistry(FEE_SCHEDULE, FEES_FILE_REGISTRY));
}
Also used : OK(com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK) TxnVerbs.cryptoCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate) TxnVerbs.fileUpdate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileUpdate) ContractResources(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources) UtilVerbs.restoreFileFromRegistry(com.hedera.services.bdd.spec.utilops.UtilVerbs.restoreFileFromRegistry) UtilVerbs.sleepFor(com.hedera.services.bdd.spec.utilops.UtilVerbs.sleepFor) QueryVerbs.getAccountInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountInfo) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) Duration(java.time.Duration) Map(java.util.Map) UtilVerbs.withLiveNode(com.hedera.services.bdd.spec.utilops.UtilVerbs.withLiveNode) NOT_SUPPORTED(com.hederahashgraph.api.proto.java.ResponseCodeEnum.NOT_SUPPORTED) UtilVerbs.makeFree(com.hedera.services.bdd.spec.utilops.UtilVerbs.makeFree) QueryVerbs.getFileContents(com.hedera.services.bdd.spec.queries.QueryVerbs.getFileContents) CryptoGetInfo(com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoGetInfo) Set(java.util.Set) HapiApiSpec.customHapiSpec(com.hedera.services.bdd.spec.HapiApiSpec.customHapiSpec) QueryVerbs.getAccountBalance(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance) ByteString(com.google.protobuf.ByteString) TimeUnit(java.util.concurrent.TimeUnit) UtilVerbs.saveFileToRegistry(com.hedera.services.bdd.spec.utilops.UtilVerbs.saveFileToRegistry) List(java.util.List) TxnVerbs.fileCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate) Logger(org.apache.logging.log4j.Logger) UtilVerbs(com.hedera.services.bdd.spec.utilops.UtilVerbs) AUTORENEW_DURATION_NOT_IN_RANGE(com.hederahashgraph.api.proto.java.ResponseCodeEnum.AUTORENEW_DURATION_NOT_IN_RANGE) AutoRenewEntitiesForReconnect.runTransfersBeforeReconnect(com.hedera.services.bdd.suites.reconnect.AutoRenewEntitiesForReconnect.runTransfersBeforeReconnect) TxnVerbs.contractCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCreate) INSUFFICIENT_TX_FEE(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INSUFFICIENT_TX_FEE) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) LogManager(org.apache.logging.log4j.LogManager) ByteString(com.google.protobuf.ByteString) ByteString(com.google.protobuf.ByteString)

Aggregations

ByteString (com.google.protobuf.ByteString)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 HapiApiSpec.customHapiSpec (com.hedera.services.bdd.spec.HapiApiSpec.customHapiSpec)1 ContractResources (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources)1 QueryVerbs.getAccountBalance (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance)1 QueryVerbs.getAccountInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountInfo)1 QueryVerbs.getFileContents (com.hedera.services.bdd.spec.queries.QueryVerbs.getFileContents)1 TxnVerbs.contractCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCreate)1 TxnVerbs.cryptoCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate)1 TxnVerbs.fileCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate)1 TxnVerbs.fileUpdate (com.hedera.services.bdd.spec.transactions.TxnVerbs.fileUpdate)1 UtilVerbs (com.hedera.services.bdd.spec.utilops.UtilVerbs)1 UtilVerbs.makeFree (com.hedera.services.bdd.spec.utilops.UtilVerbs.makeFree)1 UtilVerbs.restoreFileFromRegistry (com.hedera.services.bdd.spec.utilops.UtilVerbs.restoreFileFromRegistry)1 UtilVerbs.saveFileToRegistry (com.hedera.services.bdd.spec.utilops.UtilVerbs.saveFileToRegistry)1 UtilVerbs.sleepFor (com.hedera.services.bdd.spec.utilops.UtilVerbs.sleepFor)1 UtilVerbs.withLiveNode (com.hedera.services.bdd.spec.utilops.UtilVerbs.withLiveNode)1 HapiApiSuite (com.hedera.services.bdd.suites.HapiApiSuite)1 AutoRenewEntitiesForReconnect.runTransfersBeforeReconnect (com.hedera.services.bdd.suites.reconnect.AutoRenewEntitiesForReconnect.runTransfersBeforeReconnect)1 CryptoGetInfo (com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoGetInfo)1