bump fluence-faas version (#193)

This commit is contained in:
Mike Voronov 2021-12-14 14:01:57 +03:00 committed by GitHub
parent 1141c8e42a
commit 9f91d3161f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 201 additions and 16 deletions

184
Cargo.lock generated
View File

@ -213,12 +213,12 @@ version = "0.1.0"
[[package]] [[package]]
name = "avm-server" name = "avm-server"
version = "0.11.1" version = "0.12.0"
dependencies = [ dependencies = [
"air-interpreter-interface", "air-interpreter-interface",
"avm-data-store", "avm-data-store",
"eyre", "eyre",
"fluence-faas", "fluence-faas 0.10.0",
"log", "log",
"maplit", "maplit",
"parking_lot 0.11.2", "parking_lot 0.11.2",
@ -303,6 +303,15 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytesize"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "cargo_toml" name = "cargo_toml"
version = "0.8.1" version = "0.8.1"
@ -593,6 +602,41 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "darling"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b"
dependencies = [
"darling_core",
"quote",
"syn",
]
[[package]] [[package]]
name = "diff" name = "diff"
version = "0.1.12" version = "0.1.12"
@ -724,7 +768,7 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01c66660de99826038c5ec4ad0f5dccf10b1c8a15924aeaa5315ab49d718bfc9" checksum = "01c66660de99826038c5ec4ad0f5dccf10b1c8a15924aeaa5315ab49d718bfc9"
dependencies = [ dependencies = [
"fluence-faas", "fluence-faas 0.9.3",
"log", "log",
"maplit", "maplit",
"serde", "serde",
@ -746,8 +790,8 @@ dependencies = [
"marine-module-interface", "marine-module-interface",
"marine-rs-sdk", "marine-rs-sdk",
"marine-rs-sdk-main", "marine-rs-sdk-main",
"marine-runtime", "marine-runtime 0.7.2",
"marine-utils", "marine-utils 0.2.0",
"safe-transmute", "safe-transmute",
"serde", "serde",
"serde_derive", "serde_derive",
@ -760,6 +804,34 @@ dependencies = [
"wasmer-wasi-fl", "wasmer-wasi-fl",
] ]
[[package]]
name = "fluence-faas"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bbb9c5b3178f6374e0b14f12fbfa661c7232b7567cdb65b3c718f1ff38ca597"
dependencies = [
"bytesize",
"cmd_lib",
"itertools 0.9.0",
"log",
"marine-module-interface",
"marine-rs-sdk",
"marine-rs-sdk-main",
"marine-runtime 0.8.0",
"marine-utils 0.3.0",
"safe-transmute",
"serde",
"serde_derive",
"serde_json",
"serde_with",
"thiserror",
"toml",
"wasmer-interface-types-fl",
"wasmer-runtime-core-fl",
"wasmer-runtime-fl",
"wasmer-wasi-fl",
]
[[package]] [[package]]
name = "fluence-it-types" name = "fluence-it-types"
version = "0.3.1" version = "0.3.1"
@ -773,6 +845,12 @@ dependencies = [
"wast", "wast",
] ]
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "fstrings" name = "fstrings"
version = "0.2.3" version = "0.2.3"
@ -918,6 +996,12 @@ version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "indenter" name = "indenter"
version = "0.3.3" version = "0.3.3"
@ -1256,12 +1340,42 @@ dependencies = [
"marine-it-parser", "marine-it-parser",
"marine-module-info-parser", "marine-module-info-parser",
"marine-module-interface", "marine-module-interface",
"marine-utils", "marine-utils 0.2.0",
"multimap", "multimap",
"once_cell", "once_cell",
"parity-wasm", "parity-wasm 0.41.0",
"paste", "paste",
"pwasm-utils", "pwasm-utils 0.12.0",
"semver 0.11.0",
"serde",
"thiserror",
"wasmer-interface-types-fl",
"wasmer-runtime-core-fl",
"wasmer-runtime-fl",
"wasmer-wasi-fl",
]
[[package]]
name = "marine-runtime"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be19d5b67f04a8ad65f334a4382b15156a3e130e41c58ea44ba9f95f9966bbaa"
dependencies = [
"anyhow",
"boolinator",
"it-lilo",
"log",
"marine-it-generator",
"marine-it-interfaces",
"marine-it-parser",
"marine-module-info-parser",
"marine-module-interface",
"marine-utils 0.3.0",
"multimap",
"once_cell",
"parity-wasm 0.42.2",
"paste",
"pwasm-utils 0.18.2",
"semver 0.11.0", "semver 0.11.0",
"serde", "serde",
"thiserror", "thiserror",
@ -1287,6 +1401,12 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dc5838acba84ce4d802d672afd0814fae0ae7098021ae5b06d975e70d09f812" checksum = "8dc5838acba84ce4d802d672afd0814fae0ae7098021ae5b06d975e70d09f812"
[[package]]
name = "marine-utils"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a227f549086e34de1d9d4d1f21823eacdce55839a85fc44a2dfb9f244f3fdcc"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.4.1" version = "2.4.1"
@ -1426,6 +1546,12 @@ version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865"
[[package]]
name = "parity-wasm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.10.2" version = "0.10.2"
@ -1593,7 +1719,18 @@ checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"log", "log",
"parity-wasm", "parity-wasm 0.41.0",
]
[[package]]
name = "pwasm-utils"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "880b3384fb00b8f6ecccd5d358b93bd2201900ae3daad213791d1864f6441f5c"
dependencies = [
"byteorder",
"log",
"parity-wasm 0.42.2",
] ]
[[package]] [[package]]
@ -1848,6 +1985,29 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_with"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3"
dependencies = [
"rustversion",
"serde",
"serde_with_macros",
]
[[package]]
name = "serde_with_macros"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "siphasher" name = "siphasher"
version = "0.3.7" version = "0.3.7"
@ -1879,6 +2039,12 @@ dependencies = [
"precomputed-hash", "precomputed-hash",
] ]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.21.0" version = "0.21.0"

View File

@ -1,7 +1,7 @@
[package] [package]
name = "avm-server" name = "avm-server"
description = "Fluence AIR VM" description = "Fluence AIR VM"
version = "0.11.1" version = "0.12.0"
authors = ["Fluence Labs"] authors = ["Fluence Labs"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
@ -18,7 +18,7 @@ path = "src/lib.rs"
[dependencies] [dependencies]
air-interpreter-interface = { version = "0.7.0", path = "../../crates/air-lib/interpreter-interface" } air-interpreter-interface = { version = "0.7.0", path = "../../crates/air-lib/interpreter-interface" }
avm-data-store = { version = "0.1.0", path = "../../crates/data-store" } avm-data-store = { version = "0.1.0", path = "../../crates/data-store" }
fluence-faas = "0.9.3" fluence-faas = "0.10.0"
polyplets = { version = "0.2.0", path = "../../crates/air-lib/polyplets" } polyplets = { version = "0.2.0", path = "../../crates/air-lib/polyplets" }
eyre = "0.6.5" eyre = "0.6.5"

View File

@ -55,13 +55,14 @@ impl<E> AVM<E> {
let AVMConfig { let AVMConfig {
air_wasm_path, air_wasm_path,
current_peer_id, current_peer_id,
max_heap_size,
logging_mask, logging_mask,
mut data_store, mut data_store,
} = config; } = config;
data_store.initialize()?; data_store.initialize()?;
let runner = AVMRunner::new(air_wasm_path, current_peer_id, logging_mask) let runner = AVMRunner::new(air_wasm_path, current_peer_id, max_heap_size, logging_mask)
.map_err(AVMError::RunnerError)?; .map_err(AVMError::RunnerError)?;
let runner = SendSafeRunner(runner); let runner = SendSafeRunner(runner);
let avm = Self { runner, data_store }; let avm = Self { runner, data_store };

View File

@ -25,6 +25,9 @@ pub struct AVMConfig<E> {
/// Current peer id. /// Current peer id.
pub current_peer_id: String, pub current_peer_id: String,
/// Maximum heap size in bytes available for the interpreter.
pub max_heap_size: Option<u64>,
/// Mask used to filter logs, for details see `log_utf8_string` in fluence-faas. /// Mask used to filter logs, for details see `log_utf8_string` in fluence-faas.
pub logging_mask: i32, pub logging_mask: i32,

View File

@ -39,11 +39,12 @@ impl AVMRunner {
pub fn new( pub fn new(
air_wasm_path: PathBuf, air_wasm_path: PathBuf,
current_peer_id: impl Into<String>, current_peer_id: impl Into<String>,
max_heap_size: Option<u64>,
logging_mask: i32, logging_mask: i32,
) -> RunnerResult<Self> { ) -> RunnerResult<Self> {
let (wasm_dir, wasm_filename) = split_dirname(air_wasm_path)?; let (wasm_dir, wasm_filename) = split_dirname(air_wasm_path)?;
let faas_config = make_faas_config(wasm_dir, &wasm_filename, logging_mask); let faas_config = make_faas_config(wasm_dir, &wasm_filename, max_heap_size, logging_mask);
let faas = FluenceFaaS::with_raw_config(faas_config)?; let faas = FluenceFaaS::with_raw_config(faas_config)?;
let current_peer_id = current_peer_id.into(); let current_peer_id = current_peer_id.into();
@ -149,9 +150,15 @@ fn split_dirname(path: PathBuf) -> RunnerResult<(PathBuf, String)> {
Ok((path, file_name)) Ok((path, file_name))
} }
fn make_faas_config(air_wasm_dir: PathBuf, air_wasm_file: &str, logging_mask: i32) -> FaaSConfig { fn make_faas_config(
air_wasm_dir: PathBuf,
air_wasm_file: &str,
max_heap_size: Option<u64>,
logging_mask: i32,
) -> FaaSConfig {
let air_module_config = fluence_faas::FaaSModuleConfig { let air_module_config = fluence_faas::FaaSModuleConfig {
mem_pages_count: None, mem_pages_count: None,
max_heap_size,
logger_enabled: true, logger_enabled: true,
host_imports: <_>::default(), host_imports: <_>::default(),
wasi: None, wasi: None,

View File

@ -21,6 +21,9 @@ use std::collections::HashMap;
use std::collections::HashSet; use std::collections::HashSet;
use std::path::PathBuf; use std::path::PathBuf;
// 10 Mb
const AVM_MAX_HEAP_SIZE: u64 = 10 * 1024 * 1024;
pub struct TestRunner { pub struct TestRunner {
pub runner: AVMRunner, pub runner: AVMRunner,
pub call_service: CallServiceClosure, pub call_service: CallServiceClosure,
@ -84,8 +87,13 @@ pub fn create_avm(
let current_peer_id = current_peer_id.into(); let current_peer_id = current_peer_id.into();
let logging_mask = i32::MAX; let logging_mask = i32::MAX;
let runner = let runner = AVMRunner::new(
AVMRunner::new(air_wasm_path, current_peer_id, logging_mask).expect("vm should be created"); air_wasm_path,
current_peer_id,
Some(AVM_MAX_HEAP_SIZE),
logging_mask,
)
.expect("vm should be created");
TestRunner { TestRunner {
runner, runner,
call_service, call_service,