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

service/block: add basic encoding validation in BlockService #96

Merged
merged 1 commit into from
Sep 30, 2021

Conversation

renaynay
Copy link
Member

This PR relies on #87 being merged first.

Resolves #92.

@renaynay renaynay added area:block Raw blocks and erasure coded blocks area:fraud labels Sep 29, 2021
@renaynay renaynay added the area:header Extended header label Sep 29, 2021
liamsi
liamsi previously approved these changes Sep 29, 2021
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.

Looks good! 👏🏼

service/block/event_test.go Show resolved Hide resolved
service/block/fraud.go Show resolved Hide resolved
service/block/fraud_test.go Show resolved Hide resolved
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

It is not absolutely necessary to do this validation though, as we trust the Core. For the future case with p2p Fetcher, the protocol doing the fetch would do this check on the lower level as well. Also, if we do this check why don't we check other fields in the block validation process? It just does not make sense to me not to trust the Core only for DataHash, but trust with other things.

cc @liamsi

service/block/fraud.go Show resolved Hide resolved
@liamsi
Copy link
Member

liamsi commented Sep 29, 2021

It just does not make sense to me not to trust the Core only for DataHash, but trust with other things.

Yeah, I think we should ideally do basic validation on the block. But as we get header and block separentley, we should make sure that they match up (each field).

as we trust the Core.

Yeah, you are absolutely right about trusting core. I think we should still make sure that the stuff we get from core actually checks out. The check here is not wrong though. I think we should open an issue for the checks but most likely we can just use whatever core does as a library with the difference that we download block and header separately here (but maybe there are functions we can still use in that case).

@renaynay
Copy link
Member Author

think we should open an issue for the checks but most likely we can just use whatever core does as a library with the difference that we download block and header separately here (but maybe there are functions we can still use in that case).

@liamsi can you pls open this issue on our repo? 🙏🏻

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Codewise looks good. Conceptually, my concern is still the same, we should either have validation for everything or for nothing, but we can see this as a first step towards validation for everything

@renaynay renaynay merged commit db7c150 into celestiaorg:main Sep 30, 2021
@renaynay renaynay deleted the validate-encoding branch September 30, 2021 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:block Raw blocks and erasure coded blocks area:fraud area:header Extended header
Projects
None yet
Development

Successfully merging this pull request may close these issues.

service/block: basic validation of DAH hash against raw header data root
3 participants