Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSIP40 Implementation #1860

Merged
merged 42 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4e70e87
BSIP 40: Core implementation
nathanielhourt Jul 17, 2019
794f1ab
BSIP 40: Improve build time, update docs
nathanielhourt Jul 18, 2019
0a588c1
BSIP 40: Finish writing operations
nathanielhourt Jul 19, 2019
32cdad8
BSIP 40: Add database object
nathanielhourt Jul 19, 2019
18394fe
BSIP 40: Add evaluators, transaction eval code, testing
nathanielhourt Jul 20, 2019
1c9d74e
BSIP 40: Fixes from code review
nathanielhourt Jul 20, 2019
969999b
BSIP 40: Restrictions use member index rather than name
nathanielhourt Jul 22, 2019
ab4a262
BSIP 40: Fix build on old G++
nathanielhourt Jul 24, 2019
a2a5801
BSIP 40: Best build
nathanielhourt Jul 31, 2019
636abb0
BSIP 40: Delete expired authorities in maintenance
nathanielhourt Aug 2, 2019
d28f68c
BSIP 40: Refactor predicates
nathanielhourt Aug 5, 2019
ef87594
BSIP 40: Reduce build RAM usage
nathanielhourt Aug 5, 2019
2e0615a
BSIP 40: Cleanup, disable sign-compare warnings on g++
nathanielhourt Aug 5, 2019
5f49a94
Disable sonar/gcov as it is hanging
nathanielhourt Aug 5, 2019
e6fef06
BSIP 40: Assign restrictions stable IDs
nathanielhourt Aug 7, 2019
fde930b
BSIP 40: Re-enable coverage, but exclude custom authorities code
nathanielhourt Aug 7, 2019
6566995
BSIP 40: Error reporting, part 1
nathanielhourt Aug 9, 2019
58e7ae5
BSIP 40: Make Travis use multi-stage build
nathanielhourt Aug 9, 2019
0ff414f
BSIP 40: [TEMPORARY] Workaround Travis failures
nathanielhourt Aug 9, 2019
e72835b
BSIP 40: Error reporting, part 2
nathanielhourt Aug 10, 2019
670b474
BSIP 40: Add hardfork_visitor
nathanielhourt Aug 11, 2019
de5049a
BSIP 40: Fix build in MSVC 2017
nathanielhourt Aug 12, 2019
d01a8d0
BSIP 40: Use safe signed/unsigned comparisons
nathanielhourt Aug 12, 2019
c02fb98
BSIP 40: Ship a copy of boost's safe_compare.hpp
nathanielhourt Aug 12, 2019
66d1835
BSIP 40: Error handling & static_variant restrictions
nathanielhourt Aug 16, 2019
f3bf343
BSIP 40: Merge/Review Fixes
nathanielhourt Aug 20, 2019
ad7f5ed
BSIP 40: Rebase fixes
nathanielhourt Sep 17, 2019
dbafa02
BSIP 40: Reverse order of predicate rejection paths
nathanielhourt Sep 17, 2019
dd75b13
BSIP 40: Unit test comments
MichelSantos Aug 30, 2019
9574d18
BSIP 40: Authorization and revocation of multiple concurrent CAA
MichelSantos Sep 7, 2019
88f5fd1
BSIP 40: Authorizations of multiple users with a single CAA containin…
MichelSantos Sep 9, 2019
69acd0d
BSIP 40: Unit test for CAA trading
MichelSantos Sep 20, 2019
7429cc4
BSIP 40: Unit test of feed publishing CAA for an account
MichelSantos Sep 20, 2019
7486c9c
BSIP 40: Unit test of feed publishing CAA for a key
MichelSantos Sep 21, 2019
af4cea7
BSIP 40: Unit test of faucet key CAA
MichelSantos Sep 21, 2019
58d556d
BSIP 40: Unit test of cold storage key CAA
MichelSantos Sep 23, 2019
ddc8725
Update custom_authority_tests.cpp
nathanielhourt Oct 18, 2019
4d95742
Merge pull request #3 from MichelSantos/bsip40-unit-tests
nathanielhourt Oct 18, 2019
e658bdd
BSIP 40: Changes from code review
nathanielhourt Oct 19, 2019
51da97d
BSIP 40: Code review, round 2
nathanielhourt Oct 20, 2019
41d27a2
BSIP 40: Add container in and not_in specializations
nathanielhourt Oct 20, 2019
9da10fe
BSIP 40: Maybe fix travis?
nathanielhourt Oct 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
BSIP 40: Delete expired authorities in maintenance
  • Loading branch information
nathanielhourt committed Sep 17, 2019
commit 636abb0fc4236e8a24576dc29afc2108c28d4e1b
13 changes: 13 additions & 0 deletions libraries/chain/db_maint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <graphene/chain/vote_count.hpp>
#include <graphene/chain/witness_object.hpp>
#include <graphene/chain/worker_object.hpp>
#include <graphene/chain/custom_authority_object.hpp>

namespace graphene { namespace chain {

Expand Down Expand Up @@ -1143,6 +1144,17 @@ void process_hf_935( database& db )
}
}

/**
* @brief Remove any custom active authorities whose expiration dates are in the past
* @param db A mutable database reference
*/
void delete_expired_custom_authorities( database& db )
{
const auto& index = db.get_index_type<custom_authority_index>().indices().get<by_expiration>();
while (!index.empty() && index.begin()->valid_to < db.head_block_time())
db.remove(*index.begin());
}

void database::perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props)
{
const auto& gpo = get_global_properties();
Expand Down Expand Up @@ -1323,6 +1335,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
}

process_bitassets();
delete_expired_custom_authorities(*this);

// process_budget needs to run at the bottom because
// it needs to know the next_maintenance_time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace graphene { namespace chain {
};

struct by_account_custom;
struct by_expiration;

/**
* @ingroup object_index
Expand All @@ -74,13 +75,18 @@ namespace graphene { namespace chain {
indexed_by<
ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>,
ordered_unique<tag<by_account_custom>,
composite_key<
custom_authority_object,
composite_key<custom_authority_object,
member<custom_authority_object, account_id_type, &custom_authority_object::account>,
member<custom_authority_object, unsigned_int, &custom_authority_object::operation_type>,
member<custom_authority_object, bool, &custom_authority_object::enabled>,
member<object, object_id_type, &object::id>
>
>>,
ordered_unique<tag<by_expiration>,
composite_key<custom_authority_object,
member<custom_authority_object, time_point_sec, &custom_authority_object::valid_to>,
member<object, object_id_type, &object::id>
>,
composite_key_compare<std::greater<time_point_sec>, std::less<object_id_type>>
>
>
> custom_authority_multi_index_type;
Expand Down