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

[Feature Request]: allow user to set account sequence #3164

Closed
jcstein opened this issue Feb 5, 2024 · 28 comments
Closed

[Feature Request]: allow user to set account sequence #3164

jcstein opened this issue Feb 5, 2024 · 28 comments
Assignees
Labels
enhancement New feature or request external Issues created by non node team members

Comments

@jcstein
Copy link
Member

jcstein commented Feb 5, 2024

Implementation ideas

Users (including myself) have reported that they are hitting account sequence errors in posting blobs using celestia-node. The workaround for this is to set the correct account sequence. While it is possible to set the account sequence in celestia-app's binary, it isn't possible with celestia-node.

This feature's implementation would allow the user to send a transaction using celestia-node with a custom account sequence.

@jcstein jcstein added the enhancement New feature or request label Feb 5, 2024
@github-actions github-actions bot added the external Issues created by non node team members label Feb 5, 2024
@distractedm1nd
Copy link
Collaborator

We could maybe do this for state.SubmitPayForBlob but definitely not blob module. This functionality is technically already supported via SubmitTx no?

@jcstein
Copy link
Member Author

jcstein commented Feb 8, 2024

the only param I see is the data on state.SubmitTx?
Screenshot 2024-02-08 at 9 56 21 AM

@jcstein
Copy link
Member Author

jcstein commented Feb 9, 2024

I don't think this is possible either on other methods, based on some testing I'm doing with the CLI at the moment.

celestia state delegate celestiavaloper1ukk0l6ce58zq3snad5vn24vy7pdk9r8hva6nz9 1 10000 100000 --node.store $NODE_STORE
{
  "result": "rpc error: code = Unknown desc = timed out waiting for tx to be included in a block"
}
celestia state delegate celestiavaloper1ukk0l6ce58zq3snad5vn24vy7pdk9r8hva6nz9 1000 10000 100000 --node.store $NODE_STORE
{
  "result": {
    "txhash": "497CA6B400C9040A3771D4D63A64EAD2C6DCCD481975D4719A33F49EA53A1676",
    "codespace": "sdk",
    "code": 32,
    "raw_log": "account sequence mismatch, expected 624, got 623: incorrect account sequence",
    "logs": null,
    "gas_wanted": 100000,
    "gas_used": 46383,
    "events": null
  }
}
celestia state delegate celestiavaloper1ukk0l6ce58zq3snad5vn24vy7pdk9r8hva6nz9 1000 10000 100000 --node.store $NODE_STORE --help
Sends a user's liquid tokens to a validator for delegation.

Usage:
  celestia state delegate [valAddress] [amount] [fee] [gasLimit] [flags]

Flags:
  -h, --help   help for delegate

Global Flags:
      --node.store string   The path to root/home directory of your Celestia Node Store
      --token string        Authorization token
      --url string          Request URL (default "http://localhost:26658")

@jcstein
Copy link
Member Author

jcstein commented Feb 19, 2024

How would a user submit multiple blobs in the same block with blob.Submit or state.SubmitPayForBlobs?

@mindstyle85
Copy link

this would be really good to have, since we already saw one case where his actual vs expected sequence was not the same (due to cosmos ofc, its known this can happen), but since he was using just the da node for that, he had no way to reset it (would either require a restart of the rpc he used or import to app and use the --sequence flag)

@jcstein
Copy link
Member Author

jcstein commented Feb 19, 2024

yeah, i also want to make sure the documentation that says it is possible, is actually possible. at version v0.13.0 i cannot figure out how to set account sequence through celestia-node

@bkolad
Copy link

bkolad commented Feb 20, 2024

My observation:

While submitting blobs one after another using the blob_submit(&self, blobs: &[Blob], opts: SubmitOptions) -> Result<u64, Error>, I encountered errors related to incorrect account nonce. It appears that there might be a race condition between requests. I initially assumed that the synchronization would be managed internally since the method takes &self. After wrapping the client with a Mutex, the issue disappeared, but it might be matter of timing.

@Wondertan
Copy link
Member

Wondertan commented Feb 20, 2024

The account sequence(nounce) is not managed smart enough in the node and this is the core issue here.

We could enable account sequence control for our users, but we would then outsource the complexity away, forcing every user to manage nounce on their own. Instead, we should abstract the complexity and simplify life for our users.

cc @cmwaters

@jcstein
Copy link
Member Author

jcstein commented Feb 21, 2024

so how does one do this either on celestia-node or celestia-app? that's the thing i cannot figure out

@Wondertan
Copy link
Member

Users (including myself) have reported that they are hitting account sequence errors in posting blobs using celestia-node. The workaround for this is to set the correct account sequence.

The root issue here is the lack of smarts around nounces. Once we have them, your issue disappears, and setting the account sequence won't be necessary on the node side.

so how does one do this either on celestia-node or celestia-app?

So, one wouldn't need to do it on the celestia-node side in the first place.

@jcstein
Copy link
Member Author

jcstein commented Feb 21, 2024

will it allow someone to submit multiple transactions from the same account in one block? like described in this section

@rootulp
Copy link
Contributor

rootulp commented Mar 29, 2024

Relevant: celestiaorg/celestia-app#3196 which improved nonce handling for the celestia-app signer (in the user package). AFAICT celestia-node doesn't use the celestia-app user package yet but celestia-node is considering migrating to it (see #2650).

@Wondertan
Copy link
Member

will it allow someone to submit multiple transactions from the same account in one block?

Yes in case both transactions turn to be valid. If one of them is invalid, things might be a bit more complicated.

@vgonkivs
Copy link
Member

I can assume that this issue will not appear after signer integration as it's using local sequence number.
@rootulp, @cmwaters can you please confirm this.

@rootulp
Copy link
Contributor

rootulp commented May 14, 2024

cc: @ninabarbakadze who's working on signer stuff while @cmwaters is OOO

@renaynay renaynay added v0.15.0 and removed v0.14.0 labels May 16, 2024
@cmwaters
Copy link
Contributor

Yes this should solve the issue of submitting multiple blobs in parallel (so long as the user is not using multiple instances of the signer)

@vgonkivs
Copy link
Member

vgonkivs commented May 21, 2024

Hey @jcstein, since the issue has been already fixed, should celestia-node still support account sequencing?

@distractedm1nd
Copy link
Collaborator

Hmmmm. I think it should still be an option. But it is definitely a lot lower priority now. It can be shipped together with the rest of the blob submit options, and TxOptions in state mod

@jcstein
Copy link
Member Author

jcstein commented May 23, 2024

thanks @distractedm1nd and @vgonkivs. let's go with distractedm1nd's suggestion

@jcstein
Copy link
Member Author

jcstein commented May 23, 2024

yeah, while trying to use the golang tutorial as a template, when I run main.go I hit tx already in mempool. how do I work around this? if I increase gas price, I get account sequence error

$ go run main.go
2024/05/23 19:09:23 Error submitting blob: : tx already in mempool
exit status 1

$ celestia blob submit 0x4269 0x4269 --node.store ~/.celestia-light --gas.price 0.01
{
  "result": ": incorrect account sequence"
}

@jcstein
Copy link
Member Author

jcstein commented May 28, 2024

note: this was on mainnet so the app version may not be the one with the fix included?

@cmwaters
Copy link
Contributor

@jcstein if the tx is already in mempool then what's actually the problem?

For me, I think nonce's should be an internal detail that isn't exposed to users so ideally we smooth out these bugs rather than passing that baton to users to handle

@liamsi
Copy link
Member

liamsi commented Jun 8, 2024

I think Josh is just trying to replicate this. Apparently, RaaS providers want to prep and submit several txs and set their nonces accordingly (instead of preparing one after the other, s.t. the nonces get auto-updated from state). Is this correct @Bidon15 @jcstein, or am Im misunderstanding this?

@Bidon15
Copy link
Member

Bidon15 commented Jun 10, 2024

Apparently, RaaS providers want to prep and submit several txs and set their nonces accordingly (instead of preparing one after the other, s.t. the nonces get auto-updated from state). Is this correct @Bidon15 @jcstein, or am Im misunderstanding this?

Yes. This is born from the issue when they need to resubmit the blob, bc of the failed previous one. If we can do it automatically, then it's awesome.

If we can't do automatically, then at least giving them self-control is needed. Otherwise, they won't be able to resubmit blobs and be stuck in incorrect sequence number

Here is the gist of what our RaaS partners are experiencing

WARN [06-05|23:00:06.822] Blob Submission error                    err="rpc error: code = Unknown desc = failed to subscribe to tx: already subscribed"
WARN [06-05|23:00:06.823] Falling back to storing data on DAC      err="rpc error: code = Unknown desc = failed to subscribe to tx: already subscribed"
INFO [06-05|23:00:07.035] DataPoster sent transaction              nonce=5  hash=046fc7..12ac51 feeCap=51,055,105,760 tipCap=99,078,945 blobFeeCap=<nil> gas=1,538,064
INFO [06-05|23:00:07.038] BatchPoster: batch sent                  sequenceNumber=6 from=22 to=23 prevDelayed=8 currentDelayed=8 totalSegments=3 numBlobs=0
WARN [06-05|23:00:07.346] Blob Submission error                    err=": incorrect account sequence"
WARN [06-05|23:00:07.346] Falling back to storing data on DAC      err=": incorrect account sequence"
INFO [06-05|23:00:07.559] DataPoster sent transaction              nonce=6  hash=261475..5c08bc feeCap=51,055,105,760 tipCap=99,078,945 blobFeeCap=<nil> gas=1,540,640
INFO [06-05|23:00:07.562] BatchPoster: batch sent                  sequenceNumber=7 from=23 to=24 prevDelayed=8 currentDelayed=8 totalSegments=3 numBlobs=0
WARN [06-05|23:00:07.816] Blob Submission error                    err=": incorrect account sequence"
WARN [06-05|23:00:07.816] Falling back to storing data on DAC      err=": incorrect account sequence"
INFO [06-05|23:00:08.020] DataPoster sent transaction              nonce=7  hash=ebcae6..1afe5a feeCap=51,055,105,760 tipCap=99,078,945 blobFeeCap=<nil> gas=1,542,509

@distractedm1nd
Copy link
Collaborator

Node will not add the option to set the account sequence until the new signer/client library from @cmwaters is tried.

Callum made a very good point internally that "Users shouldn’t need to know that nonces exist. Giving them control is just a cop out because we can’t design a good system ourselves.". If it remains an issue we can add manual nonce control.

@distractedm1nd
Copy link
Collaborator

@jcstein 's case is not an example of this issue - it is the exact same transaction submitted twice, after receiving a "tx already in mempool error"

@jcstein
Copy link
Member Author

jcstein commented Jun 12, 2024

we can close this PR and reopen it if it happens again? AFAIU it is fixed in v0.13.7 celestia-node release

How would a user submit multiple blobs in the same block with blob.Submit or state.SubmitPayForBlobs?

however, I think it would be good to separately revisit this section in our docs. if it is only possible in celestia-app, we should make that clear. and make it clear it is not possible to set your own account sequence in celestia-node

@jcstein jcstein closed this as completed Jun 12, 2024
@jcstein
Copy link
Member Author

jcstein commented Jun 12, 2024

@jcstein if the tx is already in mempool then what's actually the problem?

it gets stuck in the mempool. unreliable tx submission. the issue is that there's no way to (1) increase gas (2) increase nonce, and resubmit

For me, I think nonce's should be an internal detail that isn't exposed to users so ideally we smooth out these bugs rather than passing that baton to users to handle

Although it is a detail, we do mention this is possible in the Celestia docs

@jcstein 's case is not an example of this issue - it is the exact same transaction submitted twice, after receiving a "tx already in mempool error"

Although it is the same transaction, IMO increasing gas and nonce should allow it to be forced to be included in the next block or two, assuming the fee market cooperates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request external Issues created by non node team members
Projects
None yet
Development

No branches or pull requests