ref-fvm
ref-fvm copied to clipboard
EVM: Make DelegateCall Generic
Per @anorth's request, this is how we'd make DelegateCall "generic" to avoid any type checking:
- Export
GetBytecode
as an frc42 method. We'd call it something likeGetEVMBytecode
- Blindly call this method to get the bytecode, or "nothing".
- If we receive bytecode, we load and execute it.
- If we receive nothing (block 0) but the call succeeds, we return success. This will cover the account, placeholder, etc. cases.
- If we receive an error, we return a revert to the user.
NOTE I would not make EXTCODEHASH
or EXTCODECOPY
generic (for now, at least) as users likely rely on those as trusted ways to determine the target actor's code type. However, if a user is blindly calling into some actor with DELEGATECALL
, there really isn't any security risk in just doing what they ask.
The big question is: timing. IMO:
- This is the right approach and is something we should do.
- This isn't critical now and can land in a future upgrade.
The important part, as far as I understand it, is to have a path to removing the special case.
So long as we don't get locked in to the "wrong" way by deploying it and having people write smart contracts, I'm ok with it being deferred to FVM native. Perhaps describe this plan in the FIP.