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: APIv2 endpoints for Arbitrum messages and batches #9963

Merged
merged 15 commits into from
May 22, 2024

Conversation

akolotov
Copy link
Collaborator

@akolotov akolotov commented Apr 26, 2024

Motivation

This PR is continuation of work to support Arbitrum related entities in the BlockScout and depends on the changes introduced in #9312. It implements new API endpoints:

  • api/v2/arbitrum/batches: Provides minimal details about all batches.
  • api/v2/arbitrum/batches/{batch_number}: Offers complete details about a specific batch.
  • api/v2/arbitrum/batches/count: Returns the number of indexed batches.
  • api/v2/arbitrum/messages/to-rollup: Provides details about all L1-to-L2 messages.
  • api/v2/arbitrum/messages/to-rollup/count: Returns the number of L1-to-L2 messages.
  • api/v2/arbitrum/messages/from-rollup: Provides details about all L2-to-L1 messages.
  • api/v2/arbitrum/messages/from-rollup/count: Returns the number of L2-to-L1 messages.
  • api/v2/blocks/arbitrum-batch/{batch_number}: Allows retrieval of all blocks included in a batch.
  • api/v2/transactions/arbitrum-batch/{batch_number}: Allows retrieval of all transactions included in a batch.
  • api/v2/main-page/arbitrum/messages/to-rollup: Provides details about the latest 6 relayed L1-to-L2 messages.
  • api/v2/main-page/arbitrum/batches/latest-number: Returns the latest sealed batch number.
  • api/v2/main-page/arbitrum/batches/committed: Provides minimal details about the latest 10 committed batches.

The api/v2/transactions/{tx_hash} endpoint has been extended to include a "arbitrum" element, offering additional information about associated batches and cross-chain messages:

"arbitrum": {
  "batch_number": 30480,
  "commitment_transaction": {
    "hash": "0x7a0e9c700fec6bb4d1950c725e2093692ac67f9dc3bc3cfb84aa21a9cdbfd3e7",
    "status": "finalized",
    "timestamp": "2024-04-18T22:19:46.000000Z"
  },
  "confirmation_transaction": {
    "hash": "0x0f5c71ec4abf0d25235e47dd47009c5b89d9c87a28fde124533883af4b60657a",
    "status": "finalized",
    "timestamp": "2024-04-18T22:28:28.000000Z"
  },
  "contains_message": null,
  "status": "Confirmed on base"
}

and the /api/v2/blocks/{block_number} endpoint has been extended with the following element:

"arbitrum": {
  "batch_number": null,
  "commitment_transaction": {
    "hash": null,
    "status": null,
    "timestamp": null
  },
  "confirmation_transaction": {
    "hash": null,
    "status": null,
    "timestamp": null
  },
  "status": "Processed on rollup"
 }

Changelog

Enhancements

  • Implemented a new controller BlockScoutWeb.API.V2.ArbitrumController.
  • Implemented a new view BlockScoutWeb.API.V2.ArbitrumView.
  • Changes in the controllers BlockScoutWeb.API.V2.BlockController and BlockScoutWeb.API.V2.TransactionController are made to allow getting items included in a batch.
  • Explorer.Chain.Arbitrum.Reader has been extended with the functions to read corresponding items from the database.

Checklist for your Pull Request (PR)

@akolotov akolotov self-assigned this May 2, 2024
"originator_address" => msg.originator_address,
"originating_tx_hash" => msg.originating_tx_hash,
"origination_timestamp" => msg.origination_timestamp,
"originating_tx_blocknum" => msg.originating_tx_blocknum,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a minor suggestion: maybe rename originating to origination for these fields to unify naming

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in f4d1ce7

@vbaranov vbaranov merged commit 944a4b7 into feature/arbitrum/bridge May 22, 2024
@vbaranov vbaranov deleted the feature/arbitrum/bridge-api branch May 22, 2024 08:08
vbaranov pushed a commit that referenced this pull request May 27, 2024
* Initial version of x-level messages indexer

* fixes for cspell and credo

* new state of x-level messages

* Monitoring of new L1-to-L2 messages on L1

* new batches discovery

* fetcher workers in separate modules

* proper name

* Fix for responses without "id", e.g. "Too Many Requests"

* update DB with new batches and corresponding data

* update DB with confirmed blocks

* fixes for cspell and credo

* tracking commitments confirmations for L1 to L2 messages

* Proper usign of max function

* tracking completion of L2 to L1 messages

* catchup historical messages to L2

* incorrect version of committed file

* catchup historical messages from L2 and completion of L1-to-L2 messages

* historical batches catchup

* status for historical l2-to-l1 messages

* address matching issue

* catchup historical executions of L2-to-L1 messages

* db query to find unconfirmed blocks gaps

* first changes to catchup historical confirmations

* finalized catchup of historical confirmations

* 4844 blobs support

* fix for the issue with multiple confirmations

* limit amount of batches to handle at once

* Use latest L1 block by fetchers if start block is not configured

* merge issue fix

* missed file

* historical messages discovery

* reduce logs severity

* first iteration to improve documentation for new functionality

* second iteration to improve documentation for new functionality

* third iteration to improve documentation for new functionality

* fourth iteration to improve documentation for new functionality

* fifth iteration to improve documentation for new functionality

* final iteration to improve documentation for new functionality

* merge issues addressed

* code review issues addressed

* code review issues addressed

* fix merge issue

* raising exception in the case of DB inconsistency

* fix formatting issue

* termination case for RollupMessagesCatchup

* code review comments addressed

* code review comments addressed

* consistency in primary keys

* dialyzer fix

* code review comments addressed

* missed doc comment

* code review comments addressed

* updated indices creation as per code review comments

* fix merge issue

* configuration of intervals as time variables

* TODO added to reflect improvement ability

* database fields refactoring

* association renaming

* feat: APIv2 endpoints for Arbitrum messages and batches (#9963)

* Arbitrum related info in Transaction and Block views

* Views to get info about batches and messages

* usage of committed for batches instead of confirmed

* merge issues addressed

* changes after merge

* formatting issue fix

* code review comment addressed

* associations and fields in api response renamed

* format issue addressed

* feat: Arbitrum-specific fields in the block and transaction API endpoints (#10067)

* Arbitrum related info in Transaction and Block views

* Views to get info about batches and messages

* usage of committed for batches instead of confirmed

* merge issues addressed

* changes after merge

* formatting issue fix

* block and transaction views extended

* code review comment addressed

* associations and fields in api response renamed

* format issue addressed

* fix credo issue

* fix tests issues

* ethereumjsonrpc test fail investigation

* test issues fixes
vbaranov added a commit that referenced this pull request May 29, 2024
* fix: Add healthcheck endpoints for indexer-only setup (#10076)

* fix: Update Vyper inner compilers list to support all compilers (#10091)

Increases the number of items retrieved for Vyper releases to 100. Allows to get the oldest vyper compilers when using internal verification (i.e., sc_verifier is disabled)

When not set, the default number of items retrieved is 30, which is less than total number of currently existing releases (46). This makes the oldest compilers unavailable when using vyper verificaiton method.

Should fix the failing `/api/v2/smart-contracts/{address_hash}/verification/via/vyper-code success verification` test

* Fix certified flag in the search API v2 endpoint (#10094)

* Update CHANGELOG for 6.6.0

* Remove custom release CI for Immutable

* feat: implement fetch_first_trace for Geth (#10087)

* feat: implement fetch_first_trace for Geth

* chore: add missing doc & spec

* Update CHANGELOG

* Fix GA pre-release && release workflows

* Improve response of address API to return multiple implementations for Diamond proxy (#10113)

* Update CHANGELOG

* Indexer/API separated images for Redstone

* chore: Bump ecto_sql from 3.11.1 to 3.11.2

updated-dependencies:
- dependency-name: ecto_sql
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: indexer for cross level messages on Arbitrum (#9312)

* Initial version of x-level messages indexer

* fixes for cspell and credo

* new state of x-level messages

* Monitoring of new L1-to-L2 messages on L1

* new batches discovery

* fetcher workers in separate modules

* proper name

* Fix for responses without "id", e.g. "Too Many Requests"

* update DB with new batches and corresponding data

* update DB with confirmed blocks

* fixes for cspell and credo

* tracking commitments confirmations for L1 to L2 messages

* Proper usign of max function

* tracking completion of L2 to L1 messages

* catchup historical messages to L2

* incorrect version of committed file

* catchup historical messages from L2 and completion of L1-to-L2 messages

* historical batches catchup

* status for historical l2-to-l1 messages

* address matching issue

* catchup historical executions of L2-to-L1 messages

* db query to find unconfirmed blocks gaps

* first changes to catchup historical confirmations

* finalized catchup of historical confirmations

* 4844 blobs support

* fix for the issue with multiple confirmations

* limit amount of batches to handle at once

* Use latest L1 block by fetchers if start block is not configured

* merge issue fix

* missed file

* historical messages discovery

* reduce logs severity

* first iteration to improve documentation for new functionality

* second iteration to improve documentation for new functionality

* third iteration to improve documentation for new functionality

* fourth iteration to improve documentation for new functionality

* fifth iteration to improve documentation for new functionality

* final iteration to improve documentation for new functionality

* merge issues addressed

* code review issues addressed

* code review issues addressed

* fix merge issue

* raising exception in the case of DB inconsistency

* fix formatting issue

* termination case for RollupMessagesCatchup

* code review comments addressed

* code review comments addressed

* consistency in primary keys

* dialyzer fix

* code review comments addressed

* missed doc comment

* code review comments addressed

* updated indices creation as per code review comments

* fix merge issue

* configuration of intervals as time variables

* TODO added to reflect improvement ability

* database fields refactoring

* association renaming

* feat: APIv2 endpoints for Arbitrum messages and batches (#9963)

* Arbitrum related info in Transaction and Block views

* Views to get info about batches and messages

* usage of committed for batches instead of confirmed

* merge issues addressed

* changes after merge

* formatting issue fix

* code review comment addressed

* associations and fields in api response renamed

* format issue addressed

* feat: Arbitrum-specific fields in the block and transaction API endpoints (#10067)

* Arbitrum related info in Transaction and Block views

* Views to get info about batches and messages

* usage of committed for batches instead of confirmed

* merge issues addressed

* changes after merge

* formatting issue fix

* block and transaction views extended

* code review comment addressed

* associations and fields in api response renamed

* format issue addressed

* fix credo issue

* fix tests issues

* ethereumjsonrpc test fail investigation

* test issues fixes

* --- (#10096)

updated-dependencies:
- dependency-name: phoenix_ecto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* hide chain specific fields behind Map.get (#10131)

* fix: Hotfix for Indexer.Fetcher.Optimism.WithdrawalEvent and EthereumJSONRPC.Receipt (#10130)

* fix: Hotfix for Indexer.Fetcher.Optimism.WithdrawalEvent

* Small refactoring

* Small refactoring

* Consider nil in game_index

* Add empty handler for Optimism Fjord tx receipt fields

---------

Co-authored-by: POA <33550681+poa@users.noreply.github.com>

* fix: missing nil case for revert reason (#10136)

* fix: Add missing preloads to tokens endpoints

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com>
Co-authored-by: Rim Rakhimov <rimrakhimov@gmail.com>
Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com>
Co-authored-by: Kirill Fedoseev <kirill@blockscout.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Kolotov <alexandr.kolotov@gmail.com>
Co-authored-by: varasev <33550681+varasev@users.noreply.github.com>
Co-authored-by: POA <33550681+poa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants