@@ -1145,31 +1145,64 @@ td::RefInt256 ComputePhaseConfig::compute_gas_price(td::uint64 gas_used) const {
1145
1145
namespace transaction {
1146
1146
1147
1147
/* *
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
1150
1149
*
1151
1150
* In January 2024 a highload wallet of @wallet Telegram bot in mainnet was stuck because current gas limit (1M) is
1152
1151
* not enough to clean up old queires, thus locking funds inside.
1153
1152
* See comment in crypto/smartcont/highload-wallet-v2-code.fc for details on why this happened.
1154
1153
* 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).
1156
1156
* It is activated by setting global version to 5 in ConfigParam 8.
1157
1157
* This config change also activates new behavior for special accounts in masterchain.
1158
1158
*
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
+ *
1159
1163
* @param cfg The compute phase configuration.
1160
1164
* @param now The Unix time of the transaction.
1161
1165
* @param account The account of the transaction.
1162
1166
*
1163
- * @returns True if gas_limit override is required, false otherwise
1167
+ * @returns Overridden gas limit or empty td::optional
1164
1168
*/
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 = 225'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 {};
1168
1204
}
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 ;
1173
1206
}
1174
1207
1175
1208
/* *
@@ -1183,10 +1216,12 @@ static bool override_gas_limit(const ComputePhaseConfig& cfg, ton::UnixTime now,
1183
1216
* @returns The amount of gas.
1184
1217
*/
1185
1218
td::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)) {
1187
1220
gas_limit_overridden = true ;
1188
1221
// 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;
1190
1225
auto max_gas_threshold =
1191
1226
compute_max_gas_threshold (cfg.gas_price256 , gas_limit, cfg.flat_gas_limit , cfg.flat_gas_price );
1192
1227
if (nanograms.is_null () || sgn (nanograms) < 0 ) {
@@ -1336,7 +1371,8 @@ Ref<vm::Tuple> Transaction::prepare_vm_c7(const ComputePhaseConfig& cfg) const {
1336
1371
// See crypto/block/mc-config.cpp#2223 (get_prev_blocks_info)
1337
1372
// [ wc:Integer shard:Integer seqno:Integer root_hash:Integer file_hash:Integer] = BlockId;
1338
1373
// [ last_mc_blocks:[BlockId...]
1339
- // prev_key_block:BlockId ] : PrevBlocksInfo
1374
+ // prev_key_block:BlockId
1375
+ // last_mc_blocks_100:[BlockId...] ] : PrevBlocksInfo
1340
1376
// The only context where PrevBlocksInfo (13 parameter of c7) is null is inside emulator
1341
1377
// where it need to be set via transaction_emulator_set_prev_blocks_info (see emulator/emulator-extern.cpp)
1342
1378
// Inside validator, collator and liteserver checking external message contexts
@@ -1691,9 +1727,8 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
1691
1727
}
1692
1728
}
1693
1729
}
1694
- vm::VmState vm{new_code, std::move (stack), gas, 1 , new_data, vm_log, compute_vm_libraries (cfg)};
1730
+ vm::VmState vm{new_code, cfg. global_version , std::move (stack), gas, 1 , new_data, vm_log, compute_vm_libraries (cfg)};
1695
1731
vm.set_max_data_depth (cfg.max_vm_data_depth );
1696
- vm.set_global_version (cfg.global_version );
1697
1732
vm.set_c7 (prepare_vm_c7 (cfg)); // tuple with SmartContractInfo
1698
1733
vm.set_chksig_always_succeed (cfg.ignore_chksig );
1699
1734
vm.set_stop_on_accept_message (cfg.stop_on_accept_message );
0 commit comments