diff --git a/Cargo.lock b/Cargo.lock index 11d9f2a3..dbfb37ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,11 +2,11 @@ # It is not intended for manual editing. [[package]] name = "addr2line" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" +checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" dependencies = [ - "gimli 0.22.0", + "gimli 0.23.0", ] [[package]] @@ -96,9 +96,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.53" +version = "0.3.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707b586e0e2f247cbde68cdd2c3ce69ea7b7be43e1c5b426e37c9319c4b9838e" +checksum = "2baad346b2d4e94a24347adeee9c7a93f412ee94b9cc26e5b59dea23848e9f28" dependencies = [ "addr2line", "cfg-if 1.0.0", @@ -727,20 +727,20 @@ dependencies = [ [[package]] name = "fluence" version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12efe44782ef6842b824dd281f79f808597a2c280d1facc06bb62b9cf8fbc2ef" +source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" dependencies = [ - "fluence-sdk-macro 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "fluence-sdk-main 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", + "fluence-sdk-main 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", ] [[package]] name = "fluence" version = "0.2.8" -source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12efe44782ef6842b824dd281f79f808597a2c280d1facc06bb62b9cf8fbc2ef" dependencies = [ - "fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", - "fluence-sdk-main 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", + "fluence-sdk-macro 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "fluence-sdk-main 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -780,6 +780,14 @@ dependencies = [ "wasmer-wasi-fl", ] +[[package]] +name = "fluence-sdk-macro" +version = "0.2.8" +source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" +dependencies = [ + "fluence-sdk-wit 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", +] + [[package]] name = "fluence-sdk-macro" version = "0.2.8" @@ -790,11 +798,13 @@ dependencies = [ ] [[package]] -name = "fluence-sdk-macro" +name = "fluence-sdk-main" version = "0.2.8" source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" dependencies = [ - "fluence-sdk-wit 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", + "fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", + "log", + "serde", ] [[package]] @@ -808,21 +818,10 @@ dependencies = [ "serde", ] -[[package]] -name = "fluence-sdk-main" -version = "0.2.8" -source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" -dependencies = [ - "fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)", - "log", - "serde", -] - [[package]] name = "fluence-sdk-wit" version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560baf91197ded38a99a5c94ff366a3dd971ebf33f5d987ecce31d3dedf86d17" +source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" dependencies = [ "proc-macro2", "quote", @@ -835,7 +834,8 @@ dependencies = [ [[package]] name = "fluence-sdk-wit" version = "0.2.8" -source = "git+https://github.com/fluencelabs/rust-sdk#a6c587db0b6f22c3d3af81f10b187f148f8e9d30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560baf91197ded38a99a5c94ff366a3dd971ebf33f5d987ecce31d3dedf86d17" dependencies = [ "proc-macro2", "quote", @@ -1016,9 +1016,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" [[package]] name = "h2" @@ -1553,9 +1553,9 @@ dependencies = [ [[package]] name = "object" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" [[package]] name = "once_cell" diff --git a/aquamarine-vm/src/stepper_outcome.rs b/aquamarine-vm/src/stepper_outcome.rs index 1ed2e7f7..58e2a729 100644 --- a/aquamarine-vm/src/stepper_outcome.rs +++ b/aquamarine-vm/src/stepper_outcome.rs @@ -25,86 +25,77 @@ use std::error::Error; #[derive(Debug, Default, Clone, PartialEq, Eq)] pub(crate) struct RawStepperOutcome { pub ret_code: i32, - pub data: String, - pub next_peer_pks: Vec, + pub data: err_msg, + pub next_peer_pks: Vec, } #[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct StepperOutcome { - pub data: String, - pub next_peer_pks: Vec, + pub data: err_msg, + pub next_peer_pks: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum StepperError { /// Errors occurred while parsing aqua script in the form of S expressions. - SExprParseError(String), - - /// Errors occurred on aqua data deserialization. - DataDeserializationError(String), - - /// Errors occurred on aqua data serialization. - DataSerializationError(String), + SExprParseError(err_msg), /// Errors occurred while parsing function arguments of an expression. - FuncArgsSerdeError(String), + FuncArgsSerializationError(err_msg), /// Errors occurred while parsing returned by call_service value. - CallServiceSerdeError(String), + CallServiceResultDeserializationError(err_msg), /// Indicates that environment variable with name CURRENT_PEER_ID isn't set. - CurrentPeerIdEnvError(String), + CurrentPeerIdEnvError(err_msg), /// Semantic errors in instructions. - InstructionError(String), + InstructionError(err_msg), /// An error is occurred while calling local service via call_service. - LocalServiceError(String), + LocalServiceError(err_msg), /// Value for such name isn't presence in data. - VariableNotFound(String), + VariableNotFound(err_msg), /// Multiple values for such name found. - MultipleVariablesFound(String), + MultipleVariablesFound(err_msg), /// Value with such path wasn't found in data with such error. - VariableNotInJsonPath(String), + VariableNotInJsonPath(err_msg), - /// Value for such name isn't presence in data. - IncompatibleJValueType(String), + /// Provided JValue has incompatible with target type. + IncompatibleJValueType(err_msg), + + /// Provided AValue has incompatible with target type. + IncompatibleAValueType(err_msg), /// Multiple values found for such json path. - MultipleValuesInJsonPath(String), + MultipleValuesInJsonPath(err_msg), /// Fold state wasn't found for such iterator name. - FoldStateNotFound(String), + FoldStateNotFound(err_msg), /// Multiple fold states found for such iterator name. - MultipleFoldStates(String), + MultipleFoldStates(err_msg), /// Expected evidence state of different type. - InvalidEvidenceState(String), - - /// Related to such ret_code that doesn't have match with current StepperError. - UnknownError(String), + InvalidEvidenceState(err_msg), /// Errors occurred on call evidence deserialization. - CallEvidenceDeserializationError(String), + CallEvidenceDeserializationError(err_msg), /// Errors occurred on call evidence serialization. - CallEvidenceSerializationError(String), - - /// Errors occurred when reserved keyword is used for variable name. - ReservedKeywordError(String), + CallEvidenceSerializationError(err_msg), /// Errors occurred when previous and current evidence states are incompatible. - IncompatibleEvidenceStates(String), + IncompatibleEvidenceStates(err_msg), /// Errors occurred when previous and current call results are incompatible. - IncompatibleCallResults(String), + IncompatibleCallResults(err_msg), /// Errors occurred when evidence path contains less elements then corresponding Par has. - EvidencePathTooSmall(String), + EvidencePathTooSmall(err_msg), } impl Error for StepperError {} @@ -112,29 +103,28 @@ impl Error for StepperError {} impl std::fmt::Display for StepperError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { match self { - StepperError::SExprParseError(err_msg) => write!(f, "{}", err_msg), - StepperError::DataDeserializationError(err_msg) => write!(f, "{}", err_msg), - StepperError::DataSerializationError(err_msg) => write!(f, "{}", err_msg), - StepperError::FuncArgsSerdeError(err_msg) => write!(f, "{}", err_msg), - StepperError::CallServiceSerdeError(err_msg) => write!(f, "{}", err_msg), - StepperError::CurrentPeerIdEnvError(err_msg) => write!(f, "{}", err_msg), - StepperError::InstructionError(err_msg) => write!(f, "{}", err_msg), - StepperError::LocalServiceError(err_msg) => write!(f, "{}", err_msg), - StepperError::VariableNotFound(err_msg) => write!(f, "{}", err_msg), - StepperError::MultipleVariablesFound(err_msg) => write!(f, "{}", err_msg), - StepperError::VariableNotInJsonPath(err_msg) => write!(f, "{}", err_msg), - StepperError::IncompatibleJValueType(err_msg) => write!(f, "{}", err_msg), - StepperError::MultipleValuesInJsonPath(err_msg) => write!(f, "{}", err_msg), - StepperError::FoldStateNotFound(err_msg) => write!(f, "{}", err_msg), - StepperError::MultipleFoldStates(err_msg) => write!(f, "{}", err_msg), - StepperError::InvalidEvidenceState(err_msg) => write!(f, "{}", err_msg), - StepperError::CallEvidenceDeserializationError(err_msg) => write!(f, "{}", err_msg), - StepperError::CallEvidenceSerializationError(err_msg) => write!(f, "{}", err_msg), - StepperError::ReservedKeywordError(err_msg) => write!(f, "{}", err_msg), - StepperError::IncompatibleEvidenceStates(err_msg) => write!(f, "{}", err_msg), - StepperError::IncompatibleCallResults(err_msg) => write!(f, "{}", err_msg), - StepperError::EvidencePathTooSmall(err_msg) => write!(f, "{}", err_msg), - StepperError::UnknownError(err_msg) => write!(f, "{}", err_msg), + StepperError::SExprParseError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::FuncArgsSerializationError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::CallServiceResultDeserializationError(err_msg) => { + writeln!(f, "{}", err_msg) + } + StepperError::CurrentPeerIdEnvError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::InstructionError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::LocalServiceError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::VariableNotFound(err_msg) => writeln!(f, "{}", err_msg), + StepperError::MultipleVariablesFound(err_msg) => writeln!(f, "{}", err_msg), + StepperError::VariableNotInJsonPath(err_msg) => writeln!(f, "{}", err_msg), + StepperError::IncompatibleJValueType(err_msg) => writeln!(f, "{}", err_msg), + StepperError::IncompatibleAValueType(err_msg) => writeln!(f, "{}", err_msg), + StepperError::MultipleValuesInJsonPath(err_msg) => writeln!(f, "{}", err_msg), + StepperError::FoldStateNotFound(err_msg) => writeln!(f, "{}", err_msg), + StepperError::MultipleFoldStates(err_msg) => writeln!(f, "{}", err_msg), + StepperError::InvalidEvidenceState(err_msg) => writeln!(f, "{}", err_msg), + StepperError::CallEvidenceDeserializationError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::CallEvidenceSerializationError(err_msg) => writeln!(f, "{}", err_msg), + StepperError::IncompatibleEvidenceStates(err_msg) => writeln!(f, "{}", err_msg), + StepperError::IncompatibleCallResults(err_msg) => writeln!(f, "{}", err_msg), + StepperError::EvidencePathTooSmall(err_msg) => writeln!(f, "{}", err_msg), } } } @@ -157,26 +147,25 @@ impl TryFrom for StepperOutcome { next_peer_pks: raw_outcome.next_peer_pks, }), 1 => to_vm_error!(SExprParseError), - 2 => to_vm_error!(DataDeserializationError), - 3 => to_vm_error!(DataSerializationError), - 4 => to_vm_error!(FuncArgsSerdeError), - 5 => to_vm_error!(CallServiceSerdeError), - 6 => to_vm_error!(CurrentPeerIdEnvError), - 7 => to_vm_error!(InstructionError), - 8 => to_vm_error!(LocalServiceError), - 9 => to_vm_error!(VariableNotFound), - 10 => to_vm_error!(MultipleVariablesFound), - 11 => to_vm_error!(VariableNotInJsonPath), - 12 => to_vm_error!(IncompatibleJValueType), - 13 => to_vm_error!(MultipleValuesInJsonPath), - 14 => to_vm_error!(FoldStateNotFound), - 15 => to_vm_error!(MultipleFoldStates), + 2 => to_vm_error!(FuncArgsSerializationError), + 3 => to_vm_error!(CallServiceResultDeserializationError), + 4 => to_vm_error!(CurrentPeerIdEnvError), + 5 => to_vm_error!(InstructionError), + 6 => to_vm_error!(LocalServiceError), + 7 => to_vm_error!(VariableNotFound), + 8 => to_vm_error!(MultipleVariablesFound), + 9 => to_vm_error!(VariableNotInJsonPath), + 10 => to_vm_error!(IncompatibleJValueType), + 11 => to_vm_error!(IncompatibleAValueType), + 12 => to_vm_error!(MultipleValuesInJsonPath), + 13 => to_vm_error!(FoldStateNotFound), + 14 => to_vm_error!(MultipleFoldStates), + 15 => to_vm_error!(InvalidEvidenceState), 16 => to_vm_error!(CallEvidenceDeserializationError), 17 => to_vm_error!(CallEvidenceSerializationError), - 18 => to_vm_error!(ReservedKeywordError), - 19 => to_vm_error!(IncompatibleEvidenceStates), - 20 => to_vm_error!(IncompatibleCallResults), - 21 => to_vm_error!(EvidencePathTooSmall), + 18 => to_vm_error!(IncompatibleEvidenceStates), + 19 => to_vm_error!(IncompatibleCallResults), + 20 => to_vm_error!(EvidencePathTooSmall), _ => to_vm_error!(UnknownError), } }