Difference between revisions of "IC consensus layer"
Victor.shoup (talk | contribs) m |
Victor.shoup (talk | contribs) |
||
Line 114: | Line 114: | ||
a compact multi-signature. | a compact multi-signature. | ||
The protocol will use these multi-signatures | The protocol will use these multi-signatures | ||
− | for [[#Notarization|notarizations]] and [[#Finalization| | + | for [[#Notarization|notarizations]] and [[#Finalization|finalizations]], |
which are aggregations of <math>n-f</math> signatures on messages | which are aggregations of <math>n-f</math> signatures on messages | ||
of a certain form. | of a certain form. |
Revision as of 14:43, 9 November 2022
The job of the consensus layer of the IC is to order transaction requests so that all replicas in a subnet will process such requests in the same order. There are many protocols in the literature for this problem. The IC uses a new consensus protocol, which is described here at a high level. For more details, see the paper https://eprint.iacr.org/2021/1330 (in particular, Protocol ICC1 in that paper).
Any secure consensus protocol should guarantee two properties, which (roughly stated) are:
- safety: all replicas in fact agree on the same ordering of transaction requests, and
- liveness: all replicas should make steady progress.
The paper https://eprint.iacr.org/2021/1330 proves that the IC consensus protocol satisfies both of these properties
The IC consensus protocol is designed to be
- extremely simple, and
- robust (performance degrades gracefully when some replicas are malicious).
Assumptions
As discussed in the introduction, we assume
- a subnet of
replicas, and - at most
of the replicas are faulty.
Faulty replicas may exhibit arbitrary, malicious (i.e., Byzantine) behavior.
We assume that communication is asynchronous, with no a priori
bound on the delay of messages sent between replicas.
In fact, the scheduling of message delivery may be completely under adversarial control.
The IC consensus protocol guarantees safety under this very weak communication assumption.
However, to guarantee liveness, we need to assume a form of partial synchrony,
which (roughly stated) says that the network will be periodically synchronous
for short intervals of time.
In such intervals of synchrony, all undelivered
messages will be delivered in less than time
Protocol overview
Like a number of consensus protocols, the IC consensus protocol is based on a blockchain. As the protocol progresses, a tree of blocks is grown, starting from a special genesis block that is the root of the tree. Each non-genesis block in the tree contains (among other things) a payload, consisting of a sequence of transaction requests, and a hash of the block's parent in the tree. The honest replicas have a consistent view of this tree: while each replica may have a different, partial view of this tree, all the replicas have a view of the same tree. In addition, as the protocol progresses, there is always a path of finalized blocks in this tree. Again, the honest replicas have a consistent view of this path: while each replica may have a different, partial view of this path, all the parties have a view of the same path. The transaction requests in the payloads of the blocks along this path are the ordered transaction requests will be processed by the execution layer of the Internet Computer.
The protocol proceeds in rounds.
In round
The protocol also enjoys the property known as optimistic responsiveness, which means that so long as the leader is honest, the protocol may proceed at the pace of the actual network delay, rather than some upper bound on the network delay.
Public keys
To implement the protocol, each replica is associated with a public key for the BLS signature scheme, and each replica also holds the corresponding secret signing key. The association of replicas to public keys is maintained by the Network Nervous System (NNS) of the Internet Computer. These BLS signatures will be used to authenticate messages sent by replicas.
The protocol also uses the
signature aggregation feature of BLS signatures,
which allows many signatures on the same message to be aggregated into
a compact multi-signature.
The protocol will use these multi-signatures
for notarizations and finalizations,
which are aggregations of
Random Beacon
In addition to BLS signatures and multi-signatures as discussed above,
the protocol makes use of a BLS threshold signature scheme to implement the
above-mentioned random beacon.
The random beacon for height
Block making
Each replica may at different points in time play the role of a block maker.
As a block maker in round
- the payload,
- the hash of
, - the rank of the block maker,
- the height
of the block.
After forming the block
- the block
, - the block maker's identity, and
- the block maker's signature on
.
A block maker will broadcast its block proposal to all other replicas.
Notarization
A block is effectively added to the tree of blocks when it becomes
notarized.
For a block to become notarized,
Given a proposed block
If the block is valid and certain other constraints hold,
the replica will support the notarization of the block
by broadcasting a notarization share for
- the hash of
, - the height
of , - the identity of the supporting replica, and
- the supporting replica's signature on a message comprising the hash of
and the height .
Any set of
- the hash of
, - the height
of , - the set of identities of the
supporting replicas, - an aggregation of the
signatures on the message comprising the hash of and the height .
As soon as a replica obtains a notarized block of height
The growth invariant states that each honest replica will
eventually complete each round, so that the tree of notarized blocks
continues to grow (and this holds only assuming asynchronous eventual delivery,
and not partial synchrony).
We prove the growth invariant
below.
Finalization
There may be more than one
notarized block at a given height
For a block to become finalized,
We prove the safety invariant
below.
One consequence of the safety invariant is the following.
Suppose two blocks
Delay functions
The protocol makes use of two delay functions,
Putting it all together
We now describe in more detail how the protocol works;
specifically, we describe more precisely when a replica will
propose a block and when a replica will support the notarization of a block.
A given replica
Random beacon details
As soon as a replica enters round
Block making details
Replica
Note that since
Suppose a replica
Notarization details
Replica
Proof of growth invariant
The growth invariant states that
each honest replica will
eventually complete each round.
Assume that all honest replicas have started round
Proof of safety invariant
The safety invariant states that if a block is finalized in a given round, then no other block may be notarized in that round. Here is a proof of the safety invariant:
- Suppose that the number of corrupt parties is exactly
. - If a block
is finalized, then its finalization must have been supported by a set of at least honest replicas (by the security property for aggregate signatures). - Suppose (by way of contradction) that another block
were notarized. Then its notarization must have been supported by a set of at least honest replicas (again, by the security property for aggregate signatures). - The sets
and are disjoint (by the finalization logic). - Therefore,
, which implies , a contradiction.
Proof of liveness invariant
We say that the network is
The liveness invariant may be stated as follows.
Suppose that
- the leader
in round is honest, - the first honest replica
to finish round does so at time , and - the network is
-synchronous at times and .
Then the block proposed by
Here is a proof of the liveness invariant:
- Under partial synchrony at time
, all honest replicas will enter round before time (the notarization that ended round for , as well as the necessary round random beacon shares, will arrive at all honest replicas before this time). - The leader
in round will propose a block before time , and again by partial synchrony, this block proposal will be delivered to all other replicas before time . - Since
, the protocol logic guarantees that each honest replica supports the notarization of block and no other block, and thus will become notarized and finalized.
Other issues
Growth latency
Under a partial synchrony assumption, we can also formulate and prove
a quantitative version of the growth invariant.
For simplicity, assume that the delay functions are defined
as recommended above:
Locally adjusted delay functions
When a replica does not see any finalized blocks for several rounds, it will
start increasing its own delay function
Also, while replicas do not explicitly adjust the delay function
Thus, there are many delay fucntions,
parameterized by replica and round.
The critical condition
Fairness
Another property that is important in consensus protocols is fairness. Rather than give a general definition, we simply observe that the liveness invariant also implies a useful fairness property. Recall that the liveness invariant basically says that in any round where the leader is honest and the network is synchronous, then the block proposed by the leader will be finalized. In those rounds where this happens, the fact that the leader is honest ensures that it will include in the payload of its block all of the transaction requests it knows about (modulo limits on the payload size). So, very roughly speaking, any transaction request that is disseminated to enough replicas will be included in a finalized block in a reasonable amount of time with high probability.