-
Notifications
You must be signed in to change notification settings - Fork 14
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
Consensus module #5
Conversation
uint32 height = 2; | ||
uint32 baseHeight = 3; | ||
uint32 maximumHeight = 4; | ||
bytes genesisID = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does represent the genesisID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the hash of the genesis block which is used as the chain identifier.
consensus/cosipbft/forward_link.go
Outdated
DecodeForwardLink(pb proto.Message) (forwardLink, error) | ||
} | ||
|
||
// defaultChainFactory is an implementation of the defaultChainFactory interface for forward links. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// defaultChainFactory is an implementation of the defaultChainFactory interface for forward links. | |
// defaultChainFactory is an implementation of the defaultChainFactory interface | |
// for forward links. |
cosi/mod.go
Outdated
// Hashable is the interface to implement to validate an incoming message | ||
// for a collective signing. It will return the hash that will be signed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Hashable is the interface to implement to validate an incoming message | |
// for a collective signing. It will return the hash that will be signed. | |
// Hashable is the interface to implement to validate an incoming message for a | |
// collective signing. It will return the hash that will be signed. |
mino/minoch/address.go
Outdated
// AddressFactory is an implementation of the factory interface. | ||
type AddressFactory struct{} | ||
|
||
// FromText returns an instance of an address from a string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// FromText returns an instance of an address from a string. | |
// FromText returns an instance of an address from a byte slice. |
consensus/cosipbft/mod.go
Outdated
rpcName = "cosipbft" | ||
) | ||
|
||
// Consensus is the implementation of the interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Consensus is the implementation of the interface. | |
// Consensus is the implementation of the consensus.Consensus interface. |
consensus/cosipbft/mod.go
Outdated
return nil, encoding.NewAnyDecodingError(&da, err) | ||
} | ||
|
||
// The proposal first need to be validated by the caller of the module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The proposal first need to be validated by the caller of the module | |
// The proposal first needs to be validated by the caller of the module |
|
||
// LockProposal verifies the prepare signature and stores it. It also locks | ||
// the queue to prevent further committing. | ||
func (q *queue) LockProposal(to Digest, sig crypto.Signature) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if q.locked
is already true ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right !
consensus/cosipbft/storage.go
Outdated
// ReadChain returns the list of forward links to the id. It returns an error | ||
// if the target is never reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// ReadChain returns the list of forward links to the id. It returns an error | |
// if the target is never reached. | |
// ReadChain returns the list of forward links to the id (which is not | |
// included). It returns an error if the target is never reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm it is actually included in the last forward link which has to point on id.
// Validate should return the proposal decoded from the message or | ||
// an error if it is invalid. It should also return the previous | ||
// proposal. | ||
Validate(message proto.Message) (curr Proposal, prev Proposal, err error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that feels very tight to the way we make verification now, but we could imagine scenarios where a validation needs something else. What if we make the consensus use on the blockchain abstraction?
That would give something like:
Validate(message proto.Message) (bc Blockchain, blockIndex int, err error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point was to build blockchain on top of the consensus but this one should not be aware of what is a blockchain. You could totally build something on top of the consensus that is unrelated to blockchain. The benefit is that the module is responsible to create the crypto links between proposals but a proposal can be anything.
@nkcr thanks for the comments! I answered some of them, if you can have a second look. |
This extracts the logic of the consensus from the skipchain module and implements the collective signing PBFT from the byzcoin paper.
Note: skipchain to improve later.