Rename stepper to interpreter (#67)

This commit is contained in:
vms 2021-02-17 23:36:36 +03:00 committed by GitHub
parent 271156b5fc
commit e5244db6a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
92 changed files with 284 additions and 189 deletions

View File

@ -22,11 +22,11 @@ jobs:
cargo install fcli cargo install fcli
# build a Wasm binary for stepper # build a Wasm binary for interpreter
(cd stepper; fce build --features fce) (cd interpreter; fce build --features fce)
# build Wasm binaries for tests # build Wasm binaries for tests
(cd stepper-lib/tests/; ./build_test_binaries.sh) (cd interpreter-lib/tests/; ./build_test_binaries.sh)
cargo fmt --all -- --check --color always cargo fmt --all -- --check --color always
cargo check cargo check

View File

@ -36,7 +36,7 @@ jobs:
command: update command: update
- name: fce build --release - name: fce build --release
working-directory: ./stepper working-directory: ./interpreter
shell: bash shell: bash
run: fce build --release --features fce run: fce build --release --features fce

View File

@ -64,11 +64,11 @@ jobs:
# JQ version regex pattern # JQ version regex pattern
PAT="\\\\d+.\\\\d+.\\\\d+" PAT="\\\\d+.\\\\d+.\\\\d+"
STEPPER_CARGO_TOML="stepper/Cargo.toml" STEPPER_CARGO_TOML="interpreter/Cargo.toml"
CARGO_TOML="crates/air-interpreter-wasm/Cargo.toml" CARGO_TOML="crates/air-interpreter-wasm/Cargo.toml"
# get package name from Cargo.toml # get package name from Cargo.toml
RS_PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")" RS_PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")"
JS_PKG_NAME="@fluencelabs/aquamarine-stepper" JS_PKG_NAME="@fluencelabs/aquamarine-interpreter"
# get version from Cargo.toml # get version from Cargo.toml
STEPPER_RUST_VERSION="$(toml get "$STEPPER_CARGO_TOML" package.version | tr -d \")" STEPPER_RUST_VERSION="$(toml get "$STEPPER_CARGO_TOML" package.version | tr -d \")"
@ -97,7 +97,7 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Build aquamarine.wasm for JS clients - name: Build aquamarine.wasm for JS clients
run: wasm-pack build $GITHUB_WORKSPACE/stepper --no-typescript --release -d $(pwd)/pkg run: wasm-pack build $GITHUB_WORKSPACE/interpreter --no-typescript --release -d $(pwd)/pkg
- name: Generate aquamarine.wasm.base64.js - name: Generate aquamarine.wasm.base64.js
run: | run: |
@ -105,7 +105,7 @@ jobs:
module.exports = "$(base64 -w0 pkg/aquamarine_client_bg.wasm)"; module.exports = "$(base64 -w0 pkg/aquamarine_client_bg.wasm)";
EOF EOF
### Generate index files so import works as: | import {wasmBs64} from "@fluencelabs/aquamarine-stepper"; | ### Generate index files so import works as: | import {wasmBs64} from "@fluencelabs/aquamarine-interpreter"; |
- name: Generate index.js & index.d.ts - name: Generate index.js & index.d.ts
run: | run: |
cat << EOF > index.js cat << EOF > index.js
@ -175,7 +175,7 @@ jobs:
- name: Build aquamarine.wasm for node - name: Build aquamarine.wasm for node
run: fce build --release -p aquamarine --features fce run: fce build --release -p aquamarine --features fce
working-directory: stepper working-directory: interpreter
- name: Copy aquamarine.wasm to air-interpreter-wasm - name: Copy aquamarine.wasm to air-interpreter-wasm
run: cp target/wasm32-wasi/release/aquamarine.wasm crates/air-interpreter-wasm/aquamarine.wasm run: cp target/wasm32-wasi/release/aquamarine.wasm crates/air-interpreter-wasm/aquamarine.wasm

View File

@ -79,7 +79,7 @@ jobs:
# get package name from Cargo.toml # get package name from Cargo.toml
PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")" PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")"
JS_PKG_NAME="@fluencelabs/aquamarine-stepper" JS_PKG_NAME="@fluencelabs/aquamarine-interpreter"
### NPM ### NPM
# take all versions from npm and replace single quotes with double quotes # take all versions from npm and replace single quotes with double quotes
@ -120,7 +120,7 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Build aquamarine.wasm for JS clients - name: Build aquamarine.wasm for JS clients
run: wasm-pack build $GITHUB_WORKSPACE/stepper --no-typescript --release -d $(pwd)/pkg run: wasm-pack build $GITHUB_WORKSPACE/interpreter --no-typescript --release -d $(pwd)/pkg
- name: Generate aquamarine.wasm.base64.js - name: Generate aquamarine.wasm.base64.js
run: | run: |
@ -128,7 +128,7 @@ jobs:
module.exports = "$(base64 -w0 pkg/aquamarine_client_bg.wasm)"; module.exports = "$(base64 -w0 pkg/aquamarine_client_bg.wasm)";
EOF EOF
### Generate index files so import works as: | import {wasmBs64} from "@fluencelabs/aquamarine-stepper"; | ### Generate index files so import works as: | import {wasmBs64} from "@fluencelabs/aquamarine-interpreter"; |
- name: Generate index.js & index.d.ts - name: Generate index.js & index.d.ts
run: | run: |
cat << EOF > index.js cat << EOF > index.js
@ -201,7 +201,7 @@ jobs:
- name: Build aquamarine.wasm for node - name: Build aquamarine.wasm for node
run: fce build -p aquamarine --release --features fce run: fce build -p aquamarine --release --features fce
working-directory: stepper working-directory: interpreter
- name: Copy aquamarine.wasm to air-interpreter-wasm - name: Copy aquamarine.wasm to air-interpreter-wasm
run: cp target/wasm32-wasi/release/aquamarine.wasm crates/air-interpreter-wasm/aquamarine.wasm run: cp target/wasm32-wasi/release/aquamarine.wasm crates/air-interpreter-wasm/aquamarine.wasm

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
.idea/ .idea/
**/target **/target
stepper-lib/target interpreter-lib/target
.DS_Store .DS_Store
.repl_history .repl_history
*.wasm *.wasm

View File

@ -13,7 +13,7 @@
- Added new data format ([PR 12](https://github.com/fluencelabs/aquamarine/pull/12)): - Added new data format ([PR 12](https://github.com/fluencelabs/aquamarine/pull/12)):
- previously data was a hashmap with variable names to values, and now it is call evidence path that contains call and par evidence states - previously data was a hashmap with variable names to values, and now it is call evidence path that contains call and par evidence states
- logger is refactored and supports now several log targets - logger is refactored and supports now several log targets
- stepper decoupled into two crates: `stepper-lib` and `stepper`. To build it for the FCE target the `fce` feature should be specified (`fce build --features fce`) - interpreter decoupled into two crates: `interpreter-lib` and `interpreter`. To build it for the FCE target the `fce` feature should be specified (`fce build --features fce`)
## Version 0.1.1 (2020-10-23) ## Version 0.1.1 (2020-10-23)

189
Cargo.lock generated
View File

@ -41,6 +41,26 @@ version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
[[package]]
name = "aqua-interpreter-interface"
version = "0.3.1"
dependencies = [
"fluence",
"fluence-it-types",
"serde",
]
[[package]]
name = "aqua-interpreter-interface"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c49b8a5fe1336a9c6981be09cb13706c7d9083e48588d692120b5080a13278"
dependencies = [
"fluence",
"fluence-it-types",
"serde",
]
[[package]] [[package]]
name = "aqua-test-module" name = "aqua-test-module"
version = "0.1.0" version = "0.1.0"
@ -59,29 +79,29 @@ dependencies = [
[[package]] [[package]]
name = "aquamarine" name = "aquamarine"
version = "0.5.0" version = "0.6.0"
dependencies = [ dependencies = [
"fluence", "fluence",
"interpreter-lib",
"log", "log",
"serde", "serde",
"serde_json", "serde_json",
"stepper-lib",
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]] [[package]]
name = "aquamarine-vm" name = "aquamarine-vm"
version = "0.1.29" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef719bebed9bf1a31ea528f677d891e914437924e7fc4f9fb3139b0e8cbadba3" checksum = "170e51ff427660612f237ce4d3e4fd28218f080e97fcfc23ebd587bdac3379fa"
dependencies = [ dependencies = [
"fluence-faas", "aqua-interpreter-interface 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fluence-faas 0.2.0",
"log", "log",
"maplit", "maplit",
"parking_lot 0.11.1", "parking_lot 0.11.1",
"serde", "serde",
"serde_json", "serde_json",
"stepper-interface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -641,9 +661,33 @@ checksum = "9deb5e4f0e1533694ffbfd3644b8047ae41e8098165cdf5934a60b71f82e30c9"
dependencies = [ dependencies = [
"boolinator", "boolinator",
"fce-utils", "fce-utils",
"fce-wit-generator", "fce-wit-generator 0.1.30",
"fce-wit-interfaces", "fce-wit-interfaces",
"fce-wit-parser", "fce-wit-parser 0.1.29",
"log",
"multi-map",
"multimap",
"parity-wasm",
"pwasm-utils",
"safe-transmute",
"serde",
"wasmer-interface-types-fl",
"wasmer-runtime-core-fl",
"wasmer-runtime-fl",
"wasmer-wasi-fl",
]
[[package]]
name = "fce"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54e680149a26e9b74a140a143d624c1fe83f6a9d28daf8a12b2bdba261343a71"
dependencies = [
"boolinator",
"fce-utils",
"fce-wit-generator 0.2.0",
"fce-wit-interfaces",
"fce-wit-parser 0.2.0",
"log", "log",
"multi-map", "multi-map",
"multimap", "multimap",
@ -669,7 +713,22 @@ version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e19c183d232092a59aeaa4f22212699b3da2acf0bcc5329a9de2a7bb7aa9f87" checksum = "4e19c183d232092a59aeaa4f22212699b3da2acf0bcc5329a9de2a7bb7aa9f87"
dependencies = [ dependencies = [
"fce-wit-parser", "fce-wit-parser 0.1.29",
"fluence-sdk-wit",
"once_cell",
"serde",
"serde_json",
"walrus",
"wasmer-interface-types-fl",
]
[[package]]
name = "fce-wit-generator"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1eca715cf832f99fd59dae4f639e4437e5ac92a4470e0879624049f6cb1a3910"
dependencies = [
"fce-wit-parser 0.2.0",
"fluence-sdk-wit", "fluence-sdk-wit",
"once_cell", "once_cell",
"serde", "serde",
@ -702,6 +761,20 @@ dependencies = [
"wasmer-runtime-core-fl", "wasmer-runtime-core-fl",
] ]
[[package]]
name = "fce-wit-parser"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f59267a5533d352406b7203eee4b9fe918f4671f2f66a990cab9632f528c952"
dependencies = [
"anyhow",
"fce-wit-interfaces",
"serde",
"walrus",
"wasmer-interface-types-fl",
"wasmer-runtime-core-fl",
]
[[package]] [[package]]
name = "fixedbitset" name = "fixedbitset"
version = "0.2.0" version = "0.2.0"
@ -724,7 +797,7 @@ version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fb49d32cad551606cc6ef324b93b0079e7f7f8a54be15176a314098028195cb" checksum = "2fb49d32cad551606cc6ef324b93b0079e7f7f8a54be15176a314098028195cb"
dependencies = [ dependencies = [
"fluence-faas", "fluence-faas 0.1.30",
"log", "log",
"maplit", "maplit",
"serde", "serde",
@ -741,7 +814,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a74511b8a8fc16e3cb3749631824b90f89cecb742cbbaf4e467a0873e34a5a53" checksum = "a74511b8a8fc16e3cb3749631824b90f89cecb742cbbaf4e467a0873e34a5a53"
dependencies = [ dependencies = [
"cmd_lib", "cmd_lib",
"fce", "fce 0.1.30",
"fce-utils", "fce-utils",
"fluence-sdk-main", "fluence-sdk-main",
"itertools 0.9.0", "itertools 0.9.0",
@ -757,6 +830,30 @@ dependencies = [
"wasmer-wasi-fl", "wasmer-wasi-fl",
] ]
[[package]]
name = "fluence-faas"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0696945762ee0d5ed97537bdd0fa1c71957fc23794074ae035d428e90bedae5"
dependencies = [
"cmd_lib",
"fce 0.2.0",
"fce-utils",
"fluence-sdk-main",
"itertools 0.9.0",
"log",
"safe-transmute",
"serde",
"serde_derive",
"serde_json",
"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.1.1" version = "0.1.1"
@ -974,6 +1071,31 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "interpreter-lib"
version = "0.6.0"
dependencies = [
"air-parser",
"aqua-interpreter-interface 0.3.1",
"aqua-test-utils",
"boolinator",
"criterion",
"csv",
"env_logger",
"fluence",
"fluence-app-service",
"jsonpath_lib-fl",
"log",
"maplit",
"once_cell",
"polyplets",
"pretty_assertions",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
]
[[package]] [[package]]
name = "inventory" name = "inventory"
version = "0.1.10" version = "0.1.10"
@ -1673,51 +1795,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "stepper-interface"
version = "0.1.2"
dependencies = [
"fluence",
"fluence-it-types",
"serde",
]
[[package]]
name = "stepper-interface"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95bde63566205ba83b6f55a61a1481a6c2a94fbac9d22d280f68232aab326d27"
dependencies = [
"fluence",
"fluence-it-types",
"serde",
]
[[package]]
name = "stepper-lib"
version = "0.5.0"
dependencies = [
"air-parser",
"aqua-test-utils",
"boolinator",
"criterion",
"csv",
"env_logger",
"fluence",
"fluence-app-service",
"jsonpath_lib-fl",
"log",
"maplit",
"once_cell",
"polyplets",
"pretty_assertions",
"serde",
"serde_json",
"stepper-interface 0.1.2",
"thiserror",
"wasm-bindgen",
]
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.8.1" version = "0.8.1"

View File

@ -2,17 +2,17 @@
members = [ members = [
"crates/air-parser", "crates/air-parser",
"crates/polyplets", "crates/polyplets",
"crates/stepper-interface", "crates/interpreter-interface",
"crates/test-module", "crates/test-module",
"crates/test-utils", "crates/test-utils",
"stepper", "interpreter",
"stepper-lib" "interpreter-lib"
] ]
exclude = [ exclude = [
"crates/air-interpreter-wasm", "crates/air-interpreter-wasm",
"stepper-lib/tests/security_tetraplets/auth_module", "interpreter-lib/tests/security_tetraplets/auth_module",
"stepper-lib/tests/security_tetraplets/log_storage", "interpreter-lib/tests/security_tetraplets/log_storage",
] ]
[profile.release] [profile.release]

View File

@ -1,5 +1,5 @@
[![crates.io version](https://img.shields.io/crates/v/air-interpreter-wasm?style=flat-square)](https://crates.io/crates/air-interpreter-wasm) [![crates.io version](https://img.shields.io/crates/v/air-interpreter-wasm?style=flat-square)](https://crates.io/crates/air-interpreter-wasm)
[![npm version](https://img.shields.io/npm/v/@fluencelabs/aquamarine-stepper)](https://www.npmjs.com/package/@fluencelabs/aquamarine-stepper) [![npm version](https://img.shields.io/npm/v/@fluencelabs/aquamarine-interpreter)](https://www.npmjs.com/package/@fluencelabs/aquamarine-interpreter)
# Aquamarine # Aquamarine

View File

@ -2,7 +2,7 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] [[package]]
name = "air-interpreter-wasm" name = "air-interpreter-wasm"
version = "0.0.8" version = "0.1.0"
dependencies = [ dependencies = [
"built", "built",
] ]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "air-interpreter-wasm" name = "air-interpreter-wasm"
version = "0.0.8" version = "0.1.0"
authors = ["Fluence Labs"] authors = ["Fluence Labs"]
description = "Distribution of AIR interpreter as .wasm" description = "Distribution of AIR interpreter as .wasm"
license = "Apache-2.0" license = "Apache-2.0"

View File

@ -152,7 +152,8 @@ fn parse_deep(c: &mut Criterion) {
fn parse_dashboard_script(c: &mut Criterion) { fn parse_dashboard_script(c: &mut Criterion) {
let parser = Rc::new(AIRParser::new()); let parser = Rc::new(AIRParser::new());
const DASHBOARD_SCRIPT: &str = include_str!("../../../stepper-lib/tests/scripts/dashboard.clj"); const DASHBOARD_SCRIPT: &str =
include_str!("../../../interpreter-lib/tests/scripts/dashboard.clj");
c.bench_function( c.bench_function(
format!("parse {} bytes", DASHBOARD_SCRIPT.len()).as_str(), format!("parse {} bytes", DASHBOARD_SCRIPT.len()).as_str(),

View File

@ -1,13 +1,13 @@
[package] [package]
name = "stepper-interface" name = "aqua-interpreter-interface"
description = "Interface of the Aquamarine stepper" description = "Interface of the Aquamarine interpreter"
version = "0.1.2" version = "0.3.1"
authors = ["Fluence Labs"] authors = ["Fluence Labs"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"
[lib] [lib]
name = "stepper_interface" name = "aqua_interpreter_interface"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]

View File

@ -20,19 +20,19 @@ use fluence_it_types::IValue;
use serde::Deserialize; use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
pub const STEPPER_SUCCESS: i32 = 0; pub const INTERPRETER_SUCCESS: i32 = 0;
/// Describes a result returned at the end of the stepper execution. /// Describes a result returned at the end of the interpreter execution.
#[fce] #[fce]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct StepperOutcome { pub struct InterpreterOutcome {
/// A return code, where STEPPER_SUCCESS means success. /// A return code, where INTERPRETER_SUCCESS means success.
pub ret_code: i32, pub ret_code: i32,
/// Contains error message if ret_code != STEPPER_SUCCESS. /// Contains error message if ret_code != INTERPRETER_SUCCESS.
pub error_message: String, pub error_message: String,
/// Contains script data that should be preserved in an executor of this stepper /// Contains script data that should be preserved in an executor of this interpreter
/// regardless of ret_code value. /// regardless of ret_code value.
pub data: Vec<u8>, pub data: Vec<u8>,
@ -40,19 +40,24 @@ pub struct StepperOutcome {
pub next_peer_pks: Vec<String>, pub next_peer_pks: Vec<String>,
} }
impl StepperOutcome { impl InterpreterOutcome {
pub fn from_ivalues(mut ivalues: Vec<IValue>) -> Result<Self, String> { pub fn from_ivalues(mut ivalues: Vec<IValue>) -> Result<Self, String> {
const OUTCOME_FIELDS_COUNT: usize = 4; const OUTCOME_FIELDS_COUNT: usize = 4;
let record_values = match ivalues.remove(0) { let record_values = match ivalues.remove(0) {
IValue::Record(record_values) => record_values, IValue::Record(record_values) => record_values,
v => return Err(format!("expected record for StepperOutcome, got {:?}", v)), v => {
return Err(format!(
"expected record for InterpreterOutcome, got {:?}",
v
))
}
}; };
let mut record_values = record_values.into_vec(); let mut record_values = record_values.into_vec();
if record_values.len() != OUTCOME_FIELDS_COUNT { if record_values.len() != OUTCOME_FIELDS_COUNT {
return Err(format!( return Err(format!(
"expected StepperOutcome struct with {} fields, got {:?}", "expected InterpreterOutcome struct with {} fields, got {:?}",
OUTCOME_FIELDS_COUNT, record_values OUTCOME_FIELDS_COUNT, record_values
)); ));
} }

View File

@ -11,5 +11,5 @@ path = "src/lib.rs"
[dependencies] [dependencies]
fluence = { version = "0.2.18", features = ["logger"] } fluence = { version = "0.2.18", features = ["logger"] }
aquamarine-vm = { version = "0.1.29", features = ["raw-aquamarine-vm-api"] } aquamarine-vm = { version = "0.3.1", features = ["raw-aquamarine-vm-api"] }
serde_json = "1.0.56" serde_json = "1.0.56"

View File

@ -32,8 +32,8 @@ pub use aquamarine_vm::AquamarineVMError;
pub use aquamarine_vm::CallServiceClosure; pub use aquamarine_vm::CallServiceClosure;
pub use aquamarine_vm::IType; pub use aquamarine_vm::IType;
pub use aquamarine_vm::IValue; pub use aquamarine_vm::IValue;
pub use aquamarine_vm::InterpreterOutcome;
pub use aquamarine_vm::ParticleParameters; pub use aquamarine_vm::ParticleParameters;
pub use aquamarine_vm::StepperOutcome;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -1,18 +1,18 @@
[package] [package]
name = "stepper-lib" name = "interpreter-lib"
version = "0.5.0" version = "0.6.0"
authors = ["Fluence Labs"] authors = ["Fluence Labs"]
edition = "2018" edition = "2018"
[lib] [lib]
name = "stepper_lib" name = "interpreter_lib"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
air-parser = { path = "../crates/air-parser" } air-parser = { path = "../crates/air-parser" }
fluence = { version = "0.2.18", features = ["logger"] } fluence = { version = "0.2.18", features = ["logger"] }
polyplets = { path = "../crates/polyplets" } polyplets = { path = "../crates/polyplets" }
stepper-interface = { path = "../crates/stepper-interface" } aqua-interpreter-interface = { path = "../crates/interpreter-interface" }
serde = { version = "=1.0.118", features = [ "derive", "rc" ] } serde = { version = "=1.0.118", features = [ "derive", "rc" ] }
serde_json = "=1.0.61" serde_json = "=1.0.61"

View File

@ -2,7 +2,7 @@ use aqua_test_utils::create_aqua_vm;
use aqua_test_utils::unit_call_service; use aqua_test_utils::unit_call_service;
use aqua_test_utils::AquamarineVM; use aqua_test_utils::AquamarineVM;
use aqua_test_utils::AquamarineVMError; use aqua_test_utils::AquamarineVMError;
use aqua_test_utils::StepperOutcome; use aqua_test_utils::InterpreterOutcome;
use criterion::criterion_group; use criterion::criterion_group;
use criterion::criterion_main; use criterion::criterion_main;
@ -18,7 +18,7 @@ thread_local!(static SCRIPT: String = String::from(
) )
); );
fn current_peer_id_call() -> Result<StepperOutcome, AquamarineVMError> { fn current_peer_id_call() -> Result<InterpreterOutcome, AquamarineVMError> {
VM.with(|vm| SCRIPT.with(|script| vm.borrow_mut().call_with_prev_data("", script.clone(), "[]", "[]"))) VM.with(|vm| SCRIPT.with(|script| vm.borrow_mut().call_with_prev_data("", script.clone(), "[]", "[]")))
} }

View File

@ -4,8 +4,8 @@ use aqua_test_utils::AquamarineVM;
use aqua_test_utils::AquamarineVMError; use aqua_test_utils::AquamarineVMError;
use aqua_test_utils::CallServiceClosure; use aqua_test_utils::CallServiceClosure;
use aqua_test_utils::IValue; use aqua_test_utils::IValue;
use aqua_test_utils::InterpreterOutcome;
use aqua_test_utils::NEVec; use aqua_test_utils::NEVec;
use aqua_test_utils::StepperOutcome;
use criterion::criterion_group; use criterion::criterion_group;
use criterion::criterion_main; use criterion::criterion_main;
@ -31,7 +31,7 @@ thread_local!(static REMOTE_VM: RefCell<AquamarineVM> = RefCell::new({
thread_local!(static CLIENT_1_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "A"))); thread_local!(static CLIENT_1_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "A")));
thread_local!(static CLIENT_2_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "B"))); thread_local!(static CLIENT_2_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "B")));
fn chat_sent_message_benchmark() -> Result<StepperOutcome, AquamarineVMError> { fn chat_sent_message_benchmark() -> Result<InterpreterOutcome, AquamarineVMError> {
let script = String::from( let script = String::from(
r#" r#"
(seq (seq

View File

@ -4,8 +4,8 @@ use aqua_test_utils::AquamarineVM;
use aqua_test_utils::AquamarineVMError; use aqua_test_utils::AquamarineVMError;
use aqua_test_utils::CallServiceClosure; use aqua_test_utils::CallServiceClosure;
use aqua_test_utils::IValue; use aqua_test_utils::IValue;
use aqua_test_utils::InterpreterOutcome;
use aqua_test_utils::NEVec; use aqua_test_utils::NEVec;
use aqua_test_utils::StepperOutcome;
use serde_json::json; use serde_json::json;
@ -68,7 +68,7 @@ thread_local!(static SET_VARIABLES_VM: RefCell<AquamarineVM> = RefCell::new({
create_aqua_vm(set_variables_call_service(variables_mapping), "set_variables") create_aqua_vm(set_variables_call_service(variables_mapping), "set_variables")
})); }));
fn create_service_benchmark() -> Result<StepperOutcome, AquamarineVMError> { fn create_service_benchmark() -> Result<InterpreterOutcome, AquamarineVMError> {
let script = String::from( let script = String::from(
r#" r#"
(seq (seq

View File

@ -20,9 +20,9 @@ use crate::execution::ExecutableInstruction;
use crate::preparation::prepare; use crate::preparation::prepare;
use crate::preparation::PreparationDescriptor; use crate::preparation::PreparationDescriptor;
use stepper_interface::StepperOutcome; use aqua_interpreter_interface::InterpreterOutcome;
pub fn execute_aqua(init_peer_id: String, aqua: String, prev_data: Vec<u8>, data: Vec<u8>) -> StepperOutcome { pub fn execute_aqua(init_peer_id: String, aqua: String, prev_data: Vec<u8>, data: Vec<u8>) -> InterpreterOutcome {
use std::convert::identity; use std::convert::identity;
log::trace!( log::trace!(
@ -39,7 +39,7 @@ fn execute_aqua_impl(
aqua: String, aqua: String,
prev_data: Vec<u8>, prev_data: Vec<u8>,
data: Vec<u8>, data: Vec<u8>,
) -> Result<StepperOutcome, StepperOutcome> { ) -> Result<InterpreterOutcome, InterpreterOutcome> {
let PreparationDescriptor { let PreparationDescriptor {
mut exec_ctx, mut exec_ctx,
mut trace_ctx, mut trace_ctx,

View File

@ -17,8 +17,8 @@
use crate::execution::ExecutionError; use crate::execution::ExecutionError;
use crate::preparation::PreparationError; use crate::preparation::PreparationError;
use crate::StepperOutcome; use crate::InterpreterOutcome;
use crate::STEPPER_SUCCESS; use crate::INTERPRETER_SUCCESS;
use serde::Serialize; use serde::Serialize;
@ -27,30 +27,30 @@ use std::rc::Rc;
const EXECUTION_ERRORS_START_ID: i32 = 1000; const EXECUTION_ERRORS_START_ID: i32 = 1000;
/// Create StepperOutcome from supplied data and next_peer_pks, /// Create InterpreterOutcome from supplied data and next_peer_pks,
/// set ret_code to STEPPER_SUCCESS. /// set ret_code to INTERPRETER_SUCCESS.
pub(crate) fn from_path_and_peers<T>(data: &T, next_peer_pks: Vec<String>) -> StepperOutcome pub(crate) fn from_path_and_peers<T>(data: &T, next_peer_pks: Vec<String>) -> InterpreterOutcome
where where
T: ?Sized + Serialize, T: ?Sized + Serialize,
{ {
let data = serde_json::to_vec(data).expect("default serializer shouldn't fail"); let data = serde_json::to_vec(data).expect("default serializer shouldn't fail");
let next_peer_pks = dedup(next_peer_pks); let next_peer_pks = dedup(next_peer_pks);
StepperOutcome { InterpreterOutcome {
ret_code: STEPPER_SUCCESS, ret_code: INTERPRETER_SUCCESS,
error_message: String::new(), error_message: String::new(),
data, data,
next_peer_pks, next_peer_pks,
} }
} }
/// Create StepperOutcome from supplied data and error, /// Create InterpreterOutcome from supplied data and error,
/// set ret_code based on the error. /// set ret_code based on the error.
pub(crate) fn from_preparation_error(data: impl Into<Vec<u8>>, err: PreparationError) -> StepperOutcome { pub(crate) fn from_preparation_error(data: impl Into<Vec<u8>>, err: PreparationError) -> InterpreterOutcome {
let ret_code = err.to_error_code() as i32; let ret_code = err.to_error_code() as i32;
let data = data.into(); let data = data.into();
StepperOutcome { InterpreterOutcome {
ret_code, ret_code,
error_message: format!("{}", err), error_message: format!("{}", err),
data, data,
@ -58,9 +58,13 @@ pub(crate) fn from_preparation_error(data: impl Into<Vec<u8>>, err: PreparationE
} }
} }
/// Create StepperOutcome from supplied data, next_peer_pks and error, /// Create InterpreterOutcome from supplied data, next_peer_pks and error,
/// set ret_code based on the error. /// set ret_code based on the error.
pub(crate) fn from_execution_error<T>(data: &T, next_peer_pks: Vec<String>, err: Rc<ExecutionError>) -> StepperOutcome pub(crate) fn from_execution_error<T>(
data: &T,
next_peer_pks: Vec<String>,
err: Rc<ExecutionError>,
) -> InterpreterOutcome
where where
T: ?Sized + Serialize, T: ?Sized + Serialize,
{ {
@ -70,7 +74,7 @@ where
let data = serde_json::to_vec(data).expect("default serializer shouldn't fail"); let data = serde_json::to_vec(data).expect("default serializer shouldn't fail");
let next_peer_pks = dedup(next_peer_pks); let next_peer_pks = dedup(next_peer_pks);
StepperOutcome { InterpreterOutcome {
ret_code, ret_code,
error_message: format!("{}", err), error_message: format!("{}", err),
data, data,

View File

@ -30,14 +30,14 @@ pub type ExecutionTrace = std::collections::VecDeque<ExecutedState>;
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub(crate) struct ExecutionTraceCtx { pub(crate) struct ExecutionTraceCtx {
/// Contains trace (serialized tree of states) after merging current and previous data, /// Contains trace (serialized tree of states) after merging current and previous data,
/// stepper used it to realize which instructions've been already executed. /// interpreter used it to realize which instructions've been already executed.
pub(crate) current_trace: ExecutionTrace, pub(crate) current_trace: ExecutionTrace,
/// Size of a current considered subtree inside current path. /// Size of a current considered subtree inside current path.
pub(crate) current_subtree_size: usize, pub(crate) current_subtree_size: usize,
// TODO: consider change it to Vec for optimization // TODO: consider change it to Vec for optimization
/// Accumulator for resulted path produced by the stepper after execution. /// Accumulator for resulted path produced by the interpreter after execution.
pub(crate) new_trace: ExecutionTrace, pub(crate) new_trace: ExecutionTrace,
} }

View File

@ -165,7 +165,7 @@ mod tests {
use aqua_test_utils::echo_string_call_service; use aqua_test_utils::echo_string_call_service;
use aqua_test_utils::set_variable_call_service; use aqua_test_utils::set_variable_call_service;
use aqua_test_utils::AquamarineVMError; use aqua_test_utils::AquamarineVMError;
use aqua_test_utils::StepperOutcome; use aqua_test_utils::InterpreterOutcome;
use serde_json::json; use serde_json::json;
use std::rc::Rc; use std::rc::Rc;
@ -443,7 +443,7 @@ mod tests {
use crate::contexts::execution_trace::CallResult::*; use crate::contexts::execution_trace::CallResult::*;
use crate::contexts::execution_trace::ExecutedState::*; use crate::contexts::execution_trace::ExecutedState::*;
fn execute_script(script: String) -> Result<StepperOutcome, AquamarineVMError> { fn execute_script(script: String) -> Result<InterpreterOutcome, AquamarineVMError> {
let mut set_variables_vm = create_aqua_vm(set_variable_call_service(r#"["1","2"]"#), "set_variable"); let mut set_variables_vm = create_aqua_vm(set_variable_call_service(r#"["1","2"]"#), "set_variable");
let mut vm_a = create_aqua_vm(echo_string_call_service(), "A"); let mut vm_a = create_aqua_vm(echo_string_call_service(), "A");
let mut vm_b = create_aqua_vm(echo_string_call_service(), "B"); let mut vm_b = create_aqua_vm(echo_string_call_service(), "B");

View File

@ -34,10 +34,10 @@ mod preparation;
mod aqua; mod aqua;
pub mod log_targets; pub mod log_targets;
pub use aqua_interpreter_interface::InterpreterOutcome;
pub use aqua_interpreter_interface::INTERPRETER_SUCCESS;
pub use polyplets::ResolvedTriplet; pub use polyplets::ResolvedTriplet;
pub use polyplets::SecurityTetraplet; pub use polyplets::SecurityTetraplet;
pub use stepper_interface::StepperOutcome;
pub use stepper_interface::STEPPER_SUCCESS;
pub use aqua::execute_aqua; pub use aqua::execute_aqua;

View File

@ -23,7 +23,7 @@ use thiserror::Error as ThisError;
use std::env::VarError; use std::env::VarError;
use std::error::Error; use std::error::Error;
/// Errors happened during the stepper preparation step. /// Errors happened during the interpreter preparation step.
#[derive(Debug)] #[derive(Debug)]
pub enum PreparationError { pub enum PreparationError {
/// Error occurred while parsing AIR script /// Error occurred while parsing AIR script

View File

@ -30,8 +30,8 @@ type JValue = serde_json::Value;
#[test] #[test]
fn seq_par_call() { fn seq_par_call() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let vm_peer_id = String::from("some_peer_id"); let vm_peer_id = String::from("some_peer_id");
let mut vm = create_aqua_vm(unit_call_service(), vm_peer_id.clone()); let mut vm = create_aqua_vm(unit_call_service(), vm_peer_id.clone());
@ -49,7 +49,8 @@ fn seq_par_call() {
); );
let res = call_vm!(vm, "asd", script, "[]", "[]"); let res = call_vm!(vm, "asd", script, "[]", "[]");
let actual_trace: Vec<ExecutedState> = serde_json::from_slice(&res.data).expect("stepper should return valid json"); let actual_trace: Vec<ExecutedState> =
serde_json::from_slice(&res.data).expect("interpreter should return valid json");
let test_string = String::from("test"); let test_string = String::from("test");
let expected_trace = vec![ let expected_trace = vec![
@ -65,8 +66,8 @@ fn seq_par_call() {
#[test] #[test]
fn par_par_call() { fn par_par_call() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let vm_peer_id = String::from("some_peer_id"); let vm_peer_id = String::from("some_peer_id");
let mut vm = create_aqua_vm(unit_call_service(), vm_peer_id.clone()); let mut vm = create_aqua_vm(unit_call_service(), vm_peer_id.clone());
@ -85,7 +86,7 @@ fn par_par_call() {
let res = call_vm!(vm, "asd", script, "[]", "[]"); let res = call_vm!(vm, "asd", script, "[]", "[]");
let resulted_trace: Vec<ExecutedState> = let resulted_trace: Vec<ExecutedState> =
serde_json::from_slice(&res.data).expect("stepper should return valid json"); serde_json::from_slice(&res.data).expect("interpreter should return valid json");
let test_string = String::from("test"); let test_string = String::from("test");
let expected_trace = vec![ let expected_trace = vec![
@ -102,8 +103,8 @@ fn par_par_call() {
#[test] #[test]
fn create_service() { fn create_service() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let module = "greeting"; let module = "greeting";
let module_config = json!( let module_config = json!(

View File

@ -30,8 +30,8 @@ type JValue = serde_json::Value;
#[test] #[test]
fn executed_trace_seq_par_call() { fn executed_trace_seq_par_call() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let local_peer_id = "local_peer_id"; let local_peer_id = "local_peer_id";
let mut vm = create_aqua_vm(unit_call_service(), local_peer_id); let mut vm = create_aqua_vm(unit_call_service(), local_peer_id);
@ -56,7 +56,8 @@ fn executed_trace_seq_par_call() {
.to_string(); .to_string();
let res = call_vm!(vm, "asd", script, "[]", initial_state); let res = call_vm!(vm, "asd", script, "[]", initial_state);
let actual_trace: Vec<ExecutedState> = serde_json::from_slice(&res.data).expect("stepper should return valid json"); let actual_trace: Vec<ExecutedState> =
serde_json::from_slice(&res.data).expect("interpreter should return valid json");
let test_string = String::from("test"); let test_string = String::from("test");
let expected_trace = vec![ let expected_trace = vec![
@ -72,8 +73,8 @@ fn executed_trace_seq_par_call() {
#[test] #[test]
fn executed_trace_par_par_call() { fn executed_trace_par_par_call() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let local_peer_id = "local_peer_id"; let local_peer_id = "local_peer_id";
let mut vm = create_aqua_vm(unit_call_service(), local_peer_id); let mut vm = create_aqua_vm(unit_call_service(), local_peer_id);
@ -99,7 +100,8 @@ fn executed_trace_par_par_call() {
.to_string(); .to_string();
let res = call_vm!(vm, "asd", script, "[]", initial_state); let res = call_vm!(vm, "asd", script, "[]", initial_state);
let actual_trace: Vec<ExecutedState> = serde_json::from_slice(&res.data).expect("stepper should return valid json"); let actual_trace: Vec<ExecutedState> =
serde_json::from_slice(&res.data).expect("interpreter should return valid json");
let test_string = String::from("test"); let test_string = String::from("test");
let expected_trace = vec![ let expected_trace = vec![
@ -116,8 +118,8 @@ fn executed_trace_par_par_call() {
#[test] #[test]
fn executed_trace_seq_seq() { fn executed_trace_seq_seq() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let peer_id_1 = String::from("12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"); let peer_id_1 = String::from("12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er");
let peer_id_2 = String::from("12D3KooWAzJcYitiZrerycVB4Wryrx22CFKdDGx7c4u31PFdfTbR"); let peer_id_2 = String::from("12D3KooWAzJcYitiZrerycVB4Wryrx22CFKdDGx7c4u31PFdfTbR");
@ -145,7 +147,8 @@ fn executed_trace_seq_seq() {
let res = call_vm!(vm2, "asd", script, "[]", res.data); let res = call_vm!(vm2, "asd", script, "[]", res.data);
let actual_trace: Vec<ExecutedState> = serde_json::from_slice(&res.data).expect("stepper should return valid json"); let actual_trace: Vec<ExecutedState> =
serde_json::from_slice(&res.data).expect("interpreter should return valid json");
let test_string = String::from("test"); let test_string = String::from("test");
let expected_trace = vec![ let expected_trace = vec![
@ -159,8 +162,8 @@ fn executed_trace_seq_seq() {
#[test] #[test]
fn executed_trace_create_service() { fn executed_trace_create_service() {
use stepper_lib::execution_trace::CallResult::*; use interpreter_lib::execution_trace::CallResult::*;
use stepper_lib::execution_trace::ExecutedState::{self, *}; use interpreter_lib::execution_trace::ExecutedState::{self, *};
let module = "greeting"; let module = "greeting";
let module_config = json!( let module_config = json!(
@ -345,7 +348,7 @@ fn executed_trace_par_seq_fold_in_cycle_call() {
data = res.data; data = res.data;
} }
let resulted_json: JValue = serde_json::from_slice(&data).expect("stepper should return valid json"); let resulted_json: JValue = serde_json::from_slice(&data).expect("interpreter should return valid json");
let expected_json = json!( [ let expected_json = json!( [
{ "par": [21,1] }, { "par": [21,1] },
@ -409,7 +412,7 @@ fn executed_trace_seq_par_seq_seq() {
let res = call_vm!(vm2, "asd", script, "[]", res.data); let res = call_vm!(vm2, "asd", script, "[]", res.data);
let resulted_json: JValue = serde_json::from_slice(&res.data).expect("stepper should return valid json"); let resulted_json: JValue = serde_json::from_slice(&res.data).expect("interpreter should return valid json");
let expected_json = json!( [ let expected_json = json!( [
{ "par": [2,2] }, { "par": [2,2] },

View File

@ -77,7 +77,7 @@ fn data_merge() {
let res3 = call_vm!(vm1, "asd", script.clone(), res1.data.clone(), res2.data.clone()); let res3 = call_vm!(vm1, "asd", script.clone(), res1.data.clone(), res2.data.clone());
let res4 = call_vm!(vm2, "asd", script, res1.data.clone(), res2.data.clone()); let res4 = call_vm!(vm2, "asd", script, res1.data.clone(), res2.data.clone());
let resulted_json1: JValue = serde_json::from_slice(&res1.data).expect("stepper should return valid json"); let resulted_json1: JValue = serde_json::from_slice(&res1.data).expect("interpreter should return valid json");
let expected_json1 = json!( [ let expected_json1 = json!( [
{ "call": { "executed": ["A", "B"] } }, { "call": { "executed": ["A", "B"] } },
@ -96,7 +96,7 @@ fn data_merge() {
assert_eq!(resulted_json1, expected_json1); assert_eq!(resulted_json1, expected_json1);
assert_eq!(res1.next_peer_pks, vec![String::from("B")]); assert_eq!(res1.next_peer_pks, vec![String::from("B")]);
let resulted_json2: JValue = serde_json::from_slice(&res2.data).expect("stepper should return valid json"); let resulted_json2: JValue = serde_json::from_slice(&res2.data).expect("interpreter should return valid json");
let expected_json2 = json!( [ let expected_json2 = json!( [
{ "call": { "executed": ["A", "B"] } }, { "call": { "executed": ["A", "B"] } },
@ -114,7 +114,7 @@ fn data_merge() {
assert_eq!(resulted_json2, expected_json2); assert_eq!(resulted_json2, expected_json2);
assert_eq!(res2.next_peer_pks, vec![String::from("A")]); assert_eq!(res2.next_peer_pks, vec![String::from("A")]);
let resulted_json3: JValue = serde_json::from_slice(&res3.data).expect("stepper should return valid json"); let resulted_json3: JValue = serde_json::from_slice(&res3.data).expect("interpreter should return valid json");
let expected_json3 = json!( [ let expected_json3 = json!( [
{ "call": { "executed": ["A", "B"] } }, { "call": { "executed": ["A", "B"] } },
@ -133,7 +133,7 @@ fn data_merge() {
assert_eq!(resulted_json3, expected_json3); assert_eq!(resulted_json3, expected_json3);
assert!(res3.next_peer_pks.is_empty()); assert!(res3.next_peer_pks.is_empty());
let resulted_json4: JValue = serde_json::from_slice(&res4.data).expect("stepper should return valid json"); let resulted_json4: JValue = serde_json::from_slice(&res4.data).expect("interpreter should return valid json");
let expected_json4 = json!( [ let expected_json4 = json!( [
{ "call": { "executed": ["A", "B"] } }, { "call": { "executed": ["A", "B"] } },

View File

@ -72,7 +72,7 @@ fn join_chat() {
let client_1_res = call_vm!(client_1, "asd", script.clone(), "[]", "[]"); let client_1_res = call_vm!(client_1, "asd", script.clone(), "[]", "[]");
let client_1_res_json: JValue = let client_1_res_json: JValue =
serde_json::from_slice(&client_1_res.data).expect("stepper should return valid json"); serde_json::from_slice(&client_1_res.data).expect("interpreter should return valid json");
let client_1_expected_json = json!([ let client_1_expected_json = json!([
{ "call": {"request_sent_by": "A" } }, { "call": {"request_sent_by": "A" } },
@ -83,7 +83,8 @@ fn join_chat() {
let relay_1_res = call_vm!(relay_1, "asd", script.clone(), client_1_res.data, "[]"); let relay_1_res = call_vm!(relay_1, "asd", script.clone(), client_1_res.data, "[]");
let relay_1_res_json: JValue = serde_json::from_slice(&relay_1_res.data).expect("stepper should return valid json"); let relay_1_res_json: JValue =
serde_json::from_slice(&relay_1_res.data).expect("interpreter should return valid json");
let relay_1_expected_json = json!( [ let relay_1_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -95,7 +96,8 @@ fn join_chat() {
let remote_res = call_vm!(remote, "asd", script.clone(), relay_1_res.data, "[]"); let remote_res = call_vm!(remote, "asd", script.clone(), relay_1_res.data, "[]");
let remote_res_json: JValue = serde_json::from_slice(&remote_res.data).expect("stepper should return valid json"); let remote_res_json: JValue =
serde_json::from_slice(&remote_res.data).expect("interpreter should return valid json");
let remote_expected_json = json!( [ let remote_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -118,7 +120,8 @@ fn join_chat() {
let relay_1_res = call_vm!(relay_1, "asd", script.clone(), remote_res.data.clone(), "[]"); let relay_1_res = call_vm!(relay_1, "asd", script.clone(), remote_res.data.clone(), "[]");
let relay_1_res_json: JValue = serde_json::from_slice(&relay_1_res.data).expect("stepper should return valid json"); let relay_1_res_json: JValue =
serde_json::from_slice(&relay_1_res.data).expect("interpreter should return valid json");
let relay_1_expected_json = json!( [ let relay_1_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -137,7 +140,7 @@ fn join_chat() {
let client_1_res = call_vm!(client_1, "asd", script.clone(), relay_1_res.data, "[]"); let client_1_res = call_vm!(client_1, "asd", script.clone(), relay_1_res.data, "[]");
let client_1_res_json: JValue = let client_1_res_json: JValue =
serde_json::from_slice(&client_1_res.data).expect("stepper should return valid json"); serde_json::from_slice(&client_1_res.data).expect("interpreter should return valid json");
let client_1_expected_json = json!( [ let client_1_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -155,7 +158,8 @@ fn join_chat() {
let relay_2_res = call_vm!(relay_2, "asd", script.clone(), remote_res.data, "[]"); let relay_2_res = call_vm!(relay_2, "asd", script.clone(), remote_res.data, "[]");
let relay_2_res_json: JValue = serde_json::from_slice(&relay_2_res.data).expect("stepper should return valid json"); let relay_2_res_json: JValue =
serde_json::from_slice(&relay_2_res.data).expect("interpreter should return valid json");
let relay_2_expected_json = json!( [ let relay_2_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -174,7 +178,7 @@ fn join_chat() {
let client_2_res = call_vm!(client_2, "asd", script, relay_2_res.data, "[]"); let client_2_res = call_vm!(client_2, "asd", script, relay_2_res.data, "[]");
let client_2_res_json: JValue = let client_2_res_json: JValue =
serde_json::from_slice(&client_2_res.data).expect("stepper should return valid json"); serde_json::from_slice(&client_2_res.data).expect("interpreter should return valid json");
let client_2_expected_json = json!( [ let client_2_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -230,7 +234,7 @@ fn join() {
let client_1_res = call_vm!(client_1, "asd", script, relay_1_res.data, "[]"); let client_1_res = call_vm!(client_1, "asd", script, relay_1_res.data, "[]");
let client_1_res_json: JValue = let client_1_res_json: JValue =
serde_json::from_slice(&client_1_res.data).expect("stepper should return valid json"); serde_json::from_slice(&client_1_res.data).expect("interpreter should return valid json");
let client_1_expected_json = json!( [ let client_1_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -310,7 +314,7 @@ fn init_peer_id() {
); );
let client_1_res_json: JValue = let client_1_res_json: JValue =
serde_json::from_slice(&client_1_res.data).expect("stepper should return valid json"); serde_json::from_slice(&client_1_res.data).expect("interpreter should return valid json");
let client_1_expected_json = json!( [ let client_1_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },
@ -330,7 +334,7 @@ fn init_peer_id() {
let initiator_1_res = call_vm!(initiator, initiator_peer_id, script, client_1_res.data, ""); let initiator_1_res = call_vm!(initiator, initiator_peer_id, script, client_1_res.data, "");
let initiator_1_res_json: JValue = let initiator_1_res_json: JValue =
serde_json::from_slice(&initiator_1_res.data).expect("stepper should return valid json"); serde_json::from_slice(&initiator_1_res.data).expect("interpreter should return valid json");
let initiator_1_expected_json = json!( [ let initiator_1_expected_json = json!( [
{ "call": { "executed" : "test" } }, { "call": { "executed" : "test" } },

View File

@ -21,7 +21,7 @@ use aqua_test_utils::unit_call_service;
use aqua_test_utils::CallServiceClosure; use aqua_test_utils::CallServiceClosure;
use aqua_test_utils::IValue; use aqua_test_utils::IValue;
use aqua_test_utils::NEVec; use aqua_test_utils::NEVec;
use stepper_lib::SecurityTetraplet; use interpreter_lib::SecurityTetraplet;
fn create_check_service_closure() -> CallServiceClosure { fn create_check_service_closure() -> CallServiceClosure {
Box::new(move |_, args| -> Option<IValue> { Box::new(move |_, args| -> Option<IValue> {

View File

@ -19,8 +19,8 @@ use aqua_test_utils::create_aqua_vm;
use aqua_test_utils::CallServiceClosure; use aqua_test_utils::CallServiceClosure;
use aqua_test_utils::IValue; use aqua_test_utils::IValue;
use aqua_test_utils::NEVec; use aqua_test_utils::NEVec;
use stepper_lib::ResolvedTriplet; use interpreter_lib::ResolvedTriplet;
use stepper_lib::SecurityTetraplet; use interpreter_lib::SecurityTetraplet;
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
@ -199,10 +199,10 @@ use fluence_app_service::AppService;
use fluence_app_service::AppServiceConfig; use fluence_app_service::AppServiceConfig;
use fluence_app_service::FaaSConfig; use fluence_app_service::FaaSConfig;
use interpreter_lib::execution_trace::CallResult;
use interpreter_lib::execution_trace::ExecutedState;
use interpreter_lib::execution_trace::ExecutionTrace;
use std::path::PathBuf; use std::path::PathBuf;
use stepper_lib::execution_trace::CallResult;
use stepper_lib::execution_trace::ExecutedState;
use stepper_lib::execution_trace::ExecutionTrace;
fn construct_service_config(module_name: impl Into<String>) -> AppServiceConfig { fn construct_service_config(module_name: impl Into<String>) -> AppServiceConfig {
let module_name = module_name.into(); let module_name = module_name.into();

View File

@ -67,7 +67,7 @@ name = "auth_module"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"fluence", "fluence",
"stepper-lib", "interpreter-lib",
] ]
[[package]] [[package]]
@ -673,7 +673,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7" checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"
[[package]] [[package]]
name = "stepper-interface" name = "interpreter-interface"
version = "0.1.2" version = "0.1.2"
dependencies = [ dependencies = [
"fluence", "fluence",
@ -682,7 +682,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "stepper-lib" name = "interpreter-lib"
version = "0.5.0" version = "0.5.0"
dependencies = [ dependencies = [
"air-parser", "air-parser",
@ -693,7 +693,7 @@ dependencies = [
"polyplets", "polyplets",
"serde", "serde",
"serde_json", "serde_json",
"stepper-interface", "interpreter-interface",
"thiserror", "thiserror",
"wasm-bindgen", "wasm-bindgen",
] ]

View File

@ -9,7 +9,7 @@ name = "auth_module"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
stepper-lib = { path = "../../../../stepper-lib" } interpreter-lib = { path = "../../../../interpreter-lib" }
fluence = { version = "0.2.18", features = ["logger"] } fluence = { version = "0.2.18", features = ["logger"] }
[workspace] [workspace]

View File

@ -491,7 +491,7 @@ name = "log_storage"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"fluence", "fluence",
"stepper-lib", "interpreter-lib",
] ]
[[package]] [[package]]
@ -673,7 +673,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7" checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"
[[package]] [[package]]
name = "stepper-interface" name = "interpreter-interface"
version = "0.1.2" version = "0.1.2"
dependencies = [ dependencies = [
"fluence", "fluence",
@ -682,7 +682,7 @@ dependencies = [
] ]
[[package]] [[package]]
name = "stepper-lib" name = "interpreter-lib"
version = "0.5.0" version = "0.5.0"
dependencies = [ dependencies = [
"air-parser", "air-parser",
@ -693,7 +693,7 @@ dependencies = [
"polyplets", "polyplets",
"serde", "serde",
"serde_json", "serde_json",
"stepper-interface", "interpreter-interface",
"thiserror", "thiserror",
"wasm-bindgen", "wasm-bindgen",
] ]

View File

@ -9,7 +9,7 @@ name = "log_storage"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
stepper-lib = { path = "../../../../stepper-lib" } interpreter-lib = { path = "../../../../interpreter-lib" }
fluence = { version = "0.2.18", features = ["logger"] } fluence = { version = "0.2.18", features = ["logger"] }
[workspace] [workspace]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "aquamarine" name = "aquamarine"
version = "0.5.0" version = "0.6.0"
authors = ["Fluence Labs"] authors = ["Fluence Labs"]
edition = "2018" edition = "2018"
@ -14,7 +14,7 @@ name = "aquamarine"
path = "src/fce.rs" path = "src/fce.rs"
[dependencies] [dependencies]
stepper-lib = { path = "../stepper-lib" } interpreter-lib = { path = "../interpreter-lib" }
fluence = { version = "0.2.18", features = ["logger"] } fluence = { version = "0.2.18", features = ["logger"] }
@ -26,4 +26,4 @@ serde = { version = "=1.0.118", features = [ "derive", "rc" ] }
serde_json = "1.0" serde_json = "1.0"
[features] [features]
fce = ["stepper-lib/fce"] fce = ["interpreter-lib/fce"]

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
use stepper_lib::parser::parse; use interpreter_lib::parser::parse;
/// Parse AIR script and return it as minified JSON /// Parse AIR script and return it as minified JSON
pub fn ast(script: String) -> String { pub fn ast(script: String) -> String {

View File

@ -30,9 +30,9 @@ mod ast;
mod logger; mod logger;
use fluence::fce; use fluence::fce;
use interpreter_lib::execute_aqua;
use interpreter_lib::InterpreterOutcome;
use logger::DEFAULT_LOG_LEVEL; use logger::DEFAULT_LOG_LEVEL;
use stepper_lib::execute_aqua;
use stepper_lib::StepperOutcome;
use log::Level as LogLevel; use log::Level as LogLevel;
@ -43,7 +43,7 @@ pub fn main() {
} }
#[fce] #[fce]
pub fn invoke(init_peer_id: String, aqua: String, prev_data: Vec<u8>, data: Vec<u8>) -> StepperOutcome { pub fn invoke(init_peer_id: String, aqua: String, prev_data: Vec<u8>, data: Vec<u8>) -> InterpreterOutcome {
let log_level = get_log_level(); let log_level = get_log_level();
log::set_max_level(log_level.to_level_filter()); log::set_max_level(log_level.to_level_filter());

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
use stepper_lib::log_targets::TARGET_MAP; use interpreter_lib::log_targets::TARGET_MAP;
use log::Level as LogLevel; use log::Level as LogLevel;

View File

@ -29,8 +29,8 @@
mod ast; mod ast;
mod logger; mod logger;
use interpreter_lib::execute_aqua;
use logger::DEFAULT_LOG_LEVEL; use logger::DEFAULT_LOG_LEVEL;
use stepper_lib::execute_aqua;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
@ -47,7 +47,7 @@ pub fn invoke(init_peer_id: String, aqua: String, prev_data: Vec<u8>, data: Vec<
log::set_max_level(log_level.to_level_filter()); log::set_max_level(log_level.to_level_filter());
let outcome = execute_aqua(init_peer_id, aqua, prev_data, data); let outcome = execute_aqua(init_peer_id, aqua, prev_data, data);
serde_json::to_string(&outcome).expect("Cannot parse StepperOutcome") serde_json::to_string(&outcome).expect("Cannot parse InterpreterOutcome")
} }
#[wasm_bindgen] #[wasm_bindgen]