1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Fix skipped action list order (#1036)

* nullify incorrect actions directly in skipped_action_list
This commit is contained in:
EmelyanenkoK 2024-06-25 11:18:36 +03:00 committed by GitHub
parent 94c9fece0d
commit c2e7278fcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1837,7 +1837,6 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
ap.tot_actions = n;
ap.spec_actions = ap.skipped_actions = 0;
std::vector<Ref<vm::Cell>> non_skipped_action_list;
for (int i = n - 1; i >= 0; --i) {
ap.result_arg = n - 1 - i;
if (!block::gen::t_OutListNode.validate_ref(ap.action_list[i])) {
@ -1853,6 +1852,7 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
int mode = (int)cs.fetch_ulong(8);
if (mode & 2) {
ap.skipped_actions++;
ap.action_list[i] = {};
continue;
} else if ((mode & 16) && cfg.bounce_on_fail_enabled) {
ap.bounce = true;
@ -1865,14 +1865,13 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
LOG(DEBUG) << "invalid action " << ap.result_arg << " found while preprocessing action list: error code "
<< ap.result_code;
return true;
} else {
non_skipped_action_list.push_back(ap.action_list[i]);
}
}
ap.action_list = std::move(non_skipped_action_list);
n -= ap.skipped_actions;
ap.valid = true;
for (int i = n - 1; i >= 0; --i) {
if(ap.action_list[i].is_null()) {
continue;
}
ap.result_arg = n - 1 - i;
vm::CellSlice cs = load_cell_slice(ap.action_list[i]);
CHECK(cs.fetch_ref().not_null());
@ -1910,7 +1909,7 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) {
ap.no_funds = true;
}
LOG(DEBUG) << "invalid action " << ap.result_arg << " in action list: error code " << ap.result_code;
// This is reuqired here because changes to libraries are applied even if actipn phase fails
// This is required here because changes to libraries are applied even if actipn phase fails
enforce_state_limits();
if (cfg.action_fine_enabled) {
ap.action_fine = std::min(ap.action_fine, balance.grams);