feat: use highload wallet for adding nominators#124
Conversation
There was a problem hiding this comment.
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-toncoresingle-host scenario from 7 nodes to 5 nodes (2 SNP + 3 TONCore). - Increase the
topup.tspost-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.
| to: highloadWallet.address, | ||
| value: highloadTopup, | ||
| bounce: false, | ||
| init: hlDeployed ? undefined : highloadWallet.init, | ||
| }), |
There was a problem hiding this comment.
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.
|
|
||
| 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. |
There was a problem hiding this comment.
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.
| # 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. |
…d-wallet-to-speed-up-nominator-setup-in-toncore
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.