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: concurrent alt-da requests #11698

Conversation

samlaf
Copy link
Contributor

@samlaf samlaf commented Aug 30, 2024

This is the simplest possible implementation to fix the non-blocking da requests. We build off of @karlb's celo-org#213. We use an errgroup for da requests, with its own limit to the number of concurrent goroutines. See https://hackmd.io/@samlaf/op-batcher-concurrent-altda-requests-design-doc for more details.

Testing

We added a basic e2e test by using a fakeDaServer that sleeps for 5 seconds before returning commitments, in order to simulate slow EigenDA responses.

We also tested this manually by running the devnet and submitting large txs and observing the behavior.

Open Questions

(see https://hackmd.io/@samlaf/op-batcher-concurrent-altda-requests-design-doc#Open-questions for working links)

  1. How to differentiate between stops and shutdowns for da requests? txmgr uses a separate txmgr.Close() function to quickly kill pending txs during shutdown. We might want to have a similar mechanism for DA requests? But in the meantime, we’ve opted to cancel all pending DA requests for both closes and shutdowns, by using l.shutdownCtx (see here and comment above) instead of the currently used l.killCtx . This seems fine since the txData is pushed back into the channel on error, and would be resubmitted on a later start().
  2. errgroups for alt-da and eth-da are different: should we combine them into a single goroutine that does both calls serially. This would also mean combining their max concurrent goroutine flags/parameters (MaxPendingTransactions and MaxConcurrentDARequests).
  3. How do we feel about changing the MaxL1TxSizeBytes flag/param to MaxFrameSizeBytes to better represent its dual use in the case of alt-da, where the actual l1 tx size is the size of the commitment, not of the frame?

test(batcher): add e2e test for concurrent altda requests

doc: add explanation comment for FakeDAServer

chore: fix if condition in altda sendTransaction path

feat: add maxConcurrentDaRequests config flag + semaphore

refactor: batcher to use errgroup for da instead of separate semaphore/waitgroup

fix: nil pointer bug after using wrong function after rebase

fix: defn of maxConcurrentDaRequests=0

fix: TestBatcherConcurrentAltDARequests

chore: remove unneeded if statement around time.Sleep

refactor: use TryGo instead of Go to make logic local and easier to read

chore: clean up some comments in batcher

chore: make batcher shutdown cancel pending altda requests by using shutdownCtx instead of killCtx
@samlaf samlaf requested a review from a team as a code owner August 30, 2024 22:28
@samlaf samlaf requested a review from geoknee August 30, 2024 22:28
@samlaf samlaf changed the title feat: initial goroutine blob submission implementation feat: concurrent alt-da requests Aug 30, 2024
@tynes
Copy link
Contributor

tynes commented Aug 30, 2024

This is extremely well thought through, thank you @samlaf for this! @sebastianst is the main owner of the batcher right now

op-batcher/batcher/driver.go Outdated Show resolved Hide resolved
@tynes
Copy link
Contributor

tynes commented Aug 30, 2024

@roberto-bayardo could also be a good person to help with review here

@tynes
Copy link
Contributor

tynes commented Aug 30, 2024

Generally looks good to me although I do not own this code

op-batcher/batcher/driver.go Outdated Show resolved Hide resolved
op-batcher/batcher/driver.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
op-alt-da/damock.go Show resolved Hide resolved
op-batcher/batcher/driver.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
op-e2e/system_test.go Outdated Show resolved Hide resolved
op-batcher/batcher/driver.go Outdated Show resolved Hide resolved
op-batcher/batcher/driver.go Outdated Show resolved Hide resolved
@samlaf samlaf requested a review from a team as a code owner September 10, 2024 00:33
@samlaf
Copy link
Contributor Author

samlaf commented Sep 10, 2024

@sebastianst just realized I was not initializing MaxConcurrentDARequests... :|
Fixed in my last commit: 5e519ca

@sebastianst sebastianst added this pull request to the merge queue Sep 11, 2024
Merged via the queue into ethereum-optimism:develop with commit 88b1a95 Sep 11, 2024
56 checks passed
@samlaf samlaf deleted the non-blocking-da-implv1-simple-waitgroup branch September 12, 2024 05:25
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.

4 participants