[Dev Tools] anvil-zksync replay_tx not matching chain data #1031
-
Team or ProjectAbstract ZK chainAbstract EnvironmentMainnet Select the Dev Tool you are usingFoundry Provide the version of the tool (if applicable)0.6.3 Provide a brief description of the functionality you're trying to implement and the issue you are running into.I am attempting to debug and understand the [Panic] error in the failing delegatecall frame from transaction 0xebd778429b226583a65b8bfb165ca7b3ab6218e3c73e2bc9e5ed6bb36dbeb647 by comparing against a similar, succeeding transaction 0x99a0c5d543f2b44d8e80349dec54f05a9ad37b07b9dec7a92ae4a0b4d73ed674 To attempt to understand the differences in call flow I run the following commands: Failing TX
Successful TX
Outputs here: As you can see, both replays result in the following error frame, despite there not being any error frames in the successful transaction.
Additionally, when run with an additional verbose flag ( Anvil success TX
Anvil failed TX
Any insight on how to troubleshoot this partial failure/panic would be greatly appreciated (as well as proper usage of zksync-anvil for doing so) Repo Link (Optional)No response Additional DetailsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is a tough one, adding a follow up here: matter-labs/anvil-zksync#727 |
Beta Was this translation helpful? Give feedback.
-
I did a small investigation and the reason why execution in To fully replicate what happened in real life, For transaction in question: transfer limit set in 0x221f0e1280ec657503ca55c708105f1e1529527d is 15000 which, as you can see, is too conservative for some cases. Setting the limit to 30000 and then replaying both transactions makes both of them successful in |
Beta Was this translation helpful? Give feedback.
I did a small investigation and the reason why execution in
anvil-zksync
is different is that, unfortunately, gas consumption when replaying an individual transaction (or even an individual block) is different from what it is in real life execution. For instance, it's a lot cheaper to write into slots that have already been written into by some previous transaction in the same batch.To fully replicate what happened in real life,
anvil-zksync
would have to re-execute all transactions from that batch. But batches live for quite a while on the majority of ZK chains (including Abstract) and it is unreasonable foranvil-zksync
to replay all of them. For example, second transaction from the or…