eth-json-rpc-filters icon indicating copy to clipboard operation
eth-json-rpc-filters copied to clipboard

fix: add workaround that `intToHex` produce valid `Quantity` format

Open YuyaMaruyama21D4E opened this issue 1 year ago • 0 comments

Hi and thank you for maintaining this library! I would like to fix an issue where event hooks are not working in MetaMask.

Specification

  • geth and the spec no longer support leading zero
  • Reference:
    • https://github.com/ethereum/execution-apis/issues/40#issuecomment-906400324
    • https://github.com/NomicFoundation/hardhat/issues/1585#issuecomment-906638245

Issue Description

  • Events emitted by the contract aren't being received when subscribing with .contract.on("EventName", callback)
  • Event hooks occasionally fail to arrive
  • This issue is specific to MetaMask (works fine with other wallets)
  • Many dApps are affected by MetaMask's subscription functionality issues
  • Related issues:
    • https://github.com/MetaMask/eth-json-rpc-filters/issues/70
    • https://github.com/MetaMask/eth-json-rpc-filters/issues/152
    • https://github.com/MetaMask/metamask-extension/issues/8220

Proposed Solution

スクリーンショット 2025-01-14 152537

  • This PR is intended as a temporary workaround until the intToHex function in hexUtils.js is properly audited
    • Reference for auditing function:
      • https://github.com/MetaMask/eth-json-rpc-filters/pull/71#issuecomment-1240001443
  • Added local intToHex implementation to log-filter.js
    • Following the same approach already used in getBlocksForRange.js

YuyaMaruyama21D4E avatar Jan 14 '25 06:01 YuyaMaruyama21D4E