I’m working on an upgradeable contract that uses fallback functions with inline assembly delegatecall and call calls (using calldatacopy and returndatacopy) to route internal and external function calls . Function calls often get routed through three fallback functions before executed. I have a decent set of tests and everything passes successfully. However if I emit an event in the initial fallback function, contract execution stops with a brownie.exceptions.VirtualMachineError: revert on chained fallback calls. Once the emit is removed the test suite passes again without issue.

Any ideas what's going wrong here or how I can troubleshoot this? I have layered calldata, do events impact that in some way? This brings back memories of uninitialized pointers…

  • 1
    I'll try to reproduce it with other clients like geth, ganache, besu, etc. Perhaps it is something wrong with brownie implementation. If it happens with many clients then likely is a problem with the code, one option is to debug step by step.
    – Ismael
    Apr 12, 2022 at 4:28

1 Answer 1


The contract makes intra-contract calls through the fallback function. The issue was with calls to view functions, which compile into staticcalls that can’t emit events.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.