Skip to content

Commit

Permalink
feat(runtime)!: switch to async marine (#815)
Browse files Browse the repository at this point in the history
* bench results for sync marine

* WIP

* start updating tests

* most of initial issues fixed

* tests compile without warnings

* rustfmt

* merge with master

* use git dependency

* merge fix + fmt

* fix bench builder

* add Cargo.lock

* fix + fmt after merge

* fix build with latest marine

* use released marine
  • Loading branch information
ValeryAntopol authored Apr 15, 2024
1 parent 2bffc27 commit bf9414e
Show file tree
Hide file tree
Showing 113 changed files with 4,436 additions and 3,441 deletions.
1,064 changes: 155 additions & 909 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ debug = true
overflow-checks = true
debug-assertions = false
panic = "unwind"

4 changes: 3 additions & 1 deletion air/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ rkyv = { version = "0.7.43", features = ["strict", "validation", "size_32", "arc
[dev_dependencies]
air-test-utils = { path = "../crates/air-lib/test-utils" }
air-testing-framework = { path = "../crates/testing-framework" }
fluence-app-service = "0.34.0"
fluence-app-service = "0.36.0"
marine-rs-sdk = { version = "0.14.0", features = ["logger"] }

borsh = "0.10.3"
Expand All @@ -66,6 +66,8 @@ env_logger = "0.7.1"
once_cell = "1.4.1"
pretty_assertions = "0.6.1"
serde_json = "1.0.61"
tokio = {version = "1.35", features = ["rt", "macros"]}
futures = "0.3.30"

[features]
check_signatures = []
Expand Down
50 changes: 26 additions & 24 deletions air/tests/test_module/features/cid/canon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use air_test_utils::key_utils::at;
use air_test_utils::prelude::*;
use pretty_assertions::assert_eq;

#[test]
fn test_canon_ok() {
#[tokio::test]
async fn test_canon_ok() {
let init_peer_name = "init_peer_id";

let script = format!(
Expand All @@ -36,9 +36,10 @@ fn test_canon_ok() {
)"#
);

let executor =
AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).unwrap();
let result = executor.execute_one(init_peer_name).unwrap();
let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script)
.await
.unwrap();
let result = executor.execute_one(init_peer_name).await.unwrap();
let data = data_from_result(&result);

let mut cid_state = ExecutionCidState::new();
Expand Down Expand Up @@ -99,8 +100,8 @@ fn test_canon_ok() {
);
}

#[test]
fn test_canon_ok_multi() {
#[tokio::test]
async fn test_canon_ok_multi() {
let init_peer_name = "init_peer_id";
let other_peer_name = "other_peer_id";

Expand All @@ -114,11 +115,12 @@ fn test_canon_ok_multi() {
)"#
);

let executor =
AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).unwrap();
let _result1 = executor.execute_one(init_peer_name).unwrap();
let _result2 = executor.execute_one(other_peer_name).unwrap();
let result3 = executor.execute_one(init_peer_name).unwrap();
let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script)
.await
.unwrap();
let _result1 = executor.execute_one(init_peer_name).await.unwrap();
let _result2 = executor.execute_one(other_peer_name).await.unwrap();
let result3 = executor.execute_one(init_peer_name).await.unwrap();
let data = data_from_result(&result3);

let init_peer_id = at(init_peer_name);
Expand Down Expand Up @@ -190,10 +192,10 @@ fn test_canon_ok_multi() {
);
}

#[test]
fn test_canon_value_not_found() {
#[tokio::test]
async fn test_canon_value_not_found() {
let init_peer_id = "vm_peer_id";
let mut vm = create_avm(echo_call_service(), init_peer_id);
let mut vm = create_avm(echo_call_service(), init_peer_id).await;

let mut cid_state = ExecutionCidState::new();

Expand Down Expand Up @@ -238,11 +240,11 @@ fn test_canon_value_not_found() {
assert!(check_error(&result, expected_error));
}

#[test]
fn test_canon_root_tetraplet_not_found() {
#[tokio::test]
async fn test_canon_root_tetraplet_not_found() {
let init_peer_id = "vm_peer_id";
let other_peer_id = "other_peer_id";
let mut vm = create_avm(echo_call_service(), init_peer_id);
let mut vm = create_avm(echo_call_service(), init_peer_id).await;

let mut cid_state = ExecutionCidState::new();

Expand Down Expand Up @@ -293,10 +295,10 @@ fn test_canon_root_tetraplet_not_found() {
assert_error_eq!(&result, expected_error);
}

#[test]
fn test_canon_tetraplet_not_found() {
#[tokio::test]
async fn test_canon_tetraplet_not_found() {
let init_peer_id = "vm_peer_id";
let mut vm = create_avm(echo_call_service(), init_peer_id);
let mut vm = create_avm(echo_call_service(), init_peer_id).await;

let mut cid_state = ExecutionCidState::new();

Expand Down Expand Up @@ -352,10 +354,10 @@ fn test_canon_tetraplet_not_found() {
assert_error_eq!(&result, expected_error);
}

#[test]
fn test_canon_agg_not_found() {
#[tokio::test]
async fn test_canon_agg_not_found() {
let init_peer_id = "vm_peer_id";
let mut vm = create_avm(echo_call_service(), init_peer_id);
let mut vm = create_avm(echo_call_service(), init_peer_id).await;

let mut cid_state = ExecutionCidState::new();

Expand Down
33 changes: 18 additions & 15 deletions air/tests/test_module/features/cid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ use air_test_utils::prelude::*;

use pretty_assertions::assert_eq;

#[test]
fn test_missing_cid() {
#[tokio::test]
async fn test_missing_cid() {
let peer_id = "peer_id";
let mut vm = create_avm(echo_call_service(), peer_id);
let mut vm = create_avm(echo_call_service(), peer_id).await;

let air_script = r#"
(seq
Expand All @@ -48,10 +48,10 @@ fn test_missing_cid() {
assert!(check_error(&result, expected_error), "{:?}", result);
}

#[test]
fn test_correct_cid() {
#[tokio::test]
async fn test_correct_cid() {
let peer_id = "peer_id";
let mut vm = create_avm(echo_call_service(), peer_id);
let mut vm = create_avm(echo_call_service(), peer_id).await;

let air_script = r#"
(seq
Expand All @@ -68,8 +68,8 @@ fn test_correct_cid() {
assert_eq!(result.ret_code, 0, "{:?}", result);
}

#[test]
fn test_scalar_cid() {
#[tokio::test]
async fn test_scalar_cid() {
let vm_peer_name = "vm_peer_id";

let annotated_air_script = format!(
Expand All @@ -83,9 +83,10 @@ fn test_scalar_cid() {
TestRunParameters::from_init_peer_id(vm_peer_name),
&annotated_air_script,
)
.await
.unwrap();

let result = executor.execute_one(vm_peer_name).unwrap();
let result = executor.execute_one(vm_peer_name).await.unwrap();
let data = data_from_result(&result);
let mut cid_state = ExecutionCidState::new();
let expected_trace = vec![
Expand Down Expand Up @@ -115,8 +116,8 @@ fn test_scalar_cid() {
);
}

#[test]
fn test_stream_cid() {
#[tokio::test]
async fn test_stream_cid() {
let vm_peer_name = "vm_peer_id";

let annotated_air_script = format!(
Expand All @@ -130,9 +131,10 @@ fn test_stream_cid() {
TestRunParameters::from_init_peer_id(vm_peer_name),
&annotated_air_script,
)
.await
.unwrap();

let result = executor.execute_one(vm_peer_name).unwrap();
let result = executor.execute_one(vm_peer_name).await.unwrap();
let data = data_from_result(&result);
let mut cid_state = ExecutionCidState::new();
let expected_trace = vec![
Expand Down Expand Up @@ -164,8 +166,8 @@ fn test_stream_cid() {
);
}

#[test]
fn test_unused_cid() {
#[tokio::test]
async fn test_unused_cid() {
let vm_peer_id = "vm_peer_id";

let annotated_air_script = format!(
Expand All @@ -177,9 +179,10 @@ fn test_unused_cid() {
);
let executor =
AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_peer_id), &annotated_air_script)
.await
.unwrap();

let result = executor.execute_one(vm_peer_id).unwrap();
let result = executor.execute_one(vm_peer_id).await.unwrap();
let data = data_from_result(&result);

let expected_trace = vec![
Expand Down
12 changes: 6 additions & 6 deletions air/tests/test_module/features/data_merging/air_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ use air_test_utils::prelude::*;

use pretty_assertions::assert_eq;

#[test]
fn seq_par_call() {
#[tokio::test]
async fn seq_par_call() {
let vm_peer_id = "some_peer_id";
let mut vm = create_avm(unit_call_service(), vm_peer_id);
let mut vm = create_avm(unit_call_service(), vm_peer_id).await;

let script = format!(
r#"
Expand Down Expand Up @@ -61,11 +61,11 @@ fn seq_par_call() {
assert_eq!(result.next_peer_pks, vec![String::from("remote_peer_id")]);
}

#[test]
fn par_par_call() {
#[tokio::test]
async fn par_par_call() {
let vm_peer_id = "some_peer_id";
let remote_peer_id = "remote_peer_id";
let mut vm = create_avm(unit_call_service(), vm_peer_id);
let mut vm = create_avm(unit_call_service(), vm_peer_id).await;

let script = format!(
r#"
Expand Down
Loading

0 comments on commit bf9414e

Please sign in to comment.