# FlexBFT: A Flexible and Effective Optimistic Asynchronous BFT Protocol
## 1 Introduction
In adversarial networks, the fast lane, resembling semisynchronous consensus, rarely advances. Adversaries initiate failures, switch to the slow lane, and then encounter repeated failures in subsequent consensus rounds after producing output in the slow lane. Consequently, optimistic asynchronous consensus degenerates into complete asynchronous consensus, marked by the inefficiency of a failing fast lane and frequent switches, diminishing its effectiveness compared with pure asynchronous consensus. In this paper, we introduce FlexBFT, a groundbreaking and adaptable optimistic asynchronous consensus framework poised to substantially enhance overall consensus performance. As Figure 1 shows, the pivotal innovation revolves around the sustained utilization of the slow lane, called back-up mode in FlexBFT. In this revamped approach, the slow lane serves not only as a fallback option in case of fast lane failure but also as an additional entry point for each consensus round (originally, only the fast lane is). In favorable network conditions, FlexBFT orchestrates consensus through its fast lane, also called fast mode in FlexBFT. However, when confronted with elevated network latency, FlexBFT gracefully transitions to the slow lane for multiple rounds. It persists in operating within the slow lane until it identifies an improvement in network conditions, at which point it reverts to the fast lane. This approach circumvents the burden of a faltering fast lane and the resource wastage associated with frequent switches in the presence of persistent asynchronous networks. Instead, it continuously conducts consensus optimally, namely, through the persistent execution of the slow lane. Furthermore, this paper offers the flexibility to integrate decoupled consensus modules, further enhancing performance with minimal associated costs. Among the myriad use cases for blockchain, we highlight two scenarios particularly suited to FlexBFT. The first is the Internet of Things (IoT) context, where, with the evolution of IoT concepts, the decentralized management of IoT devices becomes increasingly logical. These devices are characterized by the potential need to process a large number of transactions and the unpredictability of communication stability. Thus, FlexBFT, capable of providing objective scalability in unstable networks, is well suited for IoT scenarios. The second scenario is cross-border trade, a realm where blockchain inherently fits well within financial contexts. The network of nodes spread across the globe in cross-border trade represents an asynchronous network, for which FlexBFT can offer a secure and efficient consensus process. Our work in this paper encompasses the following significant contributions:  
* Design of FlexBFT: We introduce FlexBFT, a highly adaptable optimistic asynchronous framework built upon Bolt-Dumbo Transformer (BDT) [14]. A standout feature of FlexBFT is its ability to persistently operate slow lanes, even in the presence of continuous asynchronous network conditions. Additionally, FlexBFT dynamically reactivates fast lanes when improvements in the network environment are detected. This flexible approach enables FlexBFT to effectively address diverse network scenarios, facilitating optimal consensus while reducing system overhead and latency. * Flexible integration of consensus modules: We provide the flexibility to integrate decoupled consensus modules within FlexBFT, contributing to enhanced performance. These modules encompass the utilization of verified information delivery (VID) in the fast lane, achieving consensus prior to downloading, and concurrent execution of the fast lane within the slow lane in back-up mode to fully exploit available bandwidth resources. Our approach prioritizes efficient resource allocation by separating considerations for bandwidth resources and communication resources. * Implementation and simulation: We have implemented FlexBFT using Python 3.7.4 and conducted comprehensive simulation experiments.