From 4d332e76a813ef6bbf0264bdd6fba2c751e3381d Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 17 Oct 2023 14:05:22 +0400 Subject: [PATCH] feat!(runtime): Separate prepaid transactions into specific `pallet-gear-voucher` call (#3401) --- examples/fungible-token/tests/benchmarks.rs | 10 +- gcli/src/cmd/reply.rs | 5 - gcli/src/cmd/send.rs | 5 - gclient/src/api/calls.rs | 28 +- gclient/tests/memory_dump.rs | 2 +- gclient/tests/node.rs | 2 - gclient/tests/state.rs | 1 - gclient/tests/upload.rs | 2 +- gsdk/src/metadata/generated.rs | 41 +- gsdk/src/metadata/impls.rs | 4 - gsdk/src/signer/calls.rs | 4 - gsdk/tests/rpc.rs | 6 +- node/authorship/src/tests.rs | 2 +- pallets/gear-debug/src/tests/mod.rs | 6 - pallets/gear-voucher/src/lib.rs | 49 +- pallets/gear-voucher/src/mock.rs | 16 + pallets/gear/src/benchmarking/mod.rs | 6 +- pallets/gear/src/benchmarking/tasks.rs | 3 - .../benchmarking/tests/syscalls_integrity.rs | 6 - pallets/gear/src/lib.rs | 431 ++++++++++-------- pallets/gear/src/mock.rs | 1 + pallets/gear/src/runtime_api.rs | 14 +- pallets/gear/src/tests.rs | 244 +--------- pallets/payment/src/lib.rs | 2 +- pallets/payment/src/mock.rs | 27 +- pallets/payment/src/tests.rs | 28 +- runtime/gear/src/lib.rs | 29 +- runtime/vara/src/integration_tests.rs | 1 - runtime/vara/src/lib.rs | 29 +- utils/call-gen/src/send_message.rs | 6 +- utils/call-gen/src/send_reply.rs | 8 +- utils/runtime-fuzzer/src/gear_calls.rs | 8 +- utils/runtime-fuzzer/src/lib.rs | 6 +- utils/runtime-fuzzer/src/utils.rs | 2 - 34 files changed, 437 insertions(+), 597 deletions(-) diff --git a/examples/fungible-token/tests/benchmarks.rs b/examples/fungible-token/tests/benchmarks.rs index 589b9e15e39..9e35c867e89 100644 --- a/examples/fungible-token/tests/benchmarks.rs +++ b/examples/fungible-token/tests/benchmarks.rs @@ -40,7 +40,7 @@ async fn send_messages_in_parallel( api: &GearApi, batch_size: usize, treads_number: usize, - messages: &[(ProgramId, Vec, u64, u128, bool)], + messages: &[(ProgramId, Vec, u64, u128)], ) -> Result> { // TODO: currently have problem with transaction priorities from one user. // Fix this after loader become a lib #2781 @@ -190,9 +190,9 @@ async fn stress_test() -> Result<()> { } // Converting batch - let batch: Vec<(_, Vec, u64, _, _)> = batch + let batch: Vec<(_, Vec, u64, _)> = batch .iter() - .map(|x| (program_id, x.encode(), MAX_GAS_LIMIT, 0, false)) + .map(|x| (program_id, x.encode(), MAX_GAS_LIMIT, 0)) .collect(); // Sending batch @@ -256,9 +256,9 @@ async fn stress_transfer() -> Result<()> { )); } - let messages: Vec<(_, Vec, u64, _, _)> = actions + let messages: Vec<(_, Vec, u64, _)> = actions .into_iter() - .map(|action| (program_id, action.encode(), MAX_GAS_LIMIT, 0, false)) + .map(|action| (program_id, action.encode(), MAX_GAS_LIMIT, 0)) .collect(); let message_ids = send_messages_in_parallel(&api, BATCH_CHUNK_SIZE, 1, &messages) diff --git a/gcli/src/cmd/reply.rs b/gcli/src/cmd/reply.rs index ebf48079fb9..ada227ba901 100644 --- a/gcli/src/cmd/reply.rs +++ b/gcli/src/cmd/reply.rs @@ -31,7 +31,6 @@ use gsdk::signer::Signer; /// - `payload`: data expected by the original sender. /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. /// - `value`: balance to be transferred to the program once it's been created. -/// - `prepaid`: a flag indicating whether the tx fee and gas are paid from a voucher. /// /// - `DispatchMessageEnqueued(H256)` when dispatch message is placed in the queue. #[derive(Parser, Debug)] @@ -47,9 +46,6 @@ pub struct Reply { /// Reply value #[arg(short, long, default_value = "0")] value: u128, - /// Use pre-issued voucher - #[arg(long)] - pub prepaid: bool, } impl Reply { @@ -63,7 +59,6 @@ impl Reply { self.payload.to_vec()?, self.gas_limit, self.value, - self.prepaid, ) .await?; diff --git a/gcli/src/cmd/send.rs b/gcli/src/cmd/send.rs index 8fee0608a0c..77521884460 100644 --- a/gcli/src/cmd/send.rs +++ b/gcli/src/cmd/send.rs @@ -35,7 +35,6 @@ use gsdk::signer::Signer; /// - `payload`: in case of a program destination, parameters of the `handle` function. /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. /// - `value`: balance to be transferred to the program once it's been created. -/// - `prepaid`: a flag indicating whether the tx fee and gas are paid from a voucher. /// /// Emits the following events: /// - `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue. @@ -52,9 +51,6 @@ pub struct Send { /// Send value #[arg(short, long, default_value = "0")] pub value: u128, - /// Use pre-issued voucher - #[arg(long)] - pub prepaid: bool, } impl Send { @@ -66,7 +62,6 @@ impl Send { self.payload.to_vec()?, self.gas_limit, self.value, - self.prepaid, ) .await?; diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index 5932d0e0acf..322d458d876 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -723,14 +723,13 @@ impl GearApi { payload: impl AsRef<[u8]>, gas_limit: u64, value: u128, - prepaid: bool, ) -> Result<(MessageId, H256)> { let payload = payload.as_ref().to_vec(); let tx = self .0 .calls - .send_message(destination, payload, gas_limit, value, prepaid) + .send_message(destination, payload, gas_limit, value) .await?; for event in tx.wait_for_success().await?.iter() { @@ -756,17 +755,16 @@ impl GearApi { /// to one program. pub async fn send_message_bytes_batch( &self, - args: impl IntoIterator, u64, u128, bool)>, + args: impl IntoIterator, u64, u128)>, ) -> Result<(Vec>, H256)> { let calls: Vec<_> = args .into_iter() - .map(|(destination, payload, gas_limit, value, prepaid)| { + .map(|(destination, payload, gas_limit, value)| { RuntimeCall::Gear(GearCall::send_message { destination: destination.into(), payload: payload.as_ref().to_vec(), gas_limit, value, - prepaid, }) }) .collect(); @@ -806,9 +804,8 @@ impl GearApi { payload: impl Encode, gas_limit: u64, value: u128, - prepaid: bool, ) -> Result<(MessageId, H256)> { - self.send_message_bytes(destination, payload.encode(), gas_limit, value, prepaid) + self.send_message_bytes(destination, payload.encode(), gas_limit, value) .await } @@ -837,7 +834,6 @@ impl GearApi { payload: impl AsRef<[u8]>, gas_limit: u64, value: u128, - prepaid: bool, ) -> Result<(MessageId, u128, H256)> { let payload = payload.as_ref().to_vec(); @@ -846,7 +842,7 @@ impl GearApi { let tx = self .0 .calls - .send_reply(reply_to_id, payload, gas_limit, value, prepaid) + .send_reply(reply_to_id, payload, gas_limit, value) .await?; let events = tx.wait_for_success().await?; @@ -879,13 +875,9 @@ impl GearApi { /// program id is also returned in the resulting tuple. pub async fn send_reply_bytes_batch( &self, - args: impl IntoIterator, u64, u128, bool)> + Clone, + args: impl IntoIterator, u64, u128)> + Clone, ) -> Result<(Vec>, H256)> { - let message_ids: Vec<_> = args - .clone() - .into_iter() - .map(|(mid, _, _, _, _)| mid) - .collect(); + let message_ids: Vec<_> = args.clone().into_iter().map(|(mid, _, _, _)| mid).collect(); let messages = futures::future::try_join_all( message_ids.iter().map(|mid| self.get_mailbox_message(*mid)), @@ -900,13 +892,12 @@ impl GearApi { let calls: Vec<_> = args .into_iter() - .map(|(reply_to_id, payload, gas_limit, value, prepaid)| { + .map(|(reply_to_id, payload, gas_limit, value)| { RuntimeCall::Gear(GearCall::send_reply { reply_to_id: reply_to_id.into(), payload: payload.as_ref().to_vec(), gas_limit, value, - prepaid, }) }) .collect(); @@ -952,9 +943,8 @@ impl GearApi { payload: impl Encode, gas_limit: u64, value: u128, - prepaid: bool, ) -> Result<(MessageId, u128, H256)> { - self.send_reply_bytes(reply_to_id, payload.encode(), gas_limit, value, prepaid) + self.send_reply_bytes(reply_to_id, payload.encode(), gas_limit, value) .await } diff --git a/gclient/tests/memory_dump.rs b/gclient/tests/memory_dump.rs index 3b5ce79a543..173fe1426a7 100644 --- a/gclient/tests/memory_dump.rs +++ b/gclient/tests/memory_dump.rs @@ -31,7 +31,7 @@ async fn charge_10( .calculate_handle_gas(None, program_id, payload.clone(), 0, true) .await?; let (message_id, _hash) = api - .send_message_bytes(program_id, payload, gas_info.min_limit, 0, false) + .send_message_bytes(program_id, payload, gas_info.min_limit, 0) .await?; assert!(listener.message_processed(message_id).await?.succeed()); diff --git a/gclient/tests/node.rs b/gclient/tests/node.rs index e98b10220eb..6992948d53e 100644 --- a/gclient/tests/node.rs +++ b/gclient/tests/node.rs @@ -69,7 +69,6 @@ async fn program_migrated_to_another_node() { MULTIPLICATOR_VALUE_PAYLOAD, dest_node_gas_limit, 0, - false, ) .await .expect("Unable to send message to destination program"); @@ -209,7 +208,6 @@ async fn program_with_gas_reservation_migrated_to_another_node() { demo_reserve_gas::HandleAction::ReplyFromReservation, dest_node_gas_limit, 0, - false, ) .await .expect("Unable to send message to destination program"); diff --git a/gclient/tests/state.rs b/gclient/tests/state.rs index 82783058664..d803deb917c 100644 --- a/gclient/tests/state.rs +++ b/gclient/tests/state.rs @@ -118,7 +118,6 @@ async fn get_state_request() -> anyhow::Result<()> { btree::Request::Insert(key, value).encode(), gas_limit, 0, - false, ) }); diff --git a/gclient/tests/upload.rs b/gclient/tests/upload.rs index 9878f114932..2ffd9c7268e 100644 --- a/gclient/tests/upload.rs +++ b/gclient/tests/upload.rs @@ -198,7 +198,7 @@ async fn get_mailbox() -> anyhow::Result<()> { .calculate_handle_gas(None, program_id, vec![], 0, true) .await?; - let messages = vec![(program_id, vec![], gas_info.min_limit * 10, 0, false); 5]; + let messages = vec![(program_id, vec![], gas_info.min_limit * 10, 0); 5]; let (messages, _hash) = api.send_message_bytes_batch(messages).await?; diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 5df6de3ebcc..2def1259e6c 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -2485,18 +2485,11 @@ pub mod runtime_types { #[doc = "is not a program in uninitialized state. If the opposite holds true,"] #[doc = "the message is not enqueued for processing."] #[doc = ""] - #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] - #[doc = "charged against a `voucher` that must have been issued for the sender"] - #[doc = "in conjunction with the `destination` program. That means that the"] - #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] - #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] - #[doc = ""] #[doc = "Parameters:"] #[doc = "- `destination`: the message destination."] #[doc = "- `payload`: in case of a program destination, parameters of the `handle` function."] #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] #[doc = "- `value`: balance to be transferred to the program once it's been created."] - #[doc = "- `prepaid`: a flag that indicates whether a voucher should be used."] #[doc = ""] #[doc = "Emits the following events:"] #[doc = "- `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue."] @@ -2505,7 +2498,6 @@ pub mod runtime_types { payload: ::std::vec::Vec<::core::primitive::u8>, gas_limit: ::core::primitive::u64, value: ::core::primitive::u128, - prepaid: ::core::primitive::bool, }, #[codec(index = 4)] #[doc = "Send reply on message in `Mailbox`."] @@ -2521,18 +2513,11 @@ pub mod runtime_types { #[doc = ""] #[doc = "NOTE: only user who is destination of the message, can claim value"] #[doc = "or reply on the message from mailbox."] - #[doc = ""] - #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] - #[doc = "charged against a `voucher` that must have been issued for the sender"] - #[doc = "in conjunction with the mailboxed message source program. That means that the"] - #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] - #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] send_reply { reply_to_id: runtime_types::gear_core::ids::MessageId, payload: ::std::vec::Vec<::core::primitive::u8>, gas_limit: ::core::primitive::u64, value: ::core::primitive::u128, - prepaid: ::core::primitive::bool, }, #[codec(index = 5)] #[doc = "Claim value from message in `Mailbox`."] @@ -3317,6 +3302,13 @@ pub mod runtime_types { program: runtime_types::gear_core::ids::ProgramId, value: ::core::primitive::u128, }, + #[codec(index = 1)] + #[doc = "Dispatch allowed with voucher call."] + call { + call: runtime_types::pallet_gear_voucher::PrepaidCall< + ::core::primitive::u128, + >, + }, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] @@ -3338,6 +3330,23 @@ pub mod runtime_types { }, } } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum PrepaidCall<_0> { + #[codec(index = 0)] + SendMessage { + destination: runtime_types::gear_core::ids::ProgramId, + payload: ::std::vec::Vec<::core::primitive::u8>, + gas_limit: ::core::primitive::u64, + value: _0, + }, + #[codec(index = 1)] + SendReply { + reply_to_id: runtime_types::gear_core::ids::MessageId, + payload: ::std::vec::Vec<::core::primitive::u8>, + gas_limit: ::core::primitive::u64, + value: _0, + }, + } } pub mod pallet_grandpa { use super::runtime_types; @@ -9455,12 +9464,14 @@ pub mod calls { #[doc = "Calls of pallet `GearVoucher`."] pub enum GearVoucherCall { Issue, + Call, } impl CallInfo for GearVoucherCall { const PALLET: &'static str = "GearVoucher"; fn call_name(&self) -> &'static str { match self { Self::Issue => "issue", + Self::Call => "call", } } } diff --git a/gsdk/src/metadata/impls.rs b/gsdk/src/metadata/impls.rs index 9f10d9aec80..d2d88bfeb34 100644 --- a/gsdk/src/metadata/impls.rs +++ b/gsdk/src/metadata/impls.rs @@ -219,7 +219,6 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { payload, gas_limit, value, - prepaid, } => Value::named_variant( "send_message", [ @@ -227,7 +226,6 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { ("payload", Value::from_bytes(payload)), ("gas_limit", Value::u128(gas_limit as u128)), ("value", Value::u128(value as u128)), - ("prepaid", Value::bool(prepaid)), ], ), GearCall::send_reply { @@ -235,7 +233,6 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { payload, gas_limit, value, - prepaid, } => Value::named_variant( "send_reply", [ @@ -243,7 +240,6 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { ("payload", Value::from_bytes(payload)), ("gas_limit", Value::u128(gas_limit as u128)), ("value", Value::u128(value as u128)), - ("prepaid", Value::bool(prepaid)), ], ), GearCall::claim_value { message_id } => Value::named_variant( diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index 3ab66b71e3c..5a656d0875f 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -93,7 +93,6 @@ impl SignerCalls { payload: Vec, gas_limit: u64, value: u128, - prepaid: bool, ) -> Result { self.0 .run_tx( @@ -103,7 +102,6 @@ impl SignerCalls { Value::from_bytes(payload), Value::u128(gas_limit as u128), Value::u128(value), - Value::bool(prepaid), ], ) .await @@ -116,7 +114,6 @@ impl SignerCalls { payload: Vec, gas_limit: u64, value: u128, - prepaid: bool, ) -> Result { self.0 .run_tx( @@ -126,7 +123,6 @@ impl SignerCalls { Value::from_bytes(payload), Value::u128(gas_limit as u128), Value::u128(value), - Value::bool(prepaid), ], ) .await diff --git a/gsdk/tests/rpc.rs b/gsdk/tests/rpc.rs index 8a6677063ed..198eb21dc0d 100644 --- a/gsdk/tests/rpc.rs +++ b/gsdk/tests/rpc.rs @@ -109,7 +109,7 @@ async fn test_calculate_handle_gas() -> Result<()> { signer .calls - .send_message(pid, vec![], gas_info.min_limit, 0, false) + .send_message(pid, vec![], gas_info.min_limit, 0) .await?; Ok(()) @@ -146,7 +146,7 @@ async fn test_calculate_reply_gas() -> Result<()> { // 2. send wait message. signer .calls - .send_message(pid, payload.encode(), 100_000_000_000, 0, false) + .send_message(pid, payload.encode(), 100_000_000_000, 0) .await?; let mailbox = signer @@ -164,7 +164,7 @@ async fn test_calculate_reply_gas() -> Result<()> { signer .calls - .send_reply(message_id, vec![], gas_info.min_limit, 0, false) + .send_reply(message_id, vec![], gas_info.min_limit, 0) .await?; Ok(()) diff --git a/node/authorship/src/tests.rs b/node/authorship/src/tests.rs index c845fbbf692..8a403f9ec22 100644 --- a/node/authorship/src/tests.rs +++ b/node/authorship/src/tests.rs @@ -55,7 +55,7 @@ use testing::{ use vara_runtime::{AccountId, Runtime, RuntimeCall, UncheckedExtrinsic, SLOT_DURATION, VERSION}; const SOURCE: TransactionSource = TransactionSource::External; -const DEFAULT_GAS_LIMIT: u64 = 865_000_000; +const DEFAULT_GAS_LIMIT: u64 = 1_000_000_000; fn chain_event(header: B::Header) -> ChainEvent where diff --git a/pallets/gear-debug/src/tests/mod.rs b/pallets/gear-debug/src/tests/mod.rs index bbff6e7e9ef..8777f6584d8 100644 --- a/pallets/gear-debug/src/tests/mod.rs +++ b/pallets/gear-debug/src/tests/mod.rs @@ -76,7 +76,6 @@ fn vec() { 131072i32.encode(), 10_000_000_000, 0, - false, )); run_to_next_block(None); @@ -226,7 +225,6 @@ fn debug_mode_works() { vec![], 1_000_000_000_u64, 0_u128, - false, ) .expect("Failed to send message"); @@ -238,7 +236,6 @@ fn debug_mode_works() { vec![], 1_000_000_000_u64, 0_u128, - false, ) .expect("Failed to send message"); @@ -565,7 +562,6 @@ fn check_not_allocated_pages() { vec![], 5_000_000_000_u64, 0_u128, - false, )); run_to_block(3, None); @@ -798,7 +794,6 @@ fn check_changed_pages_in_storage() { vec![], 5_000_000_000_u64, 0_u128, - false, )); run_to_block(3, None); @@ -958,7 +953,6 @@ fn disabled_program_rent() { .encode(), 20_000_000_000, 0, - false, )); run_to_next_block(None); diff --git a/pallets/gear-voucher/src/lib.rs b/pallets/gear-voucher/src/lib.rs index 7d8258ad107..81c71ea41ac 100644 --- a/pallets/gear-voucher/src/lib.rs +++ b/pallets/gear-voucher/src/lib.rs @@ -63,11 +63,11 @@ use frame_support::{ traits::{Currency, ExistenceRequirement, ReservableCurrency, StorageVersion}, PalletId, }; -use gear_core::ids::ProgramId; +use gear_core::ids::{MessageId, ProgramId}; pub use primitive_types::H256; use sp_io::hashing::blake2_256; use sp_runtime::traits::{StaticLookup, TrailingZeroInput}; -use sp_std::convert::TryInto; +use sp_std::{convert::TryInto, vec::Vec}; pub use weights::WeightInfo; pub use pallet::*; @@ -98,6 +98,11 @@ pub mod pallet { /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; + + type CallsDispatcher: PrepaidCallsDispatcher< + AccountId = Self::AccountId, + Balance = BalanceOf, + >; } #[pallet::pallet] @@ -170,6 +175,18 @@ pub mod pallet { Ok(().into()) } + + /// Dispatch allowed with voucher call. + #[pallet::call_index(1)] + #[pallet::weight(T::CallsDispatcher::weight(call))] + pub fn call( + origin: OriginFor, + call: PrepaidCall>, + ) -> DispatchResultWithPostInfo { + let origin = ensure_signed(origin)?; + + T::CallsDispatcher::dispatch(origin, call) + } } } @@ -191,3 +208,31 @@ impl PaymentVoucher> for Pallet Self::voucher_account_id(&who, &program) } } + +#[derive(Debug, Clone, Encode, Decode, TypeInfo, PartialEq, Eq, PartialOrd, Ord)] +pub enum PrepaidCall { + SendMessage { + destination: ProgramId, + payload: Vec, + gas_limit: u64, + value: Balance, + }, + SendReply { + reply_to_id: MessageId, + payload: Vec, + gas_limit: u64, + value: Balance, + }, +} + +pub trait PrepaidCallsDispatcher { + type AccountId; + type Balance; + + fn weight(call: &PrepaidCall) -> Weight; + + fn dispatch( + account_id: Self::AccountId, + call: PrepaidCall, + ) -> DispatchResultWithPostInfo; +} diff --git a/pallets/gear-voucher/src/mock.rs b/pallets/gear-voucher/src/mock.rs index 0b609f87d73..180772bd8c5 100644 --- a/pallets/gear-voucher/src/mock.rs +++ b/pallets/gear-voucher/src/mock.rs @@ -99,11 +99,27 @@ parameter_types! { pub const VoucherPalletId: PalletId = PalletId(*b"py/vouch"); } +impl crate::PrepaidCallsDispatcher for () { + type AccountId = AccountId; + type Balance = Balance; + + fn weight(_call: &pallet_gear_voucher::PrepaidCall) -> frame_support::weights::Weight { + unimplemented!(); + } + fn dispatch( + _account_id: Self::AccountId, + _call: pallet_gear_voucher::PrepaidCall, + ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo { + unimplemented!() + } +} + impl pallet_gear_voucher::Config for Test { type RuntimeEvent = RuntimeEvent; type Currency = Balances; type PalletId = VoucherPalletId; type WeightInfo = (); + type CallsDispatcher = (); } // Build genesis storage according to the mock runtime. diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 71fde344dfd..5c1283fd9dd 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -699,10 +699,9 @@ benchmarks! { let code = benchmarking::generate_wasm2(16.into()).unwrap(); benchmarking::set_program::, _>(program_id, code, 1.into()); let payload = vec![0_u8; p as usize]; - let prepaid = false; init_block::(None); - }: _(RawOrigin::Signed(caller), program_id, payload, 100_000_000_u64, minimum_balance, prepaid) + }: _(RawOrigin::Signed(caller), program_id, payload, 100_000_000_u64, minimum_balance) verify { assert!(matches!(QueueOf::::dequeue(), Ok(Some(_)))); } @@ -732,10 +731,9 @@ benchmarks! { None, ).try_into().unwrap_or_else(|_| unreachable!("Signal message sent to user")), u32::MAX.unique_saturated_into()).expect("Error during mailbox insertion"); let payload = vec![0_u8; p as usize]; - let prepaid = false; init_block::(None); - }: _(RawOrigin::Signed(caller.clone()), original_message_id, payload, 100_000_000_u64, minimum_balance, prepaid) + }: _(RawOrigin::Signed(caller.clone()), original_message_id, payload, 100_000_000_u64, minimum_balance) verify { assert!(matches!(QueueOf::::dequeue(), Ok(Some(_)))); assert!(MailboxOf::::is_empty(&caller)) diff --git a/pallets/gear/src/benchmarking/tasks.rs b/pallets/gear/src/benchmarking/tasks.rs index e1c34d65f1c..1ec61aac52d 100644 --- a/pallets/gear/src/benchmarking/tasks.rs +++ b/pallets/gear/src/benchmarking/tasks.rs @@ -236,7 +236,6 @@ where calls.encode(), 10_000_000_000, 0u32.into(), - false, ) .expect("failed to send message"); @@ -284,7 +283,6 @@ where Command::Wait(WaitSubcommand::WaitFor(delay)).encode(), 10_000_000_000, 0u32.into(), - false, ) .expect("failed to send message"); @@ -332,7 +330,6 @@ where Command::Wait(WaitSubcommand::Wait).encode(), 10_000_000_000, 0u32.into(), - false, ) .expect("failed to send message"); diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index ff8bc74f8f9..1ea38d50329 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -96,7 +96,6 @@ where strings.encode(), BlockGasLimitOf::::get(), Zero::zero(), - false, ) .expect("Failed to send read_big_state append command"); @@ -418,7 +417,6 @@ where b"".to_vec(), 50_000_000_000, 0u128.unique_saturated_into(), - false, // call is not prepaid by issuing a voucher ) .expect("failed to send message to test program"); utils::run_to_next_block::(None); @@ -777,7 +775,6 @@ where vec![Kind::ReplyDetails([255u8; 32], reply_code)].encode(), 50_000_000_000, 0u128.unique_saturated_into(), - false, // call is not prepaid by issuing a voucher ) .expect("triggering message send to mailbox failed"); @@ -816,7 +813,6 @@ where vec![Kind::SignalDetails].encode(), 50_000_000_000, 0u128.unique_saturated_into(), - false, // call is not prepaid by issuing a voucher ) .expect("triggering message send to mailbox failed"); @@ -1021,7 +1017,6 @@ where mp.payload, 50_000_000_000, mp.value.unique_saturated_into(), - false, // call is not prepaid by issuing a voucher ) .expect("failed send message"); } @@ -1033,7 +1028,6 @@ where rp.payload, 50_000_000_000, rp.value.unique_saturated_into(), - false, // call is not prepaid by issuing a voucher ) .expect("failed send reply"); } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 5bef97c2c9c..293cf4bcf1c 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -75,6 +75,7 @@ use gear_core::{ percent::Percent, }; use manager::{CodeInfo, QueuePostProcessingData}; +use pallet_gear_voucher::{PrepaidCall, PrepaidCallsDispatcher}; use primitive_types::H256; use sp_runtime::{ traits::{One, Saturating, UniqueSaturatedInto, Zero}, @@ -1448,18 +1449,11 @@ pub mod pallet { /// is not a program in uninitialized state. If the opposite holds true, /// the message is not enqueued for processing. /// - /// If `prepaid` flag is set, the transaction fee and the gas cost will be - /// charged against a `voucher` that must have been issued for the sender - /// in conjunction with the `destination` program. That means that the - /// synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must - /// exist and have sufficient funds in it. Otherwise, the call is invalidated. - /// /// Parameters: /// - `destination`: the message destination. /// - `payload`: in case of a program destination, parameters of the `handle` function. /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. /// - `value`: balance to be transferred to the program once it's been created. - /// - `prepaid`: a flag that indicates whether a voucher should be used. /// /// Emits the following events: /// - `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue. @@ -1471,91 +1465,11 @@ pub mod pallet { payload: Vec, gas_limit: u64, value: BalanceOf, - prepaid: bool, ) -> DispatchResultWithPostInfo { - let payload = payload - .try_into() - .map_err(|err: PayloadSizeError| DispatchError::Other(err.into()))?; + // Validating origin. let who = ensure_signed(origin)?; - let origin = who.clone().into_origin(); - - Self::check_gas_limit_and_value(gas_limit, value)?; - - let message = HandleMessage::from_packet( - Self::next_message_id(origin), - HandlePacket::new_with_gas( - destination, - payload, - gas_limit, - value.unique_saturated_into(), - ), - ); - - if Self::program_exists(destination) { - ensure!(Self::is_active(destination), Error::::InactiveProgram); - - // Message is not guaranteed to be executed, that's why value is not immediately transferred. - // That's because destination can fail to be initialized, while this dispatch message is next - // in the queue. - // Note: reservation is always made against the user's account regardless whether - // a voucher exists. The latter can only be used to pay for gas or transaction fee. - GearBank::::deposit_value(&who, value)?; - - let external_node = if prepaid { - // If voucher is used, we attempt to reserve funds on the respective account. - // If no such voucher exists, the call is invalidated. - let voucher_id = VoucherOf::::voucher_id(who.clone(), destination); - - GearBank::::deposit_gas(&voucher_id, gas_limit).map_err(|e| { - log::debug!( - "Failed to redeem voucher for user {who:?} and program {destination:?}: {e:?}" - ); - Error::::FailureRedeemingVoucher - })?; - - voucher_id - } else { - // If voucher is not used, we reserve gas limit on the user's account. - GearBank::::deposit_gas(&who, gas_limit)?; - - who.clone() - }; - - Self::create(external_node, message.id(), gas_limit, false); - - let message = message.into_stored_dispatch(ProgramId::from_origin(origin)); - - Self::deposit_event(Event::MessageQueued { - id: message.id(), - source: who, - destination: message.destination(), - entry: MessageEntry::Handle, - }); - - QueueOf::::queue(message) - .unwrap_or_else(|e| unreachable!("Messages storage corrupted: {e:?}")); - } else { - let message = message.into_stored(ProgramId::from_origin(origin)); - let message: UserMessage = message - .try_into() - .unwrap_or_else(|_| unreachable!("Signal message sent to user")); - - CurrencyOf::::transfer( - &who, - &::AccountId::from_origin( - message.destination().into_origin(), - ), - value.unique_saturated_into(), - ExistenceRequirement::AllowDeath, - )?; - - Pallet::::deposit_event(Event::UserMessageSent { - message, - expiration: None, - }); - } - Ok(().into()) + Self::send_message_impl(who, destination, payload, gas_limit, value, false) } /// Send reply on message in `Mailbox`. @@ -1571,112 +1485,19 @@ pub mod pallet { /// /// NOTE: only user who is destination of the message, can claim value /// or reply on the message from mailbox. - /// - /// If `prepaid` flag is set, the transaction fee and the gas cost will be - /// charged against a `voucher` that must have been issued for the sender - /// in conjunction with the mailboxed message source program. That means that the - /// synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must - /// exist and have sufficient funds in it. Otherwise, the call is invalidated. #[pallet::call_index(4)] - #[pallet::weight(::WeightInfo::send_reply(payload.len() as u32) + if *prepaid { - Weight::zero() - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } else { - Weight::zero() - })] + #[pallet::weight(::WeightInfo::send_reply(payload.len() as u32))] pub fn send_reply( origin: OriginFor, reply_to_id: MessageId, payload: Vec, gas_limit: u64, value: BalanceOf, - prepaid: bool, ) -> DispatchResultWithPostInfo { // Validating origin. - let origin = ensure_signed(origin)?; - - let payload = payload - .try_into() - .map_err(|err: PayloadSizeError| DispatchError::Other(err.into()))?; - - // Reason for reading from mailbox. - let reason = UserMessageReadRuntimeReason::MessageReplied.into_reason(); - - // Reading message, if found, or failing extrinsic. - let mailboxed = Self::read_message(origin.clone(), reply_to_id, reason) - .ok_or(Error::::MessageNotFound)?; - - Self::check_gas_limit_and_value(gas_limit, value)?; - - let destination = mailboxed.source(); - - // Checking that program, origin replies to, is not terminated. - ensure!(Self::is_active(destination), Error::::InactiveProgram); - - let reply_id = MessageId::generate_reply(mailboxed.id()); - - // Set zero gas limit if reply deposit exists. - let gas_limit = if GasHandlerOf::::exists_and_deposit(reply_id) { - 0 - } else { - gas_limit - }; - - GearBank::::deposit_value(&origin, value)?; - - let external_node = if prepaid { - // If voucher is used, we attempt to reserve funds on the respective account. - // If no such voucher exists, the call is invalidated. - let voucher_id = VoucherOf::::voucher_id(origin.clone(), destination); - - GearBank::::deposit_gas(&voucher_id, gas_limit).map_err(|e| { - log::debug!( - "Failed to redeem voucher for user {origin:?} and program {destination:?}: {e:?}" - ); - Error::::FailureRedeemingVoucher - })?; - - voucher_id - } else { - // If voucher is not used, we reserve gas limit on the user's account. - GearBank::::deposit_gas(&origin, gas_limit)?; - - origin.clone() - }; - - // Following up with a gas node creation. - Self::create(external_node, reply_id, gas_limit, true); - - // Creating reply message. - let message = ReplyMessage::from_packet( - reply_id, - ReplyPacket::new_with_gas(payload, gas_limit, value.unique_saturated_into()), - ); - - // Converting reply message into appropriate type for queueing. - let dispatch = message.into_stored_dispatch( - ProgramId::from_origin(origin.clone().into_origin()), - destination, - mailboxed.id(), - ); - - // Pre-generating appropriate event to avoid dispatch cloning. - let event = Event::MessageQueued { - id: dispatch.id(), - source: origin, - destination: dispatch.destination(), - entry: MessageEntry::Reply(mailboxed.id()), - }; - - // Queueing dispatch. - QueueOf::::queue(dispatch) - .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); - - // Depositing pre-generated event. - Self::deposit_event(event); + let who = ensure_signed(origin)?; - Ok(().into()) + Self::send_reply_impl(who, reply_to_id, payload, gas_limit, value, false) } /// Claim value from message in `Mailbox`. @@ -1963,6 +1784,246 @@ pub mod pallet { } } + impl Pallet + where + T::AccountId: Origin, + { + /// Underlying implementation of `GearPallet::send_message`. + pub fn send_message_impl( + origin: AccountIdOf, + destination: ProgramId, + payload: Vec, + gas_limit: u64, + value: BalanceOf, + prepaid: bool, + ) -> DispatchResultWithPostInfo { + let payload = payload + .try_into() + .map_err(|err: PayloadSizeError| DispatchError::Other(err.into()))?; + + let who = origin; + let origin = who.clone().into_origin(); + + Self::check_gas_limit_and_value(gas_limit, value)?; + + let message = HandleMessage::from_packet( + Self::next_message_id(origin), + HandlePacket::new_with_gas( + destination, + payload, + gas_limit, + value.unique_saturated_into(), + ), + ); + + if Self::program_exists(destination) { + ensure!(Self::is_active(destination), Error::::InactiveProgram); + + // Message is not guaranteed to be executed, that's why value is not immediately transferred. + // That's because destination can fail to be initialized, while this dispatch message is next + // in the queue. + // Note: reservation is always made against the user's account regardless whether + // a voucher exists. The latter can only be used to pay for gas or transaction fee. + GearBank::::deposit_value(&who, value)?; + + let external_node = if prepaid { + // If voucher is used, we attempt to reserve funds on the respective account. + // If no such voucher exists, the call is invalidated. + let voucher_id = VoucherOf::::voucher_id(who.clone(), destination); + + GearBank::::deposit_gas(&voucher_id, gas_limit).map_err(|e| { + log::debug!( + "Failed to redeem voucher for user {who:?} and program {destination:?}: {e:?}" + ); + Error::::FailureRedeemingVoucher + })?; + + voucher_id + } else { + // If voucher is not used, we reserve gas limit on the user's account. + GearBank::::deposit_gas(&who, gas_limit)?; + + who.clone() + }; + + Self::create(external_node, message.id(), gas_limit, false); + + let message = message.into_stored_dispatch(ProgramId::from_origin(origin)); + + Self::deposit_event(Event::MessageQueued { + id: message.id(), + source: who, + destination: message.destination(), + entry: MessageEntry::Handle, + }); + + QueueOf::::queue(message) + .unwrap_or_else(|e| unreachable!("Messages storage corrupted: {e:?}")); + } else { + let message = message.into_stored(ProgramId::from_origin(origin)); + let message: UserMessage = message + .try_into() + .unwrap_or_else(|_| unreachable!("Signal message sent to user")); + + CurrencyOf::::transfer( + &who, + &::AccountId::from_origin( + message.destination().into_origin(), + ), + value.unique_saturated_into(), + ExistenceRequirement::AllowDeath, + )?; + + Pallet::::deposit_event(Event::UserMessageSent { + message, + expiration: None, + }); + } + + Ok(().into()) + } + + /// Underlying implementation of `GearPallet::send_reply`. + pub fn send_reply_impl( + origin: AccountIdOf, + reply_to_id: MessageId, + payload: Vec, + gas_limit: u64, + value: BalanceOf, + prepaid: bool, + ) -> DispatchResultWithPostInfo { + let payload = payload + .try_into() + .map_err(|err: PayloadSizeError| DispatchError::Other(err.into()))?; + + // Reason for reading from mailbox. + let reason = UserMessageReadRuntimeReason::MessageReplied.into_reason(); + + // Reading message, if found, or failing extrinsic. + let mailboxed = Self::read_message(origin.clone(), reply_to_id, reason) + .ok_or(Error::::MessageNotFound)?; + + Self::check_gas_limit_and_value(gas_limit, value)?; + + let destination = mailboxed.source(); + + // Checking that program, origin replies to, is not terminated. + ensure!(Self::is_active(destination), Error::::InactiveProgram); + + let reply_id = MessageId::generate_reply(mailboxed.id()); + + // Set zero gas limit if reply deposit exists. + let gas_limit = if GasHandlerOf::::exists_and_deposit(reply_id) { + 0 + } else { + gas_limit + }; + + GearBank::::deposit_value(&origin, value)?; + + let external_node = if prepaid { + // If voucher is used, we attempt to reserve funds on the respective account. + // If no such voucher exists, the call is invalidated. + let voucher_id = VoucherOf::::voucher_id(origin.clone(), destination); + + GearBank::::deposit_gas(&voucher_id, gas_limit).map_err(|e| { + log::debug!( + "Failed to redeem voucher for user {origin:?} and program {destination:?}: {e:?}" + ); + Error::::FailureRedeemingVoucher + })?; + + voucher_id + } else { + // If voucher is not used, we reserve gas limit on the user's account. + GearBank::::deposit_gas(&origin, gas_limit)?; + + origin.clone() + }; + + // Following up with a gas node creation. + Self::create(external_node, reply_id, gas_limit, true); + + // Creating reply message. + let message = ReplyMessage::from_packet( + reply_id, + ReplyPacket::new_with_gas(payload, gas_limit, value.unique_saturated_into()), + ); + + // Converting reply message into appropriate type for queueing. + let dispatch = message.into_stored_dispatch( + ProgramId::from_origin(origin.clone().into_origin()), + destination, + mailboxed.id(), + ); + + // Pre-generating appropriate event to avoid dispatch cloning. + let event = Event::MessageQueued { + id: dispatch.id(), + source: origin, + destination: dispatch.destination(), + entry: MessageEntry::Reply(mailboxed.id()), + }; + + // Queueing dispatch. + QueueOf::::queue(dispatch) + .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); + + // Depositing pre-generated event. + Self::deposit_event(event); + + Ok(().into()) + } + } + + impl PrepaidCallsDispatcher for Pallet + where + T::AccountId: Origin, + { + type AccountId = AccountIdOf; + type Balance = BalanceOf; + + fn weight(call: &PrepaidCall) -> Weight { + match call { + PrepaidCall::SendMessage { payload, .. } => { + ::WeightInfo::send_message(payload.len() as u32) + } + PrepaidCall::SendReply { payload, .. } => { + ::WeightInfo::send_reply(payload.len() as u32) + } + } + } + + fn dispatch( + account_id: Self::AccountId, + call: PrepaidCall, + ) -> DispatchResultWithPostInfo { + match call { + PrepaidCall::SendMessage { + destination, + payload, + gas_limit, + value, + } => Self::send_message_impl( + account_id, + destination, + payload, + gas_limit, + value, + true, + ), + PrepaidCall::SendReply { + reply_to_id, + payload, + gas_limit, + value, + } => { + Self::send_reply_impl(account_id, reply_to_id, payload, gas_limit, value, true) + } + } + } + } + impl QueueRunner for Pallet where T::AccountId: Origin, diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index a8113a9342d..d0702ce788f 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -293,6 +293,7 @@ impl pallet_gear_voucher::Config for Test { type Currency = Balances; type PalletId = VoucherPalletId; type WeightInfo = (); + type CallsDispatcher = Gear; } // Build genesis storage according to the mock runtime. diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index 67984db1a93..41cbd44383a 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -83,16 +83,14 @@ where })?; } HandleKind::Handle(destination) => { - Self::send_message(who.into(), destination, payload, initial_gas, value, false) - .map_err(|e| { - format!("Internal error: send_message failed with '{e:?}'").into_bytes() - })?; + Self::send_message(who.into(), destination, payload, initial_gas, value).map_err( + |e| format!("Internal error: send_message failed with '{e:?}'").into_bytes(), + )?; } HandleKind::Reply(reply_to_id, _status_code) => { - Self::send_reply(who.into(), reply_to_id, payload, initial_gas, value, false) - .map_err(|e| { - format!("Internal error: send_reply failed with '{e:?}'").into_bytes() - })?; + Self::send_reply(who.into(), reply_to_id, payload, initial_gas, value).map_err( + |e| format!("Internal error: send_reply failed with '{e:?}'").into_bytes(), + )?; } HandleKind::Signal(_signal_from, _status_code) => { return Err(b"Gas calculation for `handle_signal` is not supported".to_vec()); diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 143f55de58b..a9a9b4fec66 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -75,6 +75,7 @@ use gear_core_backend::error::{ use gear_core_errors::*; use gear_wasm_instrument::STACK_END_EXPORT_NAME; use gstd::{collections::BTreeMap, errors::Error as GstdError}; +use pallet_gear_voucher::PrepaidCall; use sp_runtime::{traits::UniqueSaturatedInto, SaturatedConversion}; use sp_std::convert::TryFrom; pub use utils::init_logger; @@ -109,7 +110,6 @@ fn default_wait_lock_timeout() { Kind::Send.encode(), BlockGasLimitOf::::get(), 0, - false )); let mid = utils::get_last_message_id(); @@ -180,7 +180,6 @@ fn value_counter_set_correctly_for_interruptions() { Default::default(), BlockGasLimitOf::::get(), VALUE, - false )); run_to_next_block(None); @@ -278,7 +277,6 @@ fn read_big_state() { strings.encode(), BlockGasLimitOf::::get(), 0, - false, )); let mid = get_last_message_id(); @@ -317,7 +315,6 @@ fn auto_reply_sent() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 10_000, - false, )); run_to_next_block(None); @@ -347,7 +344,6 @@ fn auto_reply_sent() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, - false, )); System::reset_events(); @@ -376,7 +372,6 @@ fn auto_reply_from_user_no_mailbox() { calls.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -401,7 +396,6 @@ fn auto_reply_from_user_no_mailbox() { calls.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -477,7 +471,6 @@ fn auto_reply_out_of_rent_waitlist() { Command::Wait(WaitSubcommand::Wait).encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -526,7 +519,6 @@ fn auto_reply_out_of_rent_mailbox() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, - false, )); let message_id = utils::get_last_message_id(); @@ -590,7 +582,6 @@ fn reply_deposit_to_program() { 10_000_000_000u64.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -622,7 +613,6 @@ fn reply_deposit_to_user_auto_reply() { 10_000_000_000u64.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -654,7 +644,6 @@ fn reply_deposit_panic_in_handle_reply() { 1u64.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -688,7 +677,6 @@ fn reply_deposit_to_user_reply() { reply_deposit.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -720,7 +708,6 @@ fn reply_deposit_to_user_reply() { vec![], BlockGasLimitOf::::get(), value, - false, )); assert_eq!(get_last_message_id(), reply_id); @@ -765,7 +752,6 @@ fn reply_deposit_to_user_claim() { reply_deposit.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -832,7 +818,6 @@ fn reply_deposit_to_user_out_of_rent() { reply_deposit.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -906,7 +891,6 @@ fn reply_deposit_gstd_async() { hello.to_vec(), 30_000_000_000, 0, - false, )); let handle_id = get_last_message_id(); @@ -924,7 +908,6 @@ fn reply_deposit_gstd_async() { hello_reply.to_vec(), 0, 0, - false, )); run_to_next_block(None); @@ -956,7 +939,6 @@ fn pseudo_duplicate_wake() { calls.encode(), BlockGasLimitOf::::get(), 0, - false, )); let msg_id = get_last_message_id(); run_to_next_block(None); @@ -1172,7 +1154,6 @@ fn waited_with_zero_gas() { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT * 100, 0, - false, )); run_to_next_block(None); @@ -1219,7 +1200,6 @@ fn terminated_program_zero_gas() { EMPTY_PAYLOAD.to_vec(), 0, 0, - false, )); run_to_next_block(None); @@ -1265,7 +1245,6 @@ fn exited_program_zero_gas() { EMPTY_PAYLOAD.to_vec(), 0, 0, - false, )); run_to_next_block(None); @@ -1296,7 +1275,6 @@ fn delayed_user_replacement() { gas_limit_to_forward.encode(), // to be forwarded as gas limit gas_limit_to_forward + DEFAULT_GAS_LIMIT * 100, 100_000_000, // before fix to be forwarded as value - false, )); let message_id = utils::get_last_message_id(); @@ -1387,7 +1365,6 @@ fn delayed_send_user_message_payment() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, - false, )); let proxy_msg_id = get_last_message_id(); @@ -1488,7 +1465,6 @@ fn delayed_send_user_message_with_reservation() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, - false, )); let proxy_msg_id = get_last_message_id(); @@ -1597,7 +1573,6 @@ fn delayed_send_program_message_payment() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, - false, )); let proxy_msg_id = utils::get_last_message_id(); @@ -1700,7 +1675,6 @@ fn delayed_send_program_message_with_reservation() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, - false, )); let proxy_msg_id = utils::get_last_message_id(); @@ -1811,7 +1785,6 @@ fn delayed_send_program_message_with_low_reservation() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, - false, )); let proxy_msg_id = utils::get_last_message_id(); @@ -2008,7 +1981,6 @@ fn unstoppable_block_execution_works() { EMPTY_PAYLOAD.to_vec(), gas_for_each_execution, 0, - false, )); } @@ -2560,7 +2532,6 @@ fn mailbox_sending_instant_transfer() { payload.request(USER_2.into_origin()).encode(), gas_info.burned + gas_limit.unwrap_or_default(), 0, - false, )); utils::assert_balance( @@ -2680,7 +2651,6 @@ fn send_message_works() { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, mail_value, - false, )); let message_id = get_last_message_id(); @@ -2760,7 +2730,6 @@ fn mailbox_threshold_works() { (rent - 1).encode(), BlockGasLimitOf::::get(), 0, - false, )); check_result(false); @@ -2771,7 +2740,6 @@ fn mailbox_threshold_works() { (rent).encode(), BlockGasLimitOf::::get(), 0, - false, )); let message_id = check_result(true); @@ -2782,7 +2750,6 @@ fn mailbox_threshold_works() { rent.encode(), BlockGasLimitOf::::get(), 0, - false, )); let message_id = check_result(true); @@ -2793,7 +2760,6 @@ fn mailbox_threshold_works() { (rent - 1).encode(), BlockGasLimitOf::::get(), 0, - false, )); check_result(false); }); @@ -2876,7 +2842,6 @@ fn send_message_expected_failure() { EMPTY_PAYLOAD.to_vec(), 10, value, - false, )); // And no message will be in mailbox @@ -2898,7 +2863,6 @@ fn send_message_expected_failure() { EMPTY_PAYLOAD.to_vec(), block_gas_limit + 1, 0, - false, ), Error::::GasLimitTooHigh ); @@ -2985,7 +2949,6 @@ fn unused_gas_released_back_works() { EMPTY_PAYLOAD.to_vec(), huge_send_message_gas_limit, 0, - false, )); // Spends for submit program with default gas limit and sending default message with a huge gas limit @@ -3269,7 +3232,6 @@ fn memory_access_cases() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, ); assert_ok!(res); @@ -3284,7 +3246,6 @@ fn memory_access_cases() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, ); assert_ok!(res); @@ -3370,7 +3331,6 @@ fn lazy_pages() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 1000, - false, ); assert_ok!(res); @@ -3625,7 +3585,6 @@ fn block_gas_limit_works() { EMPTY_PAYLOAD.to_vec(), gas1.min_limit - 1, 1000, - false, )); let failed1 = get_last_message_id(); @@ -3635,7 +3594,6 @@ fn block_gas_limit_works() { EMPTY_PAYLOAD.to_vec(), gas1.min_limit, 1000, - false, )); let succeed1 = get_last_message_id(); @@ -3645,7 +3603,6 @@ fn block_gas_limit_works() { EMPTY_PAYLOAD.to_vec(), gas2.min_limit - 1, 1000, - false, )); let failed2 = get_last_message_id(); @@ -3655,7 +3612,6 @@ fn block_gas_limit_works() { EMPTY_PAYLOAD.to_vec(), gas2.min_limit, 1000, - false, )); let succeed2 = get_last_message_id(); @@ -3686,7 +3642,6 @@ fn block_gas_limit_works() { EMPTY_PAYLOAD.to_vec(), gas.min_limit, 1000, - false, )); }; @@ -4025,7 +3980,6 @@ fn send_reply_works() { EMPTY_PAYLOAD.to_vec(), 10_000_000, 1000, // `prog_id` sent message with value of 1000 (see program code) - false, )); let expected_reply_message_id = get_last_message_id(); @@ -4061,7 +4015,6 @@ fn send_reply_failure_to_claim_from_mailbox() { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, 0, - false, ), Error::::MessageNotFound ); @@ -4150,7 +4103,6 @@ fn send_reply_value_claiming_works() { EMPTY_PAYLOAD.to_vec(), gas_limit_to_reply, value_to_reply, - false, )); let currently_sent = value_to_reply + gas_price(gas_limit_to_reply); @@ -4298,7 +4250,6 @@ fn uninitialized_program_zero_gas() { vec![], 0, // that triggers unreachable code atm 0, - false, )); run_to_block(3, None); @@ -4363,7 +4314,6 @@ fn distributor_distribute() { Request::Receive(10).encode(), 30_000_000_000, 0, - false, )); run_to_block(3, None); @@ -4562,7 +4512,6 @@ fn messages_to_uninitialized_program_wait() { vec![], 10_000u64, 0u128, - false, )); run_to_block(3, None); @@ -4611,7 +4560,6 @@ fn uninitialized_program_should_accept_replies() { b"PONG".to_vec(), 10_000_000_000u64, 0, - false, )); run_to_block(3, None); @@ -4652,7 +4600,6 @@ fn defer_program_initialization() { b"PONG".to_vec(), 10_000_000_000u64, 0, - false, )); run_to_block(3, None); @@ -4663,7 +4610,6 @@ fn defer_program_initialization() { vec![], 10_000_000_000u64, 0u128, - false, )); run_to_block(4, None); @@ -4709,7 +4655,6 @@ fn wake_messages_after_program_inited() { vec![], 5_000_000_000u64, 0u128, - false, )); } @@ -4726,7 +4671,6 @@ fn wake_messages_after_program_inited() { b"PONG".to_vec(), 20_000_000_000u64, 0, - false, )); run_to_block(20, None); @@ -4809,7 +4753,6 @@ fn test_different_waits_success() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_success = get_last_message_id(); @@ -4842,7 +4785,6 @@ fn test_different_waits_success() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_for_success = get_last_message_id(); @@ -4878,7 +4820,6 @@ fn test_different_waits_success() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_up_to_success = get_last_message_id(); @@ -4938,7 +4879,6 @@ fn test_different_waits_fail() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_gas = get_last_message_id(); @@ -4975,7 +4915,6 @@ fn test_different_waits_fail() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_for_gas = get_last_message_id(); @@ -5012,7 +4951,6 @@ fn test_different_waits_fail() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_up_to_gas = get_last_message_id(); @@ -5050,7 +4988,6 @@ fn test_different_waits_fail() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_for_arg = get_last_message_id(); @@ -5088,7 +5025,6 @@ fn test_different_waits_fail() { payload, gas_info.burned + wl_gas + system_reservation, value, - false, )); let wait_up_to_arg = get_last_message_id(); @@ -5132,7 +5068,6 @@ fn wait_after_reply() { Command::ReplyAndWait(subcommand).encode(), BlockGasLimitOf::::get(), 0, - false, )); let message_id = utils::get_last_message_id(); @@ -5183,7 +5118,6 @@ fn test_requeue_after_wait_for_timeout() { payload, 30_000_000_000, 0, - false, )); // Fast forward blocks. @@ -5255,7 +5189,6 @@ fn test_sending_waits() { payload, 25_000_000_000, 0, - false, )); let wait_for = get_last_message_id(); @@ -5274,7 +5207,6 @@ fn test_sending_waits() { payload, 25_000_000_000, 0, - false, )); let wait_no_more = get_last_message_id(); @@ -5293,7 +5225,6 @@ fn test_sending_waits() { payload, 30_000_000_000, 0, - false, )); let wait_wait = get_last_message_id(); @@ -5312,7 +5243,6 @@ fn test_sending_waits() { vec![], 10_000_000_000, 0, - false, )); run_to_next_block(None); @@ -5354,7 +5284,6 @@ fn test_wait_timeout() { payload, 30_000_000_000, 0, - false, )); run_to_next_block(None); @@ -5368,7 +5297,6 @@ fn test_wait_timeout() { Command::Wake.encode(), 10_000_000, 0, - false, )); run_to_next_block(None); @@ -5412,7 +5340,6 @@ fn test_join_wait_timeout() { payload, 30_000_000_000, 0, - false, )); run_to_next_block(None); @@ -5471,7 +5398,6 @@ fn test_select_wait_timeout() { payload, 30_000_000_000, 0, - false, )); run_to_next_block(None); @@ -5517,7 +5443,6 @@ fn test_wait_lost() { payload, 30_000_000_000, 0, - false, )); run_to_next_block(None); @@ -5530,7 +5455,6 @@ fn test_wait_lost() { b"ping".to_vec(), 100_000_000, 0, - false, )); true @@ -5587,7 +5511,6 @@ fn test_message_processing_for_non_existing_destination() { EMPTY_PAYLOAD.to_vec(), 10_000, 1_000, - false, )); let skipped_message_id = get_last_message_id(); @@ -5628,7 +5551,6 @@ fn exit_locking_funds() { calls.encode(), 10_000_000_000, value, - false, )); let message_1 = utils::get_last_message_id(); @@ -5639,7 +5561,6 @@ fn exit_locking_funds() { calls.encode(), 10_000_000_000, 0, - false, )); let message_2 = utils::get_last_message_id(); @@ -5782,7 +5703,6 @@ fn terminated_locking_funds() { EMPTY_PAYLOAD.to_vec(), gas_spent_reply, 0, - false, )); let reply_id = get_last_message_id(); @@ -5952,7 +5872,6 @@ fn test_create_program_works() { // Calculate the gas spent after #1242. 10_000_000_000u64, 0, - false, )); run_to_next_block(None); @@ -5996,7 +5915,6 @@ fn test_create_program_no_code_hash() { CreateProgram::Default.encode(), 50_000_000_000, 0, - false, )); run_to_block(2, None); @@ -6021,7 +5939,6 @@ fn test_create_program_no_code_hash() { .encode(), 100_000_000_000, 0, - false, )); run_to_block(3, None); @@ -6052,7 +5969,6 @@ fn test_create_program_no_code_hash() { .encode(), 100_000_000_000, 0, - false, )); run_to_block(4, None); @@ -6095,7 +6011,6 @@ fn test_create_program_simple() { CreateProgram::Default.encode(), 50_000_000_000, 0, - false, )); run_to_block(3, None); @@ -6109,7 +6024,6 @@ fn test_create_program_simple() { .encode(), 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -6131,7 +6045,6 @@ fn test_create_program_simple() { .encode(), 50_000_000_000, 0, - false, )); run_to_block(5, None); @@ -6146,7 +6059,6 @@ fn test_create_program_simple() { .encode(), 50_000_000_000, 0, - false, )); run_to_block(6, None); @@ -6190,7 +6102,6 @@ fn test_pausing_programs_works() { .encode(), 50_000_000_000, 0, - false, )); let child_program_id = ProgramId::generate_from_program( @@ -6378,7 +6289,6 @@ fn state_request() { Request::Insert(key, value).encode(), 1_000_000_000, 0, - false, )); } @@ -6425,7 +6335,6 @@ fn resume_session_push_works() { request, 1_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6540,7 +6449,6 @@ fn resume_program_works() { request, 10_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6703,7 +6611,6 @@ fn resume_program_works() { request, 10_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6737,7 +6644,6 @@ fn test_no_messages_to_paused_program() { demo_wait_wake::Request::EchoWait(10).encode(), 50_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6838,7 +6744,6 @@ fn uninitialized_program_terminates_on_pause() { b"0123456789".to_vec(), 50_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6930,7 +6835,6 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6954,7 +6858,6 @@ fn pay_program_rent_syscall_works() { vec![Kind::PayProgramRent([0u8; 32], rent, None)].encode(), 20_000_000_000, 0, - false, )); run_to_next_block(None); @@ -6973,7 +6876,6 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, 0, - false, )); let message_id = get_last_message_id(); @@ -7019,7 +6921,6 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, Gear::rent_fee_for(u32::MAX), - false, )); let message_id = get_last_message_id(); @@ -7056,7 +6957,6 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, required_value, - false, )); let message_id = get_last_message_id(); @@ -7208,7 +7108,6 @@ fn test_create_program_duplicate() { .encode(), 20_000_000_000, 0, - false, )); run_to_block(4, None); @@ -7226,7 +7125,6 @@ fn test_create_program_duplicate() { .encode(), 20_000_000_000, 0, - false, )); run_to_block(5, None); @@ -7238,7 +7136,6 @@ fn test_create_program_duplicate() { .encode(), 20_000_000_000, 0, - false, )); run_to_block(6, None); @@ -7292,7 +7189,6 @@ fn test_create_program_duplicate_in_one_execution() { .encode(), 20_000_000_000, 0, - false, )); run_to_block(3, None); @@ -7312,7 +7208,6 @@ fn test_create_program_duplicate_in_one_execution() { .encode(), 20_000_000_000, 0, - false, )); run_to_block(4, None); @@ -7382,7 +7277,6 @@ fn test_create_program_miscellaneous() { .encode(), 50_000_000_000, 0, - false, )); run_to_block(3, None); @@ -7400,7 +7294,6 @@ fn test_create_program_miscellaneous() { .encode(), 50_000_000_000, 0, - false, )); run_to_block(4, None); @@ -7417,7 +7310,6 @@ fn test_create_program_miscellaneous() { .encode(), 50_000_000_000, 0, - false, )); run_to_block(5, None); @@ -7444,7 +7336,6 @@ fn exit_handle() { vec![], 50_000_000_000u64, 0u128, - false, )); run_to_block(3, None); @@ -7497,7 +7388,6 @@ fn no_redundant_gas_value_after_exiting() { EMPTY_PAYLOAD.to_vec(), gas_spent, 0, - false, )); let msg_id = get_last_message_id(); @@ -7559,7 +7449,6 @@ fn init_wait_reply_exit_cleaned_storage() { vec![], 10_000u64, 0u128, - false, )); } @@ -7583,7 +7472,6 @@ fn init_wait_reply_exit_cleaned_storage() { EMPTY_PAYLOAD.to_vec(), 100_000_000_000u64, 0, - false, )); assert!(!Gear::is_initialized(pid)); @@ -7767,7 +7655,6 @@ fn gas_spent_vs_balance() { request.clone(), 10_000_000_000, 0, - false, )); run_to_block(3, None); @@ -8113,7 +8000,6 @@ fn test_two_contracts_composition_works() { 100_u64.to_le_bytes().to_vec(), 60_000_000_000, 0, - false, )); run_to_block(4, None); @@ -8331,7 +8217,6 @@ fn demo_constructor_works() { calls.encode(), BlockGasLimitOf::::get(), 100_000, - false, )); let message_id = get_last_message_id(); @@ -8360,7 +8245,6 @@ fn demo_constructor_works() { calls.encode(), BlockGasLimitOf::::get(), 0, - false, )); let message_id = get_last_message_id(); @@ -8412,7 +8296,6 @@ fn demo_constructor_value_eq() { calls.encode(), BlockGasLimitOf::::get(), 100_000, - false, )); run_to_next_block(None); @@ -8426,7 +8309,6 @@ fn demo_constructor_value_eq() { calls.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -8476,7 +8358,6 @@ fn demo_constructor_is_demo_ping() { b"PING".to_vec(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -8494,7 +8375,6 @@ fn demo_constructor_is_demo_ping() { vec![], BlockGasLimitOf::::get(), 0, - false, )); let reply_id = get_last_message_id(); @@ -8530,7 +8410,6 @@ fn test_reply_to_terminated_program() { payload: EMPTY_PAYLOAD.to_vec(), gas_limit: 10_000_000, value: 0, - prepaid: false, }); assert_noop!( reply_call.dispatch(RuntimeOrigin::signed(USER_1)), @@ -8648,7 +8527,6 @@ fn delayed_wake() { vec![], BlockGasLimitOf::::get(), 0, - false, )); let mid = get_last_message_id(); @@ -8668,7 +8546,6 @@ fn delayed_wake() { delay.to_le_bytes().to_vec(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -8761,7 +8638,6 @@ fn cascading_messages_with_value_do_not_overcharge() { payload, gas_reserved, value, - false, )); let gas_to_spend = gas_price(gas_to_spend); @@ -8950,7 +8826,6 @@ fn execution_over_blocks() { Package::new(expected, src).encode(), block_gas_limit, 0, - false, )); run_to_next_block(Some(MAX_BLOCK)); @@ -8963,7 +8838,6 @@ fn execution_over_blocks() { Package::new(1_024, src).encode(), block_gas_limit, 0, - false, )); let message_id = get_last_message_id(); @@ -9004,7 +8878,6 @@ fn execution_over_blocks() { Method::Start { src, id, expected }.encode(), 9_000_000_000, 0, - false, )); run_to_next_block(Some(MAX_BLOCK)); @@ -9023,7 +8896,6 @@ fn execution_over_blocks() { Method::Refuel(id).encode(), block_gas_limit, 0, - false, )); count += 1; @@ -9103,7 +8975,6 @@ fn waking_message_waiting_for_mx_lock_does_not_lead_to_deadlock() { command.encode(), BlockGasLimitOf::::get(), 0, - false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -9187,7 +9058,6 @@ fn waking_message_waiting_for_rw_lock_does_not_lead_to_deadlock() { command.encode(), BlockGasLimitOf::::get(), 0, - false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -9320,7 +9190,6 @@ fn mx_lock_ownership_exceedance() { command.encode(), BlockGasLimitOf::::get(), 0, - false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -9628,7 +9497,6 @@ fn async_sleep_for() { command.encode(), BlockGasLimitOf::::get(), 0, - false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -9889,7 +9757,6 @@ fn test_async_messages() { kind.encode(), 30_000_000_000u64, 0, - false, )); // check the message sent from the program @@ -9905,7 +9772,6 @@ fn test_async_messages() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000u64, 0, - false, )); // check the reply from the program @@ -9954,7 +9820,6 @@ fn program_generator_works() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, - false, )); let message_id = get_last_message_id(); @@ -10096,7 +9961,6 @@ fn missing_functions_are_not_executed() { EMPTY_PAYLOAD.to_vec(), 1_000_000_000, 0, - false, )); run_to_next_block(None); @@ -10123,7 +9987,6 @@ fn missing_functions_are_not_executed() { EMPTY_PAYLOAD.to_vec(), 100_000_000, reply_value, - false, )); run_to_next_block(None); @@ -10188,7 +10051,6 @@ fn missing_handle_is_not_executed() { EMPTY_PAYLOAD.to_vec(), 1_000_000_000, 0, - false, )); assert_ok!(Gear::send_message( @@ -10197,7 +10059,6 @@ fn missing_handle_is_not_executed() { EMPTY_PAYLOAD.to_vec(), 1_000_000_000, 0, - false, )); run_to_next_block(None); @@ -10271,7 +10132,6 @@ fn test_reinstrumentation_works() { vec![], 10_000_000_000, 0, - false, )); run_to_block(3, None); @@ -10286,7 +10146,6 @@ fn test_reinstrumentation_works() { vec![], 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -10381,7 +10240,6 @@ fn send_from_reservation() { HandleAction::SendToUser.encode(), 10_000_000_000, 1_000, - false, )); run_to_block(3, None); @@ -10406,7 +10264,6 @@ fn send_from_reservation() { .encode(), 10_000_000_000, 1_000, - false, )); let mid = get_last_message_id(); @@ -10431,7 +10288,6 @@ fn send_from_reservation() { HandleAction::SendToUserDelayed.encode(), 10_000_000_000, 1_000, - false, )); run_to_block(5, None); @@ -10460,7 +10316,6 @@ fn send_from_reservation() { .encode(), 10_000_000_000, 1_000, - false, )); let mid = get_last_message_id(); @@ -10518,7 +10373,6 @@ fn reply_from_reservation() { HandleAction::ReplyToUser.encode(), 30_000_000_000, 1_000, - false, )); run_to_block(3, None); @@ -10543,7 +10397,6 @@ fn reply_from_reservation() { .encode(), 30_000_000_000, 1_000, - false, )); let mid = get_last_message_id(); @@ -10589,7 +10442,6 @@ fn signal_recursion_not_occurs() { HandleAction::PanicInSignal.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -10659,7 +10511,6 @@ fn signal_during_precharge() { HandleAction::WaitWithReserveAmountAndPanic(1).encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -10676,7 +10527,6 @@ fn signal_during_precharge() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -10730,7 +10580,6 @@ fn signal_during_prepare() { HandleAction::WaitWithReserveAmountAndPanic(program_gas).encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -10747,7 +10596,6 @@ fn signal_during_prepare() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -10810,7 +10658,6 @@ fn signal_async_wait_works() { EMPTY_PAYLOAD.to_vec(), gas_spent, 0, - false, )); let mid = get_last_message_id(); @@ -10886,7 +10733,6 @@ fn signal_run_out_of_gas_memory_access_works() { HandleAction::SaveSignal(SimpleExecutionError::RanOutOfGas.into()).encode(), GAS_LIMIT, 0, - false, )); run_to_next_block(None); @@ -10909,7 +10755,6 @@ fn signal_run_out_of_gas_memory_access_works() { demo_signal_entry::HandleAction::MemoryAccess.encode(), min_limit - 1, 0, - false, )); let mid = get_last_message_id(); @@ -11015,7 +10860,6 @@ fn signal_removed_from_waitlist_works() { HandleAction::SaveSignal(SignalCode::RemovedFromWaitlist).encode(), GAS_LIMIT, 0, - false, )); run_to_next_block(None); @@ -11027,7 +10871,6 @@ fn signal_removed_from_waitlist_works() { HandleAction::WaitWithoutSendingMessage.encode(), GAS_LIMIT, 0, - false, )); let mid = get_last_message_id(); @@ -11090,7 +10933,6 @@ fn system_reservation_unreserve_works() { HandleAction::Simple.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11132,7 +10974,6 @@ fn few_system_reservations_across_waits_works() { HandleAction::AcrossWaits.encode(), 30_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11151,7 +10992,6 @@ fn few_system_reservations_across_waits_works() { EMPTY_PAYLOAD.to_vec(), 30_000_000_000, 0, - false, )); run_to_next_block(None); @@ -11184,7 +11024,6 @@ fn system_reservation_panic_works() { HandleAction::Panic.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11224,7 +11063,6 @@ fn system_reservation_exit_works() { HandleAction::Exit.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11266,7 +11104,6 @@ fn system_reservation_wait_and_panic_works() { HandleAction::WaitAndPanic.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11283,7 +11120,6 @@ fn system_reservation_wait_and_panic_works() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -11317,7 +11153,6 @@ fn system_reservation_wait_works() { HandleAction::Wait.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11377,7 +11212,6 @@ fn system_reservation_wait_and_exit_works() { HandleAction::WaitAndExit.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11394,7 +11228,6 @@ fn system_reservation_wait_and_exit_works() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -11432,7 +11265,6 @@ fn system_reservation_wait_and_reserve_with_panic_works() { HandleAction::WaitAndReserveWithPanic.encode(), 30_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11451,7 +11283,6 @@ fn system_reservation_wait_and_reserve_with_panic_works() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, )); run_to_block(4, None); @@ -11489,7 +11320,6 @@ fn system_reservation_accumulate_works() { HandleAction::Accumulate.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11527,7 +11357,6 @@ fn system_reservation_zero_amount_panics() { HandleAction::ZeroReserve.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11588,7 +11417,6 @@ fn gas_reservation_works() { HandleAction::Unreserve.encode(), spent_gas, 0, - false, )); run_to_block(3, None); @@ -11630,7 +11458,6 @@ fn gas_reservation_works() { HandleAction::Exit.encode(), 50_000_000_000, 0, - false, )); run_to_block(2 + 4, None); @@ -11679,7 +11506,6 @@ fn gas_reservations_cleaned_in_terminated_program() { ReplyAction::Panic.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_block(3, None); @@ -11729,7 +11555,6 @@ fn gas_reservation_wait_wake_exit() { ReplyAction::Exit.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_block(3, None); @@ -11819,7 +11644,6 @@ fn gas_reservations_existing_reserve_unreserve() { HandleAction::SendFromReservationAndUnreserve.encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11857,7 +11681,6 @@ fn custom_async_entrypoint_works() { EMPTY_PAYLOAD.to_vec(), 30_000_000_000, 0, - false, )); run_to_block(3, None); @@ -11871,7 +11694,6 @@ fn custom_async_entrypoint_works() { EMPTY_PAYLOAD.to_vec(), 30_000_000_000, 0, - false, )); run_to_block(4, None); @@ -11909,7 +11731,6 @@ fn dispatch_kind_forbidden_function() { HandleAction::ForbiddenCallInSignal(USER_1.into_origin().into()).encode(), 10_000_000_000, 0, - false, )); let mid = get_last_message_id(); @@ -11989,7 +11810,6 @@ fn system_reservation_gas_allowance_rollbacks() { HandleAction::Simple.encode(), min_limit, 0, - false, )); let mid = get_last_message_id(); @@ -12025,7 +11845,6 @@ fn system_reservation_wait_and_exit_across_executions() { HandleAction::Wait.encode(), 10_000_000_000, 0, - false, )); let mid_wait = get_last_message_id(); @@ -12040,7 +11859,6 @@ fn system_reservation_wait_and_exit_across_executions() { HandleAction::Exit.encode(), 10_000_000_000, 0, - false, )); let mid_exit = get_last_message_id(); @@ -12109,7 +11927,6 @@ fn signal_on_uninitialized_program() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, - false, )); let reply_mid = get_last_message_id(); @@ -12141,7 +11958,6 @@ fn missing_block_tasks_handled() { vec![], 100_000_000, 1000, - false, )); run_to_block(N - 1, None); @@ -12215,7 +12031,6 @@ fn async_does_not_duplicate_sync() { b"async".to_vec(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -12982,7 +12797,6 @@ fn check_random_works() { EMPTY_PAYLOAD.to_vec(), 50_000_000_000, 0, - false, )); let output: ([u8; 32], BlockNumber) = @@ -13045,7 +12859,6 @@ fn reply_with_small_non_zero_gas() { payload.to_vec(), DEFAULT_GAS_LIMIT * 10, 0, - false, )); let message_id = utils::get_last_message_id(); @@ -13087,7 +12900,6 @@ fn replies_denied_in_handle_reply() { vec![], 50_000_000_000, 0, - false, )); let message_id = get_last_message_id(); @@ -13102,7 +12914,6 @@ fn replies_denied_in_handle_reply() { vec![], 50_000_000_000, 0, - false, )); let reply_id = get_last_message_id(); @@ -13160,7 +12971,6 @@ fn relay_messages() { payload.to_vec(), DEFAULT_GAS_LIMIT * 10, 0, - false, ) .is_ok(), "{}", @@ -13559,7 +13369,6 @@ fn calculate_gas_fails_when_calculation_limit_exceeded() { .encode(), BlockGasLimitOf::::get(), 0, - false, ) .expect("Making reservation failed"); } @@ -13626,7 +13435,6 @@ fn reservation_manager() { payload.encode(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -13739,13 +13547,14 @@ fn send_gasless_message_works() { // Test 1: USER_2 sends a gasless message to the program (intending to use a voucher). // Expect failure because USER_2 has no voucher. assert_noop!( - Gear::send_message( + GearVoucher::call( RuntimeOrigin::signed(USER_2), - program_id, - EMPTY_PAYLOAD.to_vec(), - DEFAULT_GAS_LIMIT, - 0, - true, + PrepaidCall::SendMessage { + destination: program_id, + payload: EMPTY_PAYLOAD.to_vec(), + gas_limit: DEFAULT_GAS_LIMIT, + value: 0 + } ), Error::::FailureRedeemingVoucher ); @@ -13779,13 +13588,14 @@ fn send_gasless_message_works() { // Test 2: USER_2 sends a gasless message to the program (intending to use a voucher). // Now that voucher is issued, the message should be sent successfully. - assert_ok!(Gear::send_message( + assert_ok!(GearVoucher::call( RuntimeOrigin::signed(USER_2), - program_id, - EMPTY_PAYLOAD.to_vec(), - DEFAULT_GAS_LIMIT, - 1_000_000_u128, - true, + PrepaidCall::SendMessage { + destination: program_id, + payload: EMPTY_PAYLOAD.to_vec(), + gas_limit: DEFAULT_GAS_LIMIT, + value: 1_000_000 + } )); // Balances check @@ -13863,13 +13673,14 @@ fn send_gasless_reply_works() { // USER_1 sends a gasless reply using a voucher let gas_limit = 10_000_000_u64; - assert_ok!(Gear::send_reply( + assert_ok!(GearVoucher::call( RuntimeOrigin::signed(USER_1), - reply_to_id, - EMPTY_PAYLOAD.to_vec(), - gas_limit, - 1000, // `prog_id` sent message with value of 1000 (see program code) - true, + PrepaidCall::SendReply { + reply_to_id, + payload: EMPTY_PAYLOAD.to_vec(), + gas_limit, + value: 1_000 + } )); let expected_reply_message_id = get_last_message_id(); @@ -13935,7 +13746,6 @@ fn double_read_works() { b"PAYLOAD".to_vec(), BlockGasLimitOf::::get(), 100_000, - false, )); run_to_next_block(None); @@ -14030,7 +13840,6 @@ fn test_gas_allowance_exceed_with_context() { calls.encode(), BlockGasLimitOf::::get(), 0, - false, )); let msg_id = get_last_message_id(); run_to_next_block(allowance); @@ -14182,7 +13991,6 @@ fn test_send_to_terminated_from_program() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, - false, )); run_to_next_block(None); @@ -14362,7 +14170,6 @@ fn remove_from_waitlist_after_exit_reply() { vec![], 1_000_000_000, 0, - false, )); run_to_next_block(None); @@ -14637,7 +14444,6 @@ mod utils { payload, limit, value, - false, )); let message_id = get_last_message_id(); @@ -14733,7 +14539,6 @@ mod utils { Vec::new(), gas_limit, // `prog_id` program sends message in handle which sets gas limit to 10_000_000. value, - false, )); let message_id = get_last_message_id(); @@ -14831,7 +14636,6 @@ mod utils { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, 0, - false, ) } @@ -14841,7 +14645,6 @@ mod utils { payload: EMPTY_PAYLOAD.to_vec(), gas_limit: DEFAULT_GAS_LIMIT, value: 0, - prepaid: false, }) } @@ -15312,7 +15115,6 @@ mod utils { payload, BlockGasLimitOf::::get(), 0, - false, )); get_last_message_id() @@ -15388,7 +15190,6 @@ mod utils { HandleAction::SaveSignal(signal_code).encode(), GAS_LIMIT, 0, - false, )); run_to_next_block(None); @@ -15400,7 +15201,6 @@ mod utils { action.encode(), GAS_LIMIT, 0, - false, )); let mid = get_last_message_id(); diff --git a/pallets/payment/src/lib.rs b/pallets/payment/src/lib.rs index 6f7fcf428f9..68e6ecaa67d 100644 --- a/pallets/payment/src/lib.rs +++ b/pallets/payment/src/lib.rs @@ -196,7 +196,7 @@ where who: &'a ::AccountId, ) -> Cow<'a, ::AccountId> { // Check if the extrinsic being called allows to charge fee payment to another account. - // The only such call at the moment is `Gear::send_message` with `prepaid == true`. + // The only such call at the moment is `GearVoucher::call`. if let Some(acc) = T::DelegateFee::delegate_fee(call, who) { Cow::Owned(acc) } else { diff --git a/pallets/payment/src/mock.rs b/pallets/payment/src/mock.rs index 414bef402ae..8b8b85077fd 100644 --- a/pallets/payment/src/mock.rs +++ b/pallets/payment/src/mock.rs @@ -271,24 +271,14 @@ pub struct DelegateFeeAccountBuilder; impl DelegateFee for DelegateFeeAccountBuilder { fn delegate_fee(call: &RuntimeCall, who: &AccountId) -> Option { match call { - RuntimeCall::Gear(pallet_gear::Call::send_message { prepaid, .. }) => { - prepaid.then_some(FEE_PAYER) - } - RuntimeCall::Gear(pallet_gear::Call::send_reply { - reply_to_id, - prepaid, - .. - }) => { - if *prepaid { - as common::storage::Mailbox>::peek(who, reply_to_id).map( - |stored_message| { - GearVoucher::voucher_account_id(who, &stored_message.source()) - }, - ) - } else { - None - } - } + RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendMessage { .. }, + }) => Some(FEE_PAYER), + RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendReply { reply_to_id, .. }, + }) => as common::storage::Mailbox>::peek(who, reply_to_id).map( + |stored_message| GearVoucher::voucher_account_id(who, &stored_message.source()), + ), _ => None, } } @@ -309,6 +299,7 @@ impl pallet_gear_voucher::Config for Test { type Currency = Balances; type PalletId = VoucherPalletId; type WeightInfo = (); + type CallsDispatcher = Gear; } // Build genesis storage according to the mock runtime. diff --git a/pallets/payment/src/tests.rs b/pallets/payment/src/tests.rs index 8f908ce0fc4..de712b3e193 100644 --- a/pallets/payment/src/tests.rs +++ b/pallets/payment/src/tests.rs @@ -218,7 +218,6 @@ fn mq_size_affecting_fee_works() { payload: Default::default(), gas_limit: 100_000, value: 0, - prepaid: false, }); let len = 100usize; @@ -399,7 +398,6 @@ fn query_info_and_fee_details_work() { payload: Default::default(), gas_limit: 100_000, value: 0, - prepaid: false, }); let call_not_affecting_mq = RuntimeCall::Gear(pallet_gear::Call::claim_value { message_id: 1.into(), @@ -571,12 +569,13 @@ fn fee_payer_replacement_works() { let program_id = ProgramId::from_origin(H256::random()); let call: &::RuntimeCall = - &RuntimeCall::Gear(pallet_gear::Call::send_message { - destination: program_id, - payload: Default::default(), - gas_limit: 100_000, - value: 0, - prepaid: true, + &RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendMessage { + destination: program_id, + payload: Default::default(), + gas_limit: 100_000, + value: 0, + }, }); let len = 100usize; @@ -660,12 +659,13 @@ fn reply_with_voucher_pays_fee_from_voucher_ok() { // Preparing a call let gas_limit = 100_000_u64; let call: &::RuntimeCall = - &RuntimeCall::Gear(pallet_gear::Call::send_reply { - reply_to_id: msg_id, - payload: vec![], - gas_limit, - value: 0, - prepaid: true, + &RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendReply { + reply_to_id: msg_id, + payload: vec![], + gas_limit, + value: 0, + }, }); let len = 100_usize; diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 4a6b5a2dbb5..9f48f117cba 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -547,26 +547,14 @@ pub struct DelegateFeeAccountBuilder; impl DelegateFee for DelegateFeeAccountBuilder { fn delegate_fee(call: &RuntimeCall, who: &AccountId) -> Option { match call { - RuntimeCall::Gear(pallet_gear::Call::send_message { - destination, - prepaid, - .. - }) => prepaid.then(|| GearVoucher::voucher_account_id(who, destination)), - RuntimeCall::Gear(pallet_gear::Call::send_reply { - reply_to_id, - prepaid, - .. - }) => { - if *prepaid { - <::Mailbox as Mailbox>::peek(who, reply_to_id).map( - |stored_message| { - GearVoucher::voucher_account_id(who, &stored_message.source()) - }, - ) - } else { - None - } - } + RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendMessage { destination, .. }, + }) => Some(GearVoucher::voucher_account_id(who, destination)), + RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendReply { reply_to_id, .. }, + }) => <::Mailbox as Mailbox>::peek(who, reply_to_id).map( + |stored_message| GearVoucher::voucher_account_id(who, &stored_message.source()), + ), _ => None, } } @@ -587,6 +575,7 @@ impl pallet_gear_voucher::Config for Runtime { type Currency = Balances; type PalletId = VoucherPalletId; type WeightInfo = weights::pallet_gear_voucher::SubstrateWeight; + type CallsDispatcher = Gear; } impl frame_system::offchain::SendTransactionTypes for Runtime diff --git a/runtime/vara/src/integration_tests.rs b/runtime/vara/src/integration_tests.rs index 2a3763a494e..ab5e6b3e4b9 100644 --- a/runtime/vara/src/integration_tests.rs +++ b/runtime/vara/src/integration_tests.rs @@ -366,7 +366,6 @@ fn tokens_locking_works() { vec![], 10_000_000_000, 11_000 * UNITS, - false, ), pallet_gear_bank::Error::::InsufficientBalance ); diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index bde63b1de42..29f2e6e60da 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -1051,26 +1051,14 @@ pub struct DelegateFeeAccountBuilder; impl DelegateFee for DelegateFeeAccountBuilder { fn delegate_fee(call: &RuntimeCall, who: &AccountId) -> Option { match call { - RuntimeCall::Gear(pallet_gear::Call::send_message { - destination, - prepaid, - .. - }) => prepaid.then(|| GearVoucher::voucher_account_id(who, destination)), - RuntimeCall::Gear(pallet_gear::Call::send_reply { - reply_to_id, - prepaid, - .. - }) => { - if *prepaid { - <::Mailbox as Mailbox>::peek(who, reply_to_id).map( - |stored_message| { - GearVoucher::voucher_account_id(who, &stored_message.source()) - }, - ) - } else { - None - } - } + RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendMessage { destination, .. }, + }) => Some(GearVoucher::voucher_account_id(who, destination)), + RuntimeCall::GearVoucher(pallet_gear_voucher::Call::call { + call: pallet_gear_voucher::PrepaidCall::SendReply { reply_to_id, .. }, + }) => <::Mailbox as Mailbox>::peek(who, reply_to_id).map( + |stored_message| GearVoucher::voucher_account_id(who, &stored_message.source()), + ), _ => None, } } @@ -1091,6 +1079,7 @@ impl pallet_gear_voucher::Config for Runtime { type Currency = Balances; type PalletId = VoucherPalletId; type WeightInfo = weights::pallet_gear_voucher::SubstrateWeight; + type CallsDispatcher = Gear; } impl frame_system::offchain::SendTransactionTypes for Runtime diff --git a/utils/call-gen/src/send_message.rs b/utils/call-gen/src/send_message.rs index 0c4d2bbfb23..22fa41b2351 100644 --- a/utils/call-gen/src/send_message.rs +++ b/utils/call-gen/src/send_message.rs @@ -26,7 +26,7 @@ use gear_core::ids::ProgramId; use gear_utils::{NonEmpty, RingGet}; // destination, payload, gas, value -type SendMessageArgsInner = (ProgramId, Vec, u64, u128, bool); +type SendMessageArgsInner = (ProgramId, Vec, u64, u128); /// Send message args /// @@ -67,8 +67,6 @@ impl GeneratableCallArgs for SendMessageArgs { // TODO #2203 let value = 0; - let prepaid = false; - - Self((destination, payload, gas_limit, value, prepaid)) + Self((destination, payload, gas_limit, value)) } } diff --git a/utils/call-gen/src/send_reply.rs b/utils/call-gen/src/send_reply.rs index 2ef34ef7bba..25ca41046dc 100644 --- a/utils/call-gen/src/send_reply.rs +++ b/utils/call-gen/src/send_reply.rs @@ -25,8 +25,8 @@ use crate::{ use gear_core::ids::MessageId; use gear_utils::{NonEmpty, RingGet}; -// reply to message id, payload, gas limit, value, prepaid -type SendReplyArgsInner = (MessageId, Vec, u64, u128, bool); +// reply to message id, payload, gas limit, value. +type SendReplyArgsInner = (MessageId, Vec, u64, u128); /// Send reply args /// @@ -62,8 +62,6 @@ impl GeneratableCallArgs for SendReplyArgs { // TODO #2203 let value = 0; - let prepaid = false; - - Self((message_id, payload, gas_limit, value, prepaid)) + Self((message_id, payload, gas_limit, value)) } } diff --git a/utils/runtime-fuzzer/src/gear_calls.rs b/utils/runtime-fuzzer/src/gear_calls.rs index e5dd10e7133..e616f9cfe4b 100644 --- a/utils/runtime-fuzzer/src/gear_calls.rs +++ b/utils/runtime-fuzzer/src/gear_calls.rs @@ -271,7 +271,6 @@ impl From for ExtrinsicGenerator { pub(crate) struct SendMessageGenerator { pub gas: u64, pub value: u128, - pub prepaid: bool, } impl SendMessageGenerator { @@ -291,7 +290,7 @@ impl SendMessageGenerator { log::trace!("Payload (send_message) length {:?}", payload.len()); Ok(Some( - SendMessageArgs((program_id, payload, self.gas, self.value, self.prepaid)).into(), + SendMessageArgs((program_id, payload, self.gas, self.value)).into(), )) } @@ -312,7 +311,6 @@ pub(crate) struct SendReplyGenerator { pub gas: u64, pub value: u128, - pub prepaid: bool, } impl SendReplyGenerator { @@ -334,9 +332,7 @@ impl SendReplyGenerator { ); log::trace!("Payload (send_reply) length {:?}", payload.len()); - Some( - SendReplyArgs((message_id, payload, self.gas, self.value, self.prepaid)).into(), - ) + Some(SendReplyArgs((message_id, payload, self.gas, self.value)).into()) } }) } diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 86793e81e6a..e241451cc32 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -120,25 +120,23 @@ fn execute_gear_call(sender: AccountId, call: GearCall) -> DispatchResultWithPos ) } GearCall::SendMessage(args) => { - let SendMessageArgs((destination, payload, gas_limit, value, prepaid)) = args; + let SendMessageArgs((destination, payload, gas_limit, value)) = args; Gear::send_message( RuntimeOrigin::signed(sender), destination, payload, gas_limit, value, - prepaid, ) } GearCall::SendReply(args) => { - let SendReplyArgs((message_id, payload, gas_limit, value, prepaid)) = args; + let SendReplyArgs((message_id, payload, gas_limit, value)) = args; Gear::send_reply( RuntimeOrigin::signed(sender), message_id, payload, gas_limit, value, - prepaid, ) } GearCall::ClaimValue(args) => { diff --git a/utils/runtime-fuzzer/src/utils.rs b/utils/runtime-fuzzer/src/utils.rs index c2a041652b9..033a9e38cc5 100644 --- a/utils/runtime-fuzzer/src/utils.rs +++ b/utils/runtime-fuzzer/src/utils.rs @@ -52,7 +52,6 @@ pub(crate) fn default_generator_set(test_input_id: String) -> ExtrinsicGenerator SendMessageGenerator { gas: default_gas_limit(), value: 0, - prepaid: false, } .into(), ), @@ -64,7 +63,6 @@ pub(crate) fn default_generator_set(test_input_id: String) -> ExtrinsicGenerator }), gas: default_gas_limit(), value: 0, - prepaid: false, } .into(), ),