Skip to content

Conversation

evan-forbes
Copy link
Member

This is a draft until we get an official release from app, but it would be super useful for me to get reviews from node folks as I do not know what I'm doing in this repo 😅

Currently, node automatically submits blobs asynchronously. Meaning we can submit multiple per block, but the ordering isn't guaranteed.

This adds the ability to submit blobs in parallel and the ability to submit blobs synchronously.

Synchronous (workers == 1) has a single worker that has a queue of blobs. It submits the blob, waits for it to be confirmed, and then submits the next blob in the queue. This doesn't guarantee order, as its possible a tx fails or gets evicted and the next blob in the queue does not. However most importantly avoids sequence mismatches since we're only ever submitting a single blob from an account at once. The account that is submitting the blob here is the one passed to TxClient.

Parallel submission works in the exact same way, except there are more than one worker. In order to manage these accounts, it creates new ones and grants them a feegrant by submitting a single transaction for all accounts that don't already have this. This ofc means that different accounts will submit blobs. All accounts are in the same keyring that has the main account.

@evan-forbes evan-forbes self-assigned this Sep 26, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in core/app Sep 26, 2025
@github-actions github-actions bot added external Issues created by non node team members kind:break! Attached to breaking PRs labels Sep 26, 2025
@evan-forbes evan-forbes moved this from Needs Triage to In Progress in core/app Sep 26, 2025
Comment on lines 216 to 222
response, err := client.SubmitPayForBlobWithAccount(ctx, account.Name(), libBlobs, opts...)
response, err := client.SubmitPayForBlob(ctx, libBlobs, opts...)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the bulk of the change

Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly good w me, mostly about namings

// parallel submissions. This means that blobs can be submitted by multiple different
// signers, and that blobs will not be submitted on chain in the original sending order.
// This is highly recommended for high throughput chains.
WorkerAccounts int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WorkerAccounts int
TxWorkerAccounts int

}

if cmd.Flag(txWorkerAccountsFlag).Changed {
value, err := strconv.Atoi(cmd.Flag(txWorkerAccountsFlag).Value.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can fatal out on err here

ca.estimatorConn = estimatorConn
}

if ca.workerAccounts > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe > 1 since default is 1

state/option.go Outdated
// WithWorkerAccounts configures the CoreAccessor to manage the provided number of
// worker accounts via the TxClient. A value of zero leaves parallel
// submission disabled.
func WithWorkerAccounts(workerAccounts int) Option {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func WithWorkerAccounts(workerAccounts int) Option {
func WithTxWorkerAccounts(workerAccounts int) Option {

@renaynay renaynay force-pushed the evan/besttx/parallel-0 branch from 1f32639 to 12ed37e Compare September 30, 2025 14:53
…ath thru SubmitPayForBlobWithAccount if non-default account specified in TxConfig

response, err := client.SubmitPayForBlobWithAccount(ctx, account.Name(), libBlobs, opts...)
var response *user.TxResponse
if account.Name() == ca.defaultSignerAccount {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is ugly, but until we have TxClient refactor, it will remain ugly.

Also, once we get Signer field in TxResponse, we should implement unit test for this. For now, manually tested.

@renaynay renaynay marked this pull request as ready for review October 1, 2025 08:35
@renaynay
Copy link
Member

renaynay commented Oct 1, 2025

For documentation purposes (cc @jcstein)

This PR introduces parallel transaction submission lanes #5776.

Parallel Transaction Submission Lanes

Node runners enable this feature by setting TxWorkerAccounts in the state config:

  [State]
    DefaultKeyName = "my_celes_key"
    DefaultBackendName = "test"
    EstimatorAddress = ""
    EnableEstimatorTLS = false
    TxWorkerAccounts = 8

TxWorkerAccounts defines how many parallel lanes the TxClient will initialize. These lanes are subaccounts funded by the default account to submit PayForBlob transactions in parallel, bypassing account sequence limits and enabling higher throughput (≥ TxWorkerAccounts PayForBlob txs per block).

Example: TxWorkerAccounts = 8 → 7 funded subaccounts + 1 default account, allowing at least 8 PayForBlob txs per block.

⚠️ Important Notes

  • Not suitable for implementations requiring sequential ordering.
  • Only valid for unordered transaction workflows.
  • Parallel submission works only with the default account. Specifying another account in TxConfig bypasses it.

Synchronous Submission

TxWorkerAccounts of 1 → synchronous/queued transaction submission.

  • Each tx queues until the previous is confirmed.
  • Preserves ordering and avoids sequence mismatches.
  • Throughput: ~1 PayForBlob tx per block.

⚠️ Important Notes

  • If an account other than the default account is specified in TxConfig, the queue is bypassed and txs enter the mempool directly without waiting on confirmations.

Default Behavior (immediate transaction submission)

TxWorkerAccounts defaults to 0 → queued submission disabled. All PayForBlob txs are submitted immediately. This is exactly the same behaviour as before with txs entering the mempool directly without waiting on confirmations.

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

We should also mark this change as (config) breaking btw

@Wondertan Wondertan changed the title feat: add the ability to submit blobs in parallel feat(state)!: add the ability to submit blobs in parallel Oct 1, 2025
@evan-forbes
Copy link
Member Author

generally correct, but I could see room for confusion

This feature CANNOT be used by implementations that need sequential ordering of transactions.

The default TxWorkerAccounts value is 1.
A value of 1 would indicate to the TxClient not to enable parallel tx submission and all PayForBlob transactions

might be worth refactoring this to state the 1 thing first, as the "cannot use this new feature" thing might cause confusion. ofc, we can use this new feature and it actually provides more sequential ordering than before since we don't need to resign. The current TxClient is actually incapable of sequential ordering as is fwiw.

The bigger diff here might be that the blobs come from different accounts.

This preserves old behaviour with the caveat that now, users will still be able to call SubmitPayForBlob multiple times, but every call to this endpoint will queue up transactions to be submitted by the default account. The TxClient submits the blob, waits for it to be confirmed, and then submits the next blob in the queue. This doesn't guarantee order, as its possible a tx fails or gets evicted and the next blob in the queue does not. However most importantly avoids sequence mismatches since we're only ever submitting a single blob from an account at once.

imo it would clearer to state something along the lines of:

Setting a value to 0 preservers the previous behavior of submitting multiple blobs from the same account. This is not recommended due to hitting many sequence mismatches and low throughput. Setting a value of 1 is breaking in that blobs are queued and submitted one by one. This avoid sequence mismatches and preserves the original order of the blobs in almost all cases.

@renaynay
Copy link
Member

renaynay commented Oct 1, 2025

Setting a value to 0 preservers the previous behavior of submitting multiple blobs from the same account. This is not recommended due to hitting many sequence mismatches and low throughput. Setting a value of 1 is breaking in that blobs are queued and submitted one by one. This avoid sequence mismatches and preserves the original order of the blobs in almost all cases.

@evan-forbes we do not even allow a TxWorker count of 0 -- we default to 1 worker. We enforce this

@renaynay renaynay marked this pull request as draft October 1, 2025 13:02
Copy link
Member Author

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't approve my own PR but I approve the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issues created by non node team members kind:break! Attached to breaking PRs
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants