matter-labs / matter-labs/zksync-cli
Balance error for ETH token on zk chain with custom base asset
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 168
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
### 🐛 Bug Report for zksync-cli
#### 📝 Description
The token info for ETH bridged to a zk chain that uses a custom base asset isn't able to be decoded correctly, resulting in an error if you try to get the balance of the L2 token for ETH.
#### 🔄 Reproduction Steps
1. Deploy a local zk chain that uses a custom base asset
2. Bridge actual ETH from L1 to that chain
3. Get the L2 token address for ETH using `await wallet.l2TokenAddress(ETH_ADDRESS_IN_CONTRACTS)`
4. try to get the balance for the L2 token for ETH using the `wallet balance` command
#### 🤔 Expected Behavior
The command should output the balance.
#### 😯 Current Behavior
```shell
ⓘ There was an error while fetching balance for the specified address:
ⓘ call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="symbol()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)
```
#### 🖥️ Environment
- **Package version**: latest & master branch
- **Node version**: v18.20.3
- **NPM/Yarn version**: 10.7.0
- **Operating System & Version**: Mac Sonoma 14.5
#### 📋 Additional Context
I'm able to get this working and see the correct balance output by removing `utils.IERC20.decodeFunctionResult` in the `getTokenInfo` function in `src/utils/token.ts` and hardcoding the `name` and `symbol` in the return object.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/utils/token.ts at getTokenInfo and reproduce the issue with a local zk chain using a custom base asset, then run the wallet balance command for the bridged ETH L2 token. Trace the symbol() decoding path and verify that the command outputs the token balance without the decoding error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100