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

Remove shard block chunking #1560

Merged
merged 2 commits into from Jan 29, 2020
Merged

Remove shard block chunking #1560

merged 2 commits into from Jan 29, 2020

Conversation

vbuterin
Copy link
Contributor

@vbuterin vbuterin commented Jan 8, 2020

Only store a 32 byte root for every shard block

Rationale: originally, I added shard block chunking (store 4 chunks for every shard block instead of one root) to facilitate construction of data availability roots. However, it turns out that there is an easier technique. Set the width of the data availability rectangle's rows to be 1/4 the max size of a shard block, so each block would fill multiple rows. Then, non-full blocks will generally create lots of zero rows. For example if the block bodies are 31415926535 and 897932 with a max size of 24 bytes, the rows might look like this:

31415926
53500000
00000000
89793200
00000000
00000000

Zero rows would extend rightward to complete zero rows, and when extending downward we can count the number of zero rows, and reduce the number of extra rows that we make, so we only make a new row for every nonzero row in the original data. This way we get only a close-to-optimal ~4-5x blowup in the data even if the data has zero rows in the middle.

@djrtwo
Copy link
Contributor

djrtwo commented Jan 21, 2020

This looks good @vbuterin

We are going to get #1504 merged in shortly, then I'll rebase this and get it merged

@djrtwo djrtwo changed the base branch from phase1rebase to dev January 23, 2020 19:09
Only store a 32 byte root for every shard block

Rationale: originally, I added shard block chunking (store 4 chunks for every shard block instead of one root) to facilitate construction of data availability roots. However, it turns out that there is an easier technique. Set the width of the data availability rectangle's rows to be 1/4 the max size of a shard block, so each block would fill multiple rows. Then, non-full blocks will generally create lots of zero rows. For example if the block bodies are `31415926535` and `897932` with a max size of 24 bytes, the rows might look like this:

```
31415926
53500000
00000000
89793200
00000000
00000000
```
Zero rows would extend rightward to complete zero rows, and when extending downward we can count the number of zero rows, and reduce the number of extra rows that we make, so we only make a new row for every nonzero row in the original data. This way we get only a close-to-optimal ~4-5x blowup in the data even if the data has zero rows in the middle.
@djrtwo djrtwo merged commit b7004a9 into dev Jan 29, 2020
@djrtwo djrtwo deleted the vbuterin-patch-1 branch January 29, 2020 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants