Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(interface)!: Use MessagePack for calls #780

Merged
merged 29 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9c1e6b1
feat(interface)!: use MessagePack for calls
monoid Dec 25, 2023
a21255e
Fix tetraplets serialization.
monoid Dec 25, 2023
4e9057f
Update benches on Arm64 MacOS
monoid Dec 25, 2023
8fcf9e8
Update Linux x64 benches
monoid Dec 25, 2023
5cfc704
Merge branch 'master' into feat/VM-397-binary-calls
monoid Dec 25, 2023
4ba008a
Merge branch 'master' into feat/VM-397-binary-calls
monoid Dec 25, 2023
384e7ae
Merge branch 'master' into feat/VM-397-binary-calls
monoid Dec 26, 2023
f01fde2
Use named MessagePack for structs
monoid Dec 27, 2023
ae2a4c1
Fix requests' format
monoid Dec 27, 2023
96fdebb
Fix JS part
monoid Dec 27, 2023
63e6914
WIP: JS-compatible CallResults
monoid Dec 27, 2023
23e74a7
make fmt happy
monoid Dec 27, 2023
fb8d29f
Update crates/air-lib/interpreter-interface/src/call_service_result.rs
monoid Jan 4, 2024
14e9a8e
Update crates/air-lib/interpreter-interface/src/call_service_result.rs
monoid Jan 4, 2024
4082dde
KLUDGE for js-client test details
monoid Jan 4, 2024
877cabd
Revert "KLUDGE for js-client test details"
monoid Jan 4, 2024
550fc69
Use JSON for call arguments
monoid Jan 4, 2024
08661da
Try to switch to JSON completely
monoid Jan 4, 2024
2e94e85
Enable MsgPack multiformat for call requests
monoid Jan 5, 2024
10bf2f7
Enable MsgPack multiformat for call results
monoid Jan 5, 2024
86c5906
Use named MsgPack for JS compatibility
monoid Jan 5, 2024
d8afc89
Enable MsgPack for arguments and tetraplets
monoid Jan 5, 2024
24ce0d2
Merge branch 'master' into feat/VM-397-binary-calls
monoid Jan 5, 2024
1f49008
Use string-based CallResults everywhere
monoid Jan 5, 2024
31e131b
Update MacOS ARM benchmarks
monoid Jan 5, 2024
b9edb7c
Update Linux x64 benches
monoid Jan 5, 2024
d247f90
More comments
monoid Jan 5, 2024
fe8c1fc
Make comments better
monoid Jan 7, 2024
55ca68a
Merge branch 'master' into feat/VM-397-binary-calls
monoid Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub(super) fn handle_prev_state<'i>(
if peer_id.as_str() == exec_ctx.run_parameters.current_peer_id.as_str() =>
{
// call results are identified by call_id that is saved in data
let call_id = call_id.to_string();
match exec_ctx.call_results.remove(&call_id) {
Some(call_result) => {
update_state_with_service_result(
Expand Down
2 changes: 1 addition & 1 deletion air/tests/test_module/negative_tests/farewell_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn unprocessed_call_result() {

let expected_call_service_result = air_interpreter_interface::CallServiceResult::ok(&json!("null"));
let expected_call_results = maplit::hashmap!(
70 => expected_call_service_result,
"70".to_owned() => expected_call_service_result,
);
let expected_error = FarewellError::UnprocessedCallResult(expected_call_results);
assert!(check_error(&result, expected_error));
Expand Down
10 changes: 5 additions & 5 deletions avm/client/src/avmHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
*/

import { CallResultsArray, InterpreterResult, CallRequest, RunParameters, JSONArray, JSONObject } from './types';
import { JsonRepr } from './formats'
import { MulticodecRepr, MsgPackRepr } from './formats'

// Have to match the air-interpreter-interface.
const callRequestsRepr = new JsonRepr();
const callRequestsRepr = new MulticodecRepr(new MsgPackRepr());
// Have to match the air-interpreter-interface.
const argumentRepr = new JsonRepr();
const argumentRepr = new MsgPackRepr();
// Have to match the air-interpreter-interface.
const tetrapletRepr = new JsonRepr();
const tetrapletRepr = new MsgPackRepr();
// Have to match the air-interpreter-interface.
const callResultsRepr = new JsonRepr();
const callResultsRepr = new MulticodecRepr(new MsgPackRepr());

/**
* Encodes arguments into JSON array suitable for marine-js
Expand Down
4 changes: 2 additions & 2 deletions avm/client/src/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class MulticodecRepr implements Representation {

toBinary(obj: object): Uint8Array {
let bareData = this.serializer.toBinary(obj);
let varintCode = multicodec.getVarintFromCode(this.serializer.get_code());
return multicodec.addPrefix(varintCode, bareData)
let codeName = multicodec.getNameFromCode(this.serializer.get_code());
return multicodec.addPrefix(codeName, bareData)
}
}
2 changes: 1 addition & 1 deletion avm/interface/src/call_service_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl CallServiceResult {
pub fn into_raw_result(call_results: CallResults) -> air_interpreter_interface::CallResults {
call_results
.into_iter()
.map(|(call_id, call_result)| (call_id, call_result.into_raw()))
.map(|(call_id, call_result)| (call_id.to_string(), call_result.into_raw()))
.collect::<_>()
}

Expand Down
Loading
Loading