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

Short-circuit C2 table loading at first encounter of lesser C2 entry #337

Merged
merged 1 commit into from Sep 16, 2022

Conversation

harold-b
Copy link
Contributor

Short-circuits C2 table loading at the first encounter of an C2 table entry which is lesser than the previous C2 table entry.

This prevents DiskProver from loading dead-space into memory when reading C2.

As there's no specification for the layout of tables in the plot file, but simply a table address in the plot header, plotters may place tables at addresses not immediately following the previous table.

Bladebit v1 does this since it writes with direct-io enabled and it does not make any effort to ensure the tables appear immediately after another if the previous table size is unaligned. Therefore the may be empty space between tables given the block size of the filesystem of the directory used to export the plot.

See Bladebit issue #153 and chiapos issue #13084

When said filesystem has a large block size, the empty space between tables will end up being quite large, and DiskProver will load the empty space following the C2 entries. This prevents that from happening.

Because C2 entries are sorted in ascending order, we always expect to load a C2 entry of greater value, therefore if a lesser value is encountered it either means this is a corrupted/bad plot file or potentially there might be empty space, in which case it is safe to stop loading the table.

xdustinface
xdustinface previously approved these changes Sep 15, 2022
Copy link
Contributor

@xdustinface xdustinface left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@rostislav rostislav left a comment

Choose a reason for hiding this comment

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

The change itself is okay, but the commit message does not look good. Its first line should fit into 72 characters if possible and be followed by a blank line - this is so that git log --oneline output looks pretty. The title of this PR could be used there, with a small change: please use imperative mood ("Short-circuit C2 ..." instead of "Short-circuits C2 ..."). And no extra indentation for the rest of the commit message.

src/prover_disk.hpp Outdated Show resolved Hide resolved
This prevents DiskProver from loading dead-space into memory when reading C2.
@harold-b harold-b changed the title Short-circuits C2 table loading at first encounter of lesser C2 entry Short-circuit C2 table loading at first encounter of lesser C2 entry Sep 16, 2022
Copy link
Contributor

@rostislav rostislav left a comment

Choose a reason for hiding this comment

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

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants