Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synth-bench: query nonces from RPC before sending traffic #12805

Open
3 tasks
mooori opened this issue Jan 27, 2025 · 0 comments · May be fixed by #12826
Open
3 tasks

synth-bench: query nonces from RPC before sending traffic #12805

mooori opened this issue Jan 27, 2025 · 0 comments · May be fixed by #12826
Assignees

Comments

@mooori
Copy link
Contributor

mooori commented Jan 27, 2025

Nonces stored in the --user-data-dir might get out of sync with the network for various reasons. To avoid failing workloads due to invalid nonces, they can be queried from the RPC. This approach works well when there are not too many accounts in --user-data-dir.

Possible steps for implementing this:

  • Here is some code that get's access keys for a set of accounts. Factor that out to make it reusable in multiple places. Ideally also handling the TODO to use a JoinSet.
  • Once above is done, use that code when starting up workloads like benchmark-native-transfers or benchmark-mpc-sign to query recent nonces.
    • It should be possible to enable/disable this with a CLI flap. In a scenario with a lot of accounts and knowing that their nonces on disk are fine, we want to avoid querying nonces from the RPC.

With this in place, is #12753 still relevant? I would argue yes, because #12753 is a relatively small change and will help in the scenario with a lot of accounts.

@ssavenko-near ssavenko-near self-assigned this Jan 28, 2025
ssavenko-near added a commit that referenced this issue Jan 29, 2025
[issue 12805](#12805)
The flag (default=false) triggers the update of the account nonces from the network before generating the transactions.

impl details:
  - extract the `update_account_nonces()` function
  - add a corresponding flag to benhmark_native_transfers and benchmark_mpc binaries
    + apply the `update_account_nonces()` depending on the flag value

tested:
   - run the benchmark from the clean state
   - edit the `a_user_0.test.near.json`, set "nonce" to 7000001
   - update the log level to "trace" in the justfile
   - re-run the benchmark
   - find the `[2025-01-29T13:06:56Z TRACE near_synth_bm::account] updating nonce for a user a_user_0.test.near (7000001->7000020)` in the log
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 a pull request may close this issue.

2 participants