-
Notifications
You must be signed in to change notification settings - Fork 487
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
cow: always process KvMods to add OldData to mods when building StateDeltas #4804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this entire early exit / guard clause? I don't see any point in exiting early. If those values are len == 0, the for loops should (not) run just as quickly.
+1 to remove, empty blocks are rare :) |
Removed the guard clause |
Codecov Report
@@ Coverage Diff @@
## master #4804 +/- ##
==========================================
- Coverage 54.68% 54.66% -0.03%
==========================================
Files 414 414
Lines 53550 53552 +2
==========================================
- Hits 29286 29273 -13
- Misses 21836 21851 +15
Partials 2428 2428
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Test that old data is populated by roundCowState.deltas()
kvMods[name] = ledgercore.KvValueDelta{Data: nil} | ||
// needs an old data, else optimized away. | ||
// if oldData = "" there is the best chance of a bug, so we use that | ||
kvMods[name] = ledgercore.KvValueDelta{Data: nil, OldData: []byte("")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kvMods[name] = ledgercore.KvValueDelta{Data: nil, OldData: []byte("")} | |
kvMods[name] = ledgercore.KvValueDelta{Data: nil, OldData: []byte{}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As intended, I confirmed the added tests fail in master
while passing in the PR.
@cce Thanks again for your efforts to isolate + find the issue!
Summary
Through debugging we noticed OldData was not set when it should be. Later we realized that roundCowState.deltas() was not always adding OldData to KvMods, and the early exit on empty sdeltas was the culprit.
Test Plan
Existing tests should pass, maybe we should have new tests for this kind of thing.