Skip to content
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

Replace LeafNodeRef with leaf index. #658

Merged
merged 1 commit into from May 19, 2022
Merged

Replace LeafNodeRef with leaf index. #658

merged 1 commit into from May 19, 2022

Conversation

Bren2010
Copy link
Collaborator

@Bren2010 Bren2010 commented May 9, 2022

This seems to be a layer of indirection that doesn't add any value to implementation.

Copy link
Collaborator

@bifurcation bifurcation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion on this question, but this change seems sensible to me. The use of LeafNodeRef requires either (a) a linear scan through the tree, which is time-expensive in large trees, or (b) keeping an index that maps LeafNodeRef values to indices, which is storage-intensive in large trees.

IIRC, the change to LeafNodeRef was made in the context of @TWal's work to make the tree description less tied to the array representation. In general, that is the right thing to do, and it's good that we did it. But we still have leaf indices anyway, for unmerged_leaves. Since we still have the concept, we might as well use it where it makes sense. And it certainly seems to me like Sender.sender and removed make sense, since they are internal to the protocol.

In case folks are worried about the application-facing API -- MLS stacks can certainly be more intelligent, e.g., exposing remove(LeafNodeRef) or remove(ApplicationIDFromExtension) or remove(SignaturePublicKey). But they can do that regardless of this PR.

Comment on lines +1336 to +1339
Internally to the protocol, group members are uniquely identified by their leaf
index. However, a leaf index is only valid for referring to members in a given
epoch. The same leaf index may represent a different member, or no member at
all, in a subsequent epoch.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a little more concrete: A member's leaf index is stable while that member is part of the group, but before that member joins or after they leave, a different member may occupy that leaf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants