From bf3fd177645235e76cd69a7f0642c4ac424df9ba Mon Sep 17 00:00:00 2001 From: Maximilian Summe Date: Tue, 7 May 2024 11:42:23 +0000 Subject: [PATCH] test(nns): Set DTS slice size for NNS tests to 2 billion --- .../governance_mem_test_canister.rs | 9 +++++++++ rs/nns/test_utils/src/state_test_helpers.rs | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/rs/nns/integration_tests/test_canisters/governance_mem_test_canister.rs b/rs/nns/integration_tests/test_canisters/governance_mem_test_canister.rs index cd5b8c6cf98..6e777d9a153 100644 --- a/rs/nns/integration_tests/test_canisters/governance_mem_test_canister.rs +++ b/rs/nns/integration_tests/test_canisters/governance_mem_test_canister.rs @@ -156,6 +156,15 @@ fn populate_canister_state() { let mut proto = GovernanceProto { economics: Some(NetworkEconomicsProto::with_default_values()), in_flight_commands: create_in_flight_commands(), + xdr_conversion_rate: Some(XdrConversionRate { + timestamp_seconds: Some( + dfn_core::api::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_secs(), + ), + xdr_permyriad_per_icp: Some(1000), + }), ..Default::default() }; diff --git a/rs/nns/test_utils/src/state_test_helpers.rs b/rs/nns/test_utils/src/state_test_helpers.rs index 6b9cfcc016a..2d0a6ef9aa2 100644 --- a/rs/nns/test_utils/src/state_test_helpers.rs +++ b/rs/nns/test_utils/src/state_test_helpers.rs @@ -13,6 +13,7 @@ use dfn_candid::candid_one; use dfn_http::types::{HttpRequest, HttpResponse}; use dfn_protobuf::ToProto; use ic_base_types::{CanisterId, PrincipalId, SubnetId}; +use ic_config::{execution_environment::Config, subnet_config::SubnetConfig}; use ic_management_canister_types::{ CanisterInstallMode, CanisterSettingsArgs, CanisterSettingsArgsBuilder, CanisterStatusResultV2, UpdateSettingsArgs, @@ -48,6 +49,7 @@ use ic_nns_governance::pb::v1::{ RewardNodeProviders, Vote, }; use ic_nns_handler_root::init::RootCanisterInitPayload; +use ic_registry_subnet_type::SubnetType; use ic_sns_governance::{ pb::v1::{ self as sns_pb, manage_neuron_response::Command as SnsCommandResponse, GetModeResponse, @@ -59,11 +61,11 @@ use ic_sns_wasm::{ init::SnsWasmCanisterInitPayload, pb::v1::{ListDeployedSnsesRequest, ListDeployedSnsesResponse}, }; -use ic_state_machine_tests::{StateMachine, StateMachineBuilder}; +use ic_state_machine_tests::{StateMachine, StateMachineBuilder, StateMachineConfig}; use ic_test_utilities::universal_canister::{ call_args, wasm as universal_canister_argument_builder, UNIVERSAL_CANISTER_WASM, }; -use ic_types::{ingress::WasmResult, Cycles}; +use ic_types::{ingress::WasmResult, Cycles, NumInstructions}; use icp_ledger::{AccountIdentifier, BinaryAccountBalanceArgs, BlockIndex, Memo, SendArgs, Tokens}; use icrc_ledger_types::icrc1::{ account::Account, @@ -81,12 +83,23 @@ use std::{convert::TryInto, env, time::Duration}; /// is omitted so that the canister range of the II subnet is not used /// for automatic generation of new canister IDs. pub fn state_machine_builder_for_nns_tests() -> StateMachineBuilder { + // TODO, remove when this is the value set in the normal IC build + // This is to uncover issues in testing that might affect performance in production + const MAX_INSTRUCTIONS_PER_SLICE: NumInstructions = NumInstructions::new(2_000_000_000); // 2 Billion is the value used in app subnets + + let mut subnet_config = SubnetConfig::new(SubnetType::System); + subnet_config.scheduler_config.max_instructions_per_slice = MAX_INSTRUCTIONS_PER_SLICE; + StateMachineBuilder::new() .with_current_time() .with_extra_canister_range(std::ops::RangeInclusive::::new( CanisterId::from_u64(0x2100000), CanisterId::from_u64(0x21FFFFE), )) + .with_config(Some(StateMachineConfig::new( + subnet_config, + Config::default(), + ))) } /// Turn down state machine logging to just errors to reduce noise in tests where this is not relevant