Skip to content

feat: use highload wallet for adding nominators#124

Merged
mrnkslv merged 3 commits into
release/nodectl/v0.5.0from
feature/sma-83-use-highload-wallet-to-speed-up-nominator-setup-in-toncore
May 4, 2026
Merged

feat: use highload wallet for adding nominators#124
mrnkslv merged 3 commits into
release/nodectl/v0.5.0from
feature/sma-83-use-highload-wallet-to-speed-up-nominator-setup-in-toncore

Conversation

@mrnkslv
Copy link
Copy Markdown
Contributor

@mrnkslv mrnkslv commented Apr 27, 2026

Summary

This change speeds up TONCore multi-nominator setup by routing deploy-and-fund through a masterchain Highload Wallet v3 in add-nominators-to-pool (single sendBatch for all nominator wallet deploys, then parallel stake sends from each V3R2 subwallet). The single-host bootstrap scenario is tightened by lowering the node count from 7 to 5 so the scripted run stays lighter while still covering SNP + TONCore + elections behavior.

Changes

-src/node/tests/test_load_net/scripts/add-nominators-to-pool.ts — Add Highload-based path: fund/deploy highload from the master wallet, poll until the highload contract is live and holds enough balance for the upcoming sendBatch (threshold tied to valuePerBatch plus a small fee headroom instead of the full nominal top-up minus 1 TON), then one sendBatch of all nominator deploy+fund internals; keep existing pool deposit flow and timeouts for seqno / deploy waits.

-src/node/tests/test_run_net_py/run_singlehost_nodectl.py — Update the scenario / NODE_CNT (or equivalent) from 7 to 5 for the scripted single-host layout; align docstrings/comments and any logic that assumes the old node count (e.g. pool slot mapping, test_run_net.json generation, phase loops over node1..nodeN).

-src/node/tests/test_load_net/scripts/topup.ts— Extend the post-transfer balance poll timeout (e.g. 30s → 60s) so slow RPC / indexing does not fail pool top-ups during bootstrap.

Copilot AI review requested due to automatic review settings April 27, 2026 08:48
@linear
Copy link
Copy Markdown

linear Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the TONCore multi-nominator bootstrap flow in the test-load network by using a masterchain Highload Wallet v3 to deploy+fund nominator wallets in a single batched external message, and it lightens the single-host nodectl scenario while improving top-up robustness.

Changes:

  • Add a Highload Wallet v3 “orchestrator” path to batch deploy+fund of nominator wallets, then send stake transfers in parallel.
  • Reduce the snp-toncore single-host scenario from 7 nodes to 5 nodes (2 SNP + 3 TONCore).
  • Increase the topup.ts post-transfer balance polling timeout from 30s to 60s.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/node/tests/test_load_net/scripts/add-nominators-to-pool.ts Routes nominator deploy+fund through Highload Wallet v3 sendBatch, adds polling helpers and parallel staking sends.
src/node/tests/test_run_net_py/run_singlehost_nodectl.py Updates snp-toncore scenario sizing and adjusts bun topup timeout defaults.
src/node/tests/test_load_net/scripts/topup.ts Extends balance-update polling timeout to reduce flakiness on slower RPC/indexing.
src/node/tests/test_load_net/package.json Adds @tonkite/highload-wallet-v3 dependency.
src/node/tests/test_load_net/bun.lock Locks the new @tonkite/highload-wallet-v3 dependency version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +279 to +283
to: highloadWallet.address,
value: highloadTopup,
bounce: false,
init: hlDeployed ? undefined : highloadWallet.init,
}),
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The highload top-up logic always transfers highloadTopup when the contract is underfunded, even if only a small delta is needed to reach highloadFundedMinBalance. This can unnecessarily overfund the highload wallet (leaving large unused balance) and can also fail reruns due to requiring much more master balance than needed. Consider calculating the required top-up as max(0, highloadFundedMinBalance - hlBalance) (plus a small headroom) and only sending that amount.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


def _bun_topup(self, address: str, amount: str) -> None:
timeout_raw = os.environ.get("BUN_TOPUP_TIMEOUT_SECONDS", "120")
# Must be >= scripts/topup.ts balance wait (default TOPUP_BALANCE_WAIT_MS 300s) + margin.
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment references a TOPUP_BALANCE_WAIT_MS default of 300s, but scripts/topup.ts currently hardcodes a 60s balance-wait timeout and does not define TOPUP_BALANCE_WAIT_MS. Please update the comment to match the actual behavior so the timeout guidance remains accurate.

Suggested change
# Must be >= scripts/topup.ts balance wait (default TOPUP_BALANCE_WAIT_MS 300s) + margin.
# Must be >= scripts/topup.ts balance wait (currently hardcoded to 60s) + margin.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@mrnkslv mrnkslv requested a review from Keshoid May 1, 2026 11:37
…d-wallet-to-speed-up-nominator-setup-in-toncore
@mrnkslv mrnkslv merged commit 5b2d963 into release/nodectl/v0.5.0 May 4, 2026
5 checks passed
@mrnkslv mrnkslv deleted the feature/sma-83-use-highload-wallet-to-speed-up-nominator-setup-in-toncore branch May 4, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants