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
Added check for circular and out-of-range dependency problem #841
Conversation
core/parallel_state_processor.go
Outdated
if depTx >= n { | ||
return false | ||
} |
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.
If we also enforce depTx < tx
here, the circular dependency could be avoided, and we won't need the loop below. wdyt?
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.
Good point, Jerry. I agree.
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.
Done.
core/parallel_state_processor.go
Outdated
// Handle out-of-range and circular dependency problem | ||
for tx, val := range deps { | ||
for depTx := range val { | ||
if depTx >= n && depTx < tx { |
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.
Should this be ||
instead of &&
?
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.
My bad, done thanks!
core/parallel_state_processor.go
Outdated
@@ -304,6 +304,11 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat | |||
metadata = true | |||
} | |||
|
|||
if !VerifyDeps(deps) { |
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.
If deps is nil or empty, we can skip the check.
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.
Done, thanks.
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## block-stm #841 +/- ##
=============================================
- Coverage 56.79% 56.76% -0.04%
=============================================
Files 617 617
Lines 73603 73602 -1
=============================================
- Hits 41806 41780 -26
- Misses 28262 28286 +24
- Partials 3535 3536 +1
☔ View full report in Codecov by Sentry. |
POS-1391 and POS-1392