Fix false positive in boolean flag #500
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This caused some head scratching whilst debugging. Not sure about what to do here. Closing this in favor of a different diff is fine by me.
In short, we set a boolean flag
WasBidSaved
, which we also log aswasBidSavedInRedis
as soon as we add a command to store the bid to the pipeline. But, when top bid == prev top bid, we return early and never execute the pipeline, making the flag a false positive. It andWasTopBidUpdated
are also false positives in six or so early-return error branches, but currently do not get used in those scenarios.Because this flag returned a false positive, Redis would not store the bid, but because we say it did, in
handleSubmitNewBlock
, memcached would actually store the payload! If I'm not mistaken, this would mean for bids which hit this path, when the proposer asks for a payload, it would not be found in Redis, but get served from memcached instead of postgres. For this narrow case, fixing the false positive would lead to worse performance for "non top bid bids".Getting rid of the false positive is great, but the location the flag ends up getting set in is rather counter-intuitive. I think it's worth the trade-off, perhaps someone has ideas for how to better set this flag the first time Exec is called which happens to be in another function entirely. Perhaps it was never even the intention to drop the queued commands in the pipeline. Not sure.
✅ I have run these commands
make lint
. Many errors, none my code.make test-race
go mod tidy
CONTRIBUTING.md