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

es-voting-statistic-plugin #1971

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
6d6f5dd
Merge pull request #427 from pmconrad/testnet_release
oxarbitrage Oct 24, 2017
504e63e
Merge pull request #441 from pmconrad/testnet_release
pmconrad Oct 25, 2017
fb0e3e3
Merge branch 'testnet_release'
pmconrad Nov 5, 2017
147c14e
Merge branch 'develop' into testnet_release
pmconrad Nov 5, 2017
c17f8fc
Merge branch 'testnet_release'
pmconrad Nov 5, 2017
1e73aa8
market_history default buckets
oxarbitrage Nov 7, 2017
af2bce6
mistake
oxarbitrage Nov 7, 2017
480b7e5
Merge pull request #526 from bitshares/release
oxarbitrage Dec 12, 2017
41fae40
Merge pull request #529 from bitshares/develop
oxarbitrage Dec 12, 2017
015026f
Merge pull request #530 from bitshares/release
oxarbitrage Dec 12, 2017
1d0b859
Merge pull request #617 from bitshares/release
oxarbitrage Feb 1, 2018
d91be31
Merge pull request #630 from bitshares/release
abitmore Feb 3, 2018
96c0c27
Merge pull request #646 from bitshares/release
oxarbitrage Feb 6, 2018
92eb45c
Merge pull request #797 from bitshares/release
abitmore Mar 28, 2018
bf263b1
Merge pull request #877 from bitshares/release
abitmore Apr 25, 2018
d6fda25
Add: Bug Report & Feature Request
ryanRfox May 9, 2018
46527fb
Merge pull request #14 from ryanRfox/895-Add-Issue-Templates
ryanRfox May 9, 2018
16de19c
Update bug_report.md
ryanRfox May 9, 2018
5f1f6d9
Update feature_request.md
ryanRfox May 9, 2018
54f7268
update project number
oxarbitrage May 14, 2018
dc7eb35
Merge pull request #925 from oxarbitrage/hotfix-2.0.180425
abitmore May 21, 2018
0dc5bcd
Merge remote-tracking branch 'upstream/master'
ryanRfox May 23, 2018
d23896d
Fixup: ISSUE_TEMPLATE
ryanRfox May 23, 2018
3293a95
Merge pull request #956 from ryanRfox/895-Add-Issue-Template
oxarbitrage May 24, 2018
0ac87af
Add: Build Error
ryanRfox Jun 6, 2018
e591d63
Add: Build Error Template
ryanRfox Jun 6, 2018
6911192
Add: Build Error Template
ryanRfox Jun 6, 2018
1d1db0b
Add: Build Error Template
ryanRfox Jun 6, 2018
52f2992
Merge pull request #1030 from ryanRfox/1021-New-Build-Template
oxarbitrage Jun 7, 2018
27d2e3e
Merge pull request #1043 from bitshares/release
abitmore Jun 12, 2018
1297e1b
update doxyfile and readme
oxarbitrage Jun 12, 2018
c9a3c52
update max boost in sentence
oxarbitrage Jun 12, 2018
a275688
Merge pull request #1046 from oxarbitrage/update_boost
oxarbitrage Jun 12, 2018
bce8777
sync project description in doxyfile
oxarbitrage Jun 15, 2018
35ec65b
Merge pull request #1064 from bitshares/oxarbitrage-patch-4
oxarbitrage Jun 18, 2018
859262a
Update node requirements
oxarbitrage Jul 2, 2018
76c808a
fix syntax error
oxarbitrage Jul 2, 2018
cabb3c9
Add: Require 64-bit OS
ryanRfox Jun 19, 2018
58969c2
Merge pull request #1167 from bitshares/update-readme
abitmore Jul 27, 2018
ec2805e
Merge branch 'master' into release-to-master
abitmore Aug 23, 2018
af28e26
Merge pull request #1279 from bitshares/release-to-master
abitmore Aug 23, 2018
3e74426
Merge pull request #1283 from bitshares/release
abitmore Aug 23, 2018
6218cdf
Merge pull request #1377 from bitshares/release
oxarbitrage Oct 17, 2018
3ea5287
Merge pull request #1414 from bitshares/release
oxarbitrage Nov 2, 2018
a0e7dff
Merge pull request #1440 from bitshares/release
jmjatlanta Nov 20, 2018
5b23099
Merge pull request #1451 from bitshares/release
pmconrad Nov 27, 2018
3aeb5aa
Merge pull request #1473 from bitshares/release
oxarbitrage Dec 18, 2018
58c0c49
Merge pull request #1484 from bitshares/release
pmconrad Dec 21, 2018
319d7b9
Merge pull request #1599 from bitshares/release
oxarbitrage Feb 19, 2019
57c40ec
Merge pull request #1631 from bitshares/release
oxarbitrage Mar 5, 2019
5bad558
Merge pull request #1657 from bitshares/release
oxarbitrage Mar 18, 2019
8c1a78b
Merge pull request #1681 from bitshares/release
oxarbitrage Mar 27, 2019
623aea2
Merge pull request #1708 from bitshares/release
jmjatlanta Apr 8, 2019
e3d1226
Merge pull request #1761 from bitshares/release
jmjatlanta May 15, 2019
716387b
Fixed saving keys in wallet
anzhy-chernyavski Feb 25, 2019
c77c069
Added test.
anzhy-chernyavski Feb 27, 2019
e6ecf10
fc commit changed
anzhy-chernyavski Feb 28, 2019
05ceb7c
Prevent Boost/WinSock.h multiple inclusion
jmjatlanta Mar 5, 2019
37f9aaa
Fix uin64_t / safe<int64_t> comparision
jmjatlanta Mar 5, 2019
bb2a757
update full node specs
oxarbitrage Feb 13, 2019
00f9c90
add note to clarify new full node requirements
oxarbitrage Feb 13, 2019
93050ba
update full nodes setup notes
oxarbitrage Feb 14, 2019
38746ff
reject oversized transactions
jmjatlanta Feb 27, 2019
b9a2284
initialize percent_change in market_ticker constructor
oxarbitrage Feb 27, 2019
6b8f157
add a second contructor for empty ticker
oxarbitrage Feb 27, 2019
1f1155a
fix asset symbols in empty ticker contructor
oxarbitrage Feb 28, 2019
5c4b6fc
initialize lowest_ask and highest_bid
oxarbitrage Feb 28, 2019
5181459
bump database to last release date
oxarbitrage Mar 4, 2019
511076c
Removed initial_chain_id from example genesis file to avoid confusion
pmconrad Mar 1, 2019
d80e1d9
Add plugin section headers to generated config.ini
abitmore Mar 9, 2019
d4a5b40
Highlight plugin section headers in config.ini
abitmore Mar 9, 2019
81933c5
added new signals to database, calling signals from maintenance
Dimfred Mar 17, 2019
fe13e7a
added voting_statistics_object
Dimfred Mar 16, 2019
3dd1385
added voting_stat_plugin
Dimfred Mar 12, 2019
1ba8840
added test
Dimfred Mar 17, 2019
61d8f6b
added voting statistics to es_objects
Dimfred Mar 25, 2019
f67075d
added test to check for voting statistics in elasticsearch
Dimfred Mar 25, 2019
468050d
added plugin to witness node
Dimfred Jul 1, 2019
7397506
Merge tag '3.1.0' into feature/es-voting-stat-plugin-MERGED-CORRECT
Dimfred Jul 1, 2019
dd5233f
es objects switch case optimization
Dimfred Jul 30, 2019
ca01462
voteable statistics object
Dimfred Jul 30, 2019
cd7f8d5
voting statisitics object
Dimfred Jul 30, 2019
592845e
voting stat plugin
Dimfred Jul 30, 2019
e741346
tests
Dimfred Aug 1, 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
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: Bug Report
about: Create a detailed report about a deficiency in the BitShares Core implementation.

---

**Instructions**
Please include a detailed Title above. Next, please complete the following sections below:
* Bug Description
* Impacts
* Steps To Reproduce
* Expected Behavior
* Screenshots (optional)
* Host Environment (optional)
* Additional Context (optional)

Finally, press the 'Submit new issue' button. The Core Team will evaluate and prioritize your Bug Report for future development.

**Bug Description**
A clear and concise description of what the bug is.

**Impacts**
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
- [ ] API (the application programming interface)
- [ ] Build (the build process or something prior to compiled code)
- [ ] CLI (the command line wallet)
- [ ] Deployment (the deployment process after building such as Docker, Travis, etc.)
- [ ] DEX (the Decentralized EXchange, market engine, etc.)
- [ ] P2P (the peer-to-peer network for transaction/block propagation)
- [ ] Performance (system or user efficiency, etc.)
- [ ] Protocol (the blockchain logic, consensus, validation, etc.)
- [ ] Security (the security of system or user data, etc.)
- [ ] UX (the User Experience)
- [ ] Other (please add below)

**Steps To Reproduce**
Steps to reproduce the behavior (example outlined below):
1. Execute API call '...'
2. Using JSON payload '...'
3. Received response '...'
4. See error in screenshot

**Expected Behavior**
A clear and concise description of what you expected to happen.

**Screenshots (optional)**
If applicable, add screenshots to help explain process flow and behavior.

**Host Environment**
Please provide details about the host environment. Much of this information can be found running: `witness_node --version`.
- Host OS: [e.g. Ubuntu 18.04 LTS]
- Host Physical RAM [e.g. 4GB]
- BitShares Version: [e.g. 2.0.180425]
- OpenSSL Version: [e.g. 1.1.0g]
- Boost Version: [e.g. 1.65.1]

**Additional Context (optional)**
Add any other context about the problem here.

## CORE TEAM TASK LIST
- [ ] Evaluate / Prioritize Bug Report
- [ ] Refine User Stories / Requirements
- [ ] Define Test Cases
- [ ] Design / Develop Solution
- [ ] Perform QA/Testing
- [ ] Update Documentation
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/build_error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Build Error
about: Create a detailed report about an error encountered during the BitShares Core build process.

---

**Instructions**
Please include a detailed Title above. Next, please complete the following sections below:
* Build Error
* Build Environment
* Steps To Reproduce
* Console Logs (optional)

Finally, press the 'Submit new issue' button. The Core Team will evaluate and prioritize your Bug Report for future development.

**Build Error Description**
A clear and concise description of what the build error is.

**Build Environment**
Details about the build environment, including the relevant required libraries. Much of this information can be found in the `CMakeFiles/CMakeOutput.log`.
- Host OS: [e.g. Ubuntu 18.04 LTS]
- Host Physical RAM [e.g. 4GB]
- Source Branch/Tag: [e.g. master or 2.0.180425]
- OpenSSL Version: [e.g. 1.1.0g]
- Boost Version: [e.g. 1.65.1]
- C++ Compiler: [e.g. gcc version 4.8.5]

**Steps To Reproduce**
Steps to reproduce the behavior (example outlined below):
1. Using installation guide from this URL...
2. This is my complete build script...
3. It fails at this step with the following output...
4. See the error in the console log below...

**Console Logs (optional)**
Please provide the full console log, including all commands entered and their output. This will allow detailed troubleshooting.

## CORE TEAM TASK LIST
- [ ] Evaluate `Build Error`
- [ ] Provide build guidance
- [ ] <OR> Create `Bug Report`
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Feature Request
about: Suggest an idea for the BitShares Core Team to evaluate and prioritize for development.

---

**Instructions**
Please include a detailed Title above. Next, please complete the following sections below:
* User Story
* Impacts
* Additional Context (optional)

Finally, press the 'Submit new issue' button. The Core Team will evaluate and prioritize your Feature Request for future development.

**User Story**
Please tell us about your feature request using the User Story format:
As a `<persona>` I want `<some functionality>` so that `<some benefit is realized>`.

At minimum, please define the `<who>`, `<what>` and `<why>` for your feature request. The `<who>` may be the system software, a component thereof, the end user, etc.; please be specific describing the context. The `<what>` details the solution your feature will provide; please describe the process flow for the functionality. The `<why>` details the benefits the feature will deliver; consider referencing alternative implementations for context.

**Impacts**
Describe which portion(s) of BitShares Core may be impacted by your request. Please tick at least one box.
- [ ] API (the application programming interface)
- [ ] Build (the build process or something prior to compiled code)
- [ ] CLI (the command line wallet)
- [ ] Deployment (the deployment process after building such as Docker, Travis, etc.)
- [ ] DEX (the Decentralized EXchange, market engine, etc.)
- [ ] P2P (the peer-to-peer network for transaction/block propagation)
- [ ] Performance (system or user efficiency, etc.)
- [ ] Protocol (the blockchain logic, consensus, validation, etc.)
- [ ] Security (the security of system or user data, etc.)
- [ ] UX (the User Experience)
- [ ] Other (please add below)

**Additional Context (optional)**
Add any other context about your request here.

## CORE TEAM TASK LIST
- [ ] Evaluate / Prioritize Feature Request
- [ ] Refine User Stories / Requirements
- [ ] Define Test Cases
- [ ] Design / Develop Solution
- [ ] Perform QA/Testing
- [ ] Update Documentation
7 changes: 7 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/voting_statistics_object.hpp>

namespace graphene { namespace chain {

Expand Down Expand Up @@ -1150,6 +1151,8 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
distribute_fba_balances(*this);
create_buyback_orders(*this);

on_maintenance_begin( next_block.block_num() );

struct vote_tally_helper {
database& d;
const global_property_object& props;
Expand Down Expand Up @@ -1179,6 +1182,8 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
+ (stake_account.cashback_vb.valid() ? (*stake_account.cashback_vb)(d).balance.amount.value: 0)
+ stats.core_in_balance.value;

d.on_voting_stake_calculated( stake_account, opinion_account, voting_stake );

for( vote_id_type id : opinion_account.options.votes )
{
uint32_t offset = id.instance();
Expand Down Expand Up @@ -1327,6 +1332,8 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
// process_budget needs to run at the bottom because
// it needs to know the next_maintenance_time
process_budget();

on_maintenance_end();
}

} }
17 changes: 16 additions & 1 deletion libraries/chain/include/graphene/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ namespace graphene { namespace chain {
*/
fc::signal<void(const vector<object_id_type>&, const vector<const object*>&, const flat_set<account_id_type>&)> removed_objects;

/**
* Emitted after the calculation of the voting_stake (occurs in the maintenance interval)
*/
fc::signal<void(const account_object&, const account_object&, const uint64_t)> on_voting_stake_calculated;

/**
* Emitted after the beginning of the maintenance interval
*/
fc::signal<void(uint32_t)> on_maintenance_begin;

/**
* Emitted after the end of the maintenance interval
*/
fc::signal<void()> on_maintenance_end;

//////////////////// db_witness_schedule.cpp ////////////////////

/**
Expand Down Expand Up @@ -321,7 +336,7 @@ namespace graphene { namespace chain {
* to newly created VBID and return it.
*
* Otherwise, credit amount to ovbid.
*
*
* @return ID of newly created VBO, but only if VBO was created.
*/
optional< vesting_balance_id_type > deposit_lazy_vesting(
Expand Down
10 changes: 10 additions & 0 deletions libraries/chain/include/graphene/chain/protocol/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ namespace graphene { namespace chain {
worker_object_type,
balance_object_type,
htlc_object_type,
voting_statistics_object_type,
voteable_statistics_object_type,
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
};

Expand Down Expand Up @@ -197,7 +199,9 @@ namespace graphene { namespace chain {
class worker_object;
class balance_object;
class blinded_balance_object;
class voting_statistics_object;
class htlc_object;
class voteable_statistics_object;

typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type;
Expand All @@ -213,7 +217,9 @@ namespace graphene { namespace chain {
typedef object_id< protocol_ids, vesting_balance_object_type, vesting_balance_object> vesting_balance_id_type;
typedef object_id< protocol_ids, worker_object_type, worker_object> worker_id_type;
typedef object_id< protocol_ids, balance_object_type, balance_object> balance_id_type;
typedef object_id< protocol_ids, voting_statistics_object_type, voting_statistics_object> voting_statistics_id_type;
typedef object_id< protocol_ids, htlc_object_type, htlc_object> htlc_id_type;
typedef object_id< protocol_ids, voteable_statistics_object_type, voteable_statistics_object> voteable_statistics_id_type;

// implementation types
class global_property_object;
Expand Down Expand Up @@ -388,6 +394,8 @@ FC_REFLECT_ENUM( graphene::chain::object_type,
(worker_object_type)
(balance_object_type)
(htlc_object_type)
(voting_statistics_object_type)
(voteable_statistics_object_type)
(OBJECT_TYPE_COUNT)
)
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
Expand Down Expand Up @@ -441,7 +449,9 @@ FC_REFLECT_TYPENAME( graphene::chain::special_authority_id_type )
FC_REFLECT_TYPENAME( graphene::chain::buyback_id_type )
FC_REFLECT_TYPENAME( graphene::chain::fba_accumulator_id_type )
FC_REFLECT_TYPENAME( graphene::chain::collateral_bid_id_type )
FC_REFLECT_TYPENAME( graphene::chain::voting_statistics_id_type )
FC_REFLECT_TYPENAME( graphene::chain::htlc_id_type )
FC_REFLECT_TYPENAME( graphene::chain::voteable_statistics_id_type )

FC_REFLECT( graphene::chain::void_t, )

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright (c) 2019 Blockchain Projects B.V.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once

#include <boost/range/numeric.hpp>
#include <boost/range/adaptor/map.hpp>

#include <fc/optional.hpp>

#include <graphene/chain/protocol/types.hpp>
#include <graphene/chain/protocol/vote.hpp>

#include <graphene/db/generic_index.hpp>


namespace graphene { namespace chain {

/**
* @brief tracks the history of the voting stake for an account
* @ingroup object
* @ingroup implementation
*
* The calculation of the voting stake, performed in the maintenance interval, results
* in the creation or, if present, in the update of a voting_statistics_object.
*
* @note By default these objects are not tracked, the voting_stat_plugin must
* be loaded for these objects to be maintained.
*/
class voteable_statistics_object : public abstract_object<voteable_statistics_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = voteable_statistics_object_type;

voteable_statistics_object(){}

/* the block_num where the maintenance interval was performed */
uint32_t block_number;
/* vote_id of the voteable_object */
vote_id_type vote_id;
/* the accounts which this voteable is voted by with the number of votes */
flat_map< account_id_type, uint64_t > voted_by;

/* returns the total votes of this object */
uint64_t get_votes() const
{
return boost::accumulate( voted_by | boost::adaptors::map_values, 0 );
}
};


//struct by_block_number{}; // declared in voting_statistics_object just let it like this?
typedef multi_index_container< voteable_statistics_object,
indexed_by<
ordered_unique< tag<by_id>,
member< object, object_id_type, &object::id >
>,
ordered_unique< tag<by_block_number>,
composite_key< voteable_statistics_object,
member< voteable_statistics_object, uint32_t, &voteable_statistics_object::block_number >,
member< voteable_statistics_object, vote_id_type, &voteable_statistics_object::vote_id >
>
>
>
> voteable_statistics_multi_index_type;

typedef generic_index< voteable_statistics_object,
voteable_statistics_multi_index_type
> voteable_statistics_index;

}} // graphene::chain

FC_REFLECT_DERIVED( graphene::chain::voteable_statistics_object, (graphene::chain::object),
(block_number)(vote_id)(voted_by) )
Loading