From 866fbf936b2669cf337027d3de636facaf62e56f Mon Sep 17 00:00:00 2001 From: SpyCheese Date: Thu, 12 Oct 2023 14:53:54 +0300 Subject: [PATCH] Explicitly handle special cells in action list (#777) --- crypto/block/transaction.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/crypto/block/transaction.cpp b/crypto/block/transaction.cpp index 0a02d6fd5..e82b1eeb9 100644 --- a/crypto/block/transaction.cpp +++ b/crypto/block/transaction.cpp @@ -943,7 +943,12 @@ int output_actions_count(Ref list) { int i = -1; do { ++i; - list = load_cell_slice(std::move(list)).prefetch_ref(); + bool special = true; + auto cs = load_cell_slice_special(std::move(list), special); + if (special) { + break; + } + list = cs.prefetch_ref(); } while (list.not_null()); return i; } @@ -1122,7 +1127,8 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) { int out_act_num = output_actions_count(cp.actions); if (verbosity > 2) { std::cerr << "new smart contract data: "; - load_cell_slice(cp.new_data).print_rec(std::cerr); + bool can_be_special = true; + load_cell_slice_special(cp.new_data, can_be_special).print_rec(std::cerr); std::cerr << "output actions: "; block::gen::OutList{out_act_num}.print_ref(std::cerr, cp.actions); } @@ -1192,7 +1198,15 @@ bool Transaction::prepare_action_phase(const ActionPhaseConfig& cfg) { int n = 0; while (true) { ap.action_list.push_back(list); - auto cs = load_cell_slice(std::move(list)); + bool special = true; + auto cs = load_cell_slice_special(std::move(list), special); + if (special) { + ap.result_code = 32; // action list invalid + ap.result_arg = n; + ap.action_list_invalid = true; + LOG(DEBUG) << "action list invalid: special cell"; + return true; + } if (!cs.size_ext()) { break; }