@@ -1640,7 +1640,7 @@ bool Transaction::unpack_msg_state(const ComputePhaseConfig& cfg, bool lib_only,
16401640 if (forbid_public_libs) {
16411641 size_limits.max_acc_public_libraries = 0 ;
16421642 }
1643- auto S = check_state_limits (size_limits, false );
1643+ auto S = check_state_limits (size_limits, cfg. global_version , false );
16441644 if (S.is_error ()) {
16451645 LOG (DEBUG) << " Cannot unpack msg state: " << S.move_as_error ();
16461646 new_code = old_code;
@@ -2046,7 +2046,7 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
20462046 if (account.is_special ) {
20472047 return 1 ;
20482048 }
2049- auto S = check_state_limits (cfg.size_limits );
2049+ auto S = check_state_limits (cfg.size_limits , cfg. global_version );
20502050 if (S.is_error ()) {
20512051 if (S.code () != AccountStorageStat::errorcode_limits_exceeded) {
20522052 LOG (ERROR) << " Account storage stat error: " << S.move_as_error ();
@@ -3175,14 +3175,16 @@ static td::uint32 get_public_libraries_diff_count(const td::Ref<vm::Cell>& old_l
31753175 * This function is not called for special accounts.
31763176 *
31773177 * @param size_limits The size limits configuration.
3178+ * @param global_version Global version (ConfigParam 8).
31783179 * @param is_account_stat Store storage stat in the Transaction's AccountStorageStat.
31793180 *
31803181 * @returns A `td::Status` indicating the result of the check.
31813182 * - If the state limits are within the allowed range, returns OK.
31823183 * - If the state limits exceed the maximum allowed range, returns an error with AccountStorageStat::errorcode_limits_exceeded code.
31833184 * - If an error occurred during storage stat calculation, returns other error.
31843185 */
3185- td::Status Transaction::check_state_limits (const SizeLimitsConfig& size_limits, bool is_account_stat) {
3186+ td::Status Transaction::check_state_limits (const SizeLimitsConfig& size_limits, int global_version,
3187+ bool is_account_stat) {
31863188 auto cell_equal = [](const td::Ref<vm::Cell>& a, const td::Ref<vm::Cell>& b) -> bool {
31873189 return a.is_null () || b.is_null () ? a.is_null () == b.is_null () : a->get_hash () == b->get_hash ();
31883190 };
@@ -3213,13 +3215,12 @@ td::Status Transaction::check_state_limits(const SizeLimitsConfig& size_limits,
32133215 }
32143216 }
32153217
3216- if (storage_stat.get_total_cells () > size_limits.max_acc_state_cells ||
3217- storage_stat.get_total_bits () > size_limits.max_acc_state_bits ) {
3218+ td::uint32 max_cells = account.is_masterchain () && global_version >= 12 ? size_limits.max_mc_acc_state_cells
3219+ : size_limits.max_acc_state_cells ;
3220+ if (storage_stat.get_total_cells () > max_cells) {
32183221 return td::Status::Error (AccountStorageStat::errorcode_limits_exceeded,
32193222 PSTRING () << " account state is too big: cells=" << storage_stat.get_total_cells ()
3220- << " , bits=" << storage_stat.get_total_bits ()
3221- << " (max cells=" << size_limits.max_acc_state_cells
3222- << " , max bits=" << size_limits.max_acc_state_bits << " )" );
3223+ << " (max cells=" << max_cells << " )" );
32233224 }
32243225 if (account.is_masterchain () && !cell_equal (account.library , new_library)) {
32253226 auto libraries_count = get_public_libraries_count (new_library);
@@ -4178,6 +4179,7 @@ td::Status FetchConfigParams::fetch_config_params(
41784179 action_phase_cfg->extra_currency_v2 = config.get_global_version () >= 10 ;
41794180 action_phase_cfg->disable_anycast = config.get_global_version () >= 10 ;
41804181 action_phase_cfg->disable_ihr_flag = config.get_global_version () >= 11 ;
4182+ action_phase_cfg->global_version = config.get_global_version ();
41814183 }
41824184 {
41834185 serialize_cfg->extra_currency_v2 = config.get_global_version () >= 10 ;
0 commit comments