chore(nodectl): prep v0.4.0 release#93
Conversation
…-api-docs-for-v040-endpoint-changes-and-bump
There was a problem hiding this comment.
Pull request overview
Prepares the nodectl v0.4.0 release by bumping crate/chart versions and aligning docs with the updated REST API surface (unified elections settings, TON HTTP API endpoints, stake policies, and voting commands).
Changes:
- Bump
node-controlcrate versions and lockfile entries to0.4.0. - Update Helm chart (
appVersion+ default image tag) forv0.4.0. - Refresh documentation (README + setup/security/staking-strategies) to match the v0.4.0 REST API/CLI behavior.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/node/tests/test_load_net/scripts/create-proposal.ts | Updates proposal script to fetch transactions/config via HTTP endpoints and decode tx BOCs for inspection. |
| src/node-control/ton-http-api-client/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/service/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/nodectl/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/elections/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/control-client/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/contracts/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/common/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/commands/Cargo.toml | Bump crate version to 0.4.0. |
| src/node-control/docs/staking-strategies.md | Expanded/rewritten stake policy documentation (Minimum/Fixed/Split50/AdaptiveSplit50) and configuration details. |
| src/node-control/docs/nodectl-setup.md | Reordered setup flow around service-first + JWT auth; updated image tag and REST-driven config steps. |
| src/node-control/docs/nodectl-security.md | Updated operator capabilities list to reflect new unified endpoints and config entity CRUD. |
| src/node-control/README.md | Updated CLI semantics (REST-client config commands), TON HTTP API flags, stake policies, voting commands, and REST endpoint matrix/examples. |
| src/node-control/CHANGELOG.md | Added v0.4.0 release notes (features, changes, breaking changes). |
| src/Cargo.lock | Lockfile updates for crate version bumps to 0.4.0. |
| helm/nodectl/values.yaml | Default container image tag set to v0.4.0. |
| helm/nodectl/Chart.yaml | Chart version bump + appVersion set to v0.4.0. |
| helm/nodectl/CHANGELOG.md | Added chart release notes for 0.2.1 pointing to nodectl v0.4.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| lt, hash, | ||
| }); | ||
| for (const tx of transactions) { | ||
| const transactions = await getTransactions(configAddress, 10, parseInt(lt), hash); |
There was a problem hiding this comment.
lt from getContractState().lastTransaction is a 64-bit logical time and can exceed JS Number.MAX_SAFE_INTEGER. Converting it with parseInt(lt) (and typing lt as number in getTransactions) can lose precision and make pagination fetch the wrong transaction set. Keep lt as a string or bigint end-to-end and pass that through to the RPC call.
| const transactions = await getTransactions(configAddress, 10, parseInt(lt), hash); | |
| const transactions = await getTransactions(configAddress, 10, lt, hash); |
| async function getTransactions(address: Address, limit: number, lt: number, hash: string) { | ||
| const result = await fetch(`http://127.0.0.1:3301/jsonRPC`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| jsonrpc: '2.0', | ||
| method: 'getTransactions', | ||
| params: { | ||
| address: address.toString(), | ||
| limit, | ||
| lt, | ||
| hash, | ||
| }, | ||
| }), | ||
| }); | ||
| const data = await result.json(); | ||
| if (!data.ok) { | ||
| throw new Error(`Failed to get config: ${data.error}`); | ||
| throw new Error(`Failed to get transactions: ${data.error}`); | ||
| } | ||
| return Cell.fromBase64(data.result.config.bytes as string); | ||
| return data.result; |
There was a problem hiding this comment.
getTransactions posts JSON-RPC but the request omits the required id, and the response handling assumes an { ok, result } envelope (if (!data.ok) ...). Standard TON /jsonRPC returns { jsonrpc, id, result } or { jsonrpc, id, error }, so this will throw even on success. Update the request to include an id and handle data.error / data.result per JSON-RPC 2.0 (or switch back to client.getTransactions if you just need parsed transactions).
| async function getTransactions(address: Address, limit: number, lt: number, hash: string) { | ||
| const result = await fetch(`http://127.0.0.1:3301/jsonRPC`, { | ||
| method: 'POST', | ||
| headers: { |
There was a problem hiding this comment.
getTransactions is hard-coded to http://127.0.0.1:3301/jsonRPC, but getConfig supports overriding the endpoint via --custom. This makes --custom only partially effective and can lead to confusing behavior when pointing at a non-local RPC. Consider reusing the same normalized base URL logic from getConfig (or passing the endpoint in as an argument) so both calls hit the same server.
| method: 'GET', | ||
| try { | ||
| const idx = process.argv.findIndex(arg => arg == '--custom'); | ||
| const url = idx !== -1 ? process.argv[idx + 1] : 'http://127.0.0.1:3301'; |
There was a problem hiding this comment.
--custom parsing assumes a value exists at process.argv[idx + 1]. If the flag is provided without a URL (or is the last arg), url becomes undefined and .endsWith(...) will throw. Add an explicit check and a clear error message when --custom is present but no URL follows it.
| const url = idx !== -1 ? process.argv[idx + 1] : 'http://127.0.0.1:3301'; | |
| let url = 'http://127.0.0.1:3301'; | |
| if (idx !== -1) { | |
| const customUrl = process.argv[idx + 1]; | |
| if (!customUrl || customUrl.startsWith('--')) { | |
| throw new Error('--custom requires a URL argument'); | |
| } | |
| url = customUrl; | |
| } |
Release prep for nodectl v0.4.0: bumps all node-control crates and the helm chart to 0.4.0, adds the CHANGELOG entry, and brings the README, security guide, setup guide, and staking-strategies doc in line with the v0.4.0 REST API, CLI, and stake-policy changes. Linear: SMA-73