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

fix: tests for invalid state parts #9122

Merged
merged 8 commits into from
May 30, 2023

Conversation

Longarithm
Copy link
Member

@Longarithm Longarithm commented May 29, 2023

Check that invalid state parts don't pass validation. Add missing StorageError kind for one of test cases. Now we check two scenarios:

  • MissingTrieValue - should be returned if some trie value is missing during validation - e.g. some intermediate node wasn't sent;
  • UnexpectedTrieValue - should be returned if some extra trie value was included to state part. Necessary to check, otherwise malicious actor can spam nodes with large amounts of non-existent nodes.

@Longarithm Longarithm self-assigned this May 29, 2023
@Longarithm Longarithm added the A-storage Area: storage and databases label May 29, 2023
@Longarithm Longarithm marked this pull request as ready for review May 29, 2023 11:38
@Longarithm Longarithm requested a review from a team as a code owner May 29, 2023 11:38
@Longarithm Longarithm requested a review from jakmeier May 29, 2023 11:38
Copy link
Contributor

@jakmeier jakmeier left a comment

Choose a reason for hiding this comment

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

Glad to see this being improved. Also, the updates to the comments are very welcome, too!

@Longarithm
Copy link
Member Author

Also added checks for duplicated value and shuffled state part.

@near-bulldozer near-bulldozer bot merged commit a635290 into near:master May 30, 2023
nikurt pushed a commit that referenced this pull request May 31, 2023
Check that invalid state parts don't pass validation. Add missing `StorageError` kind for one of test cases. Now we check two scenarios:
* MissingTrieValue - should be returned if some trie value is missing during validation - e.g. some intermediate node wasn't sent;
* UnexpectedTrieValue - should be returned if some extra trie value was included to state part. Necessary to check, otherwise malicious actor can spam nodes with large amounts of non-existent nodes.
nikurt pushed a commit to nikurt/nearcore that referenced this pull request Jun 8, 2023
Check that invalid state parts don't pass validation. Add missing `StorageError` kind for one of test cases. Now we check two scenarios:
* MissingTrieValue - should be returned if some trie value is missing during validation - e.g. some intermediate node wasn't sent;
* UnexpectedTrieValue - should be returned if some extra trie value was included to state part. Necessary to check, otherwise malicious actor can spam nodes with large amounts of non-existent nodes.
nikurt pushed a commit to nikurt/nearcore that referenced this pull request Jun 8, 2023
Check that invalid state parts don't pass validation. Add missing `StorageError` kind for one of test cases. Now we check two scenarios:
* MissingTrieValue - should be returned if some trie value is missing during validation - e.g. some intermediate node wasn't sent;
* UnexpectedTrieValue - should be returned if some extra trie value was included to state part. Necessary to check, otherwise malicious actor can spam nodes with large amounts of non-existent nodes.
nikurt pushed a commit that referenced this pull request Jun 13, 2023
Check that invalid state parts don't pass validation. Add missing `StorageError` kind for one of test cases. Now we check two scenarios:
* MissingTrieValue - should be returned if some trie value is missing during validation - e.g. some intermediate node wasn't sent;
* UnexpectedTrieValue - should be returned if some extra trie value was included to state part. Necessary to check, otherwise malicious actor can spam nodes with large amounts of non-existent nodes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage Area: storage and databases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants