-
Notifications
You must be signed in to change notification settings - Fork 215
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
[Merged by Bors] - detect double atx-merging malfeasance #6135
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6135 +/- ##
=======================================
Coverage 82.0% 82.0%
=======================================
Files 308 308
Lines 33844 33905 +61
=======================================
+ Hits 27761 27813 +52
- Misses 4310 4317 +7
- Partials 1773 1775 +2 ☔ View full report in Codecov by Sentry. |
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.
other than the tiny logging comment - LGTM
@@ -62,6 +63,10 @@ func decoder(fn decoderCallback) sql.Decoder { | |||
stmt.ColumnBytes(12, a.CommitmentATX[:]) | |||
} | |||
a.Weight = uint64(stmt.ColumnInt64(13)) | |||
if stmt.ColumnType(14) != sqlite.SQLITE_NULL { | |||
a.MarriageATX = new(types.ATXID) | |||
stmt.ColumnBytes(14, a.MarriageATX[:]) |
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.
NIT:
stmt.ColumnBytes(14, a.MarriageATX[:]) | |
stmt.ColumnBytes(14, a.MarriageATX.Bytes()) |
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.
Why prefer .Bytes()
over [:]
?
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.
Mostly because of readability 🙂
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 guess it depends 🤷. Slicing is the idiomatic way of getting bytes from an array.
catx.Units = make(map[types.NodeID]uint32) | ||
if stmt.ColumnType(9) != sqlite.SQLITE_NULL { | ||
catx.MarriageATX = new(types.ATXID) | ||
stmt.ColumnBytes(9, catx.MarriageATX[:]) |
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.
stmt.ColumnBytes(9, catx.MarriageATX[:]) | |
stmt.ColumnBytes(9, catx.MarriageATX.Bytes()) |
Co-authored-by: Matthias Fasching <5011972+fasmat@users.noreply.github.com>
bors merge |
Merge conflict. |
bors merge |
## Motivation Publishing two merged ATXs in the same epoch is forbidden, even if the sets of IDs participating in both are disjoint. For example, given a married set of IDs (A, B, C, D), it's not allowed to publish two merged ATXs, one with IDs (A, B) and the second with (C, D). The C and D can publish **separately**.
Pull request successfully merged into develop. Build succeeded: |
Motivation
Publishing two merged ATXs in the same epoch is forbidden, even if the sets of IDs participating in both are disjoint.
For example, given a married set of IDs (A, B, C, D), it's not allowed to publish two merged ATXs, one with IDs (A, B) and the second with (C, D). The C and D can publish separately.
Description
Added a
marriage_atx
column toatxs
table to quickly identify if a given marriage_atx was already used in a given epoch (only a merged ATX references a marriage_atx).Updated the checkpoint-recovery to persist
marriage_atx
.Test Plan
added tests
TODO