Skip to content

Commit

Permalink
feat!: update marine-rs-sdk to 0.14.0, remove all of json_path remains (
Browse files Browse the repository at this point in the history
#820)

* support call_parameters v2

* remove old comment

* use released marine

* fix test wasm

* update sdk marine use lens

* fix test module

* WIP fixing the tests to use lens

* WIP tetraplet field renaming test fixes

* rename more lambda to lens

* fix build

* Fix gen-bench-data compilation

* Update gen-bench-data Cargo.lock

* Fix signature tests

---------

Co-authored-by: drrtuy <roman@fluence.one>
Co-authored-by: Ivan Boldyrev <ivan@fluence.one>
  • Loading branch information
3 people authored Feb 22, 2024
1 parent b9f04df commit 08e8547
Show file tree
Hide file tree
Showing 49 changed files with 580 additions and 324 deletions.
181 changes: 152 additions & 29 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion air-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ aquavm-air = { version = "0.60.0", path = "../air" }
air-interpreter-interface = { version = "0.18.0", path = "../crates/air-lib/interpreter-interface" }
air-log-targets = { version = "0.1.0", path = "../crates/air-lib/log-targets" }

marine-rs-sdk = {version = "0.10.3", features = ["logger"] }
marine-rs-sdk = {version = "0.14.0", features = ["logger"] }

wasm-bindgen = "=0.2.83"

Expand Down
4 changes: 2 additions & 2 deletions air/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ 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.31.0"
marine-rs-sdk = { version = "0.10.0", features = ["logger"] }
fluence-app-service = "0.34.0"
marine-rs-sdk = { version = "0.14.0", features = ["logger"] }

borsh = "0.10.3"
bs58 = "0.5.0"
Expand Down
4 changes: 2 additions & 2 deletions air/src/execution_step/instructions/ap/apply_to_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn apply_canon_stream(
let value = JValuable::as_jvalue(&&canon_stream.canon_stream);
let tetraplet = canon_stream.tetraplet().clone();
let position = trace_ctx.trace_pos().map_err(UncatchableError::from)?;
let value = CanonResultAggregate::new(value, tetraplet.peer_pk.as_str().into(), &tetraplet.json_path, position);
let value = CanonResultAggregate::new(value, tetraplet.peer_pk.as_str().into(), &tetraplet.lens, position);
let result = ValueAggregate::from_canon_result(value, canon_stream.cid.clone());
Ok(result)
}
Expand Down Expand Up @@ -187,7 +187,7 @@ fn apply_canon_stream_map(
let value = JValuable::as_jvalue(&&canon_stream_map.canon_stream_map);
let tetraplet = canon_stream_map.tetraplet();
let position = trace_ctx.trace_pos().map_err(UncatchableError::from)?;
let value = CanonResultAggregate::new(value, tetraplet.peer_pk.as_str().into(), &tetraplet.json_path, position);
let value = CanonResultAggregate::new(value, tetraplet.peer_pk.as_str().into(), &tetraplet.lens, position);
let result = ValueAggregate::from_canon_result(value, canon_stream_map.cid.clone());
Ok(result)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn epilog_closure<'closure, 'name: 'closure>(scalar_name: &'name str) -> Box<Can

let position = trace_ctx.trace_pos().map_err(UncatchableError::from)?;

let value = CanonResultAggregate::new(value, peer_pk, &tetraplet.json_path, position);
let value = CanonResultAggregate::new(value, peer_pk, &tetraplet.lens, position);
let result = ValueAggregate::from_canon_result(value, canon_result_cid.clone());

exec_ctx.scalars.set_scalar_value(scalar_name, result)?;
Expand Down
10 changes: 5 additions & 5 deletions air/src/execution_step/lambda_applier/applier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ fn select_by_path_from_canon_map_stream<'value>(
let result = select_by_path_from_scalar(&value, body.iter(), exec_ctx)?;

let joined = body.iter().map(ToString::to_string).collect::<Vec<_>>().join(".");
let json_path_suffix = format!(".{}", joined);
let lambda_suffix = format!(".{}", joined);
let prefix_with_path = true;
let updated_tetraplet = update_tetraplet_with_path(&tetraplet, &json_path_suffix, prefix_with_path);
let updated_tetraplet = update_tetraplet_with_path(&tetraplet, &lambda_suffix, prefix_with_path);

MapLensResult::new(result, updated_tetraplet)
};
Expand Down Expand Up @@ -206,14 +206,14 @@ fn update_tetraplet_with_path(
original_path: &impl ToString,
prefix_with_path: bool,
) -> RcSecurityTetraplet {
let json_path_updated = if prefix_with_path {
original_tetraplet.json_path.to_string() + &original_path.to_string()
let lens_updated = if prefix_with_path {
original_tetraplet.lens.to_string() + &original_path.to_string()
} else {
original_path.to_string()
};

SecurityTetraplet {
json_path: json_path_updated,
lens: lens_updated,
..original_tetraplet.clone()
}
.into()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'ctx> Iterable<'ctx> for IterableLambdaResult {

let jvalue = &self.jvalues[self.cursor];
let mut tetraplet = (*self.tetraplet).clone();
tetraplet.add_lambda(&format!(".$.[{}]", self.cursor));
tetraplet.add_lens(&format!(".$.[{}]", self.cursor));
let result = IterableItem::RefValue((jvalue, tetraplet.into(), 0.into(), self.provenance.clone()));

Some(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'ctx> Iterable<'ctx> for IterableResolvedCall {
};

let mut tetraplet = (*tetraplet).clone();
tetraplet.add_lambda(&format!(".$.[{}]", self.cursor));
tetraplet.add_lens(&format!(".$.[{}]", self.cursor));

let result = IterableItem::RefValue((jvalue, tetraplet.into(), trace_pos, provenance));
Some(result)
Expand Down
Loading

0 comments on commit 08e8547

Please sign in to comment.