Skip to content

Instantly share code, notes, and snippets.

@rystsov
Created August 10, 2020 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rystsov/8ff42978cd0feaa0427fa6774903db50 to your computer and use it in GitHub Desktop.
Save rystsov/8ff42978cd0feaa0427fa6774903db50 to your computer and use it in GitHub Desktop.
epoch and hash
// by default ballot has a form of a tuple (tick, node_id)
// so in this piece of code
appeal = casCmd.apply(function(state) {
    if (state.epoch == epoch) {
        state.requests = requests;
        state.epoch += 1;
    }
    return state;
});
// even if a proposer has stale epoch it still compete for the register
// and potentially causes up to date proposers to retry
// we may include epoch into the ballot number to cut off the stale
// proposers: (epoch, tick, node_id)
// the next step is to reduce competition between proposers for the same epoch
// we'll achieve it if use hash of data (requests) instead of node_id: (epoch, tick, hash(requests))
// during a prepare phase a proposer may discover a competitor for the same epoch with greater hash
// in that case it picks up the competitor's request and executes prepare / accept using it. Since it uses
// the same ballot, the same value and the current epoch doesn't depends on the value of the previous epoch
// the concurrent requests don't cancel each other and the system faster achieves consensus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment