ref-fvm icon indicating copy to clipboard operation
ref-fvm copied to clipboard

EVM: Include the caller's ethereum address in the call parameters

Open Stebalien opened this issue 3 years ago • 2 comments

Currently, invoke_contract just takes the parameters. Unfortunately, this means determining the caller's ethereum address is expensive (requires calling back into the caller to retrieve it).

Instead, we should modify the invoke_contract parameters to take both a caller and the params. That way, the called contract can simply validate that the caller is a valid "ethereum" address for the calling contract (by resolving it).

Stebalien avatar Sep 15 '22 23:09 Stebalien

This also applies to the constructor:

  • The EAM's Create/Create2 methods will take (and validate) the caller's "EVM" address as a parameter.
  • The EAM will pass this address to the EVM contract's constructor.
  • The EVM Contract actor's constructor will:
    • Validate that it's being called by the EAM.
    • Present the passed "caller" as the real caller to the contract. Otherwise, the contract would see the ID address of the EAM contract.

Stebalien avatar Sep 16 '22 04:09 Stebalien

Ok, we have an alternative. If we get rid of Bind4 (which I'm planning on doing), we'll have at most one f4 address (unfortunately, along with an f2 address). Given that, we could store both addresses inside the actor metadata itself, exposing them from a syscall. Basically, we'd add fn resolve_addresses(id) -> Addresses where Addresses is struct { stable: Option<Address>, delegated: Option<Address> }.

Stebalien avatar Sep 16 '22 17:09 Stebalien

Resolved in https://github.com/filecoin-project/FIPs/discussions/477 (merged into the f4 work).

Stebalien avatar Oct 10 '22 04:10 Stebalien