mirror of
https://github.com/logos-co/roadmap.git
synced 2025-02-03 11:53:48 +00:00
Update Carnot-Specs
This commit is contained in:
parent
b69d6a4869
commit
7e931c1a3f
@ -49,53 +49,58 @@ Utilities:
|
|||||||
download(view): Download missing block for the view.
|
download(view): Download missing block for the view.
|
||||||
getMaxViewQC(qcs): returns the qc with the highest view number.
|
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
|
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
|
memberOfInternalComExceptRoot(): returns true if a node is member of internal committees within the committee tree overlay except root committee
|
||||||
childcommittee(nodeIndx): returns true if the node id in the nodeIndx is member internal node (but not root) of the overlay
|
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.
|
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
|
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:
|
#Core Functions of the Carnot consensus:
|
||||||
|
|
||||||
Func safeBlock(block){
|
Func safeBlock(block){
|
||||||
|
# this check makes sure block is not old and the previous leader did not fail
|
||||||
if block.QC != Null{
|
if block.QC != Null{
|
||||||
return block.view >= curView and block.view == block.qc.block.view + 1
|
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)
|
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
|
parentBlock = block.qc.block
|
||||||
grandparentBlock = parentBlock.qc.block
|
grandparentBlock = parentBlock.qc.block
|
||||||
return parentBlock.view = grandparentBlock.view+1
|
return parentBlock.view = grandparentBlock.view+1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Update the latest certification (qc) and view number
|
||||||
Func update_higQC(qc, aggQC){
|
Func update_higQC(qc, aggQC){
|
||||||
if qc != Null{ # Happy case
|
# Happy case
|
||||||
|
if qc != Null{
|
||||||
if qc.block.view > highQC.block.view{
|
if qc.block.view > highQC.block.view{
|
||||||
highQC = qc
|
highQC = qc
|
||||||
}
|
}
|
||||||
if qc.block.view > curView { # download blocks from missing views
|
if qc.block.view > curView { # download blocks from missing views
|
||||||
while curView++ <= qc.block.view {
|
while curView++ <= qc.block.view {
|
||||||
download(curView)
|
download(curView)
|
||||||
|
reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#reset()
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if aggQC != Null { # Unhappy case
|
# Unhappy case
|
||||||
|
if aggQC != Null {
|
||||||
if aggQC.highQC.block.view != highQC.block.view{
|
if aggQC.highQC.block.view != highQC.block.view{
|
||||||
highQC = aggQC.highQC # release the lock and adopt the global lock
|
highQC = aggQC.highQC # release the lock and adopt the global lock
|
||||||
if aggQC.highQC.block.view > curView { # download the blocks of the missed views
|
if aggQC.highQC.block.view > curView { # download the blocks of the missed views
|
||||||
while curView++ <= aggQC.highQC.view {
|
while curView++ <= aggQC.highQC.view {
|
||||||
download(curView)
|
download(curView)
|
||||||
|
reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#reset()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,16 +111,21 @@ Utilities:
|
|||||||
Func receive(block){
|
Func receive(block){
|
||||||
if block.hash is known OR block.view <= latestCommittedBlock.view {return}
|
if block.hash is known OR block.view <= latestCommittedBlock.view {return}
|
||||||
if block.parent missing{ download(block.parent)}
|
if block.parent missing{ download(block.parent)}
|
||||||
|
#Previous leader did not fail and its proposal was certified
|
||||||
if block.qc != Null
|
if block.qc != Null
|
||||||
{if block.qc.block.view <= latestCommittedBlock.view {return}}
|
{if block.qc.block.view <= latestCommittedBlock.view {return}}
|
||||||
|
|
||||||
|
# Previous leader failed
|
||||||
if block.aggQC! = Null
|
if block.aggQC! = Null
|
||||||
{
|
{
|
||||||
block.aggQC.highQC = getMaxViewQC (block.agg_qc.qcs)
|
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 block.aggQC.highQC.view <= latestCommittedBlock.view {return}
|
||||||
}
|
}
|
||||||
|
|
||||||
if safeBlock(block){
|
if safeBlock(block){
|
||||||
update_higQC(block.qc, block.aggQC)
|
update_higQC(block.qc, block.aggQC)
|
||||||
if memberOfLeafCommittee(){ send(vote, parentCommittee)
|
if memberOfLeafCommittee(){ send(vote, parentCommittee)
|
||||||
reset()
|
reset()
|
||||||
tryToCommitGrandParent(block)
|
tryToCommitGrandParent(block)
|
||||||
@ -135,7 +145,7 @@ Utilities:
|
|||||||
if vote.block missing {download(vote.block)}
|
if vote.block missing {download(vote.block)}
|
||||||
if vote.block.view < curView - 1{ return}
|
if vote.block.view < curView - 1{ return}
|
||||||
if memberOfInternalComExceptRoot(nodeIndx) {
|
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]){
|
if supermajority(collection[vote.block]){
|
||||||
send(vote, parentCommittee)
|
send(vote, parentCommittee)
|
||||||
curView++
|
curView++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user