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

Light client conformance tests differences between description and real errors #290

Closed
OStevan opened this issue Jun 2, 2020 · 6 comments · Fixed by #366
Closed

Light client conformance tests differences between description and real errors #290

OStevan opened this issue Jun 2, 2020 · 6 comments · Fixed by #366
Assignees
Labels
light-client Issues/features which involve the light client tests
Milestone

Comments

@OStevan
Copy link
Contributor

OStevan commented Jun 2, 2020

When running tests for light client I noticed that for not_enough_commits (in the current canonical implementation) and invalid_validator_set (the new one in light-client) the expected error based on the description is not the same as the error we get when the test is run.

not_enough_commits: fails with InvalidNextValidatorSet for height 5 instead of InsufficientCommitPower for height 6

invalid_validator_set: fails with request for height 6 instead of invalid InvalidNextValidatorSet for height 11

@ebuchman ebuchman added this to the Light Node milestone Jun 2, 2020
@ebuchman ebuchman added the light-client Issues/features which involve the light client label Jun 3, 2020
@OStevan
Copy link
Contributor Author

OStevan commented Jun 4, 2020

@ebuchman I'll continue adding differences between errors we would expect based on the description and the ones which are currently registered in this issue.

@OStevan
Copy link
Contributor Author

OStevan commented Jun 4, 2020

wrong_header_height, wrong_header_timestamp, wrong_last_block_id: fails with InvalidCommitValue while the description would suggest a different error.

@Shivani912
Copy link
Contributor

I'm looking into this now

@Shivani912
Copy link
Contributor

When running tests for light client I noticed that for not_enough_commits (in the current canonical implementation) and invalid_validator_set (the new one in light-client) the expected error based on the description is not the same as the error we get when the test is run.

not_enough_commits: fails with InvalidNextValidatorSet for height 5 instead of InsufficientCommitPower for height 6

invalid_validator_set: fails with request for height 6 instead of invalid InvalidNextValidatorSet for height 11

So as @OStevan explained, there were errors in not_enough_commits and invalid_validator_set. These have been fixed in PR #366 .

wrong_header_height, wrong_header_timestamp, wrong_last_block_id: fails with InvalidCommitValue while the description would suggest a different error.

Well, description in tests explain "where" the error should be instead of "what". Specifying the error type could be tricky here because the above cases are essentially all about detecting differences in header and commit. So for the same error, you could say it's an invalid header. As long as it fails for the expected reason, I wouldn't care much about the error type.

@OStevan
Copy link
Contributor Author

OStevan commented Jun 24, 2020

@Shivani912 thanks for following up on this.

Well, description in tests explain "where" the error should be instead of "what". Specifying the error type could be tricky here because the above cases are essentially all about detecting differences in header and commit. So for the same error, you could say it's an invalid header. As long as it fails for the expected reason, I wouldn't care much about the error type.

I'll just explain my reasoning why I mentioned this. I considered this as an issue because the current implementation passes tests because header hash check catches the differences. Therefore someone could easily delete those height checks, etc. in the code without failing any of those tests and then someone could make artificial light blocks which would pass the validation. Also it seems a bit wasteful to compute the hash for the whole block while there is only an error in height values.

@Shivani912
Copy link
Contributor

@Shivani912 thanks for following up on this.

Well, description in tests explain "where" the error should be instead of "what". Specifying the error type could be tricky here because the above cases are essentially all about detecting differences in header and commit. So for the same error, you could say it's an invalid header. As long as it fails for the expected reason, I wouldn't care much about the error type.

I'll just explain my reasoning why I mentioned this. I considered this as an issue because the current implementation passes tests because header hash check catches the differences. Therefore someone could easily delete those height checks, etc. in the code without failing any of those tests and then someone could make artificial light blocks which would pass the validation. Also it seems a bit wasteful to compute the hash for the whole block while there is only an error in height values.

Thanks for explaining further @OStevan but I still don't understand what you mean by deleting checks and and validating artificial light blocks 🤔

I do agree it'll be useful to have less expensive checks for fields like height or timestamp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
light-client Issues/features which involve the light client tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants