Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
40 changes: 22 additions & 18 deletions Cargo.lock

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

43 changes: 28 additions & 15 deletions contracts/Cargo.lock

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

16 changes: 8 additions & 8 deletions crates/runtime/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct CachedModule {

impl CachedModule {
/// Constructs a cache entry for the given strategy and import linker, optionally pre-populating stores.
pub fn new(strategy: Strategy, import_linker: Rc<ImportLinker>) -> Self {
pub fn new(strategy: Strategy, import_linker: Arc<ImportLinker>) -> Self {
let mut stores = LinkedList::new();
for _ in 0..N_DEFAULT_CACHED_STORE {
let store = strategy.create_store(
Expand Down Expand Up @@ -64,7 +64,7 @@ pub struct RuntimeFactory {
/// Suspended runtimes keyed by per-transaction call identifier.
pub recoverable_runtimes: HashMap<u32, Runtime>,
/// Import linker used to instantiate new stores.
pub import_linker: Rc<ImportLinker>,
pub import_linker: Arc<ImportLinker>,
/// Monotonically increasing counter for assigning call identifiers.
pub transaction_call_id_counter: u32,
}
Expand Down Expand Up @@ -111,7 +111,7 @@ impl RuntimeFactory {
println!("missing strategy: code_hash={code_hash} address={address}");

let _span = tracing::info_span!("parse_rwasm_module").entered();
let rwasm_module = Rc::new(RwasmModule::new_or_empty(rwasm_module.as_ref()).0);
let (rwasm_module, _) = RwasmModule::new_or_empty(rwasm_module.as_ref());
drop(_span);

#[cfg(feature = "wasmtime")]
Expand All @@ -128,9 +128,9 @@ impl RuntimeFactory {
#[tracing::instrument(level = "info", skip_all, fields(code_hash = %code_hash))]
/// Initializes a Wasmtime-based strategy for the given module and inserts it into the cache.
fn init_wasmtime(
import_linker: Rc<ImportLinker>,
import_linker: Arc<ImportLinker>,
entry: VacantEntry<B256, CachedModule>,
rwasm_module: Rc<RwasmModule>,
rwasm_module: RwasmModule,
#[allow(unused)] code_hash: B256,
) -> &mut CachedModule {
// The lock helps to avoid recompiling same wasmtime modules,
Expand All @@ -150,17 +150,17 @@ impl RuntimeFactory {
.expect("failed to compile wasmtime module, this should never happen");

let strategy = Strategy::Wasmtime {
module: Rc::new(wasmtime_module),
module: wasmtime_module,
};
let cached_module = CachedModule::new(strategy, import_linker);
entry.insert(cached_module)
}

#[tracing::instrument(level = "info", skip_all, fields(code_hash = %code_hash))]
fn init_rwasm(
import_linker: Rc<ImportLinker>,
import_linker: Arc<ImportLinker>,
entry: VacantEntry<B256, CachedModule>,
rwasm_module: Rc<RwasmModule>,
rwasm_module: RwasmModule,
#[allow(unused)] code_hash: B256,
) -> &mut CachedModule {
let strategy = Strategy::Rwasm {
Expand Down
6 changes: 3 additions & 3 deletions crates/types/src/import_linker.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{emit_fuel_procedure, SysFuncIdx};
use alloc::rc::Rc;
use alloc::sync::Arc;
use rwasm::{ImportLinker, ImportName, ValType};

pub fn import_linker_v1_preview() -> Rc<ImportLinker> {
pub fn import_linker_v1_preview() -> Arc<ImportLinker> {
let mut import_linker = ImportLinker::default();
macro_rules! import_function {
($func_name:literal, $sys_func_idx:ident, $params:expr, $results:expr $(,)?) => {
Expand Down Expand Up @@ -202,5 +202,5 @@ pub fn import_linker_v1_preview() -> Rc<ImportLinker> {
&[]
);

Rc::new(import_linker)
Arc::new(import_linker)
}
6 changes: 3 additions & 3 deletions e2e/src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use fluentbase_sdk::{
use fluentbase_testing::{EvmTestingContext, TxBuilder};
use hex_literal::hex;
use revm::context::result::{ExecutionResult, Output};
use rwasm::{instruction_set, RwasmModule};
use rwasm::{instruction_set, RwasmModule, RwasmModuleInner};

#[test]
fn test_simple_nested_call() {
Expand Down Expand Up @@ -124,7 +124,7 @@ fn test_simple_nested_call() {
};
ctx.add_wasm_contract(
ACCOUNT3_ADDRESS,
RwasmModule {
RwasmModuleInner {
code_section,
data_section,
..Default::default()
Expand Down Expand Up @@ -300,7 +300,7 @@ fn test_blended_gas_spend_evm_from_wasm() {
};
ctx.add_wasm_contract(
ACCOUNT3_ADDRESS,
RwasmModule {
RwasmModuleInner {
code_section,
data_section,
..Default::default()
Expand Down
4 changes: 2 additions & 2 deletions evm-e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ ctor = "0.5.0"
fluentbase-genesis = { path = "../crates/genesis", default-features = false }
fluentbase-contracts = { path = "../crates/contracts", default-features = false }
fluentbase-types = { path = "../crates/types", default-features = false }
rwasm = { git = "https://github.com/fluentlabs-xyz/rwasm", branch = "devel" }
#rwasm = { path = "../rwasm", default-features = false }
rwasm = { git = "https://github.com/fluentlabs-xyz/rwasm", branch = "devel", features = ["wasmtime"] }
#rwasm = { path = "../../rwasm", default-features = false, features = ["wasmtime"] }

[features]
default = [
Expand Down
Loading
Loading