Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

state: nonce management #2389

Closed
Wondertan opened this issue Jun 22, 2023 · 0 comments
Closed

state: nonce management #2389

Wondertan opened this issue Jun 22, 2023 · 0 comments
Assignees
Labels
area:state Related to fetching state and state execution

Comments

@Wondertan
Copy link
Member

Wondertan commented Jun 22, 2023

Current state

Before sending a transaction, the node requests the sequence number from the state.

Problem

  • You can't send multiple transactions to be included in one block because they will have the same bounce.
  • One roundtrip latency to APP node before sending TX

Solution

Nounce/sequence management:

  • Fetch current nounce on StateModule start per each account registered the node(currently one only)
  • Maintain a local state of the nounces per account
  • Increment them every time a new tx is sent

Caveats

Doesn't support cases where multiple transactions are sent from the same account but from different wallets. (the only real solution here is a mempool connection between wallets)

Impl Details

  • Keyring.Signer, which is available on the CoreAccessor has QueryAccountNumber method that needs to be called on start only instead of per each TX to use the nounce node keeps and to avoid roundtrip problem
  • Before sending each transaction nounce has to be incremented on the node through SetSequence method

Refs

Further improvements to this workflow on the app side: celestiaorg/celestia-app#1910

@renaynay renaynay self-assigned this Jun 22, 2023
@renaynay renaynay changed the title state: nounce management state: nonce management Jun 22, 2023
@renaynay renaynay added area:state Related to fetching state and state execution and removed needs:triage labels Jun 22, 2023
@celestiaorg celestiaorg locked and limited conversation to collaborators Dec 20, 2023
@ramin ramin converted this issue into discussion #3048 Dec 20, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
area:state Related to fetching state and state execution
Projects
None yet
Development

No branches or pull requests

2 participants