Skip to content

Commit 668dd16

Browse files
committed
Fix review feedback: correct PrivateKeyCiphertext API, remove non-public estimateDeploymentFee, fix polling pattern and submitTransaction consistency
1 parent e9b5ff9 commit 668dd16

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

.agents/skills/aleo-sdk-builder/scripts/verify-execution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function verifyExecution(filePath: string): { valid: boolean; errors: string[];
3030
}
3131

3232
// Check for DPS without unnecessary initThreadPool
33-
if (content.includes("buildAuthorization") && content.includes("initThreadPool")) {
34-
warnings.push("initThreadPool() found alongside DPS (buildAuthorization). Thread pool is not needed for delegated proving.");
33+
if ((content.includes("buildAuthorization") || content.includes("provingRequest")) && content.includes("initThreadPool")) {
34+
warnings.push("initThreadPool() found alongside DPS (buildAuthorization/provingRequest). Thread pool is not needed for delegated proving.");
3535
}
3636

3737
// Check for key provider setup when doing local proving

docs/sdk-guide/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ Multi-threading is not required for all contexts:
9696

9797
### Fee Management
9898

99-
- NEVER hardcode fee amounts — always use `estimateExecutionFee()` or `estimateDeploymentFee()`
100-
or `estimateFeeForAuthorization()` to get the base fee
99+
- NEVER hardcode fee amounts — use `estimateExecutionFee()` or `estimateFeeForAuthorization()`
100+
to get the base fee. Deployment fees are estimated automatically by `buildDeploymentTransaction`.
101101
- Always include a `priorityFee` parameter (even if 0)
102102
- Handle insufficient balance errors before attempting transactions:
103103
```ts
@@ -129,8 +129,8 @@ Multi-threading is not required for all contexts:
129129
for (let i = 0; i < 60; i++) {
130130
try {
131131
const result = await client.getTransaction(txId);
132-
if (result) { confirmed = true; break; }
133-
} catch { /* not confirmed yet */ }
132+
confirmed = true; break; // if getTransaction succeeds, the tx is confirmed
133+
} catch { /* throws when not found — not confirmed yet */ }
134134
await new Promise(r => setTimeout(r, 2000));
135135
}
136136
```

docs/sdk-guide/delegated-proving.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const tx = await pm.buildTransactionFromAuthorization({
105105
feeAuthorization,
106106
});
107107

108-
const txId = await pm.networkClient.submitTransaction(tx.toString());
108+
const txId = await pm.networkClient.submitTransaction(tx);
109109
```
110110

111111
> **Note:** `buildTransactionFromAuthorization` performs **local proving** via

docs/sdk-guide/deployment.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const txId = await pm.networkClient.submitTransaction(tx);
3131

3232
```bash
3333
cargo install leo-lang
34+
# Standard devnet-only key — not used on mainnet
3435
leo devnode start --private-key APrivateKey1zkp8CZNn3yeCseEtxuVPbDCwSyhGW6yZKUYKfgXmcpoGPWH
3536
```
3637

@@ -52,7 +53,7 @@ const execTx = await pm.buildDevnodeExecutionTransaction({
5253
priorityFee: 0,
5354
privateFee: false,
5455
});
55-
await pm.networkClient.submitTransaction(execTx.toString());
56+
await pm.networkClient.submitTransaction(execTx);
5657
```
5758

5859
Note: `buildDevnodeExecutionTransaction` takes an `ExecuteOptions` object (same shape

docs/sdk-guide/keys-and-crypto.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ pm.setKeyStore(keyStore);
4343
Never store plaintext private keys. Use `PrivateKeyCiphertext`:
4444

4545
```ts
46-
import { PrivateKeyCiphertext } from "@provablehq/sdk/testnet.js";
46+
import { PrivateKey, PrivateKeyCiphertext } from "@provablehq/sdk/testnet.js";
4747

4848
// Encrypt for storage
49-
const encrypted = PrivateKeyCiphertext.encryptPrivateKey(privateKey, password);
49+
const encrypted = privateKey.toCiphertext(password);
5050
const encryptedString = encrypted.toString();
5151
// Store encryptedString safely (file, database, env var)
5252

5353
// Decrypt when needed
54-
const restored = PrivateKeyCiphertext.fromString(encryptedString)
55-
.decryptToPrivateKey(password);
54+
const restored = PrivateKey.fromPrivateKeyCiphertext(
55+
PrivateKeyCiphertext.fromString(encryptedString),
56+
password,
57+
);
5658
```
5759

5860
## Custom Cryptography (libsodium)

0 commit comments

Comments
 (0)