Skip to content

Commit

Permalink
Merge branch 'GH-2057-transition' into GH-2286-irreversible
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Mar 26, 2024
2 parents dc029db + b280344 commit 97df979
Show file tree
Hide file tree
Showing 27 changed files with 1,399 additions and 120 deletions.
3 changes: 2 additions & 1 deletion benchmark/bls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ struct interface_in_benchmark {
// build transaction context from the packed transaction
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));
trx_ctx = std::make_unique<transaction_context>(*chain->control.get(), *ptrx, ptrx->id(), std::move(*trx_timer),
action_digests_t::store_which_t::legacy);
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
20 changes: 10 additions & 10 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using boost::container::flat_set;

namespace eosio { namespace chain {
namespace eosio::chain {

static inline void print_debug(account_name receiver, const action_trace& ar) {
if (!ar.console.empty()) {
Expand Down Expand Up @@ -184,7 +184,7 @@ void apply_context::exec_one()
r.auth_sequence[auth.actor] = next_auth_sequence( auth.actor );
}

trx_context.executed_action_receipt_digests.emplace_back( r.digest() );
trx_context.executed_action_receipts.compute_and_append_digests_from(trace);

finalize_trace( trace, start );

Expand Down Expand Up @@ -218,17 +218,17 @@ void apply_context::exec()
exec_one();
}

if( _cfa_inline_actions.size() > 0 || _inline_actions.size() > 0 ) {
if( !_cfa_inline_actions.empty() || !_inline_actions.empty() ) {
EOS_ASSERT( recurse_depth < control.get_global_properties().configuration.max_inline_action_depth,
transaction_exception, "max inline action depth per transaction reached" );
}

for( uint32_t ordinal : _cfa_inline_actions ) {
trx_context.execute_action( ordinal, recurse_depth + 1 );
}
for( uint32_t ordinal : _cfa_inline_actions ) {
trx_context.execute_action( ordinal, recurse_depth + 1 );
}

for( uint32_t ordinal : _inline_actions ) {
trx_context.execute_action( ordinal, recurse_depth + 1 );
for( uint32_t ordinal : _inline_actions ) {
trx_context.execute_action( ordinal, recurse_depth + 1 );
}
}

} /// exec()
Expand Down Expand Up @@ -1105,4 +1105,4 @@ bool apply_context::should_use_eos_vm_oc()const {
}


} } /// eosio::chain
} /// eosio::chain
4 changes: 2 additions & 2 deletions libraries/chain/block_header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ namespace eosio { namespace chain {
}

bool block_header::contains_header_extension(uint16_t extension_id)const {
return std::find_if(header_extensions.cbegin(), header_extensions.cend(), [&](const auto& p) {
return std::any_of(header_extensions.cbegin(), header_extensions.cend(), [&](const auto& p) {
return p.first == extension_id;
}) != header_extensions.cend();
});
}

} }
2 changes: 1 addition & 1 deletion libraries/chain/block_header_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ block_header_state block_header_state::next(block_header_state_input& input) con
// header
// ------
next_header_state.header = {
.timestamp = input.timestamp, // [greg todo] do we have to do the slot++ stuff from the legacy version?
.timestamp = input.timestamp,
.producer = input.producer,
.confirmed = 0,
.previous = input.parent_id,
Expand Down
9 changes: 5 additions & 4 deletions libraries/chain/block_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ block_state::block_state(const block_header_state& bhs,

// Used for transition from dpos to Savanna.
block_state_ptr block_state::create_if_genesis_block(const block_state_legacy& bsp) {
assert(bsp.action_receipt_digests);
assert(bsp.action_receipt_digests_savanna);

auto result_ptr = std::make_shared<block_state>();
auto &result = *result_ptr;
Expand All @@ -63,10 +63,11 @@ block_state_ptr block_state::create_if_genesis_block(const block_state_legacy& b
result.header_exts = bsp.header_exts;
result.block = bsp.block;
result.activated_protocol_features = bsp.activated_protocol_features;
result.core = finality_core::create_core_for_genesis_block(bsp.block_num()); // [if todo] instant transition is not acceptable
result.core = finality_core::create_core_for_genesis_block(bsp.block_num());

// Calculate Merkel tree root in Savanna way so that it is stored in Leaf Node when building block_state.
auto action_mroot_svnn = calculate_merkle(*bsp.action_receipt_digests);
// Calculate Merkle tree root in Savanna way so that it is stored in Leaf Node when building block_state.
auto digests = *bsp.action_receipt_digests_savanna;
auto action_mroot_svnn = calculate_merkle(std::move(digests));
// built leaf_node and validation_tree
valid_t::finality_leaf_node_t leaf_node {
.block_num = bsp.block_num(),
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/block_state_legacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace eosio::chain {
block_state_legacy::block_state_legacy( pending_block_header_state_legacy&& cur,
signed_block_ptr&& b,
deque<transaction_metadata_ptr>&& trx_metas,
std::optional<digests_t>&& action_receipt_digests,
std::optional<digests_t>&& action_receipt_digests_savanna,
const protocol_feature_set& pfs,
const validator_t& validator,
const signer_callback_type& signer
Expand All @@ -75,7 +75,7 @@ namespace eosio::chain {
,block( std::move(b) )
,_pub_keys_recovered( true ) // called by produce_block so signature recovery of trxs must have been done
,_cached_trxs( std::move(trx_metas) )
,action_receipt_digests( std::move(action_receipt_digests) )
,action_receipt_digests_savanna( std::move(action_receipt_digests_savanna) )
{}

block_state_legacy::block_state_legacy(snapshot_detail::snapshot_block_state_legacy_v7&& sbs)
Expand Down
Loading

0 comments on commit 97df979

Please sign in to comment.