op-node: Simplify Receipts Fetching API#3639
Conversation
|
|
This PR changes implementation code, but doesn't include a changeset. Did you forget to add one? |
|
Generally seems like a sane change that makes using the |
protolambda
left a comment
There was a problem hiding this comment.
Do we really want this? Sure it simplifies the API (yay, good thinking), but I expect it makes things quite unreliable when syncing from a L1 source: receipts are not cached individually, and the progress of the fetching is lost, since the receipt fetcher itself isn't cached anymore either.
Note that there's 1 receipt request per L1 tx. And on average Mainnet L1 has 10x as many txs per block as Goerli. And our op-e2e tx throughput is both lower and unrealistically stable (pretty much never a failed receipt retrieval).
Maybe we should do a mainnet test: without deploying any contracts, we can create a ghost rollup, that essentially functions the same like a rollup without active sequencer. Verifiers will run through all L1 blocks and receipts, and hit the bottlenecks that I think are fragile enough to warrant per-request caching/continuation on errors. If that works fine we can merge this, but I highly doubt it (especially when syncing from a rate-limited L1 endpoint, like an average user might...)
It's not an easy API to use and doesn't document that it relies on future calls to
That's not that hard to do. |
1e1eaf5 to
953a22b
Compare
|
@protolambda thanks for pointing out that the receipts fetcher cache is important. I've added a commit to this PR which now caches the receipts fetcher instead of the set of receipts. It attempts to used a cached receipts fetcher instead of making a new one. This means that this new code is the essentially the same as the old code except for the fact that the iteration is done inside of the How do you feel about this change? I think the performance should be the same and the API is a bit easier to use. |
protolambda
left a comment
There was a problem hiding this comment.
LGTM!
Hopefully the debug_getRawReceipts RPC method becomes more accessible than debug namespace some day, then the receipts fetcher stuff would be easier for us both. (And might still even be worth adding as option for those that sync from their own node now that I think of it)
|
This PR has been added to the merge queue, and will be merged soon. |
|
This PR is next in line to be merged, and will be merged as soon as checks pass. |
|
Merge failed. Please see automated check logs for more details. |
d937cf9 to
1d8ad09
Compare
|
gonna merge by hand b/c mergify messed up the update merge. |
|
Hey @trianglesphere! This PR has merge conflicts. Please fix them before continuing review. |
1d8ad09 to
dd4f5bd
Compare
|
Needed a force update b/c it conflicted with #3647 (b/c there are several interfaces that say the exact same thing). |
The previous API would return a receipts fetcher that the caller was responsible for iterating through and then calling `Result` on. This moves this inside the `Fetch` function. This simplifies usage of the API and does not result in performance regression because the receipts hash check requires all receipts to be fetched before
This modifies the refactor to be equivalent to the previous code. Caching the receipts fetcher is actually critical for performance because the fetcher caches intermediate results. The fetcher typically makes lots of calls to fetch all the receipts so if all work is thrown out on a single failure it will be very hard for the node to make progress.
dd4f5bd to
c54de7b
Compare
Description
The previous api would return a receipts fetcher that the caller was responsible for iterating through and then calling
Resulton. This moves this inside theFetchfunction. This simplifies usage of the API and does not result in performance regression because the receipts hash check requires all receipts to be fetched beforeTests
No added tests, but all pass.