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

Overabundant balance check for bid_collateral_operation #1692

Closed
3 of 17 tasks
abitmore opened this issue Apr 2, 2019 · 1 comment
Closed
3 of 17 tasks

Overabundant balance check for bid_collateral_operation #1692

abitmore opened this issue Apr 2, 2019 · 1 comment
Assignees
Labels
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 6 DEX Impact flag identifying the Decentralized EXchange, market engine, etc. 6 Protocol Impact flag identifying the blockchain logic, consensus, validation, etc. 6 UX Impact flag identifying the User Interface (UX) hardfork

Comments

@abitmore
Copy link
Member

abitmore commented Apr 2, 2019

Bug Description

if( o.additional_collateral.amount > 0 )
{
FC_ASSERT( d.get_balance(*_paying_account, _bitasset_data->options.short_backing_asset(d)) >= o.additional_collateral,
"Cannot bid ${c} collateral when payer only has ${b}", ("c", o.additional_collateral.amount)
("b", d.get_balance(*_paying_account, o.additional_collateral.asset_id(d)).amount) );
}

  • If a bidder is creating a new bid, this check is fine;
  • if a bidder is updating an old bid, this check doesn't make sense but only annoying, actually we should check balance + old_bid_collateral >= new_bid_collateral, because the old bid will be cancelled so collateral will be released then can be used in the new bid. Additionally, balance will be checked when calling adjust_balance() later, so the check here is not necessary.

Fixing this requires a consensus upgrade.

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. globally settle asset USD;
  2. fund account test with 10000 BTS;
  3. bid with 9000 BTS;
  4. try to update the bid to 8000 BTS, fail.

Expected Behavior
Able to update bid when balance + old_bid_collateral >= new_bid_collateral.

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
@abitmore abitmore added hardfork 6 Protocol Impact flag identifying the blockchain logic, consensus, validation, etc. 6 UX Impact flag identifying the User Interface (UX) 6 DEX Impact flag identifying the Decentralized EXchange, market engine, etc. labels Apr 2, 2019
@pmconrad pmconrad added the 3d Bug Classification indicating the existing implementation does not match the intention of the design label Apr 3, 2019
@pmconrad pmconrad self-assigned this Jun 24, 2019
@pmconrad pmconrad added the 2d Developing Status indicating currently designing and developing a solution label Jun 24, 2019
pmconrad added a commit to pmconrad/bitshares-core that referenced this issue Jun 24, 2019
@pmconrad pmconrad mentioned this issue Jun 24, 2019
@pmconrad pmconrad added 2e Ready for Testing Status indicating the solution is sufficiently developed to begin testing and removed 2d Developing Status indicating currently designing and developing a solution labels Jun 24, 2019
jmjatlanta pushed a commit that referenced this issue Sep 3, 2019
@pmconrad
Copy link
Contributor

pmconrad commented Sep 4, 2019

Fixed by #1830

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 6 DEX Impact flag identifying the Decentralized EXchange, market engine, etc. 6 Protocol Impact flag identifying the blockchain logic, consensus, validation, etc. 6 UX Impact flag identifying the User Interface (UX) hardfork
Projects
None yet
Development

No branches or pull requests

2 participants