filecoin-project / fvm-workbench

Tooling for developing actors on the FVM
Other
6 stars 0 forks source link

Ethereum tests don't work on the real FVM #40

Open alexytsu opened 1 year ago

alexytsu commented 1 year ago

An example test like placeholder_deploy_test fails to run to completion on the workbench.

        v.execute_message_implicit(
            &EAM_ACTOR_ADDR, // so this works even if "m2-native" is disabled.
            &INIT_ACTOR_ADDR,
            &TokenAmount::zero(),
            fil_actor_init::Method::Exec4 as u64,
            Some(serialize_ok(&fil_actor_init::Exec4Params {
                code_cid: *MULTISIG_ACTOR_CODE_ID,
                constructor_params: msig_ctor_params.clone(),
                subaddress: subaddr[..].to_owned().into(),
            })),
        )
        .unwrap()

However, the call from the INIT_ACTOR_ADDR to the placeholder's address returns with ExitCode::10, failing to deploy an actor over the placeholder.

InvocationTrace { 
  from: 10, 
  to: Address { payload: ID(1) },
  value: TokenAmount(0.0),
  method: 3, 
  params: Some(IpldBlock {...}), 
  error_number: None,
  exit_code: ExitCode { value: 10 }, 
  return_value: None,
  subinvocations: [
    InvocationTrace { 
      from: 1, 
      to: Address { payload: ID(103) }, 
      value: TokenAmount(0.0), 
      method: 1, 
      params: Some(IpldBlock {...}), 
      error_number: None,
      exit_code: ExitCode { value: 10 }, 
      return_value: None,
      subinvocations: [] 
    }
  ] 
}

The backtrace shows that this happens when trying to instantiate the placeholder module from this code in ref_fvm/fvm/src/call_manager/default.rs

                // Instantiate the module.
                let instance = engine
                    .instantiate(&mut store, &state.code)?
                    .context("actor not found")
                    .map_err(Abort::Fatal)?;
alexytsu commented 1 year ago

Could be related to this https://github.com/anorth/fvm-workbench/issues/29

It seems that by the time this code is called, the state.code cid of the placeholder actor, no longer matches the Placeholder's Cid recorded in the manifest..