Update Carnot-Specs

This commit is contained in:
mjalalzai 2023-02-27 10:26:23 -08:00 committed by GitHub
parent b69d6a4869
commit 7e931c1a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,53 +49,58 @@ Utilities:
download(view): Download missing block for the view.
getMaxViewQC(qcs): returns the qc with the highest view number.
memberOfLeafCommittee(): returns true if a node is in the leaf committee of the committee overlay
memberOfInternalComExceptRoot(): returns true if a node is member of internal committees within the committee tree overlay
childcommittee(nodeIndx): returns true if the node id in the nodeIndx is member internal node (but not root) of the overlay
memberOfInternalComExceptRoot(): returns true if a node is member of internal committees within the committee tree overlay except root committee
childcommittee (signer): returns true if the node id (signer) in the nodeIndx is member of the child committee
supermajority(votes): returns if the number of distinctive signers of votes for a block is is equal to the threshold or returns if the qourum size has reached.
morethanSsupermajority(votes): returns if the number of distinctive signers of votes for a block is is more than the threshold
#Core Functions of the Carnot consensus:
Func safeBlock(block){
# this check makes sure block is not old and the previous leader did not fail
if block.QC != Null{
return block.view >= curView and block.view == block.qc.block.view + 1
}
if block.aggQC != Null{
# this meails previous leader/leaders have failed. But still we need to check if the block is not old and the block extends from a valid ancestor.
if block.aggQC != Null{
return block.view >= curView and extends(block, block.aggQC.highQC.block)
}
}
Func tryToCommitGrandParent(block){
# Commit a grand parent if the grandparent and the parent have been added during two consecutive views.
Func tryToCommitGrandParent(block){
parentBlock = block.qc.block
grandparentBlock = parentBlock.qc.block
return parentBlock.view = grandparentBlock.view+1
}
#Update the latest certification (qc) and view number
Func update_higQC(qc, aggQC){
if qc != Null{ # Happy case
# Happy case
if qc != Null{
if qc.block.view > highQC.block.view{
highQC = qc
}
if qc.block.view > curView { # download blocks from missing views
while curView++ <= qc.block.view {
download(curView)
reset()
}
}
#reset()
}
}
if aggQC != Null { # Unhappy case
# Unhappy case
if aggQC != Null {
if aggQC.highQC.block.view != highQC.block.view{
highQC = aggQC.highQC # release the lock and adopt the global lock
if aggQC.highQC.block.view > curView { # download the blocks of the missed views
while curView++ <= aggQC.highQC.view {
download(curView)
reset()
}
}
#reset()
}
}
@ -106,16 +111,21 @@ Utilities:
Func receive(block){
if block.hash is known OR block.view <= latestCommittedBlock.view {return}
if block.parent missing{ download(block.parent)}
#Previous leader did not fail and its proposal was certified
if block.qc != Null
{if block.qc.block.view <= latestCommittedBlock.view {return}}
# Previous leader failed
if block.aggQC! = Null
{
block.aggQC.highQC = getMaxViewQC (block.agg_qc.qcs)
# Since verification of signatures is not included in this psuedocode, it is worth mentioning that here verification of block.aggQC.highQC
# along with the block.aggQC.signature is suffice. No need to verify each qc inside block.aggQC
if block.aggQC.highQC.view <= latestCommittedBlock.view {return}
}
if safeBlock(block){
update_higQC(block.qc, block.aggQC)
update_higQC(block.qc, block.aggQC)
if memberOfLeafCommittee(){ send(vote, parentCommittee)
reset()
tryToCommitGrandParent(block)
@ -135,7 +145,7 @@ Utilities:
if vote.block missing {download(vote.block)}
if vote.block.view < curView - 1{ return}
if memberOfInternalComExceptRoot(nodeIndx) {
if childcommittee(vote.signer) { collection[vote.block].append(vote)}
if childcommittee (vote.signer) { collection[vote.block].append(vote)}
if supermajority(collection[vote.block]){
send(vote, parentCommittee)
curView++