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
abitmore opened this issue Apr 13, 2019 · 2 comments

Comments

Projects
2 participants
@abitmore
Copy link
Member

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 this to the 3.1.0 - Feature Release milestone Apr 13, 2019

@abitmore abitmore added this to To do in Feature Release (3.1.0) via automation Apr 13, 2019

@pmconrad pmconrad self-assigned this Apr 13, 2019

@pmconrad pmconrad moved this from To do to In development in Feature Release (3.1.0) Apr 13, 2019

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Apr 13, 2019

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 moved this from In development to In testing in Feature Release (3.1.0) Apr 13, 2019

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Apr 14, 2019

Merged #1719

@pmconrad pmconrad closed this Apr 14, 2019

Feature Release (3.1.0) automation moved this from In testing to Done Apr 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.