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

Refactor block file logic + util.h/cpp moved to util/system.h #2336

Merged
merged 11 commits into from
May 15, 2021

Conversation

furszy
Copy link

@furszy furszy commented Apr 23, 2021

This is part of the block logic refactoring and encapsulation work coming from upstream (work started in #2326 and #2328 due the possible blocks db corruption issue).
Needed for two future works: (1) faster block validation using a new cache structure and (2) the future possible custom BIP157 (new sync protocol that supersedes BIP37 for light clients -- pending research needed after finishing v6.0 priorities --)

Essentially, it's encapsulating the sequenced files open/read/write functionalities inside a new flatfile module, and extending the unit test coverage to validate its correct behavior.

Adapted the following PRs:

@furszy furszy self-assigned this Apr 23, 2021
@furszy furszy changed the title Refactor block file logic + util.h/cpp moved to util/system.h [WIP] Refactor block file logic + util.h/cpp moved to util/system.h Apr 23, 2021
@furszy furszy added this to the 6.0.0 milestone Apr 23, 2021
@furszy furszy force-pushed the 2021_refactor_block_file_logic branch from c121a5f to 5629d03 Compare April 24, 2021 11:12
@furszy furszy force-pushed the 2021_refactor_block_file_logic branch from 5629d03 to 9529162 Compare May 1, 2021 18:34
@furszy furszy changed the title [WIP] Refactor block file logic + util.h/cpp moved to util/system.h Refactor block file logic + util.h/cpp moved to util/system.h May 1, 2021
@furszy furszy changed the title Refactor block file logic + util.h/cpp moved to util/system.h Refactor block file logic + util.h/cpp renamed to util/system.h May 1, 2021
@furszy furszy changed the title Refactor block file logic + util.h/cpp renamed to util/system.h Refactor block file logic + util.h/cpp moved to util/system.h May 1, 2021
@furszy
Copy link
Author

furszy commented May 1, 2021

Rebased after #2326 merge, ready to go.

@furszy furszy force-pushed the 2021_refactor_block_file_logic branch from 9529162 to 894890a Compare May 4, 2021 14:10
@furszy
Copy link
Author

furszy commented May 4, 2021

rebased on master so this work gets more test coverage.

@furszy furszy force-pushed the 2021_refactor_block_file_logic branch 2 times, most recently from 3a901d6 to c4a798c Compare May 5, 2021 13:56
random-zebra
random-zebra previously approved these changes May 8, 2021
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. ACK c4a798c

@furszy furszy force-pushed the 2021_refactor_block_file_logic branch 2 times, most recently from b9ec374 to 2e35dea Compare May 11, 2021 20:44
@furszy
Copy link
Author

furszy commented May 11, 2021

rebased due conflicts with a recently merged PR, ready to go.

random-zebra
random-zebra previously approved these changes May 12, 2021
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 2e35dea after rebase

@furszy
Copy link
Author

furszy commented May 14, 2021

rebased.

@furszy furszy requested a review from random-zebra May 14, 2021 02:32
random-zebra
random-zebra previously approved these changes May 14, 2021
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-re-utACK b1a4b50 after rebase

Fuzzbawls
Fuzzbawls previously approved these changes May 15, 2021
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from introducing a couple compiler warnings that can be fixed directly here, or in a small followup PR,

ACK b1a4b50

} else
return state.Error("out of disk space");
bool out_of_space;
size_t bytes_allocated = BlockFileSeq().Allocate(pos, nAddSize, out_of_space);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bytes_allocated is never used, because we don't have block pruning yet. This introduces a compiler warning that can be squelched by simply re-writing the line as follows until block pruning is introduced.

/*size_t bytes_allocated = */BlockFileSeq().Allocate(pos, nAddSize, out_of_space);

} else
return state.Error("out of disk space");
bool out_of_space;
size_t bytes_allocated = UndoFileSeq().Allocate(pos, nAddSize, out_of_space);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

/*size_t bytes_allocated = */UndoFileSeq().Allocate(pos, nAddSize, out_of_space);

@furszy furszy dismissed stale reviews from Fuzzbawls and random-zebra via 3e48fc1 May 15, 2021 14:25
@furszy furszy force-pushed the 2021_refactor_block_file_logic branch from b1a4b50 to 3e48fc1 Compare May 15, 2021 14:25
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 3e48fc1

@furszy
Copy link
Author

furszy commented May 15, 2021

Merging..

@furszy furszy merged commit 6b95c76 into PIVX-Project:master May 15, 2021
furszy added a commit that referenced this pull request May 18, 2021
…r_basic_data

23d31db [BUG][Tests] Properly set temporary datadir for dbwrapper_basic_data (random-zebra)

Pull request description:

  Few cases left out in #2336

ACKs for top commit:
  Fuzzbawls:
    ACK 23d31db
  furszy:
    ACK 23d31db and merging

Tree-SHA512: fac4fdd14b028520a473b234faac9e9472869ff1e97948c31af126554bc959ef6b920979e62036bb61189728635801367dc1fe35c8fdac828633fe95bc38d073
@furszy furszy deleted the 2021_refactor_block_file_logic branch November 29, 2022 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants