feat: Add Celestia blobs support to Optimism batches fetcher - #10199
Merged
Conversation
varasev
marked this pull request as ready for review
June 6, 2024 07:35
varasev
requested review from
Qwerty5Uiop,
fedor-ivn,
nikitosing,
sl1depengwyn and
vbaranov
June 6, 2024 07:36
akolotov
self-requested a review
June 7, 2024 11:50
varasev
marked this pull request as draft
June 10, 2024 09:12
varasev
force-pushed
the
va-optimism-celestia-da
branch
from
June 19, 2024 13:57
25636a5 to
797698e
Compare
varasev
marked this pull request as ready for review
June 20, 2024 12:00
akolotov
requested changes
Jun 24, 2024
akolotov
approved these changes
Jul 9, 2024
vbaranov
force-pushed
the
va-optimism-celestia-da
branch
from
July 10, 2024 09:52
ee2caa2 to
cc75681
Compare
vbaranov
reviewed
Jul 10, 2024
vbaranov
approved these changes
Jul 11, 2024
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10198, #9982, #8402.
Motivation
This PR adds Celestia blobs handling to
Indexer.Fetcher.Optimism.TxnBatchmodule and saving blob's metadata to the database (for EIP-4844 blobs the metadata is also saved).Also:
Changelogbelow).SystemConfigcontract). SeeUpgradingsection below).Changelog
New or extended API routes
/api/v2/optimism/batches(and/api/v2/optimism/batches/count) in addition to the existing/api/v2/optimism/txn-batches. The new endpoint outputs a list of batches with internal Blockscout IDs. Example:/api/v2/optimism/batches/da/celestia/:height/:commitmentoutputs L1 batch info by Celestia blob's height and commitment. Requests and response examples (for Optimism Celestia Raspberry):or
requests will respond with
blobsarray represents the list of L1 transactions with the corresponding blob metadata (commitment and height), sorted chronologically.internal_idfield contains the internal Blockscout ID of the batch.l1_timestampcontains the timestamp of the last L1 transaction in the list.l1_tx_hasheslist can have more than one L1 tx hash (the batch consists of)./api/v2/optimism/batches/:internal_id. The output is the same as above for/api/v2/optimism/batches/da/celestia/:height/:commitment, but the batch is requested by its internal ID./api/v2/transactions/optimism-batch/:batch_numberoutputs a list of L2 transactions related to the specified Optimism batch (by its internal ID). Example of the output:/api/v2/blocks/:block_hash_or_numberAPI route was extended to show L1 batch info (where the specified L2 block relates to). Example:blobsarray contains the blobs (with metadata) related to the L1 batch, sorted chronologically. In case of EIP-4844 blobs thebatch_data_containerfield will bein_blob4844. In case of Celestia blobs the field will bein_celestia. If there are no blobs, the field will be equal toin_calldata.internal_iddesignates the internal Blockscout ID of the batch.l1_tx_hasheslist can have more than one L1 tx hash (the batch consists of).l1_timestampcontains the timestamp of the last L1 transaction in the list./api/v2/optimism/txn-batches/:l2_block_range_start/:l2_block_range_endallows to limit displaying items by the specified L2 block range. There is no/api/v2/optimism/txn-batches/:l2_block_range_start/:l2_block_range_end/counthandle, so UI page should hide the total number of items when using the explicit range.l2_block_range_startmust be less than or equal tol2_block_range_end.New or extended UI pages
The new pages in UI (based on the above API endpoints) should have the following columns and fields:
Batches (instead of
Txn batches)API endpoints for this page:
/api/v2/optimism/batches/api/v2/optimism/batches/countThis should be a table with the following columns:
Batch detailspage described below)Transactionstab on theBatch detailspage)Batch details
API endpoints for this page:
/api/v2/optimism/batches/:internal_id/api/v2/optimism/batches/da/celestia/:height/:commitmentShould have the following fields:
L1 txn hash (can have more than one hash for the same batch)(we don't display it here because the hashes are visible in the blob list below)
Transactionstab)Commitment,Height,Timestamp,L1 txn hash,Namespaceor
Versioned hash,Timestamp,L1 txn hashTransactionstab on theBatch detailspageAPI endpoint for this tab:
/api/v2/transactions/optimism-batch/:batch_numberShould be the same table as for zkSync or zkEVM. The transaction list is paginated (as there can be a lot of transactions in one batch).
Block page
API endpoint for this page:
/api/v2/blocks/:block_hash_or_numberThis page can be extended by the batch info (either by displaying full batch info on a separate tab or just giving the user a link to the batch by its Internal ID).
Upgrading
A new optional env variable
INDEXER_OPTIMISM_L1_BATCH_CELESTIA_BLOBS_API_URLwas added to define URL to Celestia blobs indexer service. Corresponding PR inblockscout/docs: https://github.com/blockscout/docs/pull/292. Example:http://localhost:8050/api/v1/celestia/blob. If the URL is not defined, Celestia blobs will be skipped.Env variable
INDEXER_OPTIMISM_L1_BATCH_BLOCKSCOUT_BLOBS_API_URLnow is not required. If it's not defined, EIP-4844 blobs are ignored (with an error message in logs for skipped blobs).In part of env variables optimization, the following ones were removed:
The two variables now are optional (have default values) and can be omitted:
The new
INDEXER_OPTIMISM_L1_SYSTEM_CONFIG_CONTRACTenv var was added to replace the variables listed above. This variable must be defined after instance upgrade (and before its restart).Checklist for your Pull Request (PR)
masterin the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.