View cleanup: avoid sending the proposal in the commit
tock-ibm opened this issue · comments
Currently the commit message includes this the proposal, as well as the proposal-digest and signatures.
This is not necessary, because the proposal should exists on every node that replied with prepare...
right now this would cause the big proposal to be broadcast by all:
O(N^2) message complexity x |proposal|
message Commit {
uint64 view = 1;
uint64 seq = 2;
string digest = 3;
Signature signature = 4;
bool assist = 5;
}
You can't say it includes the proposal, because the signature data is produced by the application so we don't have control over it.
Ideally, the application will not serialize the proposal, but will only serialize something that binds to it, yet is small in size, such as the hash over the proposal, etc. etc.
It turns out that this is mainly a documentation issue. The source of the confusion is what needs to go in each field of the struct:
type Signature struct {
Id uint64
Value []byte
Msg []byte
}
This struct is filled by the application, and in Msg, it should put something that binds the proposal to the signature of it (like a hash, digest, etc) but not the proposal itself (because that would be expensive).
Solution: better document the API and add a few comments in the code.
Added a comment in here: https://github.com/SmartBFT-Go/consensus/pull/177
added a comment