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

Separate genesis file into independent units #308

Merged
merged 19 commits into from
May 19, 2022

Conversation

uprendis
Copy link
Collaborator

@uprendis uprendis commented May 13, 2022

Genesis file:

  • instead of using .zip container for storage of sections of genesis file, use custom gzip-based container, whose items can be separated or concatenated on binary level (i.e. units of a genesis file can split into independent files on binary level, and then re-arranged in an arbitrary order, as each unit is an independent piece with its own file header). It will help to reduce data redundancy on servers for hosting the genesis files, and will make it easier to incrementally generate diffs compared to prev genesis files rather than re-generating all data from scratch. Using gzip instead of zip is also advantageous for compression speed, because there's more performant parallel implementation for gzip parallel compression
  • add dry mode for genesis generation, which calculates the data hashes without storing data or allocating disk space

Changes in filehash module:

  • fix bug in filehash module which resulted into insecure hashing of genesis file (034bfed)
  • add tests for filehash module

}
}

func (w *Writer) writeIntoTmp(p []byte) error {
if len(p) == 0 {
return nil
}
if w.size/w.tmpSize >= uint64(len(w.tmps)) {
w.tmps = append(w.tmps, w.openTmp())
if w.size/w.pieceSize >= uint64(len(w.tmps)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@uprendis can you explain the logic here, please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cyberbono3 would you mean this change specifically, or filehash module in general?

@uprendis uprendis merged commit 9c240b4 into Fantom-foundation:develop May 19, 2022
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

3 participants