TESTNET RESET REQUIRED - convert all hashed indexs to ordered indexes
Fix #362 by replacing non-deterministic hashed indexes with ordered indexes Remove HARDFORK check for witness ordering because this #362 will require a test net reset to effeciently implment. Changed the order in wich process_fees iterates accounts to be "by_name" rather than "by_id" so that we retain the ability to switch back to hashed indexes in the future. This change was overly pestimistic and assumes all indexes may be traversed as part of consensus. We want to reserve the ability to change some of the indices back to hashed indicies in the future after a through audit reveals that they are never iterated over in order.
This commit is contained in:
parent
f45fabd5c8
commit
a536d39253
12 changed files with 22 additions and 36 deletions
|
|
@ -640,23 +640,9 @@ const witness_object& database::validate_block_header( uint32_t skip, const sign
|
|||
|
||||
witness_id_type scheduled_witness = get_scheduled_witness( slot_num );
|
||||
|
||||
#warning REMOVE HARDFORK in final release check
|
||||
if( next_block.block_num() > 58500 ) {
|
||||
FC_ASSERT( next_block.witness == scheduled_witness, "Witness produced block at wrong time",
|
||||
("block witness",next_block.witness)("scheduled",scheduled_witness)("slot_num",slot_num) );
|
||||
}
|
||||
} /*else {
|
||||
uint32_t slot_num = get_slot_at_time( next_block.timestamp );
|
||||
FC_ASSERT( slot_num > 0 );
|
||||
|
||||
const witness_schedule_object& wso = witness_schedule_id_type()(*this);
|
||||
const dynamic_global_property_object& dpo = get_dynamic_global_properties();
|
||||
|
||||
witness_id_type scheduled_witness = get_scheduled_witness( slot_num );
|
||||
if( next_block.witness != scheduled_witness )
|
||||
edump( (next_block.block_num())(next_block.witness)(scheduled_witness)(slot_num)(wso)(dpo.current_aslot) );
|
||||
FC_ASSERT( next_block.witness == scheduled_witness, "Witness produced block at wrong time",
|
||||
("block witness",next_block.witness)("scheduled",scheduled_witness)("slot_num",slot_num) );
|
||||
}
|
||||
*/
|
||||
|
||||
return witness;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ vector<std::reference_wrapper<const typename Index::object_type>> database::sort
|
|||
template<class... Types>
|
||||
void database::perform_account_maintenance(std::tuple<Types...> helpers)
|
||||
{
|
||||
const auto& idx = get_index_type<account_index>().indices();
|
||||
const auto& idx = get_index_type<account_index>().indices().get<by_name>();
|
||||
for( const account_object& a : idx )
|
||||
detail::for_each(helpers, a, detail::gen_seq<sizeof...(Types)>());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ namespace graphene { namespace chain {
|
|||
account_balance_object,
|
||||
indexed_by<
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
hashed_unique< tag<by_balance>, composite_key<
|
||||
ordered_unique< tag<by_balance>, composite_key<
|
||||
account_balance_object,
|
||||
member<account_balance_object, account_id_type, &account_balance_object::owner>,
|
||||
member<account_balance_object, asset_id_type, &account_balance_object::asset_type> >
|
||||
|
|
@ -311,7 +311,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
account_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_name>, member<account_object, string, &account_object::name> >
|
||||
>
|
||||
> account_multi_index_type;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
asset_bitasset_data_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag<by_feed_expiration>,
|
||||
const_mem_fun< asset_bitasset_data_object, time_point_sec, &asset_bitasset_data_object::feed_expiration_time >
|
||||
>
|
||||
|
|
@ -227,7 +227,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
asset_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_symbol>, member<asset_object, string, &asset_object::symbol> >
|
||||
>
|
||||
> asset_object_multi_index_type;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace graphene { namespace chain {
|
|||
using balance_multi_index_type = multi_index_container<
|
||||
balance_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag<by_owner>, composite_key<
|
||||
balance_object,
|
||||
member<balance_object, address, &balance_object::owner>,
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ namespace graphene { namespace chain {
|
|||
ordered_unique< tag<by_id>,
|
||||
member<object, object_id_type, &object::id>
|
||||
>,
|
||||
hashed_unique< tag<by_account>,
|
||||
ordered_unique< tag<by_account>,
|
||||
member<committee_member_object, account_id_type, &committee_member_object::committee_member_account>
|
||||
>,
|
||||
hashed_unique< tag<by_vote_id>,
|
||||
ordered_unique< tag<by_vote_id>,
|
||||
member<committee_member_object, vote_id_type, &committee_member_object::vote_id>
|
||||
>
|
||||
>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
limit_order_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>,
|
||||
ordered_unique< tag<by_id>,
|
||||
member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag<by_expiration>, member< limit_order_object, time_point_sec, &limit_order_object::expiration> >,
|
||||
ordered_unique< tag<by_price>,
|
||||
|
|
@ -112,7 +112,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
call_order_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>,
|
||||
ordered_unique< tag<by_id>,
|
||||
member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_price>,
|
||||
composite_key< call_order_object,
|
||||
|
|
@ -140,7 +140,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
force_settlement_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag<by_account>,
|
||||
member<force_settlement_object, account_id_type, &force_settlement_object::owner>
|
||||
>,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ struct by_expiration{};
|
|||
typedef boost::multi_index_container<
|
||||
proposal_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag< by_id >, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag< by_expiration >, member< proposal_object, time_point_sec, &proposal_object::expiration_time > >
|
||||
>
|
||||
> proposal_multi_index_container;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
transaction_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
hashed_unique< tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_object, transaction_id_type, trx_id), std::hash<transaction_id_type> >,
|
||||
ordered_non_unique< tag<by_expiration>, const_mem_fun<transaction_object, time_point_sec, &transaction_object::get_expiration > >
|
||||
>
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
vesting_balance_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag<by_account>,
|
||||
member<vesting_balance_object, account_id_type, &vesting_balance_object::owner>
|
||||
>
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ namespace graphene { namespace chain {
|
|||
typedef multi_index_container<
|
||||
withdraw_permission_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
hashed_non_unique< tag<by_from>, member<withdraw_permission_object, account_id_type, &withdraw_permission_object::withdraw_from_account> >,
|
||||
hashed_non_unique< tag<by_authorized>, member<withdraw_permission_object, account_id_type, &withdraw_permission_object::authorized_account> >,
|
||||
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
ordered_non_unique< tag<by_from>, member<withdraw_permission_object, account_id_type, &withdraw_permission_object::withdraw_from_account> >,
|
||||
ordered_non_unique< tag<by_authorized>, member<withdraw_permission_object, account_id_type, &withdraw_permission_object::authorized_account> >,
|
||||
ordered_non_unique< tag<by_expiration>, member<withdraw_permission_object, time_point_sec, &withdraw_permission_object::expiration> >
|
||||
>
|
||||
> withdraw_permission_object_multi_index_type;
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ namespace graphene { namespace chain {
|
|||
using witness_multi_index_type = multi_index_container<
|
||||
witness_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>,
|
||||
ordered_unique< tag<by_id>,
|
||||
member<object, object_id_type, &object::id>
|
||||
>,
|
||||
hashed_unique< tag<by_account>,
|
||||
ordered_unique< tag<by_account>,
|
||||
member<witness_object, account_id_type, &witness_object::witness_account>
|
||||
>,
|
||||
hashed_unique< tag<by_vote_id>,
|
||||
ordered_unique< tag<by_vote_id>,
|
||||
member<witness_object, vote_id_type, &witness_object::vote_id>
|
||||
>
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in a new issue