eosnetworkfoundation / eos-evm-node

Other
3 stars 5 forks source link

`eth_getLogs` returns no logs #303

Closed DenisCarriere closed 4 days ago

DenisCarriere commented 1 month ago

Seems like the eth_getLogs does not return any results

Test RPC request

https://api.evm.eosnetwork.com  

{"method":"eth_getLogs","params":[{"address": "0xdAC17F958D2ee523a2206206994597C13D831ec7"}],"id":1,"jsonrpc":"2.0"}

Feedback from @elmato

Issues with the implementation (the filtering). Having said this It should work providing no filters

Note: eth_getTransactionReceipt does return logs

kostya12362 commented 1 month ago
const { ethers, JsonRpcProvider } = require("ethers");
const provider = new JsonRpcProvider("https://api.testnet.evm.eosnetwork.com/");

async function checkTransactionReceipt(txHash) {
  const receipt = await provider.getTransactionReceipt(txHash);
  console.log("Transaction Receipt:", receipt);
  if (receipt) {
    console.log("Transaction Receipt Found:", receipt);
    console.log("Logs:", receipt.logs.length);
    receipt.logs.forEach((log) => {
      console.log("Log Address:", log.address);
    });
  } else {
    console.log("Transaction is still pending or does not exist.");
  }
}

checkTransactionReceipt(
  "0x6e063e1fedf16d61488a3026d0abc16edd62b33b523d9ee84612ee2d317e80da"
);

I make script and use official node from documentation EOS EVM https://docs.eosnetwork.com/evm/quick-start/endpoints

DenisCarriere commented 1 month ago

Here is a test function to retrieve Logs from a block range, this returns an empty [] Array

const { JsonRpcProvider } = require("ethers");
const provider = new JsonRpcProvider("https://api.testnet.evm.eosnetwork.com/");

async function checkLogs(fromBlock, toBlock) {
  const logs = await provider.getLogs({ fromBlock, toBlock });
  console.log(`Block range ${fromBlock}-${toBlock}`);
  console.log("Logs:", logs.length);
  logs.forEach((log) => {
    console.log("Log Address:", log.address);
  });
}

checkLogs(47502143, 47502144);
// Block range 47502143-47502144
// Logs: 0

Filter types

https://www.quicknode.com/docs/ethereum/eth_getLogs

/**
 *  A **Filter** allows searching a specific range of blocks for mathcing
 *  logs.
 */
export interface Filter extends EventFilter {

  /**
   *  The start block for the filter (inclusive).
   */
  fromBlock?: BlockTag;

  /**
   *  The end block for the filter (inclusive).
   */
  toBlock?: BlockTag;
}

/**
 *  A **FilterByBlockHash** allows searching a specific block for mathcing
 *  logs.
 */
export interface FilterByBlockHash extends EventFilter {
    /**
     *  The blockhash of the specific block for the filter.
     */
    blockHash?: string;
}