-
Notifications
You must be signed in to change notification settings - Fork 8
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
Using blockNumber - 1
instead of block.parentHash
is a subject to reorg false alarms
#513
Comments
blockNumber - 1
instead of blockEvent.block.parentHash
is a subject to reorg false alarms blockNumber - 1
instead of block.parentHash
is a subject to reorg false alarms
|
…parentHash is a subject to reorg false alarms
…parentHash is a subject to reorg false alarms
…parentHash is a subject to reorg false alarms
…parentHash is a subject to reorg false alarms
fix: issue #513 in eth-steth: Using blockNumber - 1 instead of block.…
For ./l2-bridge-zksync/src/clients/zksync_block_client.ts:72: const blocks = await this.provider.fetchBlocks(this.cachedBlockDto.number, latestBlock.right.number - 1) /l2-bridge-linea/src/clients/linea_block_client.ts:72: const blocks = await this.provider.fetchBlocks(this.cachedBlockDto.number, latestBlock.right.number - 1) ./l2-bridge-mantle/src/clients/mantle_block_client.ts:72: const blocks = await this.mantleProvider.fetchBlocks(this.cachedBlockDto.number, latestBlock.right.number - 1) For const withdrawalEvents = await this.withdrawalsClient.getWithdrawalEvents(pastl2Block, l2BlockNumber - 1) ./ethereum-validators-set/src/subagents/exitbus-oracle/agent-exitbus-oracle.ts:283: blockEvent.blockNumber - 1, It's ok - code fetches a range of blocks. where we really need to fix:
@lidofinance/lido-tooling |
Turns out it's not possible to use the More context: ethers-io/ethers.js#2808 |
tl;dr
When the alert logic requires to query something from the previous block, it's better to use the
block.parentHash
instead ofblockNumber - 1
to avoid issues with the Ethereum chain reorganizations.How to fix
See the following reference code:
https://github.com/lidofinance/alerting-forta/blob/main/ethereum-steth/src/clients/eth_provider.ts#L181-L196
https://github.com/lidofinance/alerting-forta/blob/main/ethereum-steth/src/services/vault/Vault.srv.ts#L60-L63
Affected scope
List of the files that affected by the issue:
Explanations and references
References
Helpful picture
The text was updated successfully, but these errors were encountered: