Skip to content
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

EVM runtime: handle Filecoin method number (inbound and outbound) #805

Closed
raulk opened this issue Aug 25, 2022 · 2 comments
Closed

EVM runtime: handle Filecoin method number (inbound and outbound) #805

raulk opened this issue Aug 25, 2022 · 2 comments

Comments

@raulk
Copy link
Member

raulk commented Aug 25, 2022

Currently the EVM runtime handles calls on method_num 2 (InvokeActor). It should instead handle any method number and support a METHODNUM opcode to retrieve the method number from the Filecoin message. This would be a Filecoin-specific opcode and the upcoming Solidity library would offer a funcition that handles the assembly behind the scenes.

Doing it this way is important so that Ethereum contracts can act as proxies for native actors or built-in actors (e.g. wrapping actors and intercepting calls).

OTOH, we also need a way to specify a method number when performing a CALL. That's a separate issue, but I'll put a pin on that.

@vyzo
Copy link
Contributor

vyzo commented Sep 8, 2022

The propsed approach to solve this problem, while maintaining compatibility with existing code, is to introduce two new opcodes:

  • CALLACTOR which takes an explicit method number and executes a call (send) with fvm call conventions.
  • METHODUM which is a contextual opcode that returns the method number of the current invocation entry point.

Reserved method numbers for EVM actors:

  • 0, which is SEND.
  • 1, which is the constructor and is only implicitly invoked during initializstion.
  • 2, which is EVM contract invocations with EVM call conventions..

Note that it is possible to CALLACTOR into method 2, and enter the vanilla contract invocation flow.

Also note that this approach maintains full binary compatibility with existing code, as CALL and its brethren can only invoke EVM actors with EVM call conventions.

@raulk
Copy link
Member Author

raulk commented Sep 12, 2022

Implemented in filecoin-project/builtin-actors#633.

@raulk raulk closed this as completed Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants