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

Inconsistent required_approval_index when loading from disk #1719

Closed
2 of 17 tasks
abitmore opened this issue Apr 13, 2019 · 2 comments
Closed
2 of 17 tasks

Inconsistent required_approval_index when loading from disk #1719

abitmore opened this issue Apr 13, 2019 · 2 comments
Assignees
Labels
1b User Story The User Story details a requirement. It may reference a parent Epic. It may reference child Task(s) 2e Ready for Testing Status indicating the solution is sufficiently developed to begin testing 3d Bug Classification indicating the existing implementation does not match the intention of the design 4c High Priority Priority indicating significant impact to system/user -OR- workaround is prohibitivly expensive 6 API Impact flag identifying the application programing interface (API) 6 UX Impact flag identifying the User Interface (UX)

Comments

@abitmore
Copy link
Member

abitmore commented Apr 13, 2019

Bug Description

The secondary index class required_approval_index has an empty overridden member function about_to_modify(obj) as well as an empty object_modified(obj) function, combined with the logic in object_inserted(obj), may lead to inconsistent chain state and memory leak when reloading data from disk.

virtual void about_to_modify( const object& before ) override{};
virtual void object_modified( const object& after ) override{};

for( const auto& a : p.available_active_approvals )
_account_to_proposals[a].insert( p.id );
for( const auto& a : p.available_owner_approvals )
_account_to_proposals[a].insert( p.id );

The misbehavior is reported by Mobile App Dev Team (btspp / @syalon).

The misbehavior can be corrected and avoided with a replay.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Setup a multi-auth account Alice, with Bob and Cindy in active authorities, both have a weight below threshold
  2. Create a proposal that requires Alice's approval
  • Pair (Alice,proposal) will be inserted into required_approval_index
  1. Approve the proposal with Bob
  • required_approval_index won't be updated
  1. Stop witness_node after Bob's approval is irreversible
  2. Start witness_node
  • Pair (Alice,proposal) and (Bob,proposal) will be inserted into required_approval_index
  1. Remove Bob's approval from the proposal
  • required_approval_index won't be updated
  1. Let the proposal expire
  • Pair (Alice,proposal) will be removed from required_approval_index, but pair (Bob,proposal) will be kept in memory
  1. Query Bob's account info with get_full_accounts API, see "Unable to find object" error

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)

CORE TEAM TASK LIST

  • Evaluate / Prioritize Bug Report
  • Refine User Stories / Requirements
  • Define Test Cases
  • Design / Develop Solution
  • Perform QA/Testing
  • Update Documentation
@abitmore abitmore added 1b User Story The User Story details a requirement. It may reference a parent Epic. It may reference child Task(s) 3d Bug Classification indicating the existing implementation does not match the intention of the design 4c High Priority Priority indicating significant impact to system/user -OR- workaround is prohibitivly expensive 6 API Impact flag identifying the application programing interface (API) 6 UX Impact flag identifying the User Interface (UX) labels Apr 13, 2019
@abitmore abitmore added this to the 3.1.0 - Feature Release milestone Apr 13, 2019
@pmconrad pmconrad self-assigned this Apr 13, 2019
@pmconrad
Copy link
Contributor

Nice find, thanks.

I wouldn't call it "inconsistent chain state" since only API queries are affected, not the consensus-related state.

pmconrad added a commit that referenced this issue Apr 13, 2019
@pmconrad pmconrad added the 2e Ready for Testing Status indicating the solution is sufficiently developed to begin testing label Apr 13, 2019
@pmconrad
Copy link
Contributor

Merged #1719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1b User Story The User Story details a requirement. It may reference a parent Epic. It may reference child Task(s) 2e Ready for Testing Status indicating the solution is sufficiently developed to begin testing 3d Bug Classification indicating the existing implementation does not match the intention of the design 4c High Priority Priority indicating significant impact to system/user -OR- workaround is prohibitivly expensive 6 API Impact flag identifying the application programing interface (API) 6 UX Impact flag identifying the User Interface (UX)
Projects
None yet
Development

No branches or pull requests

2 participants