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

Feat/use tx pool for set weights #2534

Merged
merged 30 commits into from
Dec 17, 2024
Merged

Conversation

camfairchild
Copy link
Collaborator

@camfairchild camfairchild commented Dec 12, 2024

This PR addresses an issue with set_weights calls where submitting transactions can error if there is already a set_weights transaction in the pool. This happens because the nonce and the call method match with a transaction already in the pool.

We usually grab the next account nonce using the chain's state, and we increment it, therefore submitting the same nonce to the pool before the existing transaction has been included.

We can fix this by using the RPC method account_nextIndex which takes into account all the transactions in the pool and gives you the next nonce that the account should use to not conflict with any pending transactions in the pool.

tests/e2e_tests/test_set_weights.py Outdated Show resolved Hide resolved
@camfairchild camfairchild merged commit 7cede0c into staging Dec 17, 2024
30 checks passed
@camfairchild camfairchild deleted the feat/use-tx-pool-for-set-weights branch December 17, 2024 20:52
camfairchild added a commit that referenced this pull request Jan 17, 2025
* Updates tests for btwallet 3.0.0

* fix get_delegates result decoding

* Feat/use tx pool for set weights (#2534)

* use the tx pool for setting/committing weights

* add supports rpc method with cache

* handle when state call is not possible (unlikely)

* increment next index by one for correct nonce

* use for set sync set weights also

* oops, define in subtensor for sync methods

* make tests less specific

* try e2e test for commit weights

* modify comments on test

* add root set test helper

* try upping submit timeout

* add set weights e2e test

* use high timeout on tests

* add awaits and log netuid

* chore: ruff

* use sudo_set_admin_utils instead

* don't increment next index for nonce

* dont await sudo_set_admin_utils

* lower test ext timeout to 12

* enable reg during test

* use set hyp values instead

* sleep after setting reg allowed

* fix test_set_weights_uses_next_nonce

* Use asyncstdlib for lru_cache of `AsyncSubstrateInterface.supports_rpc_method`

* Increases sleep for txs in test_set_weights_uses_next_nonce

---------

Co-authored-by: Benjamin Himes <[email protected]>
Co-authored-by: ibraheem-opentensor <[email protected]>
Co-authored-by: Benjamin Himes <[email protected]>

* fix tests

* add connection limit error handler

* add test

* Backmerge master to staging post 851 (#2557)

Bumps version and changelog

* improve handler

* add async commit reveal impl

* add new logic to async_subtensor

* add unit tests

* ruff

* add uid check before processing

* fix test

* Use apt-get instead of apt for scripts (#2571)

apt --> apt-get

* fix _do_stake incorrect arguments error in staking.py

add_stake sdk (after pybytes error is fixed in delegate_info.py) another error occurs, because _do_stake is incorrectly called on line 124 in staking.py returning an invalid arguments error, must add self (subtensor) param to fix this error.

* Updates subtensor branch for e2e

* tests fix

* Bumps cr3 ffi

* Bumps version and changelog

* Updates changelog

---------

Co-authored-by: Roman <[email protected]>
Co-authored-by: Cameron Fairchild <[email protected]>
Co-authored-by: Benjamin Himes <[email protected]>
Co-authored-by: Benjamin Himes <[email protected]>
Co-authored-by: Roman <[email protected]>
Co-authored-by: Assh-codes <[email protected]>
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