use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.INSUFFICIENT_ACCOUNT_BALANCE in project hedera-services by hashgraph.
the class CryptoTransferLoadTestWithAutoAccounts method runCryptoTransfers.
protected HapiApiSpec runCryptoTransfers() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
Supplier<HapiSpecOperation[]> transferBurst = () -> {
String sender = "sender";
String receiver;
if (r.nextInt(10) < 5) {
receiver = "alias" + r.nextInt(AUTO_ACCOUNTS);
} else {
receiver = "receiver";
}
if (receiver.startsWith("alias")) {
return new HapiSpecOperation[] { cryptoTransfer(tinyBarsFromToWithAlias(sender, receiver, 1L)).logging().payingWith(sender).signedBy(GENESIS).suppressStats(true).fee(100_000_000L).hasKnownStatusFrom(SUCCESS, OK, INSUFFICIENT_PAYER_BALANCE, UNKNOWN, TRANSACTION_EXPIRED, INSUFFICIENT_ACCOUNT_BALANCE).hasRetryPrecheckFrom(BUSY, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
}
return new HapiSpecOperation[] { cryptoTransfer(tinyBarsFromTo(sender, receiver, 1L)).noLogging().payingWith(sender).signedBy(GENESIS).suppressStats(true).fee(100_000_000L).hasKnownStatusFrom(SUCCESS, OK, INSUFFICIENT_PAYER_BALANCE, UNKNOWN, TRANSACTION_EXPIRED, INSUFFICIENT_ACCOUNT_BALANCE).hasRetryPrecheckFrom(BUSY, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
};
return defaultHapiSpec("RunCryptoTransfersWithAutoAccounts").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when(cryptoCreate("sender").balance(ignore -> settings.getInitialBalance()).payingWith(GENESIS).withRecharging().key(GENESIS).rechargeWindow(3).logging().hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED), cryptoCreate("receiver").payingWith(GENESIS).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).key(GENESIS).logging(), withOpContext((spec, opLog) -> {
List<HapiSpecOperation> ops = new ArrayList<>();
for (int i = 0; i < AUTO_ACCOUNTS; i++) {
var alias = "alias" + i;
ops.add(newKeyNamed(alias));
ops.add(cryptoTransfer(tinyBarsFromToWithAlias(DEFAULT_PAYER, alias, ONE_HBAR)));
}
allRunFor(spec, ops);
})).then(defaultLoadTest(transferBurst, settings), getAccountBalance("sender").logged());
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.INSUFFICIENT_ACCOUNT_BALANCE in project hedera-services by hashgraph.
the class CryptoTransferLoadTest method runCryptoTransfers.
protected HapiApiSpec runCryptoTransfers() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
Supplier<HapiSpecOperation[]> transferBurst = () -> {
String sender = "sender";
String receiver = "receiver";
if (settings.getTotalAccounts() > 2) {
int s = r.nextInt(settings.getTotalAccounts());
int re = 0;
do {
re = r.nextInt(settings.getTotalAccounts());
} while (re == s);
sender = String.format("0.0.%d", TEST_ACCOUNT_STARTS_FROM + s);
receiver = String.format("0.0.%d", TEST_ACCOUNT_STARTS_FROM + re);
}
return new HapiSpecOperation[] { cryptoTransfer(tinyBarsFromTo(sender, receiver, 1L)).noLogging().payingWith(sender).signedBy(GENESIS).suppressStats(true).fee(100_000_000L).hasKnownStatusFrom(SUCCESS, OK, INSUFFICIENT_PAYER_BALANCE, UNKNOWN, TRANSACTION_EXPIRED, INSUFFICIENT_ACCOUNT_BALANCE).hasRetryPrecheckFrom(BUSY, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
};
return defaultHapiSpec("RunCryptoTransfers").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when(cryptoCreate("sender").balance(ignore -> settings.getInitialBalance()).payingWith(GENESIS).withRecharging().key(GENESIS).rechargeWindow(3).logging().hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED), cryptoCreate("receiver").payingWith(GENESIS).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).key(GENESIS).logging()).then(defaultLoadTest(transferBurst, settings), getAccountBalance("sender").logged());
}
Aggregations