diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10a0ee285..6c431f7c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -179,7 +179,7 @@ jobs: uses: hiero-ledger/hiero-solo-action@328bc84c3b00a990a151418144fd682a4eb76ea6 # v0.17 with: installMirrorNode: true - soloVersion: v0.65.0 + soloVersion: v0.68.0 mirrorNodeVersion: v0.153.0 hieroVersion: v0.73.0 @@ -253,7 +253,7 @@ jobs: uses: hiero-ledger/hiero-solo-action@328bc84c3b00a990a151418144fd682a4eb76ea6 # v0.17 with: installMirrorNode: true - soloVersion: v0.65.0 + soloVersion: v0.68.0 dualMode: true hieroVersion: v0.73.0 mirrorNodeVersion: v0.153.0 @@ -311,7 +311,7 @@ jobs: uses: hiero-ledger/hiero-solo-action@328bc84c3b00a990a151418144fd682a4eb76ea6 # v0.17 with: installMirrorNode: true - soloVersion: v0.65.0 + soloVersion: v0.68.0 mirrorNodeVersion: v0.153.0 hieroVersion: v0.73.0 diff --git a/examples/src/main/java/com/hedera/hashgraph/sdk/examples/FeeEstimateQueryExample.java b/examples/src/main/java/com/hedera/hashgraph/sdk/examples/FeeEstimateQueryExample.java index 4d38220c6..d9862aa62 100644 --- a/examples/src/main/java/com/hedera/hashgraph/sdk/examples/FeeEstimateQueryExample.java +++ b/examples/src/main/java/com/hedera/hashgraph/sdk/examples/FeeEstimateQueryExample.java @@ -61,7 +61,9 @@ public static void main(String[] args) throws Exception { TransferTransaction tx = createTransferTransaction(client, recipientId); FeeEstimateResponse stateEstimate = estimateWithStateMode(client, tx); FeeEstimateResponse intrinsicEstimate = estimateWithIntrinsicMode(client, tx); + compareEstimates(stateEstimate, intrinsicEstimate); + demonstrateTokenCreationEstimate(client); client.close(); @@ -100,10 +102,11 @@ private static TransferTransaction createTransferTransaction(Client client, Acco private static FeeEstimateResponse estimateWithStateMode(Client client, TransferTransaction tx) throws Exception { System.out.println("\n=== Estimating Fees with STATE Mode ==="); - FeeEstimateResponse stateEstimate = new FeeEstimateQuery() + FeeEstimateQuery query = new FeeEstimateQuery() .setMode(FeeEstimateMode.STATE) - .setTransaction(tx) - .execute(client); + .setTransaction(tx); + + FeeEstimateResponse stateEstimate = executeWithRetry(query, client); printNetworkFee(stateEstimate); printNodeFee(stateEstimate); @@ -151,10 +154,11 @@ private static FeeEstimateResponse estimateWithIntrinsicMode(Client client, Tran throws Exception { System.out.println("\n=== Estimating Fees with INTRINSIC Mode ==="); - FeeEstimateResponse intrinsicEstimate = new FeeEstimateQuery() + FeeEstimateQuery query = new FeeEstimateQuery() .setMode(FeeEstimateMode.INTRINSIC) - .setTransaction(tx) - .execute(client); + .setTransaction(tx); + + FeeEstimateResponse intrinsicEstimate = executeWithRetry(query, client); System.out.println( "Network Fee Subtotal: " + intrinsicEstimate.getNetwork().getSubtotal() + " tinycents"); @@ -187,12 +191,33 @@ private static void demonstrateTokenCreationEstimate(Client client) throws Excep .freezeWith(client) .signWithOperator(client); - FeeEstimateResponse tokenEstimate = new FeeEstimateQuery() + FeeEstimateQuery query = new FeeEstimateQuery() .setMode(FeeEstimateMode.STATE) - .setTransaction(tokenTx) - .execute(client); + .setTransaction(tokenTx); + + FeeEstimateResponse tokenEstimate = executeWithRetry(query, client); System.out.println("Token Creation Estimated Fee: " + tokenEstimate.getTotal() + " tinycents"); System.out.println("Token Creation Estimated Fee: " + Hbar.fromTinybars(tokenEstimate.getTotal() / 100)); } + + private static FeeEstimateResponse executeWithRetry(FeeEstimateQuery query, Client client) throws Exception { + int maxAttempts = 5; + int waitMillis = 2000; + IllegalStateException lastException = null; + + for (int attempt = 1; attempt <= maxAttempts; attempt++) { + try { + return query.execute(client); + } catch (IllegalStateException e) { + lastException = e; + System.err.println("Attempt " + attempt + " failed: " + e.getMessage()); + if (attempt < maxAttempts) { + System.out.println("Waiting " + (waitMillis / 1000) + " seconds before retry..."); + Thread.sleep(waitMillis); + } + } + } + throw new RuntimeException("Failed to execute FeeEstimateQuery after " + maxAttempts + " attempts", lastException); + } } diff --git a/sdk/src/testIntegration/java/com/hedera/hashgraph/sdk/test/integration/ContractFunctionParametersIntegrationTest.java b/sdk/src/testIntegration/java/com/hedera/hashgraph/sdk/test/integration/ContractFunctionParametersIntegrationTest.java index 9990122c5..f51cd46c8 100644 --- a/sdk/src/testIntegration/java/com/hedera/hashgraph/sdk/test/integration/ContractFunctionParametersIntegrationTest.java +++ b/sdk/src/testIntegration/java/com/hedera/hashgraph/sdk/test/integration/ContractFunctionParametersIntegrationTest.java @@ -2835,6 +2835,8 @@ void canCallContractFunctionInt200Min() throws Exception { void canCallContractFunctionInt200Max() throws Exception { BigInteger int200Max = new BigInteger("803469022129495137770981046170581301261101496891396417650687"); + Thread.sleep(10); // Avoid DUPLICATE_TRANSACTION + var response = new ContractCallQuery() .setContractId(contractId) .setGas(30_000)