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

feat(erasure_coding): introduce erasure coding for PoV Distributor #3281

Merged
merged 11 commits into from
Jun 8, 2023

Conversation

edwardmack
Copy link
Member

Changes

This PR introduces functions to implement erasure coding for use by PoV Distributor for sharding PoV bytes.

  • ObtainChunks splits the provided data into validatorsQty number of chunks plus additional parity chunks for reconsturction
  • Reconstruct reconstructs decodable data from a set of chunks.

This uses Reed-Solomon Erasure Coding go library created by Backblaze, see blog post for details.

Currently these function work with []byte data, future functions will construct chunks from PoV structs.

Tests

go test github.com/ChainSafe/gossamer/lib/erasure-coding -v

Issues

Regarding issue #3275

Primary Reviewer

@kishansagathiya
@timwu20

@CLAassistant
Copy link

CLAassistant commented May 25, 2023

CLA assistant check
All committers have signed the CLA.

@edwardmack edwardmack force-pushed the ed/erasure_coding branch 3 times, most recently from 3fb226c to 76b4323 Compare May 25, 2023 17:44
Copy link
Member

@EclesioMeloJunior EclesioMeloJunior left a comment

Choose a reason for hiding this comment

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

LGTM

@edwardmack edwardmack force-pushed the ed/erasure_coding branch 2 times, most recently from fd5543b to 76ff2bf Compare May 30, 2023 21:46
Copy link
Contributor

@kishansagathiya kishansagathiya left a comment

Choose a reason for hiding this comment

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

Really cool stuff. I have a few comments. It should be good to go after that!

lib/erasure/erasure.go Outdated Show resolved Hide resolved
lib/erasure/erasure.go Show resolved Hide resolved
lib/erasure/erasure.go Show resolved Hide resolved
lib/erasure/erasure_test.go Show resolved Hide resolved
lib/erasure/erasure.go Outdated Show resolved Hide resolved
@kishansagathiya
Copy link
Contributor

Now that there is a feature branch for parachains feat/parachain, we should target this PR to that branch.

@edwardmack edwardmack changed the base branch from development to feat/parachain May 31, 2023 21:36
Copy link
Contributor

@kishansagathiya kishansagathiya left a comment

Choose a reason for hiding this comment

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

Epic!!

@@ -186,17 +183,12 @@ func readLEB128ToUint64(r io.Reader, buf []byte) (uint64, int, error) {
}

// readStream reads from the stream into the given buffer, returning the number of bytes read
func readStream(stream libp2pnetwork.Stream, bufPointer *[]byte, maxSize uint64) (int, error) {
func readStream(stream libp2pnetwork.Stream, bufPointer *[]byte, maxSize uint64) (tot int, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

opinion/preference: better to not use named returns to avoid returning unexpectedly by mistake

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense, these changes were from @EclesioMeloJunior (I'm not sure why they're showing as changes on this PR, I think I may have done something wrong when rebasing this branch onto feat/parachain.)

@edwardmack edwardmack merged commit 1782a1b into feat/parachain Jun 8, 2023
@edwardmack edwardmack deleted the ed/erasure_coding branch June 8, 2023 14:30
edwardmack added a commit that referenced this pull request Jun 8, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Jun 13, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Jun 14, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jun 20, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit to kishansagathiya/gossamer that referenced this pull request Jul 4, 2023
…hainSafe#3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit to kishansagathiya/gossamer that referenced this pull request Jul 4, 2023
…hainSafe#3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kanishkatn pushed a commit that referenced this pull request Jul 5, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kanishkatn added a commit that referenced this pull request Jul 5, 2023
kishansagathiya pushed a commit that referenced this pull request Jul 12, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jul 12, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jul 14, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jul 27, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Jul 27, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Aug 4, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Aug 22, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Aug 22, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Aug 30, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Aug 31, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Aug 31, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Sep 14, 2023
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jan 23, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jan 24, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
timwu20 pushed a commit that referenced this pull request Jun 13, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
timwu20 pushed a commit that referenced this pull request Jun 17, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
timwu20 pushed a commit that referenced this pull request Jun 20, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Jun 26, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
edwardmack added a commit that referenced this pull request Jul 12, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jul 15, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
kishansagathiya pushed a commit that referenced this pull request Jul 15, 2024
…3281)

Co-authored-by: Eclésio Junior <eclesiomelo.1@gmail.com>
Co-authored-by: Edward Mack <emack@pop-os.localdomain>
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.

4 participants