Closed 0xOlias closed 3 months ago
I'd suggest one UX improvement on this:
Anvil may be open to adding a Server
header that we could use to detect anvil. Obviously the isLocalChain
option would take precedence if specified, but this would help new users a bunch
Anvil may be open to adding a Server header
Anvil doesn't need to add this, since Ponder could call the web3_clientVersion
RPC method to determine if it's a local network:
~ cast rpc web3_clientVersion -r http://127.0.0.1:8545
"anvil/v0.2.0"
This has stayed consistent throughout Foundry version upgrades, with "anvil/vX.X.X" being the returned response.
Makes sense, thought a server header would be better b/c this is an additional request on startup. But makes sense
Per discussion in the chat, Ponder doesn't currently work very well when indexing a local chain like Anvil or Hardhat Network.
Here is the proposed workflow:
anvil
b.forge script ./script/0_Deploy.s.sol:Deploy --broadcast --fork-url http://localhost:8545 ...
ponder dev
anvil
process b.anvil
c.forge script ./script/0_Deploy.s.sol:Deploy --broadcast --fork-url http://localhost:8545 ...
ponder dev
process b.ponder dev
We should be able to unblock this with some debugging and a few small changes. Here's a first pass:
networks
that disables caching. Could call itdisableCache
or maybeisLocalChain
. In practice, the easiest implementation would be to delete all cached data for that chain on startup. Ideally, this RPC cache invalidation function would be the same thing that powers the proposedponder cache
CLI entrypoint.startBlock
andendBlock
and the networklatest
andfinalized
blocks. Nearly certain we have bugs if the start block is in the unfinalized range. I'd like to design a durable solution here that also fixes https://github.com/ponder-sh/ponder/issues/813.Checklist
isLocalChain
config API. Note that the ViemChain
type already hastestnet?: boolean
.startBlock
,endBlock
,latest
block number and finality block count to understand current behavior and probably find existing bugs