diff --git a/Config.toml b/Config.toml index d70a7766..a2ff56f3 100644 --- a/Config.toml +++ b/Config.toml @@ -9,3 +9,6 @@ modules_dir = "./target/wasm32-wasi/release/" name = "aquamarine" mem_pages_count = 100 logger_enabled = true + + [module.wasi] + envs = ["CURRENT_PEER_ID=asd"] diff --git a/src/instructions/call.rs b/src/instructions/call.rs index 44ab49cd..5aa46140 100644 --- a/src/instructions/call.rs +++ b/src/instructions/call.rs @@ -50,11 +50,12 @@ pub enum FunctionPart { } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(rename_all = "kebab-case")] pub(crate) struct Call(PeerPart, FunctionPart, Vec, String); impl super::ExecutableInstruction for Call { fn execute(self, data: &mut AquaData, next_peer_pks: &mut Vec) -> Result<()> { + log::info!("call called with data: {:?} and next_peer_pks: {:?}", data, next_peer_pks); + let (peer_pk, service_id, func_name) = parse_peer_fn_parts(self.0, self.1)?; let function_args = parse_args(self.2, data)?; let function_args = serde_json::to_string(&function_args)?; diff --git a/src/instructions/mod.rs b/src/instructions/mod.rs index 3f802fb0..bb44260b 100644 --- a/src/instructions/mod.rs +++ b/src/instructions/mod.rs @@ -28,7 +28,7 @@ use serde_derive::Deserialize; use serde_derive::Serialize; #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(untagged)] +#[serde(rename_all = "kebab-case")] pub(crate) enum Instruction { Null(Null), Call(Call), diff --git a/src/instructions/null.rs b/src/instructions/null.rs index f916c220..c26f48e8 100644 --- a/src/instructions/null.rs +++ b/src/instructions/null.rs @@ -21,11 +21,12 @@ use serde_derive::Deserialize; use serde_derive::Serialize; #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] -#[serde(rename_all = "kebab-case")] pub(crate) struct Null {} impl super::ExecutableInstruction for Null { - fn execute(self, _data: &mut AquaData, _next_peer_pks: &mut Vec) -> Result<()> { + fn execute(self, data: &mut AquaData, next_peer_pks: &mut Vec) -> Result<()> { + log::info!("null called with data: {:?} and next_peer_pks: {:?}", data, next_peer_pks); + Ok(()) } } diff --git a/src/stepper/execution.rs b/src/stepper/execution.rs index 33a30232..7ab345cb 100644 --- a/src/stepper/execution.rs +++ b/src/stepper/execution.rs @@ -40,12 +40,12 @@ fn execute_aqua_impl(init_user_id: String, aqua: String, data: String) -> Result parsed_data ); - super::stepper::execute(parsed_aqua, &mut parsed_data)?; + let next_peer_pks = super::stepper::execute(parsed_aqua, &mut parsed_data)?; let data = serde_json::to_string(&parsed_data)?; Ok(StepperOutcome { ret_code: 0, data, - next_peer_pks: vec![init_user_id], + next_peer_pks, }) } diff --git a/test_module/main.rs b/test_module/main.rs index 2abdcddd..29c41d6d 100644 --- a/test_module/main.rs +++ b/test_module/main.rs @@ -17,6 +17,6 @@ pub fn call_service(service_id: String, fn_name: String, args: String) -> CallSe CallServiceResult { ret_code: 0, - result: args, + result: String::from("[\"args\"]"), } }