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

store nonce locally in client for faster call submission #231

Open
haerdib opened this issue Mar 31, 2021 · 4 comments
Open

store nonce locally in client for faster call submission #231

haerdib opened this issue Mar 31, 2021 · 4 comments
Labels
F8-enhancement New feature or request F9-question Further information is requested

Comments

@haerdib
Copy link
Contributor

haerdib commented Mar 31, 2021

To skip the potentially slow process of a trusted getter submission to get the nonce, the client could store known account nonces locally within a Hashmap<AccountId, Index>.

The process should be relatively simple:
First the local hashmap is checked if account entry exists.
-If yes: use local nonce,
-If no: create trusted getter and get nonce. Store nonce within hashmap.

The challenge is now: How does the client know if the locally stored nonce of the account is not valid anymore? (due to call submission from different client for example).

I see the following option: If an error is returned after a call submission, the local hashmap entry is removed. The call could be automatically resubmitted after getting the updated nonce via trusted getter.
This way, the client does not need to manually resubmit the same call due to an invalid local nonce. However, currently the error cause is not known to the client, hence every call failure would link to a second submission.

Is this a valid approach, or what are your thoughts @brenzi ?

@haerdib haerdib added F9-question Further information is requested F8-enhancement New feature or request labels Mar 31, 2021
@brenzi
Copy link
Collaborator

brenzi commented Apr 6, 2021

this is similar to
encointer/encointer-node#11

@brenzi

This comment was marked as outdated.

@haerdib

This comment was marked as outdated.

@haerdib
Copy link
Contributor Author

haerdib commented Nov 29, 2022

Linking issue: scs/substrate-api-client#318

@haerdib haerdib changed the title store nonce locally in client for faster call submission Update local nonce cache in case of failed extrinsic Nov 29, 2022
@haerdib haerdib changed the title Update local nonce cache in case of failed extrinsic store nonce locally in client for faster call submission Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F8-enhancement New feature or request F9-question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants