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

Trie leaf data unmarshal #4821

Merged
merged 3 commits into from Dec 21, 2022

Conversation

BeniaminDrasovean
Copy link
Contributor

Reasoning behind the pull request

  • When parsing a data trie leaf, if the leaf value was not migrated to the new version, the unmarshal should err. There are some cases in which the unmarshall does not err, but the data is still nil.

Proposed changes

  • After unmarshal, also check that the trieData is not empty.

Testing procedure

  • added unit test

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (feat/balance-data-tries@32a03f4). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             feat/balance-data-tries    #4821   +/-   ##
==========================================================
  Coverage                           ?   70.74%           
==========================================================
  Files                              ?      632           
  Lines                              ?    83542           
  Branches                           ?        0           
==========================================================
  Hits                               ?    59102           
  Misses                             ?    20023           
  Partials                           ?     4417           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

AdoAdoAdo
AdoAdoAdo previously approved these changes Dec 21, 2022
@@ -37,7 +37,7 @@ func (tlp *dataTrieLeafParser) ParseLeaf(trieKey []byte, trieVal []byte) (core.K
if tlp.enableEpochsHandler.IsAutoBalanceDataTriesEnabled() {
data := &dataTrieValue.TrieLeafData{}
err := tlp.marshaller.Unmarshal(data, trieVal)
if err == nil {
if err == nil && !isEmptyTrieData(data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a TODO to remove this after we have a proper fix on the marshaller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@BeniaminDrasovean BeniaminDrasovean merged commit 6eeb50e into feat/balance-data-tries Dec 21, 2022
@BeniaminDrasovean BeniaminDrasovean deleted the trieLeafData-unmarshal branch December 21, 2022 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants