Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_getLogs returns no logs #303

Open
DenisCarriere opened this issue Sep 29, 2024 · 2 comments
Open

eth_getLogs returns no logs #303

DenisCarriere opened this issue Sep 29, 2024 · 2 comments
Labels
bug Something isn't working 👍 lgtm

Comments

@DenisCarriere
Copy link

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
Copy link

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

@stephenpdeos stephenpdeos added bug Something isn't working 👍 lgtm labels Oct 3, 2024
@DenisCarriere
Copy link
Author

DenisCarriere commented Oct 5, 2024

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

  • fromBlock / toBlock
  • blockHash
  • address
  • topics
/**
 *  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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 👍 lgtm
Projects
Status: Todo
Development

No branches or pull requests

3 participants