@@ -162,7 +162,9 @@ td::Ref<vm::Tuple> prepare_vm_c7(SmartContract::Args args, td::Ref<vm::Cell> cod
162162 vm::load_cell_slice_ref (address), // myself:MsgAddressInt
163163 vm::StackEntry::maybe (config) // vm::StackEntry::maybe(td::Ref<vm::Cell>())
164164 };
165- if (args.config && args.config .value ()->get_global_version () >= 4 ) {
165+
166+ int global_version = args.config ? args.config .value ()->get_global_version () : SUPPORTED_VERSION;
167+ if (global_version >= 4 ) {
166168 tuple.push_back (vm::StackEntry::maybe (code)); // code:Cell
167169 tuple.push_back (block::CurrencyCollection::zero ().as_vm_tuple ()); // in_msg_value:[Integer (Maybe Cell)]
168170 tuple.push_back (td::zero_refint ()); // storage_fees:Integer
@@ -173,17 +175,18 @@ td::Ref<vm::Tuple> prepare_vm_c7(SmartContract::Args args, td::Ref<vm::Cell> cod
173175 // prev_key_block:BlockId ] : PrevBlocksInfo
174176 tuple.push_back (args.prev_blocks_info ? args.prev_blocks_info .value () : vm::StackEntry{}); // prev_block_info
175177 }
176- if (args.config && args.config .value ()->get_global_version () >= 6 ) {
177- tuple.push_back (args.config .value ()->get_unpacked_config_tuple (now)); // unpacked_config_tuple
178+ if (global_version >= 6 ) {
179+ tuple.push_back (args.config ? args.config .value ()->get_unpacked_config_tuple (now)
180+ : vm::StackEntry{}); // unpacked_config_tuple
178181 tuple.push_back (td::zero_refint ()); // due_payment
179182 // precompiled_gas_usage:(Maybe Integer)
180183 td::optional<block::PrecompiledContractsConfig::Contract> precompiled;
181- if (code.not_null ()) {
184+ if (code.not_null () && args. config ) {
182185 precompiled = args.config .value ()->get_precompiled_contracts_config ().get_contract (code->get_hash ().bits ());
183186 }
184187 tuple.push_back (precompiled ? td::make_refint (precompiled.value ().gas_usage ) : vm::StackEntry ());
185188 }
186- if (args. config && args. config . value ()-> get_global_version () >= 11 ) {
189+ if (global_version >= 11 ) {
187190 tuple.push_back (block::transaction::Transaction::prepare_in_msg_params_tuple (nullptr , {}, {}));
188191 }
189192 auto tuple_ref = td::make_cnt_ref<std::vector<vm::StackEntry>>(std::move (tuple));
@@ -263,7 +266,7 @@ SmartContract::Answer run_smartcont(SmartContract::State state, td::Ref<vm::Stac
263266 stack->dump (os, 2 );
264267 LOG (DEBUG) << " VM stack:\n " << os.str ();
265268 }
266- int global_version = config ? config->get_global_version () : 0 ;
269+ int global_version = config ? config->get_global_version () : SUPPORTED_VERSION ;
267270 vm::VmState vm{state.code , global_version, std::move (stack), gas, 1 , state.data , log};
268271 vm.set_c7 (std::move (c7));
269272 vm.set_chksig_always_succeed (ignore_chksig);
0 commit comments