diff --git a/core-processor/src/configs.rs b/core-processor/src/configs.rs index a829a7d7f9c..9964bef46f0 100644 --- a/core-processor/src/configs.rs +++ b/core-processor/src/configs.rs @@ -26,9 +26,6 @@ use gear_core::{ pub use gear_wasm_instrument::syscalls::SyscallName; -/// Number of max pages number to use it in tests. -pub const TESTS_MAX_PAGES_NUMBER: u16 = 512; - /// Contextual block information. #[derive(Clone, Copy, Debug, Default)] pub struct BlockInfo { diff --git a/gtest/src/lib.rs b/gtest/src/lib.rs index 46ebfaae02e..3743953fc96 100644 --- a/gtest/src/lib.rs +++ b/gtest/src/lib.rs @@ -531,10 +531,13 @@ pub mod constants { /// Gas allowance for executing user dispatch and set of generated /// by programs dispatches from execution of the user dispatch. - pub const GAS_ALLOWANCE: Gas = 750_000_000_000; + pub const GAS_ALLOWANCE: Gas = 1_000_000_000_000; + + /// Max allowed user gas to apply for external message. + pub const MAX_USER_GAS_LIMIT: Gas = 750_000_000_000; /// Gas multiplier used to calculate equivalence of gas in token value. - pub const GAS_MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(6); + pub const GAS_MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(VALUE_PER_GAS); /* Currency-related constants */ @@ -583,5 +586,5 @@ pub mod constants { } /// Default initial balance for users. - pub const DEFAULT_USERS_INITIAL_BALANCE: Value = EXISTENTIAL_DEPOSIT * 100_000; + pub const DEFAULT_USERS_INITIAL_BALANCE: Value = 100_000 * UNITS; } diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index 04bd511ae53..e636df9af71 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -16,16 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -mod block_exec; -mod expend; -mod hold_bound; -mod journal; -mod memory; -mod reservations; -mod send_dispatch; -mod task; -mod wait_wake; - use crate::{ constants::Value, error::usage_panic, @@ -45,9 +35,8 @@ use crate::{ GAS_MULTIPLIER, INITIAL_RANDOM_SEED, MAX_RESERVATIONS, RESERVE_FOR, VALUE_PER_GAS, }; use core_processor::{ - common::*, - configs::{BlockConfig, TESTS_MAX_PAGES_NUMBER}, - ContextChargedForInstrumentation, ContextChargedForProgram, Ext, + common::*, configs::BlockConfig, ContextChargedForInstrumentation, ContextChargedForProgram, + Ext, }; use gear_common::{ auxiliary::{ @@ -81,6 +70,16 @@ use std::{ mem, }; +mod block_exec; +mod expend; +mod hold_bound; +mod journal; +mod memory; +mod reservations; +mod send_dispatch; +mod task; +mod wait_wake; + const OUTGOING_LIMIT: u32 = 1024; const OUTGOING_BYTES_LIMIT: u32 = 64 * 1024 * 1024; diff --git a/gtest/src/manager/block_exec.rs b/gtest/src/manager/block_exec.rs index 07361be7360..8f046dd3cfd 100644 --- a/gtest/src/manager/block_exec.rs +++ b/gtest/src/manager/block_exec.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . use core_processor::SuccessfulDispatchResultKind; -use gear_core::{gas::GasCounter, str::LimitedStr}; +use gear_core::{code::MAX_WASM_PAGES_AMOUNT, gas::GasCounter, str::LimitedStr}; use task::get_maximum_task_gas; use super::*; @@ -540,7 +540,7 @@ impl ExtManager { existential_deposit: EXISTENTIAL_DEPOSIT, mailbox_threshold: schedule.rent_weights.mailbox_threshold.ref_time, max_reservations: MAX_RESERVATIONS, - max_pages: TESTS_MAX_PAGES_NUMBER.into(), + max_pages: MAX_WASM_PAGES_AMOUNT.into(), outgoing_limit: OUTGOING_LIMIT, outgoing_bytes_limit: OUTGOING_BYTES_LIMIT, } diff --git a/gtest/src/program.rs b/gtest/src/program.rs index 4199da5d252..f9ea282fd41 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -22,7 +22,7 @@ use crate::{ manager::ExtManager, state::actors::{Actors, GenuineProgram, Program as InnerProgram, TestActor}, system::System, - Result, Value, GAS_ALLOWANCE, + Result, Value, MAX_USER_GAS_LIMIT, }; use codec::{Codec, Decode, Encode}; use gear_core::{ @@ -539,7 +539,7 @@ impl<'a> Program<'a> { ID: Into, T: Into>, { - self.send_bytes_with_gas_and_value(from, payload, GAS_ALLOWANCE, value) + self.send_bytes_with_gas_and_value(from, payload, MAX_USER_GAS_LIMIT, value) } /// Send the message to the program with bytes payload, gas limit and value. diff --git a/gtest/src/state/mailbox/actor.rs b/gtest/src/state/mailbox/actor.rs index 5e1f2d6632f..5744e096074 100644 --- a/gtest/src/state/mailbox/actor.rs +++ b/gtest/src/state/mailbox/actor.rs @@ -20,7 +20,7 @@ use crate::{ error::usage_panic, manager::ExtManager, state::{accounts::Accounts, actors::Actors}, - Log, Value, GAS_ALLOWANCE, + Log, Value, MAX_USER_GAS_LIMIT, }; use codec::Encode; use gear_common::{ @@ -96,7 +96,7 @@ impl<'a> ActorMailbox<'a> { { 0 } else { - GAS_ALLOWANCE + MAX_USER_GAS_LIMIT }; // Build a reply message