matter-labs / matter-labs/block-explorer

Off-chain data updater never matches bridged ETH stored with the 0x...01 L1 sentinel address

Open
#653 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
139
Forks
145
Avg merge
8h 3m
Merged PRs (30d)
3

Description

### Bug Report

#### Description

Bridged ETH on non-ETH-base chains never receives a price or icon from the off-chain data updater because of an L1 address mismatch.

Since the Asset Router / Native Token Vault contracts, native ETH is canonically represented on L1 as `ETH_TOKEN_ADDRESS = address(1)` (era-contracts `Config.sol`), because the zero address means "the chain's own base token" in the bridge stack. When ETH is bridged in, the explorer stores `l1Address` from the `BridgeInitialize` log's `l1Token`, so the ETH row carries `0x0000...0001`.

The CoinGecko provider however emits ETH with `l1Address: ZERO_ADDRESS` (`packages/worker/src/token/tokenOffChainData/providers/coingecko/coingeckoTokenOffChainDataProvider.ts:72`), and `TokenRepository.updateTokenOffChainData` matches on exact equality. `0x...0001 != 0x...0000`, so every update cycle skips the ETH row and `usdPrice`/`iconURL` stay null.

The worker already knows the sentinel (`ETH_ADDRESS_IN_CONTRACTS` in `packages/worker/src/constants.ts:21`) but only uses it in `isBaseToken()` checks, not in price matching.

#### Reproduction Steps

1. Run the explorer on a chain with a non-ETH base token where ETH has been bridged in via the L2 Asset Router.
2. Let `TokenOffChainDataSaverService` complete a cycle (logs show tokens updated, no errors).
3. Query the ETH token via the API.

#### Expected Behavior

The bridged ETH row is matched to CoinGecko's ETH entry and gets `usdPrice`/`iconURL`.

#### Current Behavior

`usdPrice` and `iconURL` remain null even though the CoinGecko fetch succeeds.

#### Possible Solution

Treat `0x...0000` and `0x...0001` as equivalent ETH identifiers when matching off-chain data (or normalize the sentinel when storing bridged ETH). Related: #403.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TokenRepository.updateTokenOffChainData and the CoinGecko provider at packages/worker/src/token/tokenOffChainData/providers/coingecko/coingeckoTokenOffChainDataProvider.ts:72. Read packages/worker/src/constants.ts:21 and the TokenOffChainDataSaverService flow to understand the existing ETH sentinel handling. Done means a bridged ETH row receives usdPrice and iconURL after an off-chain data update cycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.