ponder-sh / ponder

A backend framework for crypto apps
https://ponder.sh
MIT License
530 stars 74 forks source link

[Bug] Multiple Networks Factories #961

Closed victormer closed 1 week ago

victormer commented 1 week ago

Hey there,

I found what I think it's a bug.

I'm trying to have multiple networks supporting a factory. What I experience is:

  1. When I config both networks (local + sepolia) it works fine with sepolia contracts except for the sepolia factory.
  2. When I config ONLY the sepolia network, it works fine with all contracts (including factory).
  3. When I config both networks and swap the name of the networks, it's the local factory that it's not registering assets.
  4. The event of the factory is being captured for the logs I see, but no entity is being created to register events.

You can see results here:

ONLY SEPOLIA

Screenshot 2024-07-07 at 09 53 20 Screenshot 2024-07-07 at 09 53 32

BOTH NETWORKS

Screenshot 2024-07-07 at 09 52 05 Screenshot 2024-07-07 at 09 53 48

CONFIG

export default createConfig({
  networks: {
    local: {
      chainId: 1337,
      transport: http('http://localhost:8545'),
  },
  sepolia: {
      chainId: 11155111,
      transport: http('https://eth-sepolia.g.alchemy.com/v2/XXXX'),

  },
  },
  contracts: {
    erc20: {
      abi: ERC20,
      network: {
        local: {
            startBlock: 0,
            factory: {
                address: '0x540FddD1ca14c403B737f579bB4DfeD6033c6314',
                event: assetDeployedEvent,
                parameter: 'proxy',
            },
        },
        sepolia: {
          startBlock: 6249452,
          factory: {
            address: '0x82cd4a7661DB5E5f524c27df578608803a28aa19',
            event: assetDeployedEvent,
            parameter: 'proxy',
          },
        },
      },
    }
  }
});
kyscott18 commented 1 week ago

Sorry about this. Is your foundry local network configured with interval mining? This seems like it could be causing the behavior that you are seeing.

https://ponder.sh/docs/advanced/foundry#mining-mode

victormer commented 1 week ago

Exactly, the error disappeared when I set an interval of 2 seconds for blocks. Thanks for the response.