fix: update transition examples for evo-sdk v4 - #65
Conversation
Replace pre-v4 privateKeyWif-in-call snippets with payload + identityKey/signer (and asset-lock PrivateKey) examples sourced from shipped Options interfaces. Stop multi-line example formatting from prefixing return on the first line and drop stale sdk_example overrides for identity create/top-up. Co-Authored-By: Claude <noreply@anthropic.com>
Apply the generator fixes for invented address/identifier helpers and regenerate the committed AI_REFERENCE examples so they match the v4 payload + signer option shapes. Co-Authored-By: Claude <noreply@anthropic.com>
Add unit coverage that loads generator transition examples, forbids privateKeyWif-in-call option keys, and checks final sdk write options against shipped wasm-sdk Options interfaces. Extend documentation check with the classic issue dashpay#63 example patterns. Co-Authored-By: Claude <noreply@anthropic.com>
sdk_params for those transitions already use the v4 names, so the assetLockPrivateKeyWif rename map is unused. Co-Authored-By: Claude <noreply@anthropic.com>
Reduce duplicated IdentitySigner and auth-key setup in generated state transition docs, consolidate example formatting helpers, and slim the issue dashpay#63 regression guards without changing example semantics.
AddressFundsWithdrawOptions requires pooling and outputScript values. Use PoolingWasm.Standard and CoreScript.fromP2PKH instead of undefined placeholders and the nonexistent CoreScript.newP2PKH helper. Co-Authored-By: Claude <noreply@anthropic.com>
Top-up and identity-to-address transfer take Identity, not identityId. Withdrawal requires coreFeePerByte, Pooling, CoreScript, and PlatformAddressSigner. Asset-lock funding requires AssetLockProof, PrivateKey, outputs, and a required PlatformAddressSigner. Co-Authored-By: Claude <noreply@anthropic.com>
Assert withdraw examples use CoreScript.fromP2PKH/PoolingWasm, and that top-up, transfer-from-identity, withdraw, and fund-from-asset-lock sdk_params match v4 required option members/types. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Parsing the full wasm-sdk d.ts once per interface kept the option-key suite near the default timeout after adding required-member checks. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Align Platform Address sdk_params with shipped v4 option types so transfer, top-up, withdraw, transfer-from-identity, fund-from-asset-lock, and create-identity document PlatformAddressInput[] / PlatformAddressOutput[] instead of plain objects, and use PoolingWasm / concrete signer types. Co-Authored-By: Claude <noreply@anthropic.com>
Restore valid top-level JS for multiline query snippets that start with return await by wrapping pure expression examples as const result = await ... while leaving multi-statement transition examples intact. Co-Authored-By: Claude <noreply@anthropic.com>
Add focused regression coverage for PlatformAddressInput[] / PlatformAddressOutput[] metadata across address transitions and for multiline AI_REFERENCE query examples becoming const result = await. Co-Authored-By: Claude <noreply@anthropic.com>
Keep the previous report file when only the timestamp changes so docs check success does not create noise commits. Restore the prior report body from before the unexpected timestamp-only refresh. Co-Authored-By: Claude <noreply@anthropic.com>
Omit signingKey on identity credit transfer/withdrawal examples so the SDK selects a matching purpose key. Key ID 3 and AUTHENTICATION fallback were invalid for v4 transfer semantics.
Assert generated transfer/withdrawal examples omit signingKey, document TRANSFER (and OWNER for withdrawal), and never fall back to AUTHENTICATION.
|
⛔ Blockers found — Sonnet deferred (commit baf93a6) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Preliminary review — Codex only
The current head still generates invalid signing-key selection logic for the DPNS and masternode voting examples. Both issues were introduced by this PR's v4 transition documentation work and can cause users following the generated examples to submit transitions with keys that fail Platform authorization.
Validated blockers were found in the Codex precheck. Sonnet is deferred until a fresh Codex revalidation clears the blocker gate.
Review provenance
- Codex reviewers:
gpt-5.6-sol— general (completed) - Verifier:
gpt-5.6-sol— verifier - Sonnet: not run (deferred by blocker gate)
🔴 2 blocking
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `scripts/generate_docs.py`:
- [BLOCKING] scripts/generate_docs.py:1151-1154: Validate the DPNS signing key before accepting key ID 1
The fixed-ID lookup bypasses the semantic checks in the fallback: if key ID 1 exists but has another purpose or security level, it is passed directly to `registerName`. DPNS registration creates document transitions whose default HIGH requirement permits CRITICAL or HIGH AUTHENTICATION keys; an arbitrary key ID is not guaranteed to satisfy those rules and will fail authorization. Select exclusively by purpose and an accepted security level, and report a clear error when no suitable key exists.
- [BLOCKING] scripts/generate_docs.py:1176-1178: Do not fall back to an arbitrary key for masternode voting
When no VOTING-purpose key is found, the generated example falls back to key ID 0 without verifying its purpose. Masternode vote transitions explicitly require a VOTING key, so a typical key ID 0 with another purpose will fail authorization instead of producing a useful local error. The same fallback is duplicated in the `masternodeVote` example at lines 1204-1206; both examples must require a VOTING-purpose key and throw clearly if none is available.
Note: GitHub does not allow PastaClaw to submit an approval or request changes on their own PR, so the canonical verifier result is transported as a COMMENT review.
| const identityKey = identity.getPublicKeyById(1) | ||
| || identity.publicKeys.find( | ||
| k => k.purpose === 'AUTHENTICATION' && k.securityLevel === 'HIGH', | ||
| ); |
There was a problem hiding this comment.
🔴 Blocking: Validate the DPNS signing key before accepting key ID 1
The fixed-ID lookup bypasses the semantic checks in the fallback: if key ID 1 exists but has another purpose or security level, it is passed directly to registerName. DPNS registration creates document transitions whose default HIGH requirement permits CRITICAL or HIGH AUTHENTICATION keys; an arbitrary key ID is not guaranteed to satisfy those rules and will fail authorization. Select exclusively by purpose and an accepted security level, and report a clear error when no suitable key exists.
| const identityKey = identity.getPublicKeyById(1) | |
| || identity.publicKeys.find( | |
| k => k.purpose === 'AUTHENTICATION' && k.securityLevel === 'HIGH', | |
| ); | |
| const identityKey = identity.publicKeys.find( | |
| k => k.purpose === 'AUTHENTICATION' | |
| && ['CRITICAL', 'HIGH'].includes(k.securityLevel), | |
| ); | |
| if (!identityKey) { | |
| throw new Error('No CRITICAL/HIGH authentication key available for DPNS registration'); | |
| } |
source: ['codex']
| const votingIdentity = await sdk.identities.fetch(masternodeProTxHash); | ||
| const votingKey = votingIdentity.publicKeys.find(k => k.purpose === 'VOTING') | ||
| || votingIdentity.getPublicKeyById(0); |
There was a problem hiding this comment.
🔴 Blocking: Do not fall back to an arbitrary key for masternode voting
When no VOTING-purpose key is found, the generated example falls back to key ID 0 without verifying its purpose. Masternode vote transitions explicitly require a VOTING key, so a typical key ID 0 with another purpose will fail authorization instead of producing a useful local error. The same fallback is duplicated in the masternodeVote example at lines 1204-1206; both examples must require a VOTING-purpose key and throw clearly if none is available.
source: ['codex']
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Summary
@dashevo/evo-sdk@4.0.0Closes #63.
Validation
python3 scripts/generate_docs.pypython3 scripts/check_documentation.pynpx vitest run— 151 tests passednode --test tests/type-extraction.test.mjs— 6 tests passedgit diff --check upstream/master..HEADshipNotes
public/docs.htmlis generated and gitignored; it was regenerated locally and covered by the documentation checker and transition-example tests.public/AI_REFERENCE.mdis tracked and regenerated in this branch.Network-writing tests used fresh standard-key identities and an identity-owned disposable token contract. Credit transfer/withdrawal, contract create/update, document CRUD, token mint/burn/transfer/freeze/unfreeze/destroy, and emergency actions passed. The three full-suite failures were fixture prerequisites: two later contract creates ran below the approximately 12 billion-credit testnet creation cost, and token claim used a fixture without perpetual distribution. Focused runs passed the affected contract/document paths when funded; no product defect was found.
The examples and regression tests were also validated against the exact installed
@dashevo/evo-sdk@4.0.0and@dashevo/wasm-sdk@4.0.0declarations and runtime behavior.Related: #64 contains the initial API-shape migration. This draft also resolves the remaining declaration and generated-example mismatches found during exact-version review, including address metadata, signer key purposes, identity-create key relationships, token fixtures, withdrawal destinations, and multiline query rendering.