共識演算法在分散式系統中扮演了極其重要的角色。它能保護系統在遭到出錯或惡意的節點攻擊時仍能繼續運作,並保證系統中誠實節點的一致性 (consistency) 與活躍性(liveness)。一個共識演算法是否能達成這兩個保證需要嚴謹的安全性數學證明,否則一個設計不良的共識演算法很有可能在某些情況下無法達成保證的性質。然而,即使一個共識演算法可以達到這兩個性質,其效能仍有可能大幅被網路的狀態或惡意節點影響。即使一個演算法被證明最終能達成共識,若我們無法得知這些影響的嚴重性,我們就無法得知這個演算法是否實用。有時,單純透過理論分析去研究這些影響是很困難的,因此我們需要藉由模擬的方式去了解演算法在攻擊下的行為。本篇論文定義了一個共識演算法模擬器應有的重要特性,並設計實作了一個符合這些特性的模擬器。我們也整理了共識演算法研究領域中常見的網路模型與攻擊者模型。最後,我們在模擬器上實作了幾個共識演算法,評估它們在攻擊下的效能如何,展示我們設計的模擬器能模擬我們整理的所有網路模型與攻擊者模型。
A consensus algorithm plays a crucial role in a distributed system. It protects a system from faulty or malicious participants and guarantees consistency and liveness among honest participants. These requirements should be mathematically proved, or a poorly-designed consensus algorithm can fail to achieve them. However, the performance of a consensus algorithm may be severely affected by factors such as different network conditions or malicious attackers. Even if an algorithm is proven to be able to reach consensus eventually, if we do not know how severe the impact is, we do not know if the algorithm is practical. It is sometimes difficult to theoretically analyze the impacts. This is why a simulation-based method is needed. In this paper, we define important requirements for a consensus simulator and design and implement a simulator based on these requirements. We also define common network models and attacker models for consensus algorithms. Finally, we implement several representative consensus algorithms on our simulator, evaluate their performance under attacks and show that our simulator can simulate attacks from all network models and attacker models we defined.