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
Add Polygon zkEVM batches fetcher #7584
Conversation
e4797a8
to
70be38f
Compare
apps/block_scout_web/lib/block_scout_web/controllers/api/v2/zkevm_controller.ex
Outdated
Show resolved
Hide resolved
apps/block_scout_web/lib/block_scout_web/views/api/v2/zkevm_view.ex
Outdated
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/import/runner/zkevm_batch_txns.ex
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@varasev please rebase the current branch to the master branch.
@vbaranov Done |
260c674
to
2376332
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@varasev please rebase onto master branch
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@varasev web tests are failing https://github.com/blockscout/blockscout/actions/runs/6614170606/job/17966222220?pr=7584
Invalid call found at 2 locations:
lib/block_scout_web/controllers/api/v2/zkevm_controller.ex:66: BlockScoutWeb.API.V2.ZkevmController.batches/2
lib/block_scout_web/controllers/api/v2/zkevm_controller.ex:99: BlockScoutWeb.API.V2.ZkevmController.batches_confirmed/2
@varasev and please move Changelog entry to the current chapter. |
@vbaranov all fixed |
Motivation
This PR adds an indexer (fetcher) for Polygon zkEVM (Hermez) transaction batches and the corresponding pages and fields to API v2.
These changes are inspired by https://zkevm.polygonscan.com/ functionality in part of displaying transaction batches.
Note that it doesn't include the corresponding changes for old UI.
The fetcher uses
zkevm_batchNumber
,zkevm_virtualBatchNumber
,zkevm_verifiedBatchNumber
, andzkevm_getBatchByNumber
RPC requests (documented here).For API v2 there are following changes:
Verify Block Number
field). Example: https://zkevm.polygonscan.com/batch/10470. Example of API v2 request: http://localhost:4000/api/v2/zkevm/batches/10470Verify Block
field). Example of API v2 request: http://localhost:4000/api/v2/zkevm/batches (and http://localhost:4000/api/v2/zkevm/batches/count)Latest Confirmed Batches
homepage section was added. Example: https://zkevm.polygonscan.com/. Example of API v2 request: http://localhost:4000/api/v2/main-page/zkevm/batches/confirmedLatest Batch
homepage section was added. Example: https://zkevm.polygonscan.com/. Example of API v2 request: http://localhost:4000/api/v2/main-page/zkevm/batches/latest-numberTo enable/disable the fetcher, one need to use
INDEXER_ZKEVM_BATCHES_ENABLED=true
env variable. To test the fetcher, the public RPChttps://zkevm-rpc.com
can be used.The new UI will need to have the following new pages and items (see the examples above):
Sequencer
field on Block page (the value can be taken fromminer
field). Example: https://zkevm.polygonscan.com/block/510844Sequencer
field on Block list page (the value can be taken fromminer
field). Example: https://zkevm.polygonscan.com/blocksBatch info
pageBatches
pageLatest Confirmed Batches
(❓) andLatest Batch
homepage sectionsChecklist for your Pull Request (PR)
CHANGELOG.md
with this PRsharelock.md
for Polygon zkEVM batches fetcher docs#161master
in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.