Skip to content

Commit

Permalink
GH-1145 Make sure correct transaction type is passed to transaction_c…
Browse files Browse the repository at this point in the history
…ontext.
  • Loading branch information
heifner committed Feb 6, 2025
1 parent 46660b3 commit 0170e02
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion benchmark/bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ struct interface_in_benchmark {
timer = std::make_unique<platform_timer>();
trx_timer = std::make_unique<transaction_checktime_timer>(*timer);
trx_ctx = std::make_unique<transaction_context>(*chain->control.get(), *ptrx, ptrx->id(), std::move(*trx_timer),
action_digests_t::store_which_t::legacy);
action_digests_t::store_which_t::legacy, fc::time_point::now(),
transaction_metadata::trx_type::input);
trx_ctx->max_transaction_time_subjective = fc::microseconds::maximum();
trx_ctx->init_for_input_trx( ptrx->get_unprunable_size(), ptrx->get_prunable_size() );
trx_ctx->exec(); // this is required to generate action traces to be used by apply_context constructor
Expand Down
6 changes: 4 additions & 2 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2644,7 +2644,8 @@ struct controller_impl {

transaction_checktime_timer trx_timer(timer);
const packed_transaction trx( std::move( etrx ) );
transaction_context trx_context( self, trx, trx.id(), std::move(trx_timer), bb.action_receipt_digests().store_which(), start );
transaction_context trx_context( self, trx, trx.id(), std::move(trx_timer), bb.action_receipt_digests().store_which(),
start, transaction_metadata::trx_type::implicit );

if (auto dm_logger = get_deep_mind_logger(trx_context.is_transient())) {
dm_logger->on_onerror(etrx);
Expand Down Expand Up @@ -2817,7 +2818,8 @@ struct controller_impl {
auto& bb = std::get<building_block>(pending->_block_stage);

transaction_checktime_timer trx_timer( timer );
transaction_context trx_context( self, *trx->packed_trx(), gtrx.trx_id, std::move(trx_timer), bb.action_receipt_digests().store_which() );
transaction_context trx_context( self, *trx->packed_trx(), gtrx.trx_id, std::move(trx_timer), bb.action_receipt_digests().store_which(),
start, transaction_metadata::trx_type::scheduled );
trx_context.leeway = fc::microseconds(0); // avoid stealing cpu resource
trx_context.block_deadline = block_deadline;
trx_context.max_transaction_time_subjective = max_transaction_time;
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/include/eosio/chain/transaction_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ namespace eosio::chain {
const transaction_id_type& trx_id, // trx_id diff than t.id() before replace_deferred
transaction_checktime_timer&& timer,
action_digests_t::store_which_t sad,
fc::time_point start = fc::time_point::now(),
transaction_metadata::trx_type type = transaction_metadata::trx_type::input);
fc::time_point start,
transaction_metadata::trx_type type);
~transaction_context();

void init_for_implicit_trx();
Expand Down

0 comments on commit 0170e02

Please sign in to comment.