Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 132 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ similar = "2"
slotmap = "1"
smallvec = "1"
smart-default = "0.7"
spire_enum = "1"
stacker = "0.1"
static_assertions = "1"
statrs = "0.18"
Expand Down Expand Up @@ -254,7 +255,7 @@ predicates = "3"
proc-macro2 = { version = "1", default-features = false, features = ["span-locations"] }
quickcheck = "1"
quickcheck_macros = "1"
ra_ap_syntax = "0.0.315"
ra_ap_syntax = "0.0.316"
regex-automata = "0.4"
serial_test = "3"
syn = { version = "2", default-features = false, features = ["full", "parsing", "visit", "printing", "extra-traits"] }
Expand Down
8 changes: 3 additions & 5 deletions src/interpreter/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use fvm4::{
},
};
use num::Zero;
use spire_enum::prelude::delegated_enum;
use std::time::{Duration, Instant};

pub(in crate::interpreter) type ForestMachineV2<DB> =
Expand Down Expand Up @@ -139,6 +140,7 @@ impl BlockMessages {

/// Interpreter which handles execution of state transitioning messages and
/// returns receipts from the VM execution.
#[delegated_enum(impl_conversions)]
pub enum VM<DB: Blockstore + Send + Sync + 'static> {
VM2(ForestExecutorV2<DB>),
VM3(ForestExecutorV3<DB>),
Expand Down Expand Up @@ -272,11 +274,7 @@ where

/// Flush stores in VM and return state root.
pub fn flush(&mut self) -> anyhow::Result<Cid> {
match self {
VM::VM2(fvm_executor) => Ok(fvm_executor.flush()?),
VM::VM3(fvm_executor) => Ok(fvm_executor.flush()?),
VM::VM4(fvm_executor) => Ok(fvm_executor.flush()?),
}
Ok(delegate_vm!(self.flush()?))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to my understanding, we can avoid the declarative macro via #[delegate_impl], no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried #[delegate_impl] but it does not compile. According to the doc, #[delegate_impl] is used for trait impls.
https://docs.rs/spire_enum/1.0.0/spire_enum/index.html#2-delegate_impl-inherenttrait-impl-attribute-macro

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, indeed. I wonder if VM should've been a trait. Something to consider in the future, but outside of the scope of this PR.

}

/// Get actor state from an address. Will be resolved to ID address.
Expand Down
Loading
Loading