Skip to content

Commit

Permalink
install_actor is a primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed May 5, 2022
1 parent 10d417b commit 1b039b8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions actors/runtime/src/runtime/fvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ where
fvm::crypto::compute_unsealed_sector_cid(proof_type, pieces)
.map_err(|e| anyhow!("failed to compute unsealed sector CID; exit code: {}", e))
}

fn install_actor(&self, code_id: &Cid) -> Result<(), Error> {
fvm::actor::install_actor(code_id).map_err(|_| Error::msg("failed to install actor"))
}
}

#[cfg(not(feature = "fake-proofs"))]
Expand Down Expand Up @@ -430,10 +434,6 @@ where
Ok(false) | Err(_) => Err(Error::msg("invalid replica")),
}
}

fn install_actor(&self, code_id: &Cid) -> Result<(), Error> {
fvm::actor::install_actor(code_id).map_err(|_| Error::msg("failed to install actor"))
}
}

#[cfg(feature = "fake-proofs")]
Expand Down
4 changes: 2 additions & 2 deletions actors/runtime/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ pub trait Primitives {
signer: &Address,
plaintext: &[u8],
) -> Result<(), anyhow::Error>;

fn install_actor(&self, code_cid: &Cid) -> Result<(), anyhow::Error>;
}

/// filcrypto verification primitives provided by the runtime
Expand Down Expand Up @@ -230,6 +232,4 @@ pub trait Verifier {
) -> Result<(), anyhow::Error>;

fn verify_replica_update(&self, replica: &ReplicaUpdateInfo) -> Result<(), anyhow::Error>;

fn install_actor(&self, code_cid: &Cid) -> Result<(), anyhow::Error>;
}
8 changes: 4 additions & 4 deletions actors/runtime/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,10 @@ impl Primitives for MockRuntime {
}
Ok(exp.cid)
}

fn install_actor(&self, _code_cid: &Cid) -> anyhow::Result<(), anyhow::Error> {
Ok(())
}
}

impl Verifier for MockRuntime {
Expand Down Expand Up @@ -1181,10 +1185,6 @@ impl Verifier for MockRuntime {
);
exp.result
}

fn install_actor(&self, _code_cid: &Cid) -> anyhow::Result<(), anyhow::Error> {
Ok(())
}
}

impl RuntimePolicy for MockRuntime {
Expand Down
4 changes: 4 additions & 0 deletions test_vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@ impl Primitives for InvocationCtx<'_, '_> {
) -> Result<Cid, anyhow::Error> {
panic!("TODO implement me")
}

fn install_actor(&self, code_id: &Cid) -> Result<(), anyhow::Error> {
panic!("TODO implement me")
}
}

impl Verifier for InvocationCtx<'_, '_> {
Expand Down

0 comments on commit 1b039b8

Please sign in to comment.