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

Is it bad that the tie breaking rule doesn't give keys a total order? #18

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

Comments

@Powersource
Copy link
Contributor

just wrote this in chat

hmmmmmmmmmmmmmm @staltz what if there's epoch A, then you discover epoch B, and the rule then says to use B. then later you discover epoch C. since epoch keys don't have a total order, this might return the rule to pick epoch A. could this break things?
they'd all have to have the same membership for this to happen, so maybe not? since there'd be no implied tombstoning from exclusion messages

@staltz
Copy link
Member

staltz commented Feb 28, 2023

Let me try to understand the problem more formally.

Given epoch keys X and Y, the tie breaking rule could pick Y, so it may seem that "Y" is "greatest", i.e.

$X < Y$

Given epoch keys X, Y, Z, the tie breaking rule could pick Z, it may seem that "Z" is "greatest", i.e.

$X < Z$ and $Y < Z$.

Blending with the results above, that gives us

$X < Y < Z$.

However, given epoch keys X and Z only, the tie breaking rule could pick X, i.e.

$Z < X$

contradicting the previous outcomes.


Could that be a problem? Perhaps it could, here's how:

graph TB;
  zero[E: a,b,c,d,e]
  zero--"a excludes c"-->X[X: a,b,d,e]
  zero--"b excludes d"-->Y[Y: a,b,c,e]
  zero--"c excludes e"-->Z[Z: a,b,c,d]
Loading

This ⬆️ is what a and b would see, and they could apply the tie breaking rule and come to the conclusion that Z is the winner. So far so good. 👍

But this ⬇️ is what c sees:

graph TB;
  zero[E: a,b,c,d,e]
  zero--"b excludes d"-->Y[Y: a,b,c,e]
  zero--"c excludes e"-->Z[Z: a,b,c,d]
Loading

And c could conclude that Z is the winner. So far so good. 👍

BUT this ⬇️ is what d sees:

graph TB;
  zero[E: a,b,c,d,e]
  zero--"a excludes c"-->X[X: a,b,d,e]
  zero--"c excludes e"-->Z[Z: a,b,c,d]
Loading

And d could come to the conclusion that X is the winner. And that's bad. 👎

@Powersource
Copy link
Contributor Author

But then if we want a b and c to know that Z should be the winner, even before they've all discovered all 3 forks, then we need to revert the current tie breaking rule and use something with an always obvious winner, like the alphabetical sort thing we discussed originally.

@staltz
Copy link
Member

staltz commented Mar 7, 2023

I have another idea: we could go back to the simple lexicographic order as before. The problem there was that you could "brute force" a strong epoch key. So what if we include the requirement that every epoch key has to do a little bit of brute forcing to get an epoch key that has 00 as the first byte? This means that whoever wants to create a strong epoch key will have to do even more brute forcing to get 00 00 as the first 2 bytes. And maybe this is too much brute forcing to be worth it.

I don't know, now that I wrote it it sounds like a weak idea.

@Powersource
Copy link
Contributor Author

yeah i think the benefit from that would be very marginal

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

2 participants