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

Add the DataAvailabilityHeader to BlockMeta #372

Merged
merged 5 commits into from
May 31, 2021

Conversation

evan-forbes
Copy link
Member

@evan-forbes evan-forbes commented May 27, 2021

Description

This super simple PR adds the DataAvailabilityHeader to BlockMeta. It's required for #374, which will close #373

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2021

Codecov Report

Merging #372 (07b8ee2) into master (40acb17) will decrease coverage by 0.06%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master     #372      +/-   ##
==========================================
- Coverage   61.86%   61.79%   -0.07%     
==========================================
  Files         262      262              
  Lines       22922    22933      +11     
==========================================
- Hits        14180    14171       -9     
- Misses       7249     7258       +9     
- Partials     1493     1504      +11     
Impacted Files Coverage Δ
store/store.go 64.60% <33.33%> (-0.58%) ⬇️
types/block_meta.go 66.66% <54.54%> (-6.07%) ⬇️
privval/signer_listener_endpoint.go 77.64% <0.00%> (-11.77%) ⬇️
privval/signer_endpoint.go 69.69% <0.00%> (-9.10%) ⬇️
privval/socket_listeners.go 78.72% <0.00%> (-4.26%) ⬇️
types/share_merging.go 72.54% <0.00%> (-3.93%) ⬇️
privval/secret_connection.go 72.68% <0.00%> (-3.61%) ⬇️
statesync/snapshots.go 91.59% <0.00%> (-1.69%) ⬇️
blockchain/v0/pool.go 80.98% <0.00%> (-1.53%) ⬇️
blockchain/v0/reactor.go 63.06% <0.00%> (-0.91%) ⬇️
... and 8 more

@@ -213,6 +213,7 @@ message BlockMeta {
int64 block_size = 2;
Header header = 3 [(gogoproto.nullable) = false];
int64 num_txs = 4;
DataAvailabilityHeader da_header = 5 [(gogoproto.nullable) = false];
Copy link
Member Author

Choose a reason for hiding this comment

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

@liamsi, what was the thinking behind not using [(gogoproto.nullable) = false] for the DAH in the tmproto.Block? I used it here, but can revert.

Copy link
Member

Choose a reason for hiding this comment

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

No particular reason. I want to use these gogoprote annotations as little as possible. Some of them break with the actual protobuf specification.

@marbar3778 is there a good rule of thumb when to use and when to use them?

Copy link
Member

@adlerjohn adlerjohn May 28, 2021

Choose a reason for hiding this comment

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

Revisiting John's favorite topic, but the deterministic protobuf spec doesn't include any provisions for gogoproto annotations. In fact, if we stick to deterministic protobuf then [(gogoproto.nullable) = false] would be invalid. This is actually a big deal, because including those annotations in our proto definitions would mean having our own custom non-standard serialization format, and also tie us to an unmaintained third-party dependency.

Copy link
Member

Choose a reason for hiding this comment

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

@adlerjohn, why do you think it is unmaintained?

Copy link
Member

Choose a reason for hiding this comment

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

Edited in the link, but here: gogo/protobuf#691

Copy link
Member Author

@evan-forbes evan-forbes May 28, 2021

Choose a reason for hiding this comment

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

@evan-forbes evan-forbes self-assigned this May 28, 2021
@evan-forbes evan-forbes marked this pull request as ready for review May 28, 2021 03:19
@evan-forbes evan-forbes removed the request for review from tac0turtle May 28, 2021 03:25
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

👏🏼

store/store.go Outdated Show resolved Hide resolved
BlockSize int `json:"block_size"`
Header Header `json:"header"`
NumTxs int `json:"num_txs"`
DAHeader DataAvailabilityHeader `json:"da_header"`
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to use value instead of a pointer?

Copy link
Member Author

Choose a reason for hiding this comment

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

good question. my thinking was that we shouldn't be editing it, the dah consists of three slices which should be passed as by value, the general rule of thumb to not use pointers unless it's necessary, and that's what Block uses

this was also why I was using gogoproto to do the same thing for the proto types, but that was revereted here 3e3fa30

Copy link
Member

@Wondertan Wondertan May 28, 2021

Choose a reason for hiding this comment

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

Ok, mostly my concern is to be consistent mostly about the use of a particular structure. For the case of DAHeader we don't do that(except for Block) and I think we need to change the places where we use pointers to values.

evan-forbes and others added 2 commits May 28, 2021 15:42
Co-authored-by: Hlib Kanunnikov <hlibwondertan@gmail.com>
@evan-forbes evan-forbes merged commit 6a4b0a7 into master May 31, 2021
@evan-forbes evan-forbes deleted the evan/add-dah-to-block-meta branch May 31, 2021 04:33
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.

Save and Load Block Data via IPFS
5 participants