@@ -1145,31 +1145,64 @@ td::RefInt256 ComputePhaseConfig::compute_gas_price(td::uint64 gas_used) const {
11451145namespace transaction {
11461146
11471147/* *
1148- * Checks if it is required to increase gas_limit (from GasLimitsPrices config) to special_gas_limit * 2
1149- * from masterchain GasLimitsPrices config for the transaction.
1148+ * Checks if it is required to increase gas_limit (from GasLimitsPrices config) for the transaction
11501149 *
11511150 * In January 2024 a highload wallet of @wallet Telegram bot in mainnet was stuck because current gas limit (1M) is
11521151 * not enough to clean up old queires, thus locking funds inside.
11531152 * See comment in crypto/smartcont/highload-wallet-v2-code.fc for details on why this happened.
11541153 * Account address: EQD_v9j1rlsuHHw2FIhcsCFFSD367ldfDdCKcsNmNpIRzUlu
1155- * It was proposed to validators to increase gas limit for this account for a limited amount of time (until 2024-02-29).
1154+ * It was proposed to validators to increase gas limit for this account to 70M for a limited amount
1155+ * of time (until 2024-02-29).
11561156 * It is activated by setting global version to 5 in ConfigParam 8.
11571157 * This config change also activates new behavior for special accounts in masterchain.
11581158 *
1159+ * In Augost 2024 it was decided to unlock other old highload wallets that got into the same situation.
1160+ * See https://t.me/tondev_news/129
1161+ * It is activated by setting global version to 9.
1162+ *
11591163 * @param cfg The compute phase configuration.
11601164 * @param now The Unix time of the transaction.
11611165 * @param account The account of the transaction.
11621166 *
1163- * @returns True if gas_limit override is required, false otherwise
1167+ * @returns Overridden gas limit or empty td::optional
11641168 */
1165- static bool override_gas_limit (const ComputePhaseConfig& cfg, ton::UnixTime now, const Account& account) {
1166- if (!cfg.special_gas_full ) {
1167- return false ;
1169+ static td::optional<td::uint64> override_gas_limit (const ComputePhaseConfig& cfg, ton::UnixTime now,
1170+ const Account& account) {
1171+ struct OverridenGasLimit {
1172+ td::uint64 new_limit;
1173+ int from_version;
1174+ ton::UnixTime until;
1175+ };
1176+ static std::map<std::pair<ton::WorkchainId, ton::StdSmcAddress>, OverridenGasLimit> accounts = []() {
1177+ auto parse_addr = [](const char * s) -> std::pair<ton::WorkchainId, ton::StdSmcAddress> {
1178+ auto r_addr = StdAddress::parse (td::Slice (s));
1179+ r_addr.ensure ();
1180+ return {r_addr.ok ().workchain , r_addr.ok ().addr };
1181+ };
1182+ std::map<std::pair<ton::WorkchainId, ton::StdSmcAddress>, OverridenGasLimit> accounts;
1183+
1184+ // Increase limit for EQD_v9j1rlsuHHw2FIhcsCFFSD367ldfDdCKcsNmNpIRzUlu until 2024-02-29 00:00:00 UTC
1185+ accounts[parse_addr (" 0:FFBFD8F5AE5B2E1C7C3614885CB02145483DFAEE575F0DD08A72C366369211CD" )] = {
1186+ .new_limit = 70'000'000 , .from_version = 5 , .until = 1709164800 };
1187+
1188+ // Increase limit for multiple accounts (https://t.me/tondev_news/129) until 2025-03-01 00:00:00 UTC
1189+ accounts[parse_addr (" UQBeSl-dumOHieZ3DJkNKVkjeso7wZ0VpzR4LCbLGTQ8xr57" )] = {
1190+ .new_limit = 70'000'000 , .from_version = 9 , .until = 1740787200 };
1191+ accounts[parse_addr (" EQC3VcQ-43klww9UfimR58TBjBzk7GPupXQ3CNuthoNp-uTR" )] = {
1192+ .new_limit = 70'000'000 , .from_version = 9 , .until = 1740787200 };
1193+ accounts[parse_addr (" EQBhwBb8jvokGvfreHRRoeVxI237PrOJgyrsAhLA-4rBC_H5" )] = {
1194+ .new_limit = 70'000'000 , .from_version = 9 , .until = 1740787200 };
1195+ accounts[parse_addr (" EQCkoRp4OE-SFUoMEnYfL3vF43T3AzNfW8jyTC4yzk8cJqMS" )] = {
1196+ .new_limit = 70'000'000 , .from_version = 9 , .until = 1740787200 };
1197+ accounts[parse_addr (" EQBDanbCeUqI4_v-xrnAN0_I2wRvEIaLg1Qg2ZN5c6Zl1KOh" )] = {
1198+ .new_limit = 70'000'000 , .from_version = 9 , .until = 1740787200 };
1199+ return accounts;
1200+ }();
1201+ auto it = accounts.find ({account.workchain , account.addr });
1202+ if (it == accounts.end () || cfg.global_version < it->second .from_version || now >= it->second .until ) {
1203+ return {};
11681204 }
1169- ton::UnixTime until = 1709164800 ; // 2024-02-29 00:00:00 UTC
1170- ton::WorkchainId wc = 0 ;
1171- const char * addr_hex = " FFBFD8F5AE5B2E1C7C3614885CB02145483DFAEE575F0DD08A72C366369211CD" ;
1172- return now < until && account.workchain == wc && account.addr .to_hex () == addr_hex;
1205+ return it->second .new_limit ;
11731206}
11741207
11751208/* *
@@ -1183,10 +1216,12 @@ static bool override_gas_limit(const ComputePhaseConfig& cfg, ton::UnixTime now,
11831216 * @returns The amount of gas.
11841217 */
11851218td::uint64 Transaction::gas_bought_for (const ComputePhaseConfig& cfg, td::RefInt256 nanograms) {
1186- if (override_gas_limit (cfg, now, account)) {
1219+ if (auto new_limit = override_gas_limit (cfg, now, account)) {
11871220 gas_limit_overridden = true ;
11881221 // Same as ComputePhaseConfig::gas_bought for, but with other gas_limit and max_gas_threshold
1189- auto gas_limit = cfg.mc_gas_prices .special_gas_limit * 2 ;
1222+ auto gas_limit = new_limit.value ();
1223+ LOG (INFO) << " overridding gas limit for account " << account.workchain << " :" << account.addr .to_hex () << " to "
1224+ << gas_limit;
11901225 auto max_gas_threshold =
11911226 compute_max_gas_threshold (cfg.gas_price256 , gas_limit, cfg.flat_gas_limit , cfg.flat_gas_price );
11921227 if (nanograms.is_null () || sgn (nanograms) < 0 ) {
0 commit comments