-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
chore: OP modules improvements #11073
Conversation
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.
replaces optimism_deposits:new_deposits socket topic (and deposits event) with optimism:new_deposits topic (and new_optimism_deposits event) for consistency. The payload remains the same
This breaking change requires to synchronize releases between backend and frontend which is complicated thing. Can we temporarily keep compatibility with the current version of the frontend? I'd suggest implementing new events and keep old events until frontend will not bind to new ones. Such a multi-step process gives us more flexibility in backend release publishing and more time to find possibly broken functionality.
- Seems, web application tests on Filecoin chain type are failed.
apps/block_scout_web/lib/block_scout_web/views/api/v2/optimism_view.ex
Outdated
Show resolved
Hide resolved
Yes, I restored those socket topic/event in c2c52dd |
53c3042
to
79da9c9
Compare
I think, this is not related to the current changes, but I'll try to rebase onto master and will see |
b6dbcb1
to
7718245
Compare
@varasev shouldn't you keep corresponding channel apps/block_scout_web/lib/block_scout_web/channels/optimism_deposit_channel.ex for compatibility as well? |
You mean the It's here now:
|
@varasev let's mark with |
Yeah, I meant that. But how about handling of the old event in |
timeout: :infinity | ||
}) | ||
|
||
Publisher.broadcast(%{new_optimism_deposits: deposit_events}, :realtime) |
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.
Seems, there is no backward compatibility with the current frontend here. We should also broadcast the old event as well.
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.
This line is responsible for the internal broadcasting of the new_optimism_deposits
notifier event. It's caught by the handler in BlockScoutWeb.Notifiers.Optimism
and then optimism:new_deposits
and optimism_deposits:new_deposits
topics are broadcasted to the socket
Ah, forgot to remove
Regarding the Don't worry, I locally tested the old and new socket topics with |
* Add new envs for OP stack * Fix updating logs filter in OP Deposits fetcher * Add fallback envs for OP * Add socket notifier for OP batches * Update common-blockscout.env * Set infinity timeout for select db queries * Support transactions without `to` field * Add some docs * mix format * Restore OP fetcher after reorg and restart * Add specs and docs * Fix spelling * Refactoring and hardcode INDEXER_BEACON_BLOB_FETCHER_* envs * mix format * Update spelling * Small fix for Indexer.Fetcher.Optimism.Deposit * Rewrite Indexer.Fetcher.Optimism.Deposit * Update common-blockscout.env * Add todo comments for deprecated socket topic * Fix for the new websocket channel * Add todo comment --------- Co-authored-by: POA <[email protected]>
* Add new envs for OP stack * Fix updating logs filter in OP Deposits fetcher * Add fallback envs for OP * Add socket notifier for OP batches * Update common-blockscout.env * Set infinity timeout for select db queries * Support transactions without `to` field * Add some docs * mix format * Restore OP fetcher after reorg and restart * Add specs and docs * Fix spelling * Refactoring and hardcode INDEXER_BEACON_BLOB_FETCHER_* envs * mix format * Update spelling * Small fix for Indexer.Fetcher.Optimism.Deposit * Rewrite Indexer.Fetcher.Optimism.Deposit * Update common-blockscout.env * Add todo comments for deprecated socket topic * Fix for the new websocket channel * Add todo comment --------- Co-authored-by: POA <[email protected]>
Fixes #11086, fixes #11101, closes #11077.
Motivation
This PR does the following things:
optimism:new_batch
topic andnew_optimism_batch
event for the frontend (see details below)optimism_deposits:new_deposits
socket topic (anddeposits
event) withoptimism:new_deposits
topic (andnew_optimism_deposits
event) for consistency. The payload remains the sameSystemConfig
contract is obsolete:INDEXER_OPTIMISM_L1_PORTAL_CONTRACT
,INDEXER_OPTIMISM_L1_START_BLOCK
,INDEXER_OPTIMISM_L1_BATCH_INBOX
,INDEXER_OPTIMISM_L1_BATCH_SUBMITTER
INDEXER_OPTIMISM_L1_ETH_GET_LOGS_RANGE_SIZE
andINDEXER_OPTIMISM_L2_ETH_GET_LOGS_RANGE_SIZE
env variables to be able to define request limits foreth_getLogs
requests (instead of the hardcoded values)INDEXER_OPTIMISM_L1_DEPOSITS_BATCH_SIZE
env variable in favor ofINDEXER_OPTIMISM_L1_ETH_GET_LOGS_RANGE_SIZE
INDEXER_OPTIMISM_BLOCK_DURATION
env variable to be able to define block time (which is 2 seconds by default for OP chains)Deposits
module (now it doesn't useeth_newFilter
andeth_getFilterChanges
)timeout: :infinity
for some db select requeststo
field ineth_getTransactionByHash
RPC responseINDEXER_BEACON_BLOB_FETCHER_*
env variables forIndexer.Fetcher.Optimism.TransactionBatch
module (see HardcodeINDEXER_BEACON_BLOB_FETCHER_*
envs forIndexer.Fetcher.Optimism.TransactionBatch
module #11077)New/updated sockets
https://github.com/blockscout/frontend needs to be updated to read the new socket channel (
optimism:new_batch
topic andnew_optimism_batch
event).The payload for that looks as follows:
Also,
optimism_deposits:new_deposits
topic was replaced withoptimism:new_deposits
(and thedeposits
event withnew_optimism_deposits
correspondingly). The payload remains the same as before.New env variables
INDEXER_OPTIMISM_L1_PORTAL_CONTRACT
(as fallback whenSystemConfig
is old)INDEXER_OPTIMISM_L1_START_BLOCK
(as fallback whenSystemConfig
is old)INDEXER_OPTIMISM_L1_BATCH_INBOX
(as fallback whenSystemConfig
is old)INDEXER_OPTIMISM_L1_BATCH_SUBMITTER
(as fallback whenSystemConfig
is old)INDEXER_OPTIMISM_L1_ETH_GET_LOGS_RANGE_SIZE
(optional)INDEXER_OPTIMISM_L2_ETH_GET_LOGS_RANGE_SIZE
(optional)INDEXER_OPTIMISM_BLOCK_DURATION
(optional)See their descriptions in blockscout/docs#337
Fix for
Indexer.Fetcher.Optimism.Deposit
Now the module doesn't use
eth_newFilter
andeth_getFilterChanges
JSON RPC requests as they work incorrectly on Nethermind (see NethermindEth/nethermind#7751).Support transactions without
to
fieldContract-creating transactions don't have the
to
field ineth_getTransactionByHash
response sent byreth
RPC node. This fix eliminates the error described in #11086 and #11101.Finding correct block number to start from after reorg
OP fetchers were improved in the part of reorgs handling: now OP fetcher will try to find nearest block from which it can continue to work after reorg and restarting the instance. Previous implementation just threw an error in logs and stopped the fetcher.
Checklist for your Pull Request (PR)
master
in the Version column. If I removed variable, I added it to Deprecated ENV Variables page. After merging docs PR, changes will be reflected in these pages.