use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION in project hedera-services by hashgraph.
the class FileContractMemoPerfSuite method RunMixedFileContractMemoOps.
// perform cryptoCreate, cryptoUpdate, TokenCreate, TokenUpdate, FileCreate, FileUpdate txs with entity memo set.
protected HapiApiSpec RunMixedFileContractMemoOps() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
final AtomicInteger createdSoFar = new AtomicInteger(0);
Supplier<HapiSpecOperation[]> mixedOpsBurst = () -> new HapiSpecOperation[] { fileCreate("testFile" + createdSoFar.getAndIncrement()).payingWith(GENESIS).entityMemo(new String(TxnUtils.randomUtf8Bytes(memoLength.getAsInt()), StandardCharsets.UTF_8)).noLogging().hasPrecheckFrom(OK, BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution(), getFileInfo(TARGET_FILE + "Info").hasMemo(FILE_MEMO), fileUpdate(TARGET_FILE).payingWith(GENESIS).entityMemo(new String(TxnUtils.randomUtf8Bytes(memoLength.getAsInt()), StandardCharsets.UTF_8)).noLogging().hasPrecheckFrom(OK, BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution(), contractCreate("testContract" + createdSoFar.getAndIncrement()).payingWith(GENESIS).bytecode(TARGET_FILE).entityMemo(new String(TxnUtils.randomUtf8Bytes(memoLength.getAsInt()), StandardCharsets.UTF_8)).noLogging().hasPrecheckFrom(OK, BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution(), getContractInfo(CONTRACT + "Info").hasExpectedInfo(), contractUpdate(CONTRACT).payingWith(GENESIS).newMemo(new String(TxnUtils.randomUtf8Bytes(memoLength.getAsInt()), StandardCharsets.UTF_8)).noLogging().hasPrecheckFrom(OK, BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
return defaultHapiSpec("RunMixedFileContractMemoOps").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when(fileCreate(TARGET_FILE).payingWith(GENESIS).path(ContractResources.VALID_BYTECODE_PATH).entityMemo(FILE_MEMO).logged(), fileCreate(TARGET_FILE + "Info").payingWith(GENESIS).entityMemo(FILE_MEMO).logged(), contractCreate(CONTRACT).payingWith(GENESIS).bytecode(TARGET_FILE).entityMemo(CONTRACT_MEMO).logged(), contractCreate(CONTRACT + "Info").payingWith(GENESIS).bytecode(TARGET_FILE).entityMemo(CONTRACT_MEMO).logged()).then(defaultLoadTest(mixedOpsBurst, settings));
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION 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());
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION in project hedera-services by hashgraph.
the class HCSChunkingRealisticPerfSuite method fragmentLongMessageIntoChunks.
private static HapiApiSpec fragmentLongMessageIntoChunks() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
Supplier<HapiSpecOperation[]> submitBurst = () -> new HapiSpecOperation[] { chunkAFile(LARGE_FILE, CHUNK_SIZE, PAYER, TOPIC, totalMsgSubmitted) };
return defaultHapiSpec("fragmentLongMessageIntoChunks").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), newKeyNamed("submitKey"), logIt(ignore -> settings.toString())).when(cryptoCreate(PAYER).balance(initialBalance.getAsLong()).withRecharging().rechargeWindow(30).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED), withOpContext((spec, ignore) -> {
int factor = settings.getIntProperty("collisionAvoidanceFactor", DEFAULT_COLLISION_AVOIDANCE_FACTOR);
List<HapiSpecOperation> opsList = new ArrayList<HapiSpecOperation>();
for (int i = 0; i < settings.getThreads() * factor; i++) {
var op = createTopic(TOPIC + i).submitKeyName("submitKey").hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED);
opsList.add(op);
}
CustomSpecAssert.allRunFor(spec, inParallel(flattened(opsList)));
}), // wait all other thread ready
sleepFor(5000)).then(defaultLoadTest(submitBurst, settings));
}
use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.DUPLICATE_TRANSACTION in project hedera-services by hashgraph.
the class createTopicLoadTest method runCreateTopics.
private static HapiApiSpec runCreateTopics() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
final AtomicInteger submittedSoFar = new AtomicInteger(0);
KeyShape submitKeyShape = threshOf(2, SIMPLE, SIMPLE, listOf(2));
Supplier<HapiSpecOperation[]> submitBurst = () -> new HapiSpecOperation[] { createTopic("testTopic" + submittedSoFar.addAndGet(1)).submitKeyShape(submitKeyShape).noLogging().hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
return defaultHapiSpec("runCreateTopics").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when().then(defaultLoadTest(submitBurst, settings));
}
Aggregations