-
Notifications
You must be signed in to change notification settings - Fork 21.5k
[Tracer] Handle Empty Contract Deployment Transactions #22276
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
[Tracer] Handle Empty Contract Deployment Transactions #22276
Conversation
|
I'm not sure if this is the best approach to fix this panic (I thought it was the least invasive) but believe the root cause is accurate. |
|
I think this is 'semantically correct' -- it basically considers contract code to be an infinite fields of zeroes, and if no code is deployed, it just executes those, ending the execution on the first However, in practice, there are problems with this. It will cause problems with differential fuzzing against other vms, and it will also add a performance penalty allocating stack and memory for plain value transfers to EOAs. |
|
Could you perhaps make a similar transaction and post it here so we could play with it on Rinkeby or Goerli and repro? |
If the contract code was empty, I considered just setting
I mimicked the empty contract creation (with a non-zero send to it) on Goerli: https://goerli.etherscan.io/tx/0x073e2af40916b3199d960814acbc08ec2e241fb7c53ffb7d19785be8a48b12f3 |
|
Here's crash stack trace and repro: |
|
So, the fix here is not to do an extra CaptureState, rather to move the database initialization into CaptureStart. It will need a bit of interface refactoring throughout the code, but should be a lot cleaner and not entail any performance hits. |
|
Closing in favou of #22333 |
Related: ava-labs/coreth#98
Problem
When invoking
debug_traceTransactionwith the default Blockscout tracing script, I noticed that theTracerpanics if called on a transaction that created a contract with no code. There is an example of such a transaction on the Avalanche testnet here.Root Cause
The root cause of this issue is that the
Tracer.dbWrapper.dbis not populated whenTracer.GetResultis called at the end oftraceTx. Specifically, note thatGetResultcallsresult(ctx, db)and that the attached script attempts to access the code of any created contract from the provided db (which panics here as nodbWrapper.dbwas ever set).