Skip to content

Commit

Permalink
move rest of crypto syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
fridrik01 committed Nov 20, 2023
1 parent 40cfa18 commit a4f8261
Show file tree
Hide file tree
Showing 13 changed files with 649 additions and 630 deletions.
5 changes: 2 additions & 3 deletions fvm/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::syscalls::error::Abort;
use crate::syscalls::{
charge_for_exec, charge_for_init, record_init_time, update_gas_available, InvocationData,
};
use crate::{kernel, Kernel};
use crate::Kernel;

use self::concurrency::EngineConcurrency;
use self::instance_pool::InstancePool;
Expand Down Expand Up @@ -513,8 +513,7 @@ impl Engine {
.expect("invalid instance cache entry"),
Vacant(e) => &mut *e
.insert({
let mut linker: Linker<InvocationData<<K as kernel::Kernel>::Kernel>> =
Linker::new(&self.inner.engine);
let mut linker = Linker::new(&self.inner.engine);
linker.allow_shadowing(true);

store
Expand Down
14 changes: 7 additions & 7 deletions fvm/src/executor/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ use crate::trace::ExecutionTrace;
pub struct DefaultExecutor<K: Kernel> {
engine_pool: EnginePool,
// If the inner value is `None` it means the machine got poisoned and is unusable.
machine: Option<<<K as Kernel>::CallManager as CallManager>::Machine>,
machine: Option<<K::CallManager as CallManager>::Machine>,
}

impl<K: Kernel> Deref for DefaultExecutor<K> {
type Target = <<K as Kernel>::CallManager as CallManager>::Machine;
type Target = <K::CallManager as CallManager>::Machine;

fn deref(&self) -> &Self::Target {
self.machine.as_ref().expect("machine poisoned")
Expand Down Expand Up @@ -101,7 +101,7 @@ where
// Apply the message.
let ret = self.map_machine(|machine| {
// We're processing a chain message, so the sender is the origin of the call stack.
let mut cm = <K as Kernel>::CallManager::new(
let mut cm = K::CallManager::new(
machine,
engine,
msg.gas_limit,
Expand Down Expand Up @@ -298,7 +298,7 @@ where
/// Create a new [`DefaultExecutor`] for executing messages on the [`Machine`].
pub fn new(
engine_pool: EnginePool,
machine: <<K as Kernel>::CallManager as CallManager>::Machine,
machine: <K::CallManager as CallManager>::Machine,
) -> anyhow::Result<Self> {
// Skip preloading all builtin actors when testing.
#[cfg(not(any(test, feature = "testing")))]
Expand All @@ -320,7 +320,7 @@ where

/// Consume consumes the executor and returns the Machine. If the Machine had
/// been poisoned during execution, the Option will be None.
pub fn into_machine(self) -> Option<<<K as Kernel>::CallManager as CallManager>::Machine> {
pub fn into_machine(self) -> Option<<K::CallManager as CallManager>::Machine> {
self.machine
}

Expand Down Expand Up @@ -535,8 +535,8 @@ where
fn map_machine<F, T>(&mut self, f: F) -> T
where
F: FnOnce(
<<K as Kernel>::CallManager as CallManager>::Machine,
) -> (T, <<K as Kernel>::CallManager as CallManager>::Machine),
<K::CallManager as CallManager>::Machine,
) -> (T, <K::CallManager as CallManager>::Machine),
{
replace_with::replace_with_and_return(
&mut self.machine,
Expand Down
Loading

0 comments on commit a4f8261

Please sign in to comment.