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

About skip_fork_db flag #1313

Closed
abitmore opened this issue Sep 8, 2018 · 7 comments

Comments

Projects
4 participants
@abitmore
Copy link
Member

commented Sep 8, 2018

The skip_fork_db flag is defined in database.hpp and the comment says it's used while reindexing:

skip_fork_db = 1 << 3, ///< used while reindexing

But it's actually not being used:

uint32_t skip = skip_witness_signature |
skip_block_size_check |
skip_transaction_signatures |
skip_transaction_dupe_check |
skip_tapos_check |
skip_witness_schedule_check |
skip_authority_check;

To improve replay performance, we can make use of that flag. However, we can not just add it to the code above, because the flag is not being carefully checked everywhere.

  • database::_push_block() calls fork_db.remove() without checking the flag (fixed in this commit: 67166ca)
  • database::pop_block() calls fork_db.pop_block() without checking the flag
    void database::pop_block()
    { try {
    _pending_tx_session.reset();
    auto head_id = head_block_id();
    optional<signed_block> head_block = fetch_block_by_id( head_id );
    GRAPHENE_ASSERT( head_block.valid(), pop_empty_chain, "there are no blocks to pop" );
    _fork_db.pop_block();
  • database::close() calls database::pop_block() and fork_db.remove() without checking the flag:
    pop_block();
    _fork_db.remove(popped_block_id); // doesn't throw on missing
  • database::reindex() calls _fork_db.start_block() regardless (actually, if to skip fork_db, should call start_block() after reindex):
    _fork_db.start_block( *fetch_block_by_number( head_block_num() ) );

Perhaps there are other related issues as well.

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 New -Awaiting Core Team Evaluation in Project Backlog via automation Sep 8, 2018

@cogutvalera

This comment has been minimized.

Copy link
Member

commented Sep 10, 2018

@ryanRfox I want to claim this issue as a continue of my researchers after #946 issue.

Thanks !

@abitmore

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2018

@cogutvalera IMHO you already have quite some issues pending, better finish them or release them before "officially" asking for working on new issues. You can research in advance if have spare time though.

@cogutvalera

This comment has been minimized.

Copy link
Member

commented Sep 10, 2018

Ok. Sure. Thanks !

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Nov 8, 2018

IMO the flag should be removed.

During most of replay, blocks are apply()'d not pushed, which has the same effect (i. e. it skips fork_db).

@jmjatlanta

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

I removed skip_fork_db and ran tests to verify there were no side effects. That is in branch jmj_1313. If you think it worthwhile, I will make the changes abit suggested, so a comparison could be made.

If it is believed to not be worthwhile, I will make a PR.

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

Like I said, I vote for removal.

@abitmore abitmore removed this from New -Awaiting Core Team Evaluation in Project Backlog Jan 15, 2019

@abitmore abitmore added this to To do in Feature Release (201902) via automation Jan 15, 2019

@abitmore

This comment has been minimized.

Copy link
Member Author

commented Jan 15, 2019

Closed by #1527.

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.