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

Specify in private-group-spec how group/init tangles should work #17

Open
Powersource opened this issue Feb 24, 2023 · 8 comments
Open

Comments

@Powersource
Copy link
Contributor

Need to update the allowed states of the group tangle on init msgs (should tangle like normal, while still being null at root)

Need to add definition for epoch tangle, that tangles different epoch inits (with root at group root)

@Powersource
Copy link
Contributor Author

@mixmix

@mixmix
Copy link
Member

mixmix commented Mar 13, 2023

Group epoch tangle

Epoch 0

flowchart RL

subgraph invitations
  0_add_0[add: Alice]
  0_add_1[add: Bob, Carol]
end

subgraph epoch_0
  0_init[init]
end


%% epoch 0 members tangle
0_add_1 --> 0_add_0 --> 0_init


classDef default fill:#fff,stroke:#000,color:#222;
classDef cluster fill:#eee,stroke:#000,color:#333;
classDef groupTangle fill:#f55,color:white;
classDef memberTangle_0 stroke:#5ff,stroke-width:3;
classDef memberTangle_1 stroke:#0f0,stroke-width:3;

class 0_init,1_init groupTangle
class 0_init,0_add_0,0_add_1,0_remove_2 memberTangle_0
class 1_init,1_add_0 memberTangle_1
Loading

Epoch 1 (remove Carol)

Init new epoch (backlinking to prior epoch), then add "remaining" members to new epoch

flowchart RL

subgraph epoch_0
  0_init[init]

  1_add_0[add: Alice, Bob]
end

subgraph epoch_1
  1_init[init]
end

%% epoch tangle
1_init -.-> 0_init


%% epoch 1 members tangle
1_add_0 --> 1_init

classDef default fill:#fff,stroke:#000,color:#222;
classDef cluster fill:#eee,stroke:#000,color:#333;
classDef groupTangle fill:#f55,color:white;
classDef memberTangle_0 stroke:#5ff,stroke-width:3;
classDef memberTangle_1 stroke:#0f0,stroke-width:3;

class 0_init,1_init groupTangle
class 0_init,0_add_0,0_add_1,0_remove_2 memberTangle_0
class 1_init,1_add_0 memberTangle_1
Loading

Second init message may look something like this:

// epoch 1
{
  type: 'group/init',
  version: 'v2',
  groupKey: new_group_key.toString('base64'),
  tangles: {
    group: {
      root: 'A',
      previous: ['X']     // last message in the "group" ?
    },
    epoch: {
      root: 'A',          // << new init points to root + previous epochs
      previous: ['A']
    },
    members: {            // initialises a new members tangle for this epoch
      root: null,
      previous: null
    }
  }
}

Announce to Carol they were removed

flowchart RL

subgraph invitations
  0_add_0[add: Alice]
  0_add_1[add: Bob, Carol]
end

subgraph epoch_0
  0_init[init]

  0_remove_2[remove: Carol]
end

%% epoch tangle

%% epoch 0 members tangle
0_remove_2 --> 0_add_1 --> 0_add_0 --> 0_init


classDef default fill:#fff,stroke:#000,color:#222;
classDef cluster fill:#eee,stroke:#000,color:#333;
classDef groupTangle fill:#f55,color:white;
classDef memberTangle_0 stroke:#5ff,stroke-width:3;
classDef memberTangle_1 stroke:#0f0,stroke-width:3;

class 0_init,1_init groupTangle
class 0_init,0_add_0,0_add_1,0_remove_2 memberTangle_0
class 1_init,1_add_0 memberTangle_1
Loading

Question: should the remove be in the epoch itself of the epoch prior? (i.e. invitations in this case)


Full diagram

flowchart RL

subgraph invitations
  0_add_0[add: Alice]
  0_add_1[add: Bob, Carol]
end

subgraph epoch_0
  0_init[init]

  1_add_0[add: Alice, Bob]
  0_remove_2[remove: Carol]
end

subgraph epoch_1
  1_init[init]
end

%% epoch tangle
1_init -.-> 0_init

%% epoch 0 members tangle
0_remove_2 --> 0_add_1 --> 0_add_0 --> 0_init

%% epoch 1 members tangle
1_add_0 --> 1_init

classDef default fill:#fff,stroke:#000,color:#222;
classDef cluster fill:#eee,stroke:#000,color:#333;
classDef groupTangle fill:#f55,color:white;
classDef memberTangle_0 stroke:#5ff,stroke-width:3;
classDef memberTangle_1 stroke:#0f0,stroke-width:3;

class 0_init,1_init groupTangle
class 0_init,0_add_0,0_add_1,0_remove_2 memberTangle_0
class 1_init,1_add_0 memberTangle_1
Loading

KEY:

  • red -..-> : epoch tangle
  • blue-border --> : epoch 0 members tangle
  • green-border --> : epoch 1 members tangle

@mixmix
Copy link
Member

mixmix commented Mar 14, 2023

This is what I had been imagining @Powersource
What do you think?
I notice I had to add a tangles.epoch as distinct from the tangles.group

I wanted that so that you could easily pull all the group/init and build a tree of the epoch inits, then off of those build up an understanding of the membership around each

@staltz
Copy link
Member

staltz commented Mar 14, 2023

Great! I love the diagrams.

Why would remove: Carol point to the additions ("invitations") feed? And what about ordering, shouldn't it be first remove: Carol and then add: Alice, Bob?

I guess the question is why did you choose these arrows like this? What purpose do they serve/enable?

@mixmix
Copy link
Member

mixmix commented Mar 14, 2023

  • remove carol does not point to the invitations feed, it points to the last message in the members tangle for the current epoch, which happens to be in the invitations feed
  • yes ordering could be different, I took a guess.
  • i think about each tangle as a story, where messages progress the narrative and connecting them makes that narrative easier to look up and reconstruct

@mixmix mixmix mentioned this issue Mar 15, 2023
@Powersource
Copy link
Contributor Author

Question: should the remove be in the epoch itself of the epoch prior? (i.e. invitations in this case)

Don't fully understand but the removal announce I think should be placed like

[group post]->[group post]->[removal announce]->[re-add members]->[re-add members]

Yeah now that I see the Full diagram it's kind of confusing why Remove: carol is placed after Add: alice, bob.


I didn't expect the members tangle to be re-inited in a new epoch, but that actually probably makes a lot of sense if we use add-members to send people the new key. Before I was thinking that we would keep the same members tangle and send people the new key using a message type different to add-members, just one that sends the new key. But now we reset the member tangle on each epoch and get a clean slate where it's kind of easy to check the current membership.

@Powersource
Copy link
Contributor Author

flowchart RL

subgraph invitations
  0_add_0[add: Alice]
  0_add_1[add: Bob, Carol]
end

subgraph epoch_0
  0_init[init]

  1_add_0[add: Alice, Bob]
  0_remove_2[remove: Carol]
end

subgraph epoch_1
  1_init[init]
end

%% epoch tangle
1_init -.-> 0_init

%% epoch 0 members tangle
0_remove_2 --> 0_add_1 --> 0_add_0 --> 0_init

%% epoch 1 members tangle
1_add_0 --> 1_init

1_init-.->0_remove_2

classDef default fill:#fff,stroke:#000,color:#222;
classDef cluster fill:#eee,stroke:#000,color:#333;
classDef groupTangle fill:#f55,color:white;
classDef memberTangle_0 stroke:#5ff,stroke-width:3;
classDef memberTangle_1 stroke:#0f0,stroke-width:3;

class 0_init,1_init groupTangle
class 0_init,0_add_0,0_add_1,0_remove_2 memberTangle_0
class 1_init,1_add_0 memberTangle_1
Loading

Added just one link for clarification, between init 1 and remove carol. I think that's the group tangle.

@mixmix
Copy link
Member

mixmix commented Mar 16, 2023

Sweet, I'll fold in the feedback and open a PR reflecting this

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

No branches or pull requests

3 participants