Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for pluggable syscalls #1922

Merged
merged 12 commits into from
Nov 22, 2023
13 changes: 13 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions fvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ minstant = "0.1.2"
blake2b_simd = "1.0.0"
byteorder = "1.4.3"
static_assertions = "1.1.0"
ambassador = "0.3.5"

[dev-dependencies]
pretty_assertions = "1.3.0"
Expand Down
12 changes: 8 additions & 4 deletions fvm/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ use crate::machine::limiter::MemoryLimiter;
use crate::machine::{Machine, NetworkConfig};
use crate::syscalls::error::Abort;
use crate::syscalls::{
bind_syscalls, charge_for_exec, charge_for_init, record_init_time, update_gas_available,
InvocationData,
charge_for_exec, charge_for_init, record_init_time, update_gas_available, InvocationData,
};
use crate::Kernel;

Expand Down Expand Up @@ -514,10 +513,15 @@ impl Engine {
.expect("invalid instance cache entry"),
Vacant(e) => &mut *e
.insert({
let mut linker: Linker<InvocationData<K>> = Linker::new(&self.inner.engine);
let mut linker = Linker::new(&self.inner.engine);
linker.allow_shadowing(true);

bind_syscalls(&mut linker).map_err(Abort::Fatal)?;
store
.data()
.kernel
.bind_syscalls(&mut linker)
.map_err(Abort::Fatal)?;

Box::new(Cache { linker })
})
.downcast_mut()
Expand Down
1 change: 0 additions & 1 deletion fvm/src/gas/price_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,6 @@ impl PriceList {
}

/// Returns the gas required for installing an actor.
#[cfg(feature = "m2-native")]
pub fn on_install_actor(&self, wasm_size: usize) -> GasCharge {
GasCharge::new(
"OnInstallActor",
Expand Down
Loading