目录
正在加载目录…
正在阅读专栏 分布式共识系统专栏 第 30 篇 · 共 59 篇 · 51%

MIT 6.5840:Lecture 21 Byzantine Fault Tolerance

发布于 2026-09-21 10:06 · 最后编辑于 2026-09-21 18:14 · 版本 v2 · 字数 19,146 · 预计阅读 39 分钟 👁 25 次阅读

本篇逐行译注 MIT 6.5840 Spring 2026 Lecture 21,覆盖 Byzantine faults、PBFT、replicated state machine、quorum intersection、primary、view change、PRE-PREPARE/PREPARE/COMMIT、checkpoints 与 recovery。

MIT 6.5840:Lecture 21 Byzantine Fault Tolerance

TL;DR

  • 问题升级:BFT 要容忍 replicas 主动发送错误结果、违反 protocol,甚至被 attacker 控制。
  • PBFT 的条件:使用 3f+1 个 replicas,最多 f 个 faulty;至少 2f+1 个 replicas non-faulty。
  • 消息阶段:PRE-PREPARE → PREPARE → COMMIT;收到足够多 COMMIT 后才 execute。
  • Faulty primary:通过 timeout、view change、NEW-VIEW 和 signed evidence 轮换 primary。
  • 恢复:checkpoints、logs 和 cryptographic optimizations 帮助 good nodes recovery。

名词解释

名词含义本讲对应物
Byzantine fault节点任意、恶意或不遵守 protocol 的 failurefaulty replica
Fail-stop节点停止但不伪造行为的 failure modelRaft 的基本假设
BFTByzantine Fault TolerancePBFT
PBFTPractical Byzantine Fault ToleranceCastro-Liskov 1999
Primary选择 concurrent requests order 的 replicaview 中的 v mod n
PRE-PREPAREprimary 提议 op 和 sequence number第一阶段
PREPAREreplicas 广播 proposal 确认第二阶段
COMMITreplicas 确认可以安全执行第三阶段
View change发现 primary 无 progress 后换 primaryNEW-VIEW
Quorum intersection两个 2f+1 quorum 至少共享一个 good replica防止冲突结果
Checkpoint截断 log、帮助 recovery 的状态快照PBFT 工程优化

目录

章节内容
版本与来源固定 BFT 源文件
原文逐行翻译按 l-bft.txt 顺序译注
机制小结BFT quorum、PBFT phases 与 view change
本篇验收源行、图示和消息流程记录

版本与来源

  • 课程版本:MIT 6.5840 Spring 2026 Schedule 中的 Lecture 21;官方源文件标题保留为 6.5840 2024 Lecture 22。
  • Lecture 源文件:l-bft.txt,342 行,非空源行 289 行,SHA-256:8ba9633dffa0e8a64277d97e45b9f2e436720f9715fa6e10c1f1401eee4d7767。
  • 配套论文:Practical Byzantine Fault Tolerance,Castro and Liskov,OSDI 1999。
  • 课程日程:MIT 6.5840 Spring 2026 Schedule。
  • 翻译边界:英文源行按原顺序保留,随后给出中文译文;Byzantine、BFT、PBFT、primary、view、PRE-PREPARE、PREPARE、COMMIT、NEW-VIEW、quorum、checkpoint、client 和 replica 等术语原样保留。
  • 图片结论:源文本没有独立图片文件;client/server diagrams、设计 2/3/4 的 ASCII 时序图和消息流程按原文位置保留。

原文逐行翻译

主题与阅读动机

6.5840 2024 Lecture 22: Security: Byzantine Fault Tolerance

6.5840 2024 年 Lecture 22:Security:Byzantine Fault Tolerance。

Paper: "Practical byzantine fault tolerance" by Castro and Liskov (OSDI'99)

Paper:《Practical byzantine fault tolerance》,作者 Castro 和 Liskov(OSDI'99)。

why are we reading this paper?

为什么阅读这篇 paper?

impressive result

这是一个 impressive result。

solves a strictly harder problem than Raft

它解决了一个严格比 Raft 更难的问题。

namely state-machine replication in the presence of malicious replicas

即在存在 malicious replicas 时进行 state-machine replication。

many follow-on papers

有许多 follow-on papers。

BFT is not widely-used today

BFT 今天并没有被 widely-used。

people rely on prevention and detection of compromised nodes

people 依赖对 compromised nodes 的 prevention 和 detection。

BFT is seeing a come back for bitcoin-like systems

BFT 正在 bitcoin-like systems 中 come back。

Bitcoin solves consensus with malicious participants

Bitcoin 用 malicious participants 解决 consensus。

  But, proof-of-work and long delays to resolve forks

但它依赖 proof-of-work,resolve forks 还会有 long delays。

Stellar generalizes PBFT for federated deployments

Stellar 为 federated deployments generalizes PBFT。

IBM's hyperledger uses PBFT

IBM 的 hyperledger 使用 PBFT。

Fault model 的升级

we've considered many fault-tolerance protocols

我们已经考虑过许多 fault-tolerance protocols。

have always assumed "fail-stop" failures -- like power failure

一直假设“fail-stop” failures——例如 power failure。

i.e. servers follow the protocol

也就是说 servers 遵守 protocol。

hard enough: crash vs network down; network partition

这已经足够困难:crash 与 network down;network partition。

can one handle a larger class of failures?

能否处理更大一类 failures?

buggy servers, that compute incorrectly rather than stopping?

会错误计算而不是停止的 buggy servers?

servers that don't follow the protocol?

不遵守 protocol 的 servers?

servers that have been modified by an attacker?

被 attacker 修改过的 servers?

often called "Byzantine" faults

通常称为“Byzantine” faults。

Paper 的 approach

the paper's approach:

paper 的 approach:

replicated state machine

replicated state machine。

assumes 2f+1 of 3f+1 are non-faulty

假设 3f+1 个中的 2f+1 个是 non-faulty。

use voting to select the right results

使用 voting 选择正确结果。

not as easy as it might sound

并不像听起来那么容易。

Worst case

let's assume the worst case:

假设 worst case:

a single attacker controls the f faulty replicas

一个 attacker 控制 f 个 faulty replicas。

and is actively trying to break the system

并且 actively trying to break the system。

if we can handle this, we can handle bugs in f replicas too

如果能处理这种情况,也就能处理 f 个 replicas 中的 bugs。

Attacker 的 powers

what are the attacker's powers?

attacker 有哪些 powers?

supplies the code that faulty replicas run

提供 faulty replicas 运行的 code。

knows the code the non-faulty replicas are running

知道 non-faulty replicas 正在运行的 code。

knows the faulty replicas' crypto keys

知道 faulty replicas 的 crypto keys。

can read network messages

可以读取 network messages。

can temporarily force messages to be delayed via DoS

可以通过 DoS 暂时 force messages 被 delayed。

哪些 faults 不会发生

what faults can't happen?

哪些 faults 不会发生?

no more than f out of 3f+1 replicas can be faulty

3f+1 个 replicas 中最多 f 个 faulty。

no client failure -- clients never do anything bad

没有 client failure——clients 永远不会做 bad things。

no guessing of crypto keys or breaking of cryptography

不会猜到 crypto keys,也不会 break cryptography。

Example use scenario

example use scenario:

example use scenario:

RM:

RM:

echo A > grade

echo A > grade。

echo B > grade

echo B > grade。

tell FK "the grade file is ready"

告诉 FK“grade file 已 ready”。

FK:

FK:

cat grade

cat grade。

a faulty system could:

faulty system 可能:

totally make up the file contents

完全捏造 file contents。

execute write("A") but ignore write("B")

执行 write("A") 但 ignore write("B")。

show "B" to RM and "A" to FK

向 RM 显示“B”,向 FK 显示“A”。

execute write("B") only only some of the replicas

只在 some replicas 上执行 write("B")。

设计自己的 BFT RSM

let's try to design our own byzantine-fault-tolerant RSM

尝试设计自己的 byzantine-fault-tolerant RSM。

start simple (and broken), work towards paper's design

从 simple(且 broken)的设计开始,逐步接近 paper 的 design。

Design 1

design 1:

design 1:

[client, n servers]

[client, n servers]。

n servers

n 个 servers。

servers don't have the same exploits

servers 不具有相同的 exploits。

different OSes, different service implementations, etc. 

different OSes、different service implementations 等。

client and servers have public-key pairs

client 和 servers 都有 public-key pairs。

every message is signed by sending

每条 message 都由 sender signed。

recipients authenticate a message

recipients 对 message 做 authenticate。

client sends request to all servers

client 向所有 servers 发送 request。

waits for all n to reply

等待全部 n 个 servers reply。

authenticates replies

authenticate replies。

only proceeds if all n agree

只有全部 n 个 agree 才继续。

Design 1 的问题

what's wrong with design 1?

design 1 有什么问题?

one server may have been compromised

一个 server 可能已经被 compromised。

that one server can stop progress by disagreeing

这一个 server 可以通过 disagreeing 阻止 progress。

Design 2

design 2:

design 2:

let's have replicas vote

让 replicas vote。

2f+1 servers, assume no more than f are faulty

2f+1 个 servers,假设最多 f 个 faulty。

client waits for f+1 matching replies

client 等待 f+1 个 matching replies。

if only f are faulty, and network works eventually, must get them!

如果只有 f 个 faulty,且 network eventually works,就一定能得到它们!

Design 2 的 2f+1 问题

what's wrong with design 2's 2f+1?

design 2 的 2f+1 有什么问题?

f+1 matching replies might be f bad nodes and just 1 good

f+1 个 matching replies 可能来自 f 个 bad nodes 和仅仅 1 个 good node。

so maybe only one good node got the operation!

所以可能只有一个 good node 收到了 operation!

next operation also waits for f+1

next operation 也等待 f+1 个。

might *not* include that one good node that saw op1

可能不包含那个看到 op1 的 good node。

example: (see drawing below)

example:(见下面的 drawing)。

f g1 g2 (f is faulty/bad)

f g1 g2(f 是 faulty/bad)。

everyone hears and replies to write("A")

everyone 都听到并 reply write("A")。

f and g1 reply to write("B"), but g2 misses it

f 和 g1 reply write("B"),但 g2 miss 它。

  client can't wait for g2 since it may be the one faulty server

client 不能等待 g2,因为 g2 可能就是 faulty server。

f and g2 reply to read(), but g1 misses it

f 和 g2 reply read(),但 g1 miss 它。

so read() yields "A"

所以 read() 得到“A”。

result: client tricked into accepting a reply based on out-of-date state

结果:client 被 tricked,接受了基于 out-of-date state 的 reply。

e.g. TA reads A instead of B from grades file

例如 TA 从 grades file 中读到 A,而不是 B。

e.g. Breaks correctness; it should provide linearizability (return B)

例如破坏 correctness;它应该提供 linearizability(return B)。

   Put k=A       Put k=B     Get k   ->   A   (f lies, sending A too)

Put k=A Put k=B Get k -> A (f lies, sending A too)。

C --------------------------------------------------

C --------------------------------------------------。

       ^ ^ ^      \   ^  ^    \   ^     ^

^ ^ ^ \ ^ ^ \ ^ ^。

    \ / / /        \/  /       \ /     /

\ / / / / / \ / /。

f --------------------------------------------------

f --------------------------------------------------。

     \/  /           \/         \    /

/ / / \ /。

g1 --------------------------------------------------

g1 --------------------------------------------------。

       \/                         \/

/ /。

g2 --------------------------------------------------

g2 --------------------------------------------------。

        A                         

A。

==> Need to to ensure that replies include majority of good nodes, so that

==> Need to to ensure that replies include majority of good nodes, so that。

at least one will return B later

at least one will return B later。

Design 3

design 3:

design 3:

3f+1 servers, of which at most f are faulty

3f+1 个 servers,其中最多 f 个 faulty。

client waits for 2f+1 matching replies

client 等待 2f+1 个 matching replies。

== f bad nodes plus a majority of the good nodes

== f 个 bad nodes 加上 good nodes 的 majority。

so all sets of 2f+1 overlap in at least one good node

因此所有 2f+1 集合至少 overlap 一个 good node。

example (see below):

example(见下方):

f g1 g2 g2 (f is faulty/bad)

f g1 g2 g2(f 是 faulty/bad)。

everyone hears write("A")

everyone 都听到 write("A")。

f, g1, g2 process write("B"), g3 misses it

f、g1、g2 process write("B"),g3 miss 它。

now the read()

现在 read()。

  client will wait for 2f+1=3 matching replies

client 会等待 2f+1=3 个 matching replies。

  f and g3 will reply "A"

f 和 g3 reply “A”。

  g1 and g2 will reply "B"

g1 和 g2 reply “B”。

client doesn't know what to believe (neither is 2f+1)

client 不知道该相信什么(两者都不是 2f+1)。

  but it is guaranteed to see there's a problem

但它必然能看到存在问题。

so client can detect that some good nodes missed an operation

所以 client 可以 detect 某些 good nodes miss 了一个 operation。

we'll see how to repair in a bit

稍后会看到如何 repair。

   Put k=A        Put k=B       Get k: A  B    B  A 

Put k=A Put k=B Get k: A B B A。

C --------------------------------------------------

C --------------------------------------------------。

       ^ ^ ^  ^     \  ^  ^ ^     \   ^  ^    ^ ^

^ ^ ^ ^ \ ^ ^ ^ \ ^ ^ ^ ^。

    \ / / /  /       \/  / /       \ /   /   / /

\ / / / / / / / \ / / / /。

f --------------------------------------------------

f --------------------------------------------------。

     \/  /  /         \/  /          \ /   / /

/ / / / / \ / / /。

g1 --------------------------------------------------

g1 --------------------------------------------------。

       \/  /           \/              \/  /

/ / / / /。

g2 --------------------------------------------------

g2 --------------------------------------------------。

        \/                              \/

/ /。

g3 --------------------------------------------------

g3 --------------------------------------------------。

多 clients 与 ordering

what about handling multiple clients?

如何处理 multiple clients?

non-faulty replicas must process operations in the same order!

non-faulty replicas 必须以 same order process operations!

let's have a primary to pick order for concurrent client requests

让 primary 为 concurrent client requests 选择 order。

but we have to worry about a faulty primary

但必须担心 faulty primary。

what can a faulty primary do?

faulty primary 能做什么?

  1. ignore a client op
  1. ignore 一个 client op。
  1. different ops to different replicas
  1. 向不同 replicas 发送 different ops。
  1. send wrong result to client
  1. 向 client 发送 wrong result。

处理 faulty primary 的 general approach

general approach to handling faulty primary

处理 faulty primary 的 general approach。

  1. clients notify replicas of each operation, as well as primary
  1. clients 把每个 operation 同时 notify replicas 和 primary。
  1. replicas exchange info about ops sent by primary
  1. replicas exchange primary 发送的 ops 信息。
  1. replicas send results direct to client
  1. replicas 直接把 results 发送给 client。
  1. each replica watches progress of each operation
  1. 每个 replica watch 每个 operation 的 progress。
 if no progress, force change of primary

如果没有 progress,则 force change of primary。

为什么需要第二轮 messages

can a replica execute an operation when it first receives it from primary?

replica 第一次从 primary 收到 operation 时能 execute 吗?

no: maybe primary gave different ops to different replicas

不能:primary 可能把 different ops 给了 different replicas。

if we execute before we're sure, we've wrecked the replica's state

如果在确定之前 execute,就会 wreck replica 的 state。

need 2nd round of messages to make sure all good replicas got the same op

需要第 2 轮 messages,以确保所有 good replicas 得到同一个 op。

Design 4:带 primary 的协议

design 4 (with primary):

design 4(带 primary):

3f+1 servers, one is primary, f faulty, primary might be faulty

3f+1 个 servers,其中一个是 primary,f 个 faulty,primary 也可能 faulty。

client sends request to primary AND to each replica

client 把 request 发送给 primary AND 每个 replica。

primary chooses next op and op #

primary 选择 next op 和 op #。

primary sends PRE-PREPARE(op, n) to replicas

primary 向 replicas 发送 PRE-PREPARE(op, n)。

each replica sends PREPARE(op, n) to all replicas

每个 replica 向所有 replicas 发送 PREPARE(op, n)。

if replica gets matching PREPARE(op, n) from 2f+1 replicas (incl itself)

如果 replica 从 2f+1 个 replicas(包括自身)收到 matching PREPARE(op, n),

and n is the next operation #

且 n 是 next operation #,

execute the operation, possibly modifying state

execute operation,可能修改 state。

send reply to client

向 client 发送 reply。

else:

否则:

keep waiting

继续 waiting。

client is happy when it gets f+1 matching replies

client 得到 f+1 个 matching replies 时就 happy。

op                                                                  f+1  matching replies

op f+1 matching replies。

C ---------------------------------------------------------------------------------------

C ---------------------------------------------------------------------------------------。

                                                 ^      ^
    \ pre-P (op,n)      PREPARE   2f+1 matching replies p /      /

\ pre-P (op,n) PREPARE 2f+1 matching replies p / /。

p ---------------------------------------------------------------------------------------

p ---------------------------------------------------------------------------------------。

     \       \    ^ ^    \   ^ ^   / \  2f+1 matching replies  /

\ \ ^ ^ \ ^ ^ / \ 2f+1 matching replies /。

g1 --------------------------------------------------------------------------------------

g1 --------------------------------------------------------------------------------------。

       \       \ / /      \ / /    \  /

\ \ / / \ / / \ /。

g2 --------------------------------------------------------------------------------------

g2 --------------------------------------------------------------------------------------。

        \       \/         \/       \/

\ / / /。

g3 --------------------------------------------------------------------------------------

g3 --------------------------------------------------------------------------------------。

回顾策略与 non-faulty primary

remember our strategy:

回顾我们的 strategy:

primary follows protocol => progress

primary follows protocol ⇒ progress。

no progress => replicas detect and force change of primary

no progress ⇒ replicas detect 并 force change of primary。

if the primary is non-faulty, can faulty replicas prevent correct progress?

如果 primary 是 non-faulty,faulty replicas 能阻止 correct progress 吗?

they can't forge primary msgs

它们不能 forge primary msgs。

they can delay msgs, but not forever

它们可以 delay msgs,但不能永远 delay。

they can do nothing: but they aren't needed for 2f+1 matching PREPAREs

它们可以什么也不做:但 2f+1 matching PREPAREs 不需要它们全部参与。

they can send correct PREPAREs

它们可以发送 correct PREPAREs。

and DoS f good replicas to prevent them from hearing ops

并 DoS f 个 good replicas,使它们听不到 ops。

but those replicas will eventually hear the ops from the primary

但这些 replicas eventually 会从 primary 听到 ops。

worst outcome: delays

最坏结果:delays。

Faulty primary 是否会造成 undetectable problem

if the primary is faulty, will replicas detect any problem?

如果 primary 是 faulty,replicas 会 detect problem 吗?

or can primary cause undetectable problem?

还是 primary 能造成 undetectable problem?

primary can't forge client ops -- signed

primary 不能 forge client ops——它们是 signed 的。

it can't ignore client ops -- client sends to all replicas

它不能 ignore client ops——client 会发送给所有 replicas。

it can try to send in different order to different replicas,

它可以尝试按 different order 发给 different replicas,

or try to trick replicas into thinking an op has been

或者 trick replicas,让它们认为一个 op 已经

processed even though it hasn't

被 processed,尽管实际上没有。

will replicas detect such an attack?

replicas 会 detect 这种 attack 吗?

Faulty primary 向不同 replicas 发送不同 ops

results of the primary sending diff ops to diff replicas?

primary 向 different replicas 发送 different ops 的结果是什么?

case 1: all good nodes get 2f+1 matching PREPAREs

case 1:所有 good nodes 都得到 2f+1 matching PREPAREs。

did they all get the same op?

它们得到的是同一个 op 吗?

yes: everyone who got 2f+1 matching PREPAREs must have gotten same op

是:每个得到 2f+1 matching PREPAREs 的节点必然得到同一个 op。

  since any two sets of 2f+1 share at least one good server

因为任意两个 2f+1 sets 至少共享一个 good server。

result: all good nodes will execute op, client happy

结果:所有 good nodes 都会 execute op,client happy。

case 2: >= f+1 good nodes get 2f+1 matching PREPARES

case 2:>= f+1 个 good nodes 得到 2f+1 matching PREPARES。

again, no disagreement possible

同样不可能 disagreement。

result: f+1 good nodes will execute op, client happy

结果:f+1 个 good nodes 会 execute op,client happy。

BUT up to f good nodes don't execute

BUT 最多 f 个 good nodes 不 execute。

  can they be used to effectively roll back the op?

它们能被用来 effectively roll back 这个 op 吗?

  i.e. send the write("B") to f+1, send read() to remaining f

也就是把 write("B") 发送给 f+1 个,把 read() 发送给剩下的 f 个。

  no: won't be able to find 2f+1 replicas with old state

不能:无法找到 2f+1 个拥有 old state 的 replicas。

  so no enough PREPAREs

因此没有足够的 PREPAREs。

case 3: < f+1 good nodes get 2f+1 matching PREPAREs

case 3:< f+1 个 good nodes 得到 2f+1 matching PREPAREs。

result: client never gets a reply

结果:client 永远得不到 reply。

result: system will stop, since f+1 stuck waiting for this op

结果:system 会 stop,因为 f+1 个节点 stuck waiting for this op。

View change

how to resume operation after faulty primary?

faulty primary 之后如何 resume operation?

need a view change to choose new primary

需要 view change 来选择 new primary。

(this view change only chooses primary; no notion of set of live servers)

(这个 view change 只选择 primary;没有 set of live servers 的 notion。)

when does a replica ask for a view change?

replica 何时请求 view change?

if it sees a client op but doesn't see 2f+1 matching PREPAREs

如果它看到 client op,却看不到 2f+1 matching PREPAREs。

after some timeout period

在某个 timeout period 之后。

is it OK to trigger a view change if just one replica asks?

仅一个 replica 请求时 trigger view change 可以吗?

no: faulty replicas might cause constant view changes

不可以:faulty replicas 可能导致 constant view changes。

let's defer the question of how many replicas must ask for

把需要多少 replicas 请求的问题暂时 defer。

a view change

view change。

选择 next primary

who is the next primary?

谁是 next primary?

need to make sure faulty replicas can't always make themselves next primary

必须确保 faulty replicas 不能总把自己变成 next primary。

view number v

view number v。

primary is v mod n

primary 是 v mod n。

so primary rotates among servers

因此 primary 在 servers 之间 rotate。

at most f faulty primaries in a row

连续最多 f 个 faulty primaries。

View change design 1

view change design 1 (not correct)

view change design 1(not correct)。

replicas send VIEW-CHANGE requests to new primary

replicas 向 new primary 发送 VIEW-CHANGE requests。

new primary waits for enough view-change requests

new primary 等待足够多的 view-change requests。

new primary announces view change w/ NEW-VIEW

new primary 用 NEW-VIEW announce view change。

includes the VIEW-CHANGE requests

包含 VIEW-CHANGE requests。

as proof that enough replicas wanted to change views

作为足够多 replicas 想 change views 的 proof。

new primary starts numbering operations at last n it saw + 1

new primary 从它看到的 last n + 1 开始给 operations 编号。

View change 中的 operation numbering

will all non-faulty replicas agree about operation numbering across view change?

view change 前后,所有 non-faulty replicas 会对 operation numbering agree 吗?

problem:

问题:

I saw 2f+1 PREPAREs for operation n, so I executed it

我看到 operation n 的 2f+1 PREPAREs,所以我 execute 了它。

new primary did not, so it did not execute it

new primary 没有看到,所以它没有 execute 它。

thus new primary may start numbering at n, yielding two different op #n

因此 new primary 可能从 n 开始编号,得到两个 different op #n。

无法只询问已执行 operations

can new primary ask all replicas for set of operations they have executed?

new primary 能询问所有 replicas,得到它们 execute 过的 operations set 吗?

doesn't work: new primary can only wait for 2f+1 replies

不行:new primary 只能等待 2f+1 replies。

faulty replicas may reply, so new primary may not wait for me

faulty replicas 可能 reply,所以 new primary 可能不等我。

第三阶段:COMMIT

solution:

solution:

don't execute operation until sure a new primary will hear about it

不要 execute operation,直到确定 new primary 会听到它。

add a third phase: PRE-PREPARE, PREPARE, then COMMIT

增加第三阶段:PRE-PREPARE、PREPARE,然后 COMMIT。

only execute after commit

只有在 commit 后才 execute。

Operation protocol

operation protocol:

operation protocol:

client sends op to primary

client 向 primary 发送 op。

primary sends PRE-PREPARE(op, n) to all

primary 向所有 replicas 发送 PRE-PREPARE(op, n)。

all send PREPARE(op, n) to all

所有 replicas 向所有 replicas 发送 PREPARE(op, n)。

after replica receives 2f+1 matching PREPARE(op, n)

replica 收到 2f+1 matching PREPARE(op, n) 后,

send COMMIT(op, n) to all

向所有 replicas 发送 COMMIT(op, n)。

after receiving 2f+1 matching COMMIT(op, n)

收到 2f+1 matching COMMIT(op, n) 后,

execute op

execute op。

View change protocol

view change:

view change:

each replica sends new primary 2f+1 PREPAREs for recent ops

每个 replica 把 recent ops 的 2f+1 PREPAREs 发送给 new primary。

new primary waits for 2f+1 VIEW-CHANGE requests

new primary 等待 2f+1 个 VIEW-CHANGE requests。

new primary fixes up the log based on info in view-change requests

new primary 根据 view-change requests 中的信息 fix up log。

new primary sends NEW-VIEW msg to all replicas with

new primary 向所有 replicas 发送 NEW-VIEW msg,其中包含

complete set of VIEW-CHANGE msgs

complete set of VIEW-CHANGE msgs。

list of every op for which some VIEW-CHANGE contained 2f+1 PREPAREs

每个 op 的 list,只要某个 VIEW-CHANGE 包含该 op 的 2f+1 PREPAREs。

  if op doesn't have 2f+1 PREPAREs, make the op a no-op

如果 op 没有 2f+1 PREPAREs,就把 op 变成 no-op。

i.e. list of final ops from last view

也就是 last view 的 final ops list。

Executed op 是否会被新 primary 得知

if a replica executes an op, will new primary will know of that op?

如果 replica execute 一个 op,new primary 会知道这个 op 吗?

replica only executed after receiving 2f+1 COMMITS

replica 只有收到 2f+1 COMMITS 后才 execute。

maybe f of those were lies, from faulty replicas, who won't tell new primary

其中可能有 f 个是 lies,来自不会告诉 new primary 的 faulty replicas。

but f+1 COMMITs were from replicas that got 2f+1 matching PREPAREs

但 f+1 个 COMMITS 来自收到 2f+1 matching PREPAREs 的 replicas。

new primary waits for view-change requests from 2f+1 replicas

new primary 等待 2f+1 个 replicas 的 view-change requests。

ignoring the f faulty nodes

忽略 f 个 faulty nodes。

f+1 sent COMMITs, f+1 sent VIEW-CHANGE

f+1 个发送了 COMMITs,f+1 个发送了 VIEW-CHANGE。

must overlap

两者必然 overlap。

NEW-VIEW 不能省略 reported operations

can the new primary omit some of the reported recent operations?

new primary 能 omit 某些 reported recent operations 吗?

no, NEW-VIEW must include signed VIEW-CHANGE messages

不能,NEW-VIEW 必须包含 signed VIEW-CHANGE messages。

Paper 的其他内容

paper also discusses

paper 还讨论了:

checkpoints and logs to help good nodes recover

帮助 good nodes recover 的 checkpoints 和 logs。

various cryptographic optimizations

各种 cryptographic optimizations。

optimizations to reduce # of msgs in common case

减少 common case 中 msgs 数量的 optimizations。

fast read-only operations

fast read-only operations。

未回答的问题

what are the consequences of more than f corrupt servers?

超过 f 个 corrupt servers 会有什么 consequences?

can the system recover?

system 能 recover 吗?

what if the client is corrupt?

如果 client corrupt 会怎样?

suppose an attacker can corrupt one of the servers

假设 attacker 能 corrupt 一个 server。

exploits a bug, or steals a password, or has physical access, &c

利用 bug、steal password,或拥有 physical access 等。

why can't the attacker corrupt them all?

为什么 attacker 不能 corrupt 它们全部?

References

References:

References:

PhD thesis: https://dspace.mit.edu/bitstream/handle/1721.1/86581/48116479-MIT.pdf

PhD thesis:https://dspace.mit.edu/bitstream/handle/1721.1/86581/48116479-MIT.pdf。

Proactive recovery: http://dl.acm.org/citation.cfm?id=571640>

Proactive recovery:http://dl.acm.org/citation.cfm?id=571640>。

BASE: http://dl.acm.org/citation.cfm?id=859718

BASE:http://dl.acm.org/citation.cfm?id=859718。

Stellar: https://www.stellar.org/papers/stellar-consensus-protocol.pdf

Stellar:https://www.stellar.org/papers/stellar-consensus-protocol.pdf。

Hyperledger: https://www.zurich.ibm.com/dccl/papers/cachin_dccl.pdf

Hyperledger:https://www.zurich.ibm.com/dccl/papers/cachin_dccl.pdf。

A funny perspective on BFT: https://www.usenix.org/system/files/login-logout_1305_mickens.pdf

A funny perspective on BFT:https://www.usenix.org/system/files/login-logout_1305_mickens.pdf。

机制小结

1. Byzantine model 与 3f+1

Byzantine replica 可以任意错误、发送不同 messages、违反 protocol,甚至由 attacker 控制。PBFT 使用 3f+1 replicas,最多 f 个 faulty;因此至少有 2f+1 good replicas。任意两个 2f+1 quorum 必然共享至少一个 good replica,这是避免冲突结果同时被接受的基础。

2. 从 Design 1 到 Design 3

等待全部 replicas reply 会被单个 faulty replica 阻塞;在 2f+1 servers 上等待 f+1 matching replies,又可能只包含一个 good replica,下一次 operation 看不到它的 state。3f+1 servers 上等待 2f+1 matching replies,确保 reply set 包含 good majority;若无法得到一致 quorum,client 至少能 detect problem,而不是错误接受 out-of-date state。

3. PRE-PREPARE、PREPARE、COMMIT

多 clients 需要所有 good replicas 按相同顺序执行 operations,因此 primary 负责选择 sequence number。primary 先发送 PRE-PREPARE,replicas 再广播 PREPARE;收到 2f+1 matching PREPARE 后还不能立即 execute,因为 view change 可能不知道该 op。第三阶段 COMMIT 让至少 f+1 good replicas 留下可被新 primary 发现的证据,收到 2f+1 matching COMMIT 后才 execute。

4. Faulty primary 与 view change

faulty primary 可以 ignore client op、向 replicas 发送不同 order,或返回 wrong result。client 同时向 primary 和 replicas 发送 request,replicas exchange information 并监视 progress;timeout 后请求 view change。primary 按 v mod n 轮换,NEW-VIEW 携带足够多 signed VIEW-CHANGE messages,并把没有足够 PREPARE evidence 的 slot 填成 no-op。

5. Recovery 与工程化边界

PBFT 论文还需要 checkpoints 和 logs 帮助 good nodes recovery,并使用 cryptographic optimizations、common-case message reduction 和 fast read-only operations。该安全模型仍依赖最多 f 个 faulty replicas、正确 client、不可破的 cryptography;超过 f 个 corrupt servers 或 corrupt client 属于额外问题。

本篇验收

  • [x] 官方 l-bft.txt 已固定:342 行、289 个非空源行,SHA-256 与来源记录一致。
  • [x] 源文本的非空行按原顺序逐行保留,中文译文紧随对应英文源行。
  • [x] Byzantine fault model、3f+1/2f+1 quorum、Design 1–4、primary、PRE-PREPARE/PREPARE/COMMIT、view change、NEW-VIEW、checkpoint 和 recovery 全部覆盖。
  • [x] client/server diagram、Design 2/3/4 ASCII 时序图和消息流程按原文位置保留;源文件没有独立图片。
  • [x] Byzantine、BFT、PBFT、primary、view、PRE-PREPARE、PREPARE、COMMIT、NEW-VIEW、quorum、checkpoint、client 和 replica 等专用词没有强行翻译。
  • [ ] 中文译文仍建议进行一次人工术语审校;自动审计只验证源文覆盖与顺序,不证明翻译语义正确。
← 返回列表
← 上一篇 MIT 6.5840:Lecture 20 Bitcoin 下一篇 → MIT 6.5840:Lecture 22 Project demos

评论 (0)

暂无评论,来留下第一条吧。
登录 或 注册 后才能发表评论