mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 23:20:18 +00:00
getting rid of %current_peer_id% (#52)
This commit is contained in:
parent
cdaa24dc03
commit
f7bba6c8c9
166
Cargo.lock
generated
166
Cargo.lock
generated
@ -70,13 +70,16 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "aquamarine-vm"
|
name = "aquamarine-vm"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
source = "git+https://github.com/fluencelabs/fce#f022a2dec4229f1dd739794e98a0e5d080ea13d5"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1e111be27ea8e9a48016b5c749a87e52de8a01801b569009024e4effb0a178e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fluence-faas 0.1.18 (git+https://github.com/fluencelabs/fce)",
|
"fluence-faas",
|
||||||
|
"log",
|
||||||
"maplit",
|
"maplit",
|
||||||
|
"parking_lot 0.11.1",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"stepper-interface 0.1.0 (git+https://github.com/fluencelabs/aquamarine)",
|
"stepper-interface 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -635,31 +638,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "6101e9c7bd51f7478c41c2c1ce2405ef9e87fac5576c012877d5a9feed628a61"
|
checksum = "6101e9c7bd51f7478c41c2c1ce2405ef9e87fac5576c012877d5a9feed628a61"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boolinator",
|
"boolinator",
|
||||||
"fce-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fce-utils",
|
||||||
"fce-wit-interfaces 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fce-wit-interfaces",
|
||||||
"fce-wit-parser 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fce-wit-parser",
|
||||||
"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.1.14"
|
|
||||||
source = "git+https://github.com/fluencelabs/fce#f022a2dec4229f1dd739794e98a0e5d080ea13d5"
|
|
||||||
dependencies = [
|
|
||||||
"boolinator",
|
|
||||||
"fce-utils 0.1.0 (git+https://github.com/fluencelabs/fce)",
|
|
||||||
"fce-wit-interfaces 0.1.9 (git+https://github.com/fluencelabs/fce)",
|
|
||||||
"fce-wit-parser 0.1.11 (git+https://github.com/fluencelabs/fce)",
|
|
||||||
"log",
|
"log",
|
||||||
"multi-map",
|
"multi-map",
|
||||||
"multimap",
|
"multimap",
|
||||||
@ -679,11 +660,6 @@ version = "0.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dcdd9d63fa5f87e03514ba8ca3bb91a25121bbf1c63a26df710f166ab8f274f7"
|
checksum = "dcdd9d63fa5f87e03514ba8ca3bb91a25121bbf1c63a26df710f166ab8f274f7"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fce-utils"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://github.com/fluencelabs/fce#f022a2dec4229f1dd739794e98a0e5d080ea13d5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fce-wit-interfaces"
|
name = "fce-wit-interfaces"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
@ -694,15 +670,6 @@ dependencies = [
|
|||||||
"wasmer-interface-types-fl",
|
"wasmer-interface-types-fl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fce-wit-interfaces"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "git+https://github.com/fluencelabs/fce#f022a2dec4229f1dd739794e98a0e5d080ea13d5"
|
|
||||||
dependencies = [
|
|
||||||
"multimap",
|
|
||||||
"wasmer-interface-types-fl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fce-wit-parser"
|
name = "fce-wit-parser"
|
||||||
version = "0.1.11"
|
version = "0.1.11"
|
||||||
@ -710,20 +677,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "064d9e93e4b588385e77582be61b6d7aaeb352b0af7b33ab9807d61ee606f4e5"
|
checksum = "064d9e93e4b588385e77582be61b6d7aaeb352b0af7b33ab9807d61ee606f4e5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"fce-wit-interfaces 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fce-wit-interfaces",
|
||||||
"serde",
|
|
||||||
"walrus",
|
|
||||||
"wasmer-interface-types-fl",
|
|
||||||
"wasmer-runtime-core-fl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fce-wit-parser"
|
|
||||||
version = "0.1.11"
|
|
||||||
source = "git+https://github.com/fluencelabs/fce#f022a2dec4229f1dd739794e98a0e5d080ea13d5"
|
|
||||||
dependencies = [
|
|
||||||
"anyhow",
|
|
||||||
"fce-wit-interfaces 0.1.9 (git+https://github.com/fluencelabs/fce)",
|
|
||||||
"serde",
|
"serde",
|
||||||
"walrus",
|
"walrus",
|
||||||
"wasmer-interface-types-fl",
|
"wasmer-interface-types-fl",
|
||||||
@ -748,11 +702,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fluence-app-service"
|
name = "fluence-app-service"
|
||||||
version = "0.1.17"
|
version = "0.1.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4f5d68695059de51743eddcd98a0ba77ec3af7fa51b2eb5fcb35edce05ff1144"
|
checksum = "f05261ebf65e17d28d158da1eccd0e2129e21c9fe5ac7a2d578262cdcd2a981b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fluence-faas 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fluence-faas",
|
||||||
"log",
|
"log",
|
||||||
"maplit",
|
"maplit",
|
||||||
"serde",
|
"serde",
|
||||||
@ -769,30 +723,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "760e23d5582bee6ec9800c0a3e179525e80a28482d17a09ed7d138d121020368"
|
checksum = "760e23d5582bee6ec9800c0a3e179525e80a28482d17a09ed7d138d121020368"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cmd_lib",
|
"cmd_lib",
|
||||||
"fce 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fce",
|
||||||
"fce-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fce-utils",
|
||||||
"fluence-sdk-main",
|
|
||||||
"itertools",
|
|
||||||
"log",
|
|
||||||
"safe-transmute",
|
|
||||||
"serde",
|
|
||||||
"serde_derive",
|
|
||||||
"serde_json",
|
|
||||||
"toml",
|
|
||||||
"wasmer-interface-types-fl",
|
|
||||||
"wasmer-runtime-core-fl",
|
|
||||||
"wasmer-runtime-fl",
|
|
||||||
"wasmer-wasi-fl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fluence-faas"
|
|
||||||
version = "0.1.18"
|
|
||||||
source = "git+https://github.com/fluencelabs/fce#f022a2dec4229f1dd739794e98a0e5d080ea13d5"
|
|
||||||
dependencies = [
|
|
||||||
"cmd_lib",
|
|
||||||
"fce 0.1.14 (git+https://github.com/fluencelabs/fce)",
|
|
||||||
"fce-utils 0.1.0 (git+https://github.com/fluencelabs/fce)",
|
|
||||||
"fluence-sdk-main",
|
"fluence-sdk-main",
|
||||||
"itertools",
|
"itertools",
|
||||||
"log",
|
"log",
|
||||||
@ -992,6 +924,15 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "instant"
|
||||||
|
version = "0.1.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inventory"
|
name = "inventory"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -1123,6 +1064,15 @@ dependencies = [
|
|||||||
"scopeguard",
|
"scopeguard",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lock_api"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
|
||||||
|
dependencies = [
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.11"
|
version = "0.4.11"
|
||||||
@ -1276,8 +1226,19 @@ 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 = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
|
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lock_api",
|
"lock_api 0.3.4",
|
||||||
"parking_lot_core",
|
"parking_lot_core 0.7.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
|
||||||
|
dependencies = [
|
||||||
|
"instant",
|
||||||
|
"lock_api 0.4.2",
|
||||||
|
"parking_lot_core 0.8.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1294,6 +1255,20 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parking_lot_core"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"instant",
|
||||||
|
"libc",
|
||||||
|
"redox_syscall",
|
||||||
|
"smallvec",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "petgraph"
|
name = "petgraph"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
@ -1685,7 +1660,8 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "stepper-interface"
|
name = "stepper-interface"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/fluencelabs/aquamarine#5cb4cc0fb0c149a4bd3160dd0bac9c3d5ac3db7d"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a2be93d2a8a33f133cdf62e2097b5b58cf46d816240e03df26c27af3432b7b87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fluence",
|
"fluence",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1694,7 +1670,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stepper-lib"
|
name = "stepper-lib"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"air-parser",
|
"air-parser",
|
||||||
"aqua-test-utils",
|
"aqua-test-utils",
|
||||||
@ -1744,9 +1720,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.55"
|
version = "1.0.56"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a571a711dddd09019ccc628e1b17fe87c59b09d513c06c026877aa708334f37a"
|
checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1790,18 +1766,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.22"
|
version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e"
|
checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.22"
|
version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56"
|
checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -2102,7 +2078,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"nix",
|
"nix",
|
||||||
"page_size",
|
"page_size",
|
||||||
"parking_lot",
|
"parking_lot 0.10.2",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-bench",
|
"serde-bench",
|
||||||
@ -2131,7 +2107,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"nix",
|
"nix",
|
||||||
"page_size",
|
"page_size",
|
||||||
"parking_lot",
|
"parking_lot 0.10.2",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-bench",
|
"serde-bench",
|
||||||
|
@ -3,6 +3,7 @@ name = "air-parser"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
lalrpop = { git = "https://github.com/fluencelabs/lalrpop", branch = "cloneable_parser", version = "0.19.1", features = ["lexer"] }
|
lalrpop = { git = "https://github.com/fluencelabs/lalrpop", branch = "cloneable_parser", version = "0.19.1", features = ["lexer"] }
|
||||||
|
@ -57,7 +57,6 @@ pub enum InstructionValue<'i> {
|
|||||||
Variable(&'i str),
|
Variable(&'i str),
|
||||||
Literal(&'i str),
|
Literal(&'i str),
|
||||||
JsonPath { variable: &'i str, path: &'i str },
|
JsonPath { variable: &'i str, path: &'i str },
|
||||||
CurrentPeerId,
|
|
||||||
InitPeerId,
|
InitPeerId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ InstructionValue: InstructionValue<'input> = {
|
|||||||
let path = path.next().expect("contain component after dot");
|
let path = path.next().expect("contain component after dot");
|
||||||
InstructionValue::JsonPath { variable, path }
|
InstructionValue::JsonPath { variable, path }
|
||||||
},
|
},
|
||||||
CURRENT_PEER_ID => InstructionValue::CurrentPeerId,
|
|
||||||
INIT_PEER_ID => InstructionValue::InitPeerId,
|
INIT_PEER_ID => InstructionValue::InitPeerId,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +74,6 @@ match {
|
|||||||
r"[\w_-]+" => ALPHANUMERIC,
|
r"[\w_-]+" => ALPHANUMERIC,
|
||||||
r"[\w_-]+\[\]" => ACCUMULATOR,
|
r"[\w_-]+\[\]" => ACCUMULATOR,
|
||||||
r#"[\w_-]+\.*\$([\w._-]*(\[[\w"]+\])*!*)+"# => JSON_PATH,
|
r#"[\w_-]+\.*\$([\w._-]*(\[[\w"]+\])*!*)+"# => JSON_PATH,
|
||||||
r#"%current_peer_id%"# => CURRENT_PEER_ID,
|
|
||||||
r#"%init_peer_id%"# => INIT_PEER_ID,
|
r#"%init_peer_id%"# => INIT_PEER_ID,
|
||||||
"seq",
|
"seq",
|
||||||
"call",
|
"call",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -238,16 +238,21 @@ fn parse_fold_with_xor_par_seq() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_current_init_peer_id() {
|
fn parse_init_peer_id() {
|
||||||
let source_code = r#"
|
let peer_id = String::from("some_peer_id");
|
||||||
|
let source_code = format!(
|
||||||
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [])
|
(call "{}" ("local_service_id" "local_fn_name") [])
|
||||||
(call %init_peer_id% ("service_id" "fn_name") [])
|
(call %init_peer_id% ("service_id" "fn_name") [])
|
||||||
)"#;
|
)"#,
|
||||||
|
peer_id
|
||||||
|
);
|
||||||
|
|
||||||
let instruction = parse(&source_code.as_ref());
|
let instruction = parse(&source_code.as_ref());
|
||||||
let expected = seq(
|
let expected = seq(
|
||||||
Instruction::Call(Call {
|
Instruction::Call(Call {
|
||||||
peer_part: PeerPk(CurrentPeerId),
|
peer_part: PeerPk(InstructionValue::Literal(&peer_id)),
|
||||||
function_part: ServiceIdWithFuncName(
|
function_part: ServiceIdWithFuncName(
|
||||||
Literal("local_service_id"),
|
Literal("local_service_id"),
|
||||||
Literal("local_fn_name"),
|
Literal("local_fn_name"),
|
||||||
@ -262,24 +267,30 @@ fn parse_current_init_peer_id() {
|
|||||||
output: None,
|
output: None,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(instruction, expected);
|
assert_eq!(instruction, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn seq_par_call() {
|
fn seq_par_call() {
|
||||||
let source_code = r#"
|
let peer_id = String::from("some_peer_id");
|
||||||
|
let source_code = format!(
|
||||||
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(par
|
(par
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_1)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_1)
|
||||||
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
(call "{0}" ("service_id" "fn_name") [] g)
|
||||||
)
|
)
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_2)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_2)
|
||||||
)"#;
|
)"#,
|
||||||
|
peer_id,
|
||||||
|
);
|
||||||
|
|
||||||
let instruction = parse(&source_code.as_ref());
|
let instruction = parse(&source_code.as_ref());
|
||||||
let expected = seq(
|
let expected = seq(
|
||||||
par(
|
par(
|
||||||
Instruction::Call(Call {
|
Instruction::Call(Call {
|
||||||
peer_part: PeerPk(CurrentPeerId),
|
peer_part: PeerPk(InstructionValue::Literal(&peer_id)),
|
||||||
function_part: ServiceIdWithFuncName(
|
function_part: ServiceIdWithFuncName(
|
||||||
Literal("local_service_id"),
|
Literal("local_service_id"),
|
||||||
Literal("local_fn_name"),
|
Literal("local_fn_name"),
|
||||||
@ -288,14 +299,14 @@ fn seq_par_call() {
|
|||||||
output: Scalar("result_1"),
|
output: Scalar("result_1"),
|
||||||
}),
|
}),
|
||||||
Instruction::Call(Call {
|
Instruction::Call(Call {
|
||||||
peer_part: PeerPk(Literal("remote_peer_id")),
|
peer_part: PeerPk(Literal(&peer_id)),
|
||||||
function_part: ServiceIdWithFuncName(Literal("service_id"), Literal("fn_name")),
|
function_part: ServiceIdWithFuncName(Literal("service_id"), Literal("fn_name")),
|
||||||
args: Rc::new(vec![]),
|
args: Rc::new(vec![]),
|
||||||
output: Scalar("g"),
|
output: Scalar("g"),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
Instruction::Call(Call {
|
Instruction::Call(Call {
|
||||||
peer_part: PeerPk(CurrentPeerId),
|
peer_part: PeerPk(InstructionValue::Literal(&peer_id)),
|
||||||
function_part: ServiceIdWithFuncName(
|
function_part: ServiceIdWithFuncName(
|
||||||
Literal("local_service_id"),
|
Literal("local_service_id"),
|
||||||
Literal("local_fn_name"),
|
Literal("local_fn_name"),
|
||||||
@ -304,6 +315,7 @@ fn seq_par_call() {
|
|||||||
output: Scalar("result_2"),
|
output: Scalar("result_2"),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(instruction, expected);
|
assert_eq!(instruction, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ name = "polyplets"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "polyplets"
|
name = "polyplets"
|
||||||
|
@ -4,6 +4,7 @@ description = "Interface of the Aquamarine stepper"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "stepper_interface"
|
name = "stepper_interface"
|
||||||
|
@ -3,6 +3,7 @@ name = "aqua-test-module"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "aqua_test_module"
|
name = "aqua_test_module"
|
||||||
|
@ -3,6 +3,7 @@ name = "aqua-test-utils"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "aqua_test_utils"
|
name = "aqua_test_utils"
|
||||||
@ -10,5 +11,5 @@ path = "src/lib.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fluence = { version = "=0.2.13", features = ["logger"] }
|
fluence = { version = "=0.2.13", features = ["logger"] }
|
||||||
aquamarine-vm = { git = "https://github.com/fluencelabs/fce", branch = "master", features = ["raw-aquamarine-vm-api"] }
|
aquamarine-vm = { version = "=0.1.6", features = ["raw-aquamarine-vm-api"] }
|
||||||
serde_json = "1.0.56"
|
serde_json = "1.0.56"
|
||||||
|
@ -29,10 +29,10 @@ pub use aquamarine_vm::vec1::Vec1;
|
|||||||
pub use aquamarine_vm::AquamarineVM;
|
pub use aquamarine_vm::AquamarineVM;
|
||||||
pub use aquamarine_vm::AquamarineVMConfig;
|
pub use aquamarine_vm::AquamarineVMConfig;
|
||||||
pub use aquamarine_vm::AquamarineVMError;
|
pub use aquamarine_vm::AquamarineVMError;
|
||||||
pub use aquamarine_vm::HostExportedFunc;
|
pub use aquamarine_vm::CallServiceClosure;
|
||||||
pub use aquamarine_vm::HostImportDescriptor;
|
|
||||||
pub use aquamarine_vm::IType;
|
pub use aquamarine_vm::IType;
|
||||||
pub use aquamarine_vm::IValue;
|
pub use aquamarine_vm::IValue;
|
||||||
|
pub use aquamarine_vm::ParticleParameters;
|
||||||
pub use aquamarine_vm::StepperOutcome;
|
pub use aquamarine_vm::StepperOutcome;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -41,21 +41,14 @@ use std::path::PathBuf;
|
|||||||
type JValue = serde_json::Value;
|
type JValue = serde_json::Value;
|
||||||
|
|
||||||
pub fn create_aqua_vm(
|
pub fn create_aqua_vm(
|
||||||
call_service: HostExportedFunc,
|
call_service: CallServiceClosure,
|
||||||
current_peer_id: impl Into<String>,
|
current_peer_id: impl Into<String>,
|
||||||
) -> AquamarineVM {
|
) -> AquamarineVM {
|
||||||
let call_service_descriptor = HostImportDescriptor {
|
|
||||||
host_exported_func: call_service,
|
|
||||||
argument_types: vec![IType::String, IType::String, IType::String, IType::String],
|
|
||||||
output_type: Some(IType::Record(0)),
|
|
||||||
error_handler: None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let tmp_dir = std::env::temp_dir();
|
let tmp_dir = std::env::temp_dir();
|
||||||
|
|
||||||
let config = AquamarineVMConfig {
|
let config = AquamarineVMConfig {
|
||||||
aquamarine_wasm_path: PathBuf::from("../target/wasm32-wasi/debug/aquamarine.wasm"),
|
aquamarine_wasm_path: PathBuf::from("../target/wasm32-wasi/debug/aquamarine.wasm"),
|
||||||
call_service: call_service_descriptor,
|
call_service,
|
||||||
current_peer_id: current_peer_id.into(),
|
current_peer_id: current_peer_id.into(),
|
||||||
particle_data_store: tmp_dir,
|
particle_data_store: tmp_dir,
|
||||||
logging_mask: i32::max_value(),
|
logging_mask: i32::max_value(),
|
||||||
@ -64,7 +57,7 @@ pub fn create_aqua_vm(
|
|||||||
AquamarineVM::new(config).expect("vm should be created")
|
AquamarineVM::new(config).expect("vm should be created")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unit_call_service() -> HostExportedFunc {
|
pub fn unit_call_service() -> CallServiceClosure {
|
||||||
Box::new(|_, _| -> Option<IValue> {
|
Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
@ -76,7 +69,7 @@ pub fn unit_call_service() -> HostExportedFunc {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn echo_string_call_service() -> HostExportedFunc {
|
pub fn echo_string_call_service() -> CallServiceClosure {
|
||||||
Box::new(|_, args| -> Option<IValue> {
|
Box::new(|_, args| -> Option<IValue> {
|
||||||
let arg = match &args[2] {
|
let arg = match &args[2] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
@ -95,7 +88,7 @@ pub fn echo_string_call_service() -> HostExportedFunc {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn echo_number_call_service() -> HostExportedFunc {
|
pub fn echo_number_call_service() -> CallServiceClosure {
|
||||||
Box::new(|_, args| -> Option<IValue> {
|
Box::new(|_, args| -> Option<IValue> {
|
||||||
let arg = match &args[2] {
|
let arg = match &args[2] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
@ -110,7 +103,7 @@ pub fn echo_number_call_service() -> HostExportedFunc {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_variable_call_service(json: impl Into<String>) -> HostExportedFunc {
|
pub fn set_variable_call_service(json: impl Into<String>) -> CallServiceClosure {
|
||||||
let json = json.into();
|
let json = json.into();
|
||||||
Box::new(move |_, _| -> Option<IValue> {
|
Box::new(move |_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
@ -119,7 +112,7 @@ pub fn set_variable_call_service(json: impl Into<String>) -> HostExportedFunc {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_variables_call_service(ret_mapping: HashMap<String, String>) -> HostExportedFunc {
|
pub fn set_variables_call_service(ret_mapping: HashMap<String, String>) -> CallServiceClosure {
|
||||||
Box::new(move |_, args| -> Option<IValue> {
|
Box::new(move |_, args| -> Option<IValue> {
|
||||||
let arg_name = match &args[2] {
|
let arg_name = match &args[2] {
|
||||||
IValue::String(json_str) => {
|
IValue::String(json_str) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "stepper-lib"
|
name = "stepper-lib"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ wasm-bindgen = "=0.2.65"
|
|||||||
|
|
||||||
[dev_dependencies]
|
[dev_dependencies]
|
||||||
aqua-test-utils = { path = "../crates/test-utils" }
|
aqua-test-utils = { path = "../crates/test-utils" }
|
||||||
fluence-app-service = "=0.1.17"
|
fluence-app-service = "=0.1.18"
|
||||||
|
|
||||||
criterion = "0.3.3"
|
criterion = "0.3.3"
|
||||||
csv = "1.1.5"
|
csv = "1.1.5"
|
||||||
|
@ -13,7 +13,7 @@ use std::cell::RefCell;
|
|||||||
thread_local!(static VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "test_peer_id")));
|
thread_local!(static VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "test_peer_id")));
|
||||||
thread_local!(static SCRIPT: String = String::from(
|
thread_local!(static SCRIPT: String = String::from(
|
||||||
r#"
|
r#"
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_name)
|
(call "test_peer_id" ("local_service_id" "local_fn_name") [] result_name)
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -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::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::StepperOutcome;
|
use aqua_test_utils::StepperOutcome;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
@ -16,7 +16,7 @@ use std::cell::RefCell;
|
|||||||
thread_local!(static RELAY_1_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "Relay1")));
|
thread_local!(static RELAY_1_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "Relay1")));
|
||||||
thread_local!(static RELAY_2_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "Relay2")));
|
thread_local!(static RELAY_2_VM: RefCell<AquamarineVM> = RefCell::new(create_aqua_vm(unit_call_service(), "Relay2")));
|
||||||
thread_local!(static REMOTE_VM: RefCell<AquamarineVM> = RefCell::new({
|
thread_local!(static REMOTE_VM: RefCell<AquamarineVM> = RefCell::new({
|
||||||
let members_call_service: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let members_call_service: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
IValue::S32(0),
|
IValue::S32(0),
|
||||||
|
@ -2,7 +2,7 @@ use aqua_test_utils::create_aqua_vm;
|
|||||||
use aqua_test_utils::set_variables_call_service;
|
use aqua_test_utils::set_variables_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::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::StepperOutcome;
|
use aqua_test_utils::StepperOutcome;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
@ -20,7 +20,7 @@ thread_local!(static VM: RefCell<AquamarineVM> = RefCell::new({
|
|||||||
let add_blueprint_response = String::from("add_blueprint response");
|
let add_blueprint_response = String::from("add_blueprint response");
|
||||||
let create_response = String::from("create response");
|
let create_response = String::from("create response");
|
||||||
|
|
||||||
let call_service: HostExportedFunc = Box::new(move |_, args| -> Option<IValue> {
|
let call_service: CallServiceClosure = Box::new(move |_, args| -> Option<IValue> {
|
||||||
let builtin_service = match &args[0] {
|
let builtin_service = match &args[0] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
@ -79,13 +79,13 @@ 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::unit_call_service;
|
use aqua_test_utils::unit_call_service;
|
||||||
use aqua_test_utils::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
// Check that %current_peer_id% alias works correctly (by comparing result with it and explicit peer id).
|
// Check that %init_peer_id% alias works correctly (by comparing result with it and explicit peer id).
|
||||||
// Additionally, check that empty string for data does the same as empty call path.
|
// Additionally, check that empty string for data does the same as empty call path.
|
||||||
#[test]
|
#[test]
|
||||||
fn current_peer_id_call() {
|
fn current_peer_id_call() {
|
||||||
@ -99,12 +99,12 @@ mod tests {
|
|||||||
let function_name = String::from("local_fn_name");
|
let function_name = String::from("local_fn_name");
|
||||||
let script = format!(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(call %current_peer_id% ("{}" "{}") [] result_name)
|
(call %init_peer_id% ("{}" "{}") [] result_name)
|
||||||
"#,
|
"#,
|
||||||
service_id, function_name
|
service_id, function_name
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "asd", script.clone(), "[]", "[]");
|
let res = call_vm!(vm, vm_peer_id.clone(), script.clone(), "[]", "[]");
|
||||||
let call_path: CallEvidencePath = serde_json::from_slice(&res.data).expect("should be a valid json");
|
let call_path: CallEvidencePath = serde_json::from_slice(&res.data).expect("should be a valid json");
|
||||||
|
|
||||||
let executed_call_state = Call(Executed(Rc::new(JValue::String(String::from("test")))));
|
let executed_call_state = Call(Executed(Rc::new(JValue::String(String::from("test")))));
|
||||||
@ -176,7 +176,7 @@ mod tests {
|
|||||||
use crate::call_evidence::CallResult::*;
|
use crate::call_evidence::CallResult::*;
|
||||||
use crate::call_evidence::EvidenceState::*;
|
use crate::call_evidence::EvidenceState::*;
|
||||||
|
|
||||||
let call_service: HostExportedFunc = Box::new(|_, args| -> Option<IValue> {
|
let call_service: CallServiceClosure = Box::new(|_, args| -> Option<IValue> {
|
||||||
let arg = match &args[2] {
|
let arg = match &args[2] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
@ -81,7 +81,6 @@ fn resolve_to_string<'i>(value: &InstructionValue<'i>, ctx: &ExecutionCtx<'i>) -
|
|||||||
use crate::air::resolve::resolve_to_jvaluable;
|
use crate::air::resolve::resolve_to_jvaluable;
|
||||||
|
|
||||||
let resolved = match value {
|
let resolved = match value {
|
||||||
InstructionValue::CurrentPeerId => ctx.current_peer_id.clone(),
|
|
||||||
InstructionValue::InitPeerId => ctx.init_peer_id.clone(),
|
InstructionValue::InitPeerId => ctx.init_peer_id.clone(),
|
||||||
InstructionValue::Literal(value) => value.to_string(),
|
InstructionValue::Literal(value) => value.to_string(),
|
||||||
InstructionValue::Variable(name) => {
|
InstructionValue::Variable(name) => {
|
||||||
|
@ -195,14 +195,16 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn par_local_remote() {
|
fn par_local_remote() {
|
||||||
let mut vm = create_aqua_vm(unit_call_service(), "");
|
let local_peer_id = "local_peer_id";
|
||||||
|
let mut vm = create_aqua_vm(unit_call_service(), local_peer_id);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(par
|
(par
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_name)
|
(call "{}" ("local_service_id" "local_fn_name") [] result_name)
|
||||||
(call "remote_peer_id_2" ("service_id" "fn_name") [] g)
|
(call "remote_peer_id_2" ("service_id" "fn_name") [] g)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "", script, "[]", "[]");
|
let res = call_vm!(vm, "", script, "[]", "[]");
|
||||||
|
@ -37,7 +37,6 @@ pub(crate) fn resolve_to_args<'i>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
match value {
|
match value {
|
||||||
InstructionValue::CurrentPeerId => handle_string_arg(ctx.current_peer_id.as_str(), ctx),
|
|
||||||
InstructionValue::InitPeerId => handle_string_arg(ctx.init_peer_id.as_str(), ctx),
|
InstructionValue::InitPeerId => handle_string_arg(ctx.init_peer_id.as_str(), ctx),
|
||||||
InstructionValue::Literal(value) => handle_string_arg(value, ctx),
|
InstructionValue::Literal(value) => handle_string_arg(value, ctx),
|
||||||
InstructionValue::Variable(name) => {
|
InstructionValue::Variable(name) => {
|
||||||
|
@ -65,17 +65,20 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn seq_local_remote() {
|
fn seq_local_remote() {
|
||||||
let mut vm = create_aqua_vm(unit_call_service(), "");
|
let local_peer_id = "local_peer_id";
|
||||||
|
let remote_peer_id = String::from("remote_peer_id");
|
||||||
|
let mut vm = create_aqua_vm(unit_call_service(), local_peer_id);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_name)
|
(call "{}" ("local_service_id" "local_fn_name") [] result_name)
|
||||||
(call "remote_peer_id_2" ("service_id" "fn_name") [] g)
|
(call "{}" ("service_id" "fn_name") [] g)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id, remote_peer_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
||||||
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id_2")]);
|
assert_eq!(res.next_peer_pks, vec![remote_peer_id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ mod tests {
|
|||||||
|
|
||||||
use aqua_test_utils::call_vm;
|
use aqua_test_utils::call_vm;
|
||||||
use aqua_test_utils::create_aqua_vm;
|
use aqua_test_utils::create_aqua_vm;
|
||||||
use aqua_test_utils::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
fn fallible_call_service(fallible_service_id: String) -> HostExportedFunc {
|
fn fallible_call_service(fallible_service_id: String) -> CallServiceClosure {
|
||||||
Box::new(move |_, args| -> Option<IValue> {
|
Box::new(move |_, args| -> Option<IValue> {
|
||||||
let builtin_service = match &args[0] {
|
let builtin_service = match &args[0] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
@ -76,15 +76,17 @@ mod tests {
|
|||||||
use crate::call_evidence::CallResult::*;
|
use crate::call_evidence::CallResult::*;
|
||||||
use crate::call_evidence::EvidenceState::*;
|
use crate::call_evidence::EvidenceState::*;
|
||||||
|
|
||||||
|
let local_peer_id = "local_peer_id";
|
||||||
let fallible_service_id = String::from("service_id_1");
|
let fallible_service_id = String::from("service_id_1");
|
||||||
let mut vm = create_aqua_vm(fallible_call_service(fallible_service_id), "");
|
let mut vm = create_aqua_vm(fallible_call_service(fallible_service_id), local_peer_id);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(xor
|
(xor
|
||||||
(call %current_peer_id% ("service_id_1" "local_fn_name") [] result_1)
|
(call "{0}" ("service_id_1" "local_fn_name") [] result_1)
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_2)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_2)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
||||||
@ -95,12 +97,13 @@ mod tests {
|
|||||||
assert_eq!(call_path[0], Call(CallServiceFailed(String::from(r#""error""#))));
|
assert_eq!(call_path[0], Call(CallServiceFailed(String::from(r#""error""#))));
|
||||||
assert_eq!(call_path[1], executed_call_result);
|
assert_eq!(call_path[1], executed_call_result);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(xor
|
(xor
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_1)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_1)
|
||||||
(call %current_peer_id% ("service_id_1" "local_fn_name") [] result_2)
|
(call "{0}" ("service_id_1" "local_fn_name") [] result_2)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
||||||
@ -116,26 +119,28 @@ mod tests {
|
|||||||
use crate::call_evidence::EvidenceState::*;
|
use crate::call_evidence::EvidenceState::*;
|
||||||
|
|
||||||
let fallible_service_id = String::from("service_id_1");
|
let fallible_service_id = String::from("service_id_1");
|
||||||
let mut vm = create_aqua_vm(fallible_call_service(fallible_service_id.clone()), "");
|
let local_peer_id = "local_peer_id";
|
||||||
|
let mut vm = create_aqua_vm(fallible_call_service(fallible_service_id.clone()), local_peer_id);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(xor
|
(xor
|
||||||
(par
|
(par
|
||||||
(seq
|
(seq
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_1)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_1)
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_2)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_2)
|
||||||
)
|
)
|
||||||
(par
|
(par
|
||||||
(call %current_peer_id% ("service_id_1" "local_fn_name") [] result_3)
|
(call "{0}" ("service_id_1" "local_fn_name") [] result_3)
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_4)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_4)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(seq
|
(seq
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_4)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_4)
|
||||||
(call %current_peer_id% ("service_id_2" "local_fn_name") [] result_5)
|
(call "{0}" ("service_id_2" "local_fn_name") [] result_5)
|
||||||
)
|
)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let result = call_vm!(vm, "asd", script.clone(), "[]", "[]");
|
let result = call_vm!(vm, "asd", script.clone(), "[]", "[]");
|
||||||
@ -144,7 +149,7 @@ mod tests {
|
|||||||
let res = String::from("res");
|
let res = String::from("res");
|
||||||
let executed_call_result = Rc::new(JValue::String(res));
|
let executed_call_result = Rc::new(JValue::String(res));
|
||||||
|
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Par(2, 2),
|
Par(2, 2),
|
||||||
Call(Executed(executed_call_result.clone())),
|
Call(Executed(executed_call_result.clone())),
|
||||||
Call(Executed(executed_call_result.clone())),
|
Call(Executed(executed_call_result.clone())),
|
||||||
@ -154,10 +159,10 @@ mod tests {
|
|||||||
Call(Executed(executed_call_result.clone())),
|
Call(Executed(executed_call_result.clone())),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(result_path, right_path);
|
assert_eq!(result_path, expected_path);
|
||||||
|
|
||||||
let result = call_vm!(vm, "asd", script, "[]", result.data);
|
let result = call_vm!(vm, "asd", script, "[]", result.data);
|
||||||
let result_path: CallEvidencePath = serde_json::from_slice(&result.data).expect("should be valid json");
|
let result_path: CallEvidencePath = serde_json::from_slice(&result.data).expect("should be valid json");
|
||||||
assert_eq!(result_path, right_path);
|
assert_eq!(result_path, expected_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,15 +226,15 @@ mod tests {
|
|||||||
|
|
||||||
let merged_path = merge_call_paths(prev_path, current_path).expect("merging should be successful");
|
let merged_path = merge_call_paths(prev_path, current_path).expect("merging should be successful");
|
||||||
|
|
||||||
let mut right_merged_path = CallEvidencePath::new();
|
let mut expected_merged_path = CallEvidencePath::new();
|
||||||
right_merged_path.push_back(Par(1, 1));
|
expected_merged_path.push_back(Par(1, 1));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Par(1, 1));
|
expected_merged_path.push_back(Par(1, 1));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
|
|
||||||
assert_eq!(merged_path, right_merged_path);
|
assert_eq!(merged_path, expected_merged_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -261,17 +261,17 @@ mod tests {
|
|||||||
|
|
||||||
let merged_path = merge_call_paths(prev_path, current_path).expect("merging should be successful");
|
let merged_path = merge_call_paths(prev_path, current_path).expect("merging should be successful");
|
||||||
|
|
||||||
let mut right_merged_path = CallEvidencePath::new();
|
let mut expected_merged_path = CallEvidencePath::new();
|
||||||
right_merged_path.push_back(Par(2, 2));
|
expected_merged_path.push_back(Par(2, 2));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(RequestSent(String::from("peer_1"))));
|
expected_merged_path.push_back(Call(RequestSent(String::from("peer_1"))));
|
||||||
right_merged_path.push_back(Par(1, 1));
|
expected_merged_path.push_back(Par(1, 1));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
|
|
||||||
assert_eq!(merged_path, right_merged_path);
|
assert_eq!(merged_path, expected_merged_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -304,20 +304,20 @@ mod tests {
|
|||||||
|
|
||||||
let merged_path = merge_call_paths(prev_path, current_path).expect("merging should be successful");
|
let merged_path = merge_call_paths(prev_path, current_path).expect("merging should be successful");
|
||||||
|
|
||||||
let mut right_merged_path = CallEvidencePath::new();
|
let mut expected_merged_path = CallEvidencePath::new();
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Par(3, 3));
|
expected_merged_path.push_back(Par(3, 3));
|
||||||
right_merged_path.push_back(Par(1, 1));
|
expected_merged_path.push_back(Par(1, 1));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Par(1, 1));
|
expected_merged_path.push_back(Par(1, 1));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(RequestSent(String::from("peer_1"))));
|
expected_merged_path.push_back(Call(RequestSent(String::from("peer_1"))));
|
||||||
right_merged_path.push_back(Par(1, 2));
|
expected_merged_path.push_back(Par(1, 2));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
expected_merged_path.push_back(Call(Executed(Rc::new(JValue::Null))));
|
||||||
right_merged_path.push_back(Call(RequestSent(String::from("peer_1"))));
|
expected_merged_path.push_back(Call(RequestSent(String::from("peer_1"))));
|
||||||
|
|
||||||
assert_eq!(merged_path, right_merged_path);
|
assert_eq!(merged_path, expected_merged_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ use aqua_test_utils::call_vm;
|
|||||||
use aqua_test_utils::create_aqua_vm;
|
use aqua_test_utils::create_aqua_vm;
|
||||||
use aqua_test_utils::set_variables_call_service;
|
use aqua_test_utils::set_variables_call_service;
|
||||||
use aqua_test_utils::unit_call_service;
|
use aqua_test_utils::unit_call_service;
|
||||||
use aqua_test_utils::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
|
|
||||||
@ -36,15 +36,16 @@ fn seq_par_call() {
|
|||||||
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());
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(par
|
(par
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_1)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_1)
|
||||||
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
||||||
)
|
)
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_2)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_2)
|
||||||
)"#,
|
)"#,
|
||||||
|
vm_peer_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
||||||
@ -52,14 +53,14 @@ fn seq_par_call() {
|
|||||||
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
||||||
|
|
||||||
let test_string = String::from("test");
|
let test_string = String::from("test");
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Par(1, 1),
|
Par(1, 1),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
Call(RequestSent(vm_peer_id)),
|
Call(RequestSent(vm_peer_id)),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_path);
|
assert_eq!(resulted_path, expected_path);
|
||||||
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,15 +72,16 @@ fn par_par_call() {
|
|||||||
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());
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(par
|
(par
|
||||||
(par
|
(par
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_1)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_1)
|
||||||
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
||||||
)
|
)
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_2)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_2)
|
||||||
)"#,
|
)"#,
|
||||||
|
vm_peer_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
let res = call_vm!(vm, "asd", script, "[]", "[]");
|
||||||
@ -87,7 +89,7 @@ fn par_par_call() {
|
|||||||
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
||||||
|
|
||||||
let test_string = String::from("test");
|
let test_string = String::from("test");
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Par(3, 1),
|
Par(3, 1),
|
||||||
Par(1, 1),
|
Par(1, 1),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
@ -95,7 +97,7 @@ fn par_par_call() {
|
|||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_path);
|
assert_eq!(resulted_path, expected_path);
|
||||||
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ fn create_service() {
|
|||||||
let add_blueprint_response = String::from("add_blueprint response");
|
let add_blueprint_response = String::from("add_blueprint response");
|
||||||
let create_response = String::from("create response");
|
let create_response = String::from("create response");
|
||||||
|
|
||||||
let call_service: HostExportedFunc = Box::new(move |_, args| -> Option<IValue> {
|
let call_service: CallServiceClosure = Box::new(move |_, args| -> Option<IValue> {
|
||||||
let builtin_service = match &args[0] {
|
let builtin_service = match &args[0] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@ -162,7 +164,7 @@ fn create_service() {
|
|||||||
let add_blueprint_response = String::from("add_blueprint response");
|
let add_blueprint_response = String::from("add_blueprint response");
|
||||||
let create_response = String::from("create response");
|
let create_response = String::from("create response");
|
||||||
let resulted_path: Vec<EvidenceState> = serde_json::from_slice(&res.data).expect("should be a correct json");
|
let resulted_path: Vec<EvidenceState> = serde_json::from_slice(&res.data).expect("should be a correct json");
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Call(Executed(Rc::new(module_bytes))),
|
Call(Executed(Rc::new(module_bytes))),
|
||||||
Call(Executed(Rc::new(module_config))),
|
Call(Executed(Rc::new(module_config))),
|
||||||
Call(Executed(Rc::new(blueprint))),
|
Call(Executed(Rc::new(blueprint))),
|
||||||
@ -172,6 +174,6 @@ fn create_service() {
|
|||||||
Call(RequestSent(String::from("A"))),
|
Call(RequestSent(String::from("A"))),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_path);
|
assert_eq!(resulted_path, expected_path);
|
||||||
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ use aqua_test_utils::call_vm;
|
|||||||
use aqua_test_utils::create_aqua_vm;
|
use aqua_test_utils::create_aqua_vm;
|
||||||
use aqua_test_utils::echo_number_call_service;
|
use aqua_test_utils::echo_number_call_service;
|
||||||
use aqua_test_utils::unit_call_service;
|
use aqua_test_utils::unit_call_service;
|
||||||
use aqua_test_utils::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
|
|
||||||
@ -33,17 +33,19 @@ fn evidence_seq_par_call() {
|
|||||||
use stepper_lib::CallResult::*;
|
use stepper_lib::CallResult::*;
|
||||||
use stepper_lib::EvidenceState::{self, *};
|
use stepper_lib::EvidenceState::{self, *};
|
||||||
|
|
||||||
let mut vm = create_aqua_vm(unit_call_service(), "");
|
let local_peer_id = "local_peer_id";
|
||||||
|
let mut vm = create_aqua_vm(unit_call_service(), local_peer_id);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(par
|
(par
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_1)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_1)
|
||||||
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
||||||
)
|
)
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_2)
|
(call "{0}" ("local_service_id" "local_fn_name") [] result_2)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let initial_state = json!([
|
let initial_state = json!([
|
||||||
@ -58,14 +60,14 @@ fn evidence_seq_par_call() {
|
|||||||
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
||||||
|
|
||||||
let test_string = String::from("test");
|
let test_string = String::from("test");
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Par(1, 1),
|
Par(1, 1),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string)))),
|
Call(Executed(Rc::new(JValue::String(test_string)))),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_path);
|
assert_eq!(resulted_path, expected_path);
|
||||||
assert!(res.next_peer_pks.is_empty());
|
assert!(res.next_peer_pks.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,17 +76,19 @@ fn evidence_par_par_call() {
|
|||||||
use stepper_lib::CallResult::*;
|
use stepper_lib::CallResult::*;
|
||||||
use stepper_lib::EvidenceState::{self, *};
|
use stepper_lib::EvidenceState::{self, *};
|
||||||
|
|
||||||
let mut vm = create_aqua_vm(unit_call_service(), "some_peer_id");
|
let local_peer_id = "local_peer_id";
|
||||||
|
let mut vm = create_aqua_vm(unit_call_service(), local_peer_id);
|
||||||
|
|
||||||
let script = String::from(
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(par
|
(par
|
||||||
(par
|
(par
|
||||||
(call "some_peer_id" ("local_service_id" "local_fn_name") [] result_1)
|
(call "local_peer_id" ("local_service_id" "local_fn_name") [] result_1)
|
||||||
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
(call "remote_peer_id" ("service_id" "fn_name") [] g)
|
||||||
)
|
)
|
||||||
(call %current_peer_id% ("local_service_id" "local_fn_name") [] result_2)
|
(call "{}" ("local_service_id" "local_fn_name") [] result_2)
|
||||||
)"#,
|
)"#,
|
||||||
|
local_peer_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
let initial_state = json!([
|
let initial_state = json!([
|
||||||
@ -100,15 +104,15 @@ fn evidence_par_par_call() {
|
|||||||
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
||||||
|
|
||||||
let test_string = String::from("test");
|
let test_string = String::from("test");
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Par(3, 1),
|
Par(3, 1),
|
||||||
Par(1, 1),
|
Par(1, 1),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
Call(RequestSent(String::from("some_peer_id"))),
|
Call(RequestSent(local_peer_id.to_string())),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string)))),
|
Call(Executed(Rc::new(JValue::String(test_string)))),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_path);
|
assert_eq!(resulted_path, expected_path);
|
||||||
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
assert_eq!(res.next_peer_pks, vec![String::from("remote_peer_id")]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,13 +151,13 @@ fn evidence_seq_seq() {
|
|||||||
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
serde_json::from_slice(&res.data).expect("stepper should return valid json");
|
||||||
|
|
||||||
let test_string = String::from("test");
|
let test_string = String::from("test");
|
||||||
let right_path = vec![
|
let expected_path = vec![
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
Call(Executed(Rc::new(JValue::String(test_string.clone())))),
|
||||||
Call(Executed(Rc::new(JValue::String(test_string)))),
|
Call(Executed(Rc::new(JValue::String(test_string)))),
|
||||||
];
|
];
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_path);
|
assert_eq!(resulted_path, expected_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -182,7 +186,7 @@ fn evidence_create_service() {
|
|||||||
let add_blueprint_response = String::from("add_blueprint response");
|
let add_blueprint_response = String::from("add_blueprint response");
|
||||||
let create_response = String::from("create response");
|
let create_response = String::from("create response");
|
||||||
|
|
||||||
let call_service: HostExportedFunc = Box::new(move |_, args| -> Option<IValue> {
|
let call_service: CallServiceClosure = Box::new(move |_, args| -> Option<IValue> {
|
||||||
let builtin_service = match &args[0] {
|
let builtin_service = match &args[0] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@ -227,7 +231,7 @@ fn evidence_create_service() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn evidence_par_seq_fold_call() {
|
fn evidence_par_seq_fold_call() {
|
||||||
let return_numbers_call_service: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let return_numbers_call_service: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
IValue::S32(0),
|
IValue::S32(0),
|
||||||
@ -271,7 +275,7 @@ fn evidence_par_seq_fold_call() {
|
|||||||
let res = call_vm!(vm3, "asd", script, "[]", data);
|
let res = call_vm!(vm3, "asd", script, "[]", data);
|
||||||
let resulted_path: JValue = serde_json::from_slice(&res.data).expect("a valid json");
|
let resulted_path: JValue = serde_json::from_slice(&res.data).expect("a valid json");
|
||||||
|
|
||||||
let right_json = json!( [
|
let expected_json = json!( [
|
||||||
{ "par": [21,1] },
|
{ "par": [21,1] },
|
||||||
{ "call": { "executed": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] } },
|
{ "call": { "executed": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] } },
|
||||||
{ "par": [1,18] },
|
{ "par": [1,18] },
|
||||||
@ -297,13 +301,13 @@ fn evidence_par_seq_fold_call() {
|
|||||||
{ "call": { "executed": "test" } },
|
{ "call": { "executed": "test" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_path, right_json);
|
assert_eq!(resulted_path, expected_json);
|
||||||
assert!(res.next_peer_pks.is_empty());
|
assert!(res.next_peer_pks.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn evidence_par_seq_fold_in_cycle_call() {
|
fn evidence_par_seq_fold_in_cycle_call() {
|
||||||
let return_numbers_call_service: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let return_numbers_call_service: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
IValue::S32(0),
|
IValue::S32(0),
|
||||||
@ -346,7 +350,7 @@ fn evidence_par_seq_fold_in_cycle_call() {
|
|||||||
|
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let right_json = json!( [
|
let expected_json = json!( [
|
||||||
{ "par": [21,1] },
|
{ "par": [21,1] },
|
||||||
{ "call": { "executed": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] } },
|
{ "call": { "executed": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] } },
|
||||||
{ "par": [1,18] },
|
{ "par": [1,18] },
|
||||||
@ -372,7 +376,7 @@ fn evidence_par_seq_fold_in_cycle_call() {
|
|||||||
{ "call": { "executed": "test" } },
|
{ "call": { "executed": "test" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_json, right_json);
|
assert_eq!(resulted_json, expected_json);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -410,7 +414,7 @@ fn evidence_seq_par_seq_seq() {
|
|||||||
|
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let right_json = json!( [
|
let expected_json = json!( [
|
||||||
{ "par": [2,2] },
|
{ "par": [2,2] },
|
||||||
{ "call": {"executed" : "test" } },
|
{ "call": {"executed" : "test" } },
|
||||||
{ "call": {"executed" : "test" } },
|
{ "call": {"executed" : "test" } },
|
||||||
@ -419,6 +423,6 @@ fn evidence_seq_par_seq_seq() {
|
|||||||
{ "call": {"executed" : "test" } },
|
{ "call": {"executed" : "test" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_json, right_json);
|
assert_eq!(resulted_json, expected_json);
|
||||||
assert!(res.next_peer_pks.is_empty());
|
assert!(res.next_peer_pks.is_empty());
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ use aqua_test_utils::call_vm;
|
|||||||
use aqua_test_utils::create_aqua_vm;
|
use aqua_test_utils::create_aqua_vm;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
use aqua_test_utils::{AquamarineVM, HostExportedFunc};
|
use aqua_test_utils::{AquamarineVM, CallServiceClosure};
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
@ -54,7 +54,7 @@ fn client_host_function(
|
|||||||
known_peers: Vec<String>,
|
known_peers: Vec<String>,
|
||||||
client_id: String,
|
client_id: String,
|
||||||
relay_id: String,
|
relay_id: String,
|
||||||
) -> (HostExportedFunc, Rc<RefCell<String>>) {
|
) -> (CallServiceClosure, Rc<RefCell<String>>) {
|
||||||
let all_info = Rc::new(RefCell::new(String::new()));
|
let all_info = Rc::new(RefCell::new(String::new()));
|
||||||
let known_peers = JValue::Array(known_peers.iter().cloned().map(JValue::String).collect::<Vec<_>>());
|
let known_peers = JValue::Array(known_peers.iter().cloned().map(JValue::String).collect::<Vec<_>>());
|
||||||
let client_id = JValue::String(client_id);
|
let client_id = JValue::String(client_id);
|
||||||
@ -72,7 +72,7 @@ fn client_host_function(
|
|||||||
);
|
);
|
||||||
|
|
||||||
let all_info_inner = all_info.clone();
|
let all_info_inner = all_info.clone();
|
||||||
let host_function: HostExportedFunc = Box::new(move |_, args| -> Option<IValue> {
|
let host_function: CallServiceClosure = Box::new(move |_, args| -> Option<IValue> {
|
||||||
let service_name = match &args[0] {
|
let service_name = match &args[0] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@ -110,7 +110,7 @@ fn peer_host_function(
|
|||||||
modules: Vec<String>,
|
modules: Vec<String>,
|
||||||
interfaces: Vec<String>,
|
interfaces: Vec<String>,
|
||||||
ident: String,
|
ident: String,
|
||||||
) -> HostExportedFunc {
|
) -> CallServiceClosure {
|
||||||
let known_peers = JValue::Array(known_peers.into_iter().map(JValue::String).collect());
|
let known_peers = JValue::Array(known_peers.into_iter().map(JValue::String).collect());
|
||||||
let blueprints = JValue::Array(blueprints.into_iter().map(JValue::String).collect());
|
let blueprints = JValue::Array(blueprints.into_iter().map(JValue::String).collect());
|
||||||
let modules = JValue::Array(modules.into_iter().map(JValue::String).collect());
|
let modules = JValue::Array(modules.into_iter().map(JValue::String).collect());
|
||||||
@ -159,7 +159,7 @@ fn peer_host_function(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn create_peer_host_function(peer_id: String, known_peer_ids: Vec<String>) -> HostExportedFunc {
|
fn create_peer_host_function(peer_id: String, known_peer_ids: Vec<String>) -> CallServiceClosure {
|
||||||
let relay_blueprints = (0..=2).map(|id| format!("{}_blueprint_{}", peer_id, id)).collect::<Vec<_>>();
|
let relay_blueprints = (0..=2).map(|id| format!("{}_blueprint_{}", peer_id, id)).collect::<Vec<_>>();
|
||||||
let relay_modules = (0..=2).map(|id| format!("{}_module_{}", peer_id, id)).collect::<Vec<_>>();
|
let relay_modules = (0..=2).map(|id| format!("{}_module_{}", peer_id, id)).collect::<Vec<_>>();
|
||||||
let relay_interfaces = (0..=2).map(|id| format!("{}_interface_{}", peer_id, id)).collect::<Vec<_>>();
|
let relay_interfaces = (0..=2).map(|id| format!("{}_interface_{}", peer_id, id)).collect::<Vec<_>>();
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
use aqua_test_utils::call_vm;
|
use aqua_test_utils::call_vm;
|
||||||
use aqua_test_utils::create_aqua_vm;
|
use aqua_test_utils::create_aqua_vm;
|
||||||
use aqua_test_utils::set_variable_call_service;
|
use aqua_test_utils::set_variable_call_service;
|
||||||
use aqua_test_utils::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
|
|
||||||
@ -28,13 +28,13 @@ type JValue = serde_json::Value;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn data_merge() {
|
fn data_merge() {
|
||||||
let neighborhood_call_service1: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let neighborhood_call_service1: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![IValue::S32(0), IValue::String(String::from("[\"A\", \"B\"]"))]).unwrap(),
|
Vec1::new(vec![IValue::S32(0), IValue::String(String::from("[\"A\", \"B\"]"))]).unwrap(),
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
|
|
||||||
let neighborhood_call_service2: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let neighborhood_call_service2: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![IValue::S32(0), IValue::String(String::from("[\"A\", \"B\"]"))]).unwrap(),
|
Vec1::new(vec![IValue::S32(0), IValue::String(String::from("[\"A\", \"B\"]"))]).unwrap(),
|
||||||
))
|
))
|
||||||
@ -46,7 +46,7 @@ fn data_merge() {
|
|||||||
let script = String::from(
|
let script = String::from(
|
||||||
r#"
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(call %current_peer_id% ("neighborhood" "") [] neighborhood)
|
(call %init_peer_id% ("neighborhood" "") [] neighborhood)
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(fold neighborhood i
|
(fold neighborhood i
|
||||||
@ -71,14 +71,15 @@ fn data_merge() {
|
|||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
let res1 = call_vm!(vm1, "asd", script.clone(), "[]", "[]");
|
// little hack here with init_peer_id to execute the first call from both VMs
|
||||||
let res2 = call_vm!(vm2, "asd", script.clone(), "[]", "[]");
|
let res1 = call_vm!(vm1, "A", script.clone(), "[]", "[]");
|
||||||
|
let res2 = call_vm!(vm2, "B", script.clone(), "[]", "[]");
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let right_json1 = json!( [
|
let expected_json1 = json!( [
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
{ "par": [1,2] },
|
{ "par": [1,2] },
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
@ -92,12 +93,12 @@ fn data_merge() {
|
|||||||
{ "call": { "request_sent": "A" } },
|
{ "call": { "request_sent": "A" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_json1, right_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("stepper should return valid json");
|
||||||
|
|
||||||
let right_json2 = json!( [
|
let expected_json2 = json!( [
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
{ "par": [1,2] },
|
{ "par": [1,2] },
|
||||||
{ "call": { "request_sent": "B" } },
|
{ "call": { "request_sent": "B" } },
|
||||||
@ -110,12 +111,12 @@ fn data_merge() {
|
|||||||
{ "call": { "request_sent": "B" } },
|
{ "call": { "request_sent": "B" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_json2, right_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("stepper should return valid json");
|
||||||
|
|
||||||
let right_json3 = json!( [
|
let expected_json3 = json!( [
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
{ "par": [1,2] },
|
{ "par": [1,2] },
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
@ -129,12 +130,12 @@ fn data_merge() {
|
|||||||
{ "call": { "request_sent": "A" } },
|
{ "call": { "request_sent": "A" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_json3, right_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("stepper should return valid json");
|
||||||
|
|
||||||
let right_json4 = json!( [
|
let expected_json4 = json!( [
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
{ "par": [1,2] },
|
{ "par": [1,2] },
|
||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
@ -148,7 +149,7 @@ fn data_merge() {
|
|||||||
{ "call": { "executed": ["A", "B"] } },
|
{ "call": { "executed": ["A", "B"] } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(resulted_json4, right_json4);
|
assert_eq!(resulted_json4, expected_json4);
|
||||||
assert!(res4.next_peer_pks.is_empty());
|
assert!(res4.next_peer_pks.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ fn data_merge() {
|
|||||||
fn acc_merge() {
|
fn acc_merge() {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
|
|
||||||
let neighborhood_call_service: HostExportedFunc = Box::new(|_, args| -> Option<IValue> {
|
let neighborhood_call_service: CallServiceClosure = Box::new(|_, args| -> Option<IValue> {
|
||||||
let args_count = match &args[1] {
|
let args_count = match &args[1] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
use aqua_test_utils::call_vm;
|
use aqua_test_utils::call_vm;
|
||||||
use aqua_test_utils::create_aqua_vm;
|
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::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ type JValue = serde_json::Value;
|
|||||||
fn join_chat() {
|
fn join_chat() {
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
let members_call_service1: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let members_call_service1: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
IValue::S32(0),
|
IValue::S32(0),
|
||||||
@ -74,30 +74,30 @@ fn join_chat() {
|
|||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let client_1_right_json = json!([
|
let client_1_expected_json = json!([
|
||||||
{ "call": {"request_sent": "A" } },
|
{ "call": {"request_sent": "A" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(client_1_res_json, client_1_right_json);
|
assert_eq!(client_1_res_json, client_1_expected_json);
|
||||||
assert_eq!(client_1_res.next_peer_pks, vec![String::from("Relay1")]);
|
assert_eq!(client_1_res.next_peer_pks, vec![String::from("Relay1")]);
|
||||||
|
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let relay_1_right_json = json!( [
|
let relay_1_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "request_sent": "Relay1" } },
|
{ "call": { "request_sent": "Relay1" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(relay_1_res_json, relay_1_right_json);
|
assert_eq!(relay_1_res_json, relay_1_expected_json);
|
||||||
assert_eq!(relay_1_res.next_peer_pks, vec![String::from("Remote")]);
|
assert_eq!(relay_1_res.next_peer_pks, vec![String::from("Remote")]);
|
||||||
|
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let remote_right_json = json!( [
|
let remote_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
@ -113,14 +113,14 @@ fn join_chat() {
|
|||||||
"Relay2",
|
"Relay2",
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(remote_res_json, remote_right_json);
|
assert_eq!(remote_res_json, remote_expected_json);
|
||||||
assert_eq!(remote_res_next_peer_pks, next_peer_pks_right);
|
assert_eq!(remote_res_next_peer_pks, next_peer_pks_right);
|
||||||
|
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let relay_1_right_json = json!( [
|
let relay_1_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
@ -131,7 +131,7 @@ fn join_chat() {
|
|||||||
{ "call": { "request_sent" : "Remote" } },
|
{ "call": { "request_sent" : "Remote" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(relay_1_res_json, relay_1_right_json);
|
assert_eq!(relay_1_res_json, relay_1_expected_json);
|
||||||
assert_eq!(relay_1_res.next_peer_pks, vec![String::from("A")]);
|
assert_eq!(relay_1_res.next_peer_pks, vec![String::from("A")]);
|
||||||
|
|
||||||
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, "[]");
|
||||||
@ -139,7 +139,7 @@ fn join_chat() {
|
|||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let client_1_right_json = json!( [
|
let client_1_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
@ -150,14 +150,14 @@ fn join_chat() {
|
|||||||
{ "call": { "request_sent" : "Remote" } },
|
{ "call": { "request_sent" : "Remote" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(client_1_res_json, client_1_right_json);
|
assert_eq!(client_1_res_json, client_1_expected_json);
|
||||||
assert_eq!(client_1_res.next_peer_pks, Vec::<String>::new());
|
assert_eq!(client_1_res.next_peer_pks, Vec::<String>::new());
|
||||||
|
|
||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let relay_2_right_json = json!( [
|
let relay_2_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
@ -168,7 +168,7 @@ fn join_chat() {
|
|||||||
{ "call": { "request_sent" : "Relay2" } },
|
{ "call": { "request_sent" : "Relay2" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(relay_2_res_json, relay_2_right_json);
|
assert_eq!(relay_2_res_json, relay_2_expected_json);
|
||||||
assert_eq!(relay_2_res.next_peer_pks, vec![String::from("B")]);
|
assert_eq!(relay_2_res.next_peer_pks, vec![String::from("B")]);
|
||||||
|
|
||||||
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, "[]");
|
||||||
@ -176,7 +176,7 @@ fn join_chat() {
|
|||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let client_2_right_json = json!( [
|
let client_2_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
{ "call": { "executed" : [["A", "Relay1"], ["B", "Relay2"]]} },
|
||||||
@ -187,13 +187,13 @@ fn join_chat() {
|
|||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(client_2_res_json, client_2_right_json);
|
assert_eq!(client_2_res_json, client_2_expected_json);
|
||||||
assert_eq!(client_2_res.next_peer_pks, Vec::<String>::new());
|
assert_eq!(client_2_res.next_peer_pks, Vec::<String>::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn join() {
|
fn join() {
|
||||||
let members_call_service1: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let members_call_service1: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![IValue::S32(0), IValue::String(String::from(r#"[["A"], ["B"]]"#))]).unwrap(),
|
Vec1::new(vec![IValue::S32(0), IValue::String(String::from(r#"[["A"], ["B"]]"#))]).unwrap(),
|
||||||
))
|
))
|
||||||
@ -232,7 +232,7 @@ fn join() {
|
|||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let client_1_right_json = json!( [
|
let client_1_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A"], ["B"]]} },
|
{ "call": { "executed" : [["A"], ["B"]]} },
|
||||||
{ "par": [2, 3] },
|
{ "par": [2, 3] },
|
||||||
@ -243,13 +243,13 @@ fn join() {
|
|||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(client_1_res_json, client_1_right_json);
|
assert_eq!(client_1_res_json, client_1_expected_json);
|
||||||
assert_eq!(client_1_res.next_peer_pks, Vec::<String>::new());
|
assert_eq!(client_1_res.next_peer_pks, Vec::<String>::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn init_peer_id() {
|
fn init_peer_id() {
|
||||||
let members_call_service1: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let members_call_service1: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![IValue::S32(0), IValue::String(String::from(r#"[["A"], ["B"]]"#))]).unwrap(),
|
Vec1::new(vec![IValue::S32(0), IValue::String(String::from(r#"[["A"], ["B"]]"#))]).unwrap(),
|
||||||
))
|
))
|
||||||
@ -312,7 +312,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("stepper should return valid json");
|
||||||
|
|
||||||
let client_1_right_json = json!( [
|
let client_1_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A"], ["B"]]} },
|
{ "call": { "executed" : [["A"], ["B"]]} },
|
||||||
{ "par": [2, 3] },
|
{ "par": [2, 3] },
|
||||||
@ -324,7 +324,7 @@ fn init_peer_id() {
|
|||||||
{ "call": { "request_sent" : "A" } },
|
{ "call": { "request_sent" : "A" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(client_1_res_json, client_1_right_json);
|
assert_eq!(client_1_res_json, client_1_expected_json);
|
||||||
assert_eq!(client_1_res.next_peer_pks, vec![initiator_peer_id.clone()]);
|
assert_eq!(client_1_res.next_peer_pks, vec![initiator_peer_id.clone()]);
|
||||||
|
|
||||||
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, "");
|
||||||
@ -332,7 +332,7 @@ fn init_peer_id() {
|
|||||||
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("stepper should return valid json");
|
||||||
|
|
||||||
let initiator_1_right_json = json!( [
|
let initiator_1_expected_json = json!( [
|
||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
{ "call": { "executed" : [["A"], ["B"]]} },
|
{ "call": { "executed" : [["A"], ["B"]]} },
|
||||||
{ "par": [2, 3] },
|
{ "par": [2, 3] },
|
||||||
@ -344,6 +344,6 @@ fn init_peer_id() {
|
|||||||
{ "call": { "executed" : "test" } },
|
{ "call": { "executed" : "test" } },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert_eq!(initiator_1_res_json, initiator_1_right_json);
|
assert_eq!(initiator_1_res_json, initiator_1_expected_json);
|
||||||
assert_eq!(initiator_1_res.next_peer_pks, Vec::<String>::new());
|
assert_eq!(initiator_1_res.next_peer_pks, Vec::<String>::new());
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
use aqua_test_utils::call_vm;
|
use aqua_test_utils::call_vm;
|
||||||
use aqua_test_utils::create_aqua_vm;
|
use aqua_test_utils::create_aqua_vm;
|
||||||
use aqua_test_utils::HostExportedFunc;
|
use aqua_test_utils::CallServiceClosure;
|
||||||
use aqua_test_utils::IValue;
|
use aqua_test_utils::IValue;
|
||||||
use aqua_test_utils::Vec1;
|
use aqua_test_utils::Vec1;
|
||||||
use polyplets::ResolvedTriplet;
|
use polyplets::ResolvedTriplet;
|
||||||
@ -27,11 +27,11 @@ use std::rc::Rc;
|
|||||||
|
|
||||||
type ArgTetraplets = Vec<Vec<SecurityTetraplet>>;
|
type ArgTetraplets = Vec<Vec<SecurityTetraplet>>;
|
||||||
|
|
||||||
fn arg_host_function() -> (HostExportedFunc, Rc<RefCell<ArgTetraplets>>) {
|
fn arg_host_function() -> (CallServiceClosure, Rc<RefCell<ArgTetraplets>>) {
|
||||||
let arg_tetraplets = Rc::new(RefCell::new(ArgTetraplets::new()));
|
let arg_tetraplets = Rc::new(RefCell::new(ArgTetraplets::new()));
|
||||||
|
|
||||||
let arg_tetraplets_inner = arg_tetraplets.clone();
|
let arg_tetraplets_inner = arg_tetraplets.clone();
|
||||||
let host_function: HostExportedFunc = Box::new(move |_, args| -> Option<IValue> {
|
let host_function: CallServiceClosure = Box::new(move |_, args| -> Option<IValue> {
|
||||||
let tetraplets = match &args[3] {
|
let tetraplets = match &args[3] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@ -51,7 +51,7 @@ fn arg_host_function() -> (HostExportedFunc, Rc<RefCell<ArgTetraplets>>) {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_fold() {
|
fn simple_fold() {
|
||||||
let return_numbers_call_service: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let return_numbers_call_service: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
IValue::S32(0),
|
IValue::S32(0),
|
||||||
@ -116,19 +116,19 @@ fn simple_fold() {
|
|||||||
json_path: String::new(),
|
json_path: String::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let right_tetraplets = vec![vec![first_arg_tetraplet], vec![second_arg_tetraplet]];
|
let expected_tetraplets = vec![vec![first_arg_tetraplet], vec![second_arg_tetraplet]];
|
||||||
let right_tetraplets = Rc::new(RefCell::new(right_tetraplets));
|
let expected_tetraplets = Rc::new(RefCell::new(expected_tetraplets));
|
||||||
for i in 0..10 {
|
for i in 0..10 {
|
||||||
let res = call_vm!(client_vms[i].0, init_peer_id.clone(), script.clone(), "[]", data);
|
let res = call_vm!(client_vms[i].0, init_peer_id.clone(), script.clone(), "[]", data);
|
||||||
data = res.data;
|
data = res.data;
|
||||||
|
|
||||||
assert_eq!(client_vms[i].1, right_tetraplets);
|
assert_eq!(client_vms[i].1, expected_tetraplets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fold_json_path() {
|
fn fold_json_path() {
|
||||||
let return_numbers_call_service: HostExportedFunc = Box::new(|_, _| -> Option<IValue> {
|
let return_numbers_call_service: CallServiceClosure = Box::new(|_, _| -> Option<IValue> {
|
||||||
Some(IValue::Record(
|
Some(IValue::Record(
|
||||||
Vec1::new(vec![
|
Vec1::new(vec![
|
||||||
IValue::S32(0),
|
IValue::S32(0),
|
||||||
@ -189,10 +189,10 @@ fn fold_json_path() {
|
|||||||
json_path: String::new(),
|
json_path: String::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let right_tetraplets = vec![vec![first_arg_tetraplet], vec![second_arg_tetraplet]];
|
let expected_tetraplets = vec![vec![first_arg_tetraplet], vec![second_arg_tetraplet]];
|
||||||
let right_tetraplets = Rc::new(RefCell::new(right_tetraplets));
|
let expected_tetraplets = Rc::new(RefCell::new(expected_tetraplets));
|
||||||
call_vm!(client_vm, init_peer_id.clone(), script.clone(), "[]", res.data);
|
call_vm!(client_vm, init_peer_id.clone(), script.clone(), "[]", res.data);
|
||||||
assert_eq!(arg_tetraplets, right_tetraplets);
|
assert_eq!(arg_tetraplets, expected_tetraplets);
|
||||||
}
|
}
|
||||||
|
|
||||||
use fluence_app_service::AppService;
|
use fluence_app_service::AppService;
|
||||||
@ -243,7 +243,7 @@ fn tetraplet_with_wasm_modules() {
|
|||||||
|
|
||||||
let services_inner = services.clone();
|
let services_inner = services.clone();
|
||||||
const ADMIN_PEER_PK: &str = "12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE1";
|
const ADMIN_PEER_PK: &str = "12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE1";
|
||||||
let host_func: HostExportedFunc = Box::new(move |_, args: Vec<IValue>| -> Option<IValue> {
|
let host_func: CallServiceClosure = Box::new(move |_, args: Vec<IValue>| -> Option<IValue> {
|
||||||
let service_id = match &args[0] {
|
let service_id = match &args[0] {
|
||||||
IValue::String(str) => str,
|
IValue::String(str) => str,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@ -281,22 +281,24 @@ fn tetraplet_with_wasm_modules() {
|
|||||||
))
|
))
|
||||||
});
|
});
|
||||||
|
|
||||||
let script = String::from(
|
let local_peer_id = "local_peer_id";
|
||||||
|
let script = format!(
|
||||||
r#"
|
r#"
|
||||||
(seq
|
(seq
|
||||||
(call %current_peer_id% ("auth" "is_authorized") [] auth_result)
|
(call "{0}" ("auth" "is_authorized") [] auth_result)
|
||||||
(call %current_peer_id% ("log_storage" "delete") [auth_result.$.is_authorized "1"])
|
(call "{0}" ("log_storage" "delete") [auth_result.$.is_authorized "1"])
|
||||||
)
|
)
|
||||||
"#,
|
"#,
|
||||||
|
local_peer_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut vm = create_aqua_vm(host_func, "some peer_id");
|
let mut vm = create_aqua_vm(host_func, local_peer_id);
|
||||||
|
|
||||||
let result = call_vm!(vm, ADMIN_PEER_PK, script, "", "");
|
let result = call_vm!(vm, ADMIN_PEER_PK, script, "", "");
|
||||||
let path: CallEvidencePath = serde_json::from_slice(&result.data).unwrap();
|
let path: CallEvidencePath = serde_json::from_slice(&result.data).unwrap();
|
||||||
let right_res = EvidenceState::Call(CallResult::Executed(Rc::new(serde_json::Value::String(String::from(
|
let expected_res = EvidenceState::Call(CallResult::Executed(Rc::new(serde_json::Value::String(String::from(
|
||||||
"Ok",
|
"Ok",
|
||||||
)))));
|
)))));
|
||||||
|
|
||||||
assert_eq!(path[1], right_res)
|
assert_eq!(path[1], expected_res)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user