Skip to content

Commit

Permalink
feat: disable FEVM
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Feb 20, 2023
1 parent fb759f8 commit 33b673d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
27 changes: 19 additions & 8 deletions actors/eam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use ext::{
init::{Exec4Params, Exec4Return},
};
use fil_actors_runtime::{
actor_dispatch_unrestricted, actor_error, deserialize_block, extract_send_result, ActorError,
AsActorError, EAM_ACTOR_ID, INIT_ACTOR_ADDR, SYSTEM_ACTOR_ADDR,
actor_error, deserialize_block, extract_send_result, ActorError, AsActorError, EAM_ACTOR_ID,
INIT_ACTOR_ADDR, SYSTEM_ACTOR_ADDR,
};

use fvm_ipld_encoding::ipld_block::IpldBlock;
use fvm_shared::{error::ExitCode, sys::SendFlags, ActorID, METHOD_CONSTRUCTOR};
use fvm_shared::{error::ExitCode, sys::SendFlags, ActorID, MethodNum, METHOD_CONSTRUCTOR};
use serde::{Deserialize, Serialize};

pub mod ext;
Expand Down Expand Up @@ -293,12 +293,23 @@ impl EamActor {

impl ActorCode for EamActor {
type Methods = Method;
actor_dispatch_unrestricted! {
Constructor => constructor,
Create => create,
Create2 => create2,
CreateExternal => create_external,
fn invoke_method<RT>(
_rt: &mut RT,
_method: MethodNum,
_args: Option<IpldBlock>,
) -> Result<Option<IpldBlock>, ActorError>
where
RT: Runtime,
RT::Blockstore: Clone,
{
Err(actor_error!(illegal_argument; "EAM has been disabled"))
}
// actor_dispatch_unrestricted! {
// Constructor => constructor,
// Create => create,
// Create2 => create2,
// CreateExternal => create_external,
// }
}

#[cfg(test)]
Expand Down
23 changes: 17 additions & 6 deletions actors/ethaccount/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use num_derive::FromPrimitive;
use crate::types::AuthenticateMessageParams;
use fil_actors_runtime::runtime::{ActorCode, Runtime};
use fil_actors_runtime::{
actor_dispatch, actor_error, ActorError, AsActorError, EAM_ACTOR_ID,
FIRST_EXPORTED_METHOD_NUMBER, SYSTEM_ACTOR_ADDR,
actor_error, ActorError, AsActorError, EAM_ACTOR_ID, FIRST_EXPORTED_METHOD_NUMBER,
SYSTEM_ACTOR_ADDR,
};

#[cfg(feature = "fil-actor")]
Expand Down Expand Up @@ -139,9 +139,20 @@ impl EthAccountActor {

impl ActorCode for EthAccountActor {
type Methods = Method;
actor_dispatch! {
Constructor => constructor,
AuthenticateMessageExported => authenticate_message,
_ => fallback [raw],
fn invoke_method<RT>(
_rt: &mut RT,
_method: MethodNum,
_args: Option<IpldBlock>,
) -> Result<Option<IpldBlock>, ActorError>
where
RT: Runtime,
RT::Blockstore: Clone,
{
Err(actor_error!(illegal_argument; "EthAccount has been disabled"))
}
// actor_dispatch! {
// Constructor => constructor,
// AuthenticateMessageExported => authenticate_message,
// _ => fallback [raw],
// }
}
3 changes: 3 additions & 0 deletions actors/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ impl ActorCode for EvmContractActor {
RT: Runtime,
RT::Blockstore: Clone,
{
if true {
return Err(actor_error!(illegal_argument; "EVM has been disabled"));
}
match FromPrimitive::from_u64(method) {
Some(Method::Constructor) => {
Self::constructor(
Expand Down

0 comments on commit 33b673d

Please sign in to comment.