ponder-sh/ponder

Call Trace Missing Internal Calls

Closed this issue · 2 comments

I am trying to use call traces, but it seems that when the call is an internal call (from another contract, not EOA), it's not being picked up (not triggering the call handler).

Here is a minimal example of when this occurs, focusing on the createSplit call to 0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE on Ethereum mainnet inside this transaction: https://etherscan.io/tx/0xa88cfbb85d32ebfdf0b9aae1e9690ff0c2d10ece903c3b71076ba853e7ef5dd6

Here is the Tenderly trace, showing the internal call occurs via a Gnosis multisig (nested inside a delegate call, and a call): https://www.tdly.co/tx/1/0xa88cfbb85d32ebfdf0b9aae1e9690ff0c2d10ece903c3b71076ba853e7ef5dd6
Screenshot 2024-11-03 at 20 52 38

Below is minimal code used:

// ponder.config.ts 

import { createConfig } from "@ponder/core";
import { http } from "viem";

const splitsMainnetAbi = [{
    inputs: [
      { internalType: "address[]", name: "accounts", type: "address[]" },
      { internalType: "uint32[]", name: "percentAllocations", type: "uint32[]" },
      { internalType: "uint32", name: "distributorFee", type: "uint32" },
      { internalType: "address", name: "controller", type: "address" },
    ],
    name: "createSplit",
    outputs: [{ internalType: "address", name: "split", type: "address" }],
    stateMutability: "nonpayable",
    type: "function",
}] as const;

export default createConfig({
  networks: {
    mainnet: { chainId: 1, transport: http(process.env.MAINNET_RPC_URL) },
  },
  contracts: {
    SplitsMainMainnet: {
      abi: splitsMainnetAbi,
      address: "0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE",
      network: "mainnet",
      includeCallTraces: true,
      startBlock: 16125816, // Txn of interest happens in block 16125817
      endBlock: 16125818,
    },
  },
});
// handler.ts

import { ponder } from "@/generated";

ponder.on("SplitsMainMainnet.createSplit()", async ({ event, context }) => {
  // Expect this log to appear from internal createSplit call trace, but it doesn't :( 
  console.log("createSplit called", event.transaction.hash);
});

I haven't been able to reproduce this - when I run this app I get one event printed to the console with the same transaction hash and from address as in the tenderly stack.

My best guess is that this is a rpc bug. What provider are you using?

Thanks for taking a look, yea you are right, seems like it was an RPC issue.

I am using Reth, and after updating to the latest version this issue wen't away :)