fix(frontend): measure ETH transaction finality against the chain tip - #13982
Draft
AntonioVentilii wants to merge 2 commits into
Draft
fix(frontend): measure ETH transaction finality against the chain tip#13982AntonioVentilii wants to merge 2 commits into
AntonioVentilii wants to merge 2 commits into
Conversation
The native ETH load judged finality with the highest block number in the Etherscan batch it was about to persist, so a response could supply both the transactions and the height that certified them as finalized. Finality now measures against the tip Infura reports, matching what the ERC-20 and scroll-back paths already do, and both incremental paths skip the save when the tip cannot be read rather than falling back to the batch. A stored block index too far above the tip to be believable is no longer honoured as a fetch boundary, so it can no longer pin startBlock above every block Etherscan can return.
…-verification-402eb2 # Conflicts: # src/frontend/src/eth/services/eth-transactions.services.ts
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.
Motivation
The native ETH incremental load decided which Etherscan transactions were finalized enough to persist by measuring them against
Math.maxof the block numbers in the same batch, so the batch certified itself: an entry 64 blocks below its own sibling looked finalized regardless of the real chain height, and finalized entries become permanent canister records.loadOlderFromEtherscanand the ERC-20 head load already measure against the Infura tip. The native head load was the one left out.The stored boundary compounds it. Every later load derives
startBlockfromnewest_block_index, so a block index the chain will not reach for years leavesstartBlockpermanently above the real tip and the incremental fetch returns nothing on every load, for that token, on every device. The canister exposes no delete.Changes
MAX_BLOCKS_AHEAD_OF_TIPabove the tip is no longer honoured as a boundary; resolution falls through to the newest believable block in the store, so an inflated index heals instead of freezing the load. The tolerance is there because a short reorg or a provider catching up legitimately puts the stored height slightly above the tip.Tests
eth-transactions.services.spec.ts, 56 passing.Three tests pinned the old behaviour and were rewritten, including
should use max block number from new transactions for finality check, nowshould measure finality against the chain tip, not the batch. Three added, covering the fail-closed save, the self-heal (fails onmain, where the load returns nothing forever), and that the tolerance keeps the #13800 skip.npm run formatandnpm run lint -- --max-warnings 0clean. Fulltests/ethandtests/evm: 4216 passed; the twoharvest-autopilotsuites fail to resolveonesec-bridge, pre-existing on this machine.