Skip to content

Commit

Permalink
doc: specifies DataChannel protocol in consensus reactor and relevant…
Browse files Browse the repository at this point in the history
… parts of StateChannel communication (#1129)

Closes #1080 by capturing the second most bandwidth intensive
communication protocol i.e., `DataChannel`.
Initially, the State channel was not included in the scope of this PR.
However, because the `DataChannel` protocol heavily relies on the
exchange of peer state, which occurs over the `StateChannel`, the
document has been expanded to address the pertinent aspects of the state
channel.

Please also note that this document will undergo additional updates in
future rounds of editing as more details and insights are gathered about
message flow, particularly concerning the updates transmitted over the
`StateChannel`, which is intricately linked with the inner workings of
the consensus state machine.
  • Loading branch information
staheri14 committed Nov 8, 2023
1 parent 0498541 commit 426edcf
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 3 deletions.
6 changes: 4 additions & 2 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"sync"
"time"

"github.com/gogo/protobuf/proto"

cstypes "github.com/cometbft/cometbft/consensus/types"
"github.com/cometbft/cometbft/libs/bits"
cmtevents "github.com/cometbft/cometbft/libs/events"
Expand All @@ -19,7 +21,6 @@ import (
sm "github.com/cometbft/cometbft/state"
"github.com/cometbft/cometbft/types"
cmttime "github.com/cometbft/cometbft/types/time"
"github.com/gogo/protobuf/proto"
)

const (
Expand Down Expand Up @@ -225,7 +226,7 @@ func (conR *Reactor) RemovePeer(peer p2p.Peer, reason interface{}) {
// ps.Disconnect()
}

// Receive implements Reactor
// ReceiveEnvelope implements Reactor
// NOTE: We process these messages even when we're fast_syncing.
// Messages affect either a peer state or the consensus state.
// Peer state updates can happen in parallel, but processing of
Expand Down Expand Up @@ -641,6 +642,7 @@ OUTER_LOOP:
Message: &cmtcons.Proposal{Proposal: *rs.Proposal.ToProto()},
}, logger) {
// NOTE[ZM]: A peer might have received different proposal msg so this Proposal msg will be rejected!
// TODO But yet we send block parts of this proposal to the peer (in the first if statement of the current function) while the proposal is rejected. This part of the protocol could be improved by sending the proposal block parts only if the proposal is accepted.
ps.SetHasProposal(rs.Proposal)
}
}
Expand Down
Loading

0 comments on commit 426edcf

Please sign in to comment.