From 67ad55f9d02668be742cce66bca10895feabeba6 Mon Sep 17 00:00:00 2001 From: modship Date: Wed, 28 Aug 2024 17:28:58 +0200 Subject: [PATCH] update sc runtime && wasm test file --- Cargo.lock | 2 +- Cargo.toml | 2 +- massa-execution-worker/src/execution.rs | 4 ++-- massa-execution-worker/src/interface_impl.rs | 9 ++++----- .../tests/wasm/deferred_call_register.wasm | Bin 3657 -> 3657 bytes .../wasm/deferred_call_register_fail.wasm | Bin 3663 -> 3663 bytes 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eaf070eed2a..8e7baa0ec57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2571,7 +2571,7 @@ dependencies = [ [[package]] name = "massa-sc-runtime" version = "0.10.0" -source = "git+https://github.com/massalabs/massa-sc-runtime?rev=116dd8a32819c8def8a5aa014f805ee2cab9f384#116dd8a32819c8def8a5aa014f805ee2cab9f384" +source = "git+https://github.com/massalabs/massa-sc-runtime?rev=7c0a48777c2481ceef62e1a1d2b989f6d001acc7#7c0a48777c2481ceef62e1a1d2b989f6d001acc7" dependencies = [ "anyhow", "as-ffi-bindings", diff --git a/Cargo.toml b/Cargo.toml index 50ef2c50b5a..93ebf5f33be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,7 +108,7 @@ massa_wallet = { path = "./massa-wallet" } # Massa projects dependencies massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", "rev" = "38950875a7aa406fedc4f0b8336864e5ff290f2c" } -massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "rev" = "116dd8a32819c8def8a5aa014f805ee2cab9f384" } +massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "rev" = "7c0a48777c2481ceef62e1a1d2b989f6d001acc7" } peernet = { git = "https://github.com/massalabs/PeerNet", "rev" = "04b05ddd320fbe76cc858115af7b5fc28bdb8310" } diff --git a/massa-execution-worker/src/execution.rs b/massa-execution-worker/src/execution.rs index d19c60d72ed..66691b3cacc 100644 --- a/massa-execution-worker/src/execution.rs +++ b/massa-execution-worker/src/execution.rs @@ -1270,7 +1270,7 @@ impl ExecutionState { context.transfer_coins(None, Some(call.target_address), call.coins, false) { // coin crediting failed: reset context to snapshot and reimburse sender - return Err(ExecutionError::RuntimeError(format!( + return Err(ExecutionError::DeferredCallsError(format!( "could not credit coins to target of deferred call execution: {}", err ))); @@ -1278,7 +1278,7 @@ impl ExecutionState { // quit if there is no function to be called if call.target_function.is_empty() { - return Err(ExecutionError::RuntimeError( + return Err(ExecutionError::DeferredCallsError( "no function to call in the deferred call".to_string(), )); } diff --git a/massa-execution-worker/src/interface_impl.rs b/massa-execution-worker/src/interface_impl.rs index ac4ac9e1393..bc7a5b282b0 100644 --- a/massa-execution-worker/src/interface_impl.rs +++ b/massa-execution-worker/src/interface_impl.rs @@ -1358,13 +1358,12 @@ impl Interface for InterfaceImpl { /// Register deferred call /// /// # Arguments - /// * target_slot: tuple containing the period and thread of the target slot /// * target_addr: string representation of the target address /// * target_func: string representation of the target function - /// * params: byte array of the parameters - /// * coins: the amount of coins to send - /// * fee: the amount of fee to send + /// * target_slot: tuple containing the period and thread of the target slot /// * max_gas: the gas limit for the call + /// * coins: the amount of coins to send + /// * params: byte array of the parameters /// /// # Returns /// The id of the call @@ -1374,8 +1373,8 @@ impl Interface for InterfaceImpl { target_func: &str, target_slot: (u64, u8), max_gas: u64, - coins: u64, params: &[u8], + coins: u64, ) -> Result> { // This function spends coins + deferred_call_quote(target_slot, max_gas).unwrap() from the caller, fails if the balance is insufficient or if the quote would return None. diff --git a/massa-execution-worker/src/tests/wasm/deferred_call_register.wasm b/massa-execution-worker/src/tests/wasm/deferred_call_register.wasm index ea7b2c73f232baab8d086b55fb00a381c79fd609..41fc05e0da5597fac881594ba9b426254e5c9728 100644 GIT binary patch delta 27 jcmX>pb5dr48dH7UMvWX64h06Mh7;=-sBWIavX&D7iz5m6 delta 27 jcmX>pb5dr48dF{UMvWX64yT3_>ldghFl?T~vX&D7kX{M+ diff --git a/massa-execution-worker/src/tests/wasm/deferred_call_register_fail.wasm b/massa-execution-worker/src/tests/wasm/deferred_call_register_fail.wasm index 9d58cc40550246b2b6fcf650128b58507c136f60..1d9c6b68a1d1ab63f355090082d6d41666664d6b 100644 GIT binary patch delta 23 fcmX>vb6#eG8dH7UMvYvb6#eG8dF{UMvY