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.
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
Remove uniqueness invariant from
MastForestBuilder
#1473Remove uniqueness invariant from
MastForestBuilder
#1473Changes from 51 commits
6523811
4c77063
bc5cb74
7272a55
725eff5
62b4c52
72a7093
30d2933
c678944
a352fa2
5ae4fd5
de51e2c
03471eb
bc045b6
67a061a
a3c5d8c
b45d459
961d6f6
a4cb422
0665cf5
ef307c2
cccf018
883356a
ecec03b
aa04649
72a482b
e18c4e7
4a46d32
d959dd6
187db6b
53003b5
126931e
45539ed
ded33b4
c5e6b8b
485cbc8
191404a
5b3285e
f141c76
8dd1662
ca2d6d1
1b619e6
a30a9c7
3b280f1
41f45d4
ed09c6c
2125923
d294d20
43185ec
4c139bb
dd72f68
72b9fe5
8243fa2
4eeeb03
2ffd050
9b74a8b
245022e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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: could we add a comment here explaining why
unwrap()
is OK?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 added a comment but honestly the
unwrap()
is true by construction:MastNodeId
is only created by aMastForest
, so allMastNodeId
s are associated with aMastNode
in aMastForest
(unless you use it with the wrong mast forest or whatnot, but that's an internal error where I believe apanic!
is appropriate).We used to implement
Index
onMastForestBuilder
for this purpose, and I'm not sure why we removed it. We had added aMastForest::get_mast_node()
to be used in deserialization code, but it was not intended to be used anywhere else.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.
Yeah I was surprised we removed
Index
as well, since I thought it was more-common-than-not that we were accessing node data from the forest, by id, with an id that we know a priori is in the forest, such as this case. Might be worth adding it back if the thinking was that it wasn't being used.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.
This isn't true if the MAST nodes are exactly identical right? i.e. same hash, same decorators? I think the only condition where duplicate nodes are required/expected, are when the MAST root is the same, but the decorators differ, otherwise we can collapse duplicates into a single node as before. That way we still largely avoid duplicating a bunch of identical nodes, and only duplicate on an as-needed basis.
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.
Oops, this is what the implementation does, but forgot to fix the docstring.
Fixed in #1466