hyperledger-labs / hyperledger-labs/SmartBFT

Issue: Potential Blocking in BroadcastConsensus May Compromise BFT Liveness

Open
#628 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
110
Forks
39
Avg merge
2h 33m
Merged PRs (30d)
3

Description

The current implementation of BroadcastConsensus in the Controller may block when sending messages to other nodes, potentially compromising the BFT protocol's liveness. This occurs because:

c.Comm.SendConsensus(node, m) can block when gRPC's getTransport function has no available connections

The synchronous nature of the broadcast means a single blocked send can delay all subsequent messages

This blocking behavior could prevent timely dissemination of consensus messages, violating the protocol's liveness guarantees

```go
func (c *Controller) BroadcastConsensus(m *protos.Message) {
for _, node := range c.NodesList {
if c.ID == node {
continue
}
c.Comm.SendConsensus(node, m) // Synchronous call that may block
}
if m.GetPrePrepare() != nil || m.GetPrepare() != nil || m.GetCommit() != nil {
if leader, _ := c.iAmTheLeader(); leader {
c.LeaderMonitor.HeartbeatWasSent()
}
}
}
```

the proposed solution is as follows:

```go
func (c *Controller) BroadcastConsensus(m *protos.Message) {
for _, node := range c.NodesList {
if c.ID == node {
continue
}
go c.Comm.SendConsensus(node, m) // Asynchronous non-blocking call
}
if m.GetPrePrepare() != nil || m.GetPrepare() != nil || m.GetCommit() != nil {
if leader, _ := c.iAmTheLeader(); leader {
c.LeaderMonitor.HeartbeatWasSent()
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.