From a0beddf1da2449d4ee4bdb3823d4989aae660f44 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 27 Mar 2024 05:37:51 +0200 Subject: [PATCH] rename: upgrade_async_call_and_exit --- .../forwarder-raw/src/forwarder_raw_deploy_upgrade.rs | 4 ++-- .../composability/forwarder/src/contract_upgrade.rs | 10 ++++------ .../base/src/types/interaction/tx_call_upgrade.rs | 10 ++++++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw_deploy_upgrade.rs b/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw_deploy_upgrade.rs index 07ddea1c3a..acd385db2c 100644 --- a/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw_deploy_upgrade.rs +++ b/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw_deploy_upgrade.rs @@ -52,7 +52,7 @@ pub trait ForwarderRawDeployUpgrade { .code(new_code) .code_metadata(code_metadata) .arguments_raw(args.to_arg_buffer()) - .upgrade_async_call(); + .upgrade_async_call_and_exit(); } #[endpoint] @@ -70,6 +70,6 @@ pub trait ForwarderRawDeployUpgrade { .code_metadata(code_metadata) .arguments_raw(args.to_arg_buffer()) .with_gas_limit(self.blockchain().get_gas_left()) - .upgrade_async_call(); + .upgrade_async_call_and_exit(); } } diff --git a/contracts/feature-tests/composability/forwarder/src/contract_upgrade.rs b/contracts/feature-tests/composability/forwarder/src/contract_upgrade.rs index a1a402c6e7..f4782821e0 100644 --- a/contracts/feature-tests/composability/forwarder/src/contract_upgrade.rs +++ b/contracts/feature-tests/composability/forwarder/src/contract_upgrade.rs @@ -11,14 +11,13 @@ pub trait UpgradeContractModule { new_code: ManagedBuffer, opt_arg: OptionalValue, ) { - let _ = self - .tx() + self.tx() .to(child_sc_address) .typed(vault_proxy::VaultProxy) .upgrade(opt_arg) .code(new_code) .code_metadata(CodeMetadata::UPGRADEABLE) - .upgrade_async_call(); + .upgrade_async_call_and_exit(); } #[endpoint] @@ -28,13 +27,12 @@ pub trait UpgradeContractModule { source_address: ManagedAddress, opt_arg: OptionalValue, ) { - let _ = self - .tx() + self.tx() .to(child_sc_address) .typed(vault_proxy::VaultProxy) .upgrade(opt_arg) .code_metadata(CodeMetadata::UPGRADEABLE) .from_source(source_address) - .upgrade_async_call(); + .upgrade_async_call_and_exit(); } } diff --git a/framework/base/src/types/interaction/tx_call_upgrade.rs b/framework/base/src/types/interaction/tx_call_upgrade.rs index 013c5adf06..93104a0f08 100644 --- a/framework/base/src/types/interaction/tx_call_upgrade.rs +++ b/framework/base/src/types/interaction/tx_call_upgrade.rs @@ -28,7 +28,10 @@ where CodeValue: TxCodeValue>, RH: TxEmptyResultHandler>, { - pub fn upgrade_async_call(self) { + /// Launches the upgrade async call. + /// + /// TODO: change return type to `!`. + pub fn upgrade_async_call_and_exit(self) { let gas = self.gas.explicit_or_gas_left(&self.env); self.payment.with_egld_value(|egld_value| { SendRawWrapper::::new().upgrade_contract( @@ -60,7 +63,10 @@ where FromSourceValue: TxFromSourceValue>, RH: TxEmptyResultHandler>, { - pub fn upgrade_async_call(self) { + /// Launches the upgrade from source async call. + /// + /// TODO: change return type to `!`. + pub fn upgrade_async_call_and_exit(self) { let gas = self.gas.explicit_or_gas_left(&self.env); self.payment.with_egld_value(|egld_value| { SendRawWrapper::::new().upgrade_from_source_contract(