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
tools: bugfix block-generator to handle conduit's Init block requests #5449
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5449 +/- ##
==========================================
- Coverage 55.47% 55.45% -0.02%
==========================================
Files 447 447
Lines 63290 63290
==========================================
- Hits 35108 35096 -12
- Misses 25800 25820 +20
+ Partials 2382 2374 -8 see 16 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -62,7 +62,7 @@ const ( | |||
|
|||
assetTotal = uint64(100000000000000000) | |||
|
|||
consensusTimeMilli int64 = 4500 | |||
consensusTimeMilli int64 = 3300 |
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.
recent consensus upgrade
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.
I'd just like to see the one comment added. Otherwise LGTM. Thanks for the explanation during standup.
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.
Left some comments, the conditions here were hard for me to follow
} | ||
numTxnForBlock := g.txnForRound(g.round) | ||
virtualRound := g.round + g.roundOffset | ||
if round+1 < virtualRound || virtualRound < round { |
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.
I'm finding this expression very difficult to understand. I think this expresses the same thing with fewer conditions
if round+1 < virtualRound || virtualRound < round { | |
// return cached round if available | |
if round - g.roundOffset + 1 == g.round && len(g.latestBlockMsgp) != 0{ | |
_, err := output.Write(g.latestBlockMsgp) | |
if err != nil { | |
return err | |
} | |
} | |
// "genesis" round | |
if round-g.roundOffset == 0 { | |
} | |
// previous logic |
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.
Interestingly, for me, it's more difficult to grok this new approach. I guess each of our brains has different embedded neural nets for such inequalities.
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.
Trying to integrate this approach landed at a compromise, hopefully clearer. Introducing nextRound
and cachedRound
variables: 3c4fc1c
Co-authored-by: Will Winder <wwinder.unh@gmail.com>
nextRound := g.round + g.roundOffset | ||
cachedRound := nextRound - 1 | ||
|
||
if round != nextRound && round != cachedRound { |
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.
ty 👍
Summary
Conduit's recent PR: algorand/conduit#89 broke the assumption that block-generator was making that all block requests must advance the ledger. This PR addresses this breakage by allowing more leniency to a caller which requests exactly the offset round, even if the internal counter has already advanced.
Test Plan
Unit Tests + WOMM (both on empty / non-empty DB)
How to test locally
(using
Makefile
andrun_runner.py
of #5450)