共识机制:CometBFT、2/3 终局与许可制验证者 Consensus: CometBFT, 2/3 finality, and a permissioned validator set
共识层只做一件事:让所有节点对下一个区块达成同一个顺序。Falari 把这件事交给 CometBFT,出块目标是 5 秒;验证者先提议、再预投票、再预提交,超过 2/3 的投票权签名后,这个高度才算最终确定。验证者也不是谁都能进:创建或编辑验证者的消息,必须先通过链上许可名单。本文按一个高度的生命周期,说明这两道门各自挡住什么。 The consensus layer does one thing: make every node agree on the next block in the same order. Falari delegates that to CometBFT with a five-second block target. Validators propose, prevote, and precommit; a height becomes final only after more than two-thirds of voting power signs it. Validators are not open to anyone either: a create-or-edit message must first pass an on-chain allowlist. This essay follows one height's lifecycle to mark what each gate does.
On this page
共识不是「谁算得快谁说了算」,也不是「矿工打包交易」。在 Falari 上,出块和投票由一组经过许可的验证者完成;矿工负责存数据,不参与区块投票。两者共享同一条链,但职责完全不同。
01共识层决定什么
共识层只决定两件事:交易以什么顺序进入区块,以及哪个高度已经不可回滚。EVM 负责执行交易、计算状态根,但它不决定顺序;顺序由 CometBFT 的验证者投票产生。每个节点按同一份父块、同一笔交易顺序执行,得到同一个状态根,链才继续。
Falari 的共识链 ID 是 falari-testnet,EVM 链 ID 是 62026。两者用途不同:前者出现在验证者的投票签名域里,后者出现在钱包和合约的 EIP-155 签名里。把 EVM 链 ID 当成共识链 ID,会让签名在错误的域里验证失败。
验证者是出块节点:它们保存完整状态、执行交易、对区块投票。全节点也保存和验证全部状态,但不投票;任何人都可以运行全节点,不需要许可名单。存储矿工是另一类角色,只负责持有分片和提交证明,不参与共识投票。
02一个高度的三步投票
每个高度从 round 0 开始。CometBFT 按投票权加权轮值选出提议者,提议者广播一个区块;验证者收到后检查父块、交易和状态,然后投 prevote。当同一个区块收到超过 2/3 投票权的预投票,验证者才投 precommit;当预提交也超过 2/3,这个高度就最终确定。
propose proposer broadcasts one block
prevote validators check it, then sign block or nil
precommit after > 2/3 prevotes for that block
commit after > 2/3 precommits → height is final
timeout no decision → round + 1, new proposer
提交签名不会消失:高度 H 的预提交集合会随高度 H+1 的区块一起传播,作为 H 已终局的证据。目标出块间隔是 5 秒(timeout_commit);create_empty_blocks=true,所以即使没有交易,高度也会继续推进。一轮没有结果时,超时把 round 加一,提议者随之更换,验证者可以对 nil 投票。
这就是「最终确定」的含义:在少于 1/3 投票权作恶的假设下,同一个高度不可能出现两个都超过 2/3 预提交的区块。要制造冲突,至少 1/3 的投票权必须在两个区块上重复签名;这种双签是可归因的,会被证据模块记录并罚没。
03阈值是投票权,不是人头
门槛是「超过 2/3 的投票权」,严格大于,不是大于等于。投票权来自质押:自质押加上委托,按代币数量计权;出块次数、在线率、奖励多少都不会改变权重。一个地址可以运行多个验证者,但每个验证者的权重仍由它自己的质押决定。
| 等权验证者 | 最少签名数 | 占比 | 容许离线 |
|---|---|---|---|
| 2 | 2 | 100% | 0 |
| 3 | 3 | 100% | 0 |
| 4 | 3 | 75% | 1 |
| 5 | 4 | 80% | 1 |
| 6 | 5 | 83.3% | 1 |
三个等权验证者需要全部签名,这一点经常被误读:2/3 正好等于 2/3,不满足「严格大于 2/3」。四个等权验证者才是「任意三个即可」。如果权重不等,门槛按权重计算,不按人数:一个持有超过 2/3 投票权的验证者可以独自达到门槛;反过来,一个持有超过 1/3 的验证者可以让任何区块都达不到门槛。
许可名单解决的是「谁有资格进来」,不解决「进来之后权重如何分布」。两者必须同时成立,这套共识才有意义。
04当前测试网:三个验证者,风险集中
写作时,测试网有 3 个共识验证者,各自自质押 5,000,000 FAR,委托量为 0,因此投票权各占三分之一(约 33.33%),佣金率统一为 70%。终局要求预提交严格超过 2/3:三份签名齐备时是 100%,少一份就只剩 66.7%,恰好等于而不是超过 2/3,链会停止终局,而不是产生一条少数派链。这正是三节点等权配置的代价:没有拜占庭余量,也没有节点维护窗口。
GET /rpc/status 会返回 height、latest_finalized_height、consensus_validators;GET /rpc/validators 返回每个验证者的自质押、委托质押和出块数。健康时 latest_finalized_height 通常只落后当前高度 0–1 块;如果它停住而 height 还在推进,说明区块在产生但投票没有凑齐。
三个等权验证者意味着任何单台机器停机都会把投票权压到恰好 2/3,终局立即停住。这不是高可用配置,也不是主网目标;它只是当前测试网为了快速迭代保留的最小集合。
主网要留出余量,验证者数量必须让「超过 2/3」在少一台机器时仍然成立。按等权计算,4 个验证者可以容忍 1 台离线(3/4 > 2/3),5–6 个仍然只多容忍 1 台;要继续提高容错,需要增加的不只是节点数,还有权重的分散度。
05许可制:allowlist 在处理器之前
验证者集合由 x/validatorallow 模块把关。模块状态只有两部分:参数(authority、enabled)和一张允许的验证者操作员地址表。链在 ante 阶段运行 ValidatorAdmissionDecorator,它扫描交易里的所有消息,只拦截两类:MsgCreateValidator 和 MsgEditValidator。被拦截的消息会取出验证者操作员地址,查表;不在表里就直接拒绝,处理器不会执行。
其余消息不受影响:委托、解绑、转账、合约调用都按原路径执行。这意味着任何人都可以委托给一个已在名单里的验证者,但不能凭空创建一个新的验证者。名单是准入闸口,不是投票权闸口。
enabled=false 是开发网的逃生口:检查被跳过,但模块状态和查询接口仍然存在。模块的默认创世值是关闭的,好让全新 devnet 不需要名单就能启动;主网创世则必须显式打开,并通过创世检查。当前测试网的状态是 enabled=true,名单里正好是 3 个共识验证者;GET /rpc/validators/allowlist 可以读到 authority、数量和地址列表。
修改名单只有一条消息:MsgUpdateValidatorAllowlist,只能由 authority 签名。操作是幂等的,并发出 validator_allowlist_updated 事件。主网配置里 authority 应是委员会多签;创世检查会拒绝空 authority、空名单,以及不包含全部创世验证者的名单。
一个必须说清的边界:把操作员从名单里删掉,只会阻止它未来创建或编辑验证者,不会自动把已经在出块的验证者踢出集合,也不会解绑它的质押。要真正移除一个活跃验证者,仍然要走质押层面的操作,或者让它的节点停止签名并被 jail。名单是入口,不是出口。
06两把钥匙,各管一件事
一个验证者涉及两把签名密钥。第一把是账户/操作员密钥:它持有并支付自质押,签署 MsgCreateValidator,其验证者地址(valoper)也是许可名单检查的对象。在 Cosmos SDK v0.54 的 MsgCreateValidator 里,验证者地址和出资账户是同一把密钥派生出的两个前缀,消息本身没有单独的 owner 字段;当前测试网的 /rpc/validators 也显示 owner 与 operator 相同。
第二把是共识密钥:Ed25519,保存在节点的 priv_validator_key.json 里,用来签提议和预投票/预提交。它的公钥在创建验证者时写进链上记录,之后不能通过 MsgEditValidator 原地更换;要换共识密钥,实际做法是创建一个新验证者并让旧的退出。共识密钥的双签证据会被记录并罚没,所以它不应该在多个节点之间复制。
还有一个节点密钥(node key),只用于 P2P 连接和 peer 身份,不参与共识签名,也不在许可名单里。把它和共识密钥混为一谈,是运维事故的常见起点。
两把钥匙分开的价值在于爆炸半径:共识密钥泄露可以让攻击者双签并被罚没,但不能直接转走账户里的资金;账户密钥泄露可以动资金,但不能替节点签出一个有效的共识投票。生产环境里,共识密钥应留在验证者主机或 HSM 上,账户密钥不应长期放在同一台对外暴露的机器上。
07验证者收入与投票权是两套账
验证者流同样按余额驱动衰减:首年满档、5 秒出块时每块最多 29.73 FAR(验证者池 7.5 亿 FAR,每年支付剩余余额的 25%)。每块先按 2% 注入永久基金(permanent_fund_injection_bps 为 200),剩余部分里 30% 直接付给当块提议者(validator_producer_share_bps 为 3000),70% 进入费用收集器,由 x/staking 和 x/distribution 按质押权重分配。提议者份额是对出块工作的直接定价,质押份额才是委托收益的来源。
验证者流与存储流是两条独立的流。存储流按 epoch 预算分给矿工,验证者不参与;验证者流也不会因为矿工证明失败而减少。两条流共享同一条链和同一个永久基金,但分配对象不同。
投票权只随质押变化。出块多、奖励多、在线率高,都不会自动增加权重;只有把奖励继续质押,权重才会上升。反过来,被 jail 的验证者会暂时从活跃集合中移除,权重随之下降。把「收入」当成「权力」,是读错这套系统的另一种方式。
08升级必须在同一个高度发生
共识对确定性的要求不止于交易执行,也包括状态迁移。所有验证者必须在同一个高度运行同一段迁移代码,否则状态根会分叉。Falari 有两条升级路径:一条是链上 x/upgrade 计划加已注册的处理器;另一条是测试网常用的 BeginBlocker 高度环境变量,节点换二进制后按同一高度触发迁移。
upgrade-info.json 本身不会触发迁移。应用启动时读取它,主要是为了给新增模块安装 store loader;真正执行迁移的是升级处理器,或者 BeginBlocker 里的高度钩子。只放一个文件、不设高度,迁移不会发生。
FALARI_UPGRADE_V1_HEIGHT=<height> exact height
FALARI_AGENTKEY_TIERS_HEIGHT=<height> exact height
FALARI_STORAGE_TUNING_HEIGHT=<height> >= height, idempotent
FALARI_POOL_ADDRESS_HEIGHT=<height> >= height, idempotent
高度钩子分为精确匹配和「大于等于」两种。精确匹配用于一次性迁移,配合迁移标记保证重启不会重复执行;「大于等于」用于幂等参数调整,节点补块或重启都可以安全重跑。无论哪一种,三个验证者必须写入同一个高度。一个节点迁移、另一个没有迁移,应用哈希会立刻不一致,链随即停住。
新增模块还会带来 store 问题:新模块的 store key 必须在升级声明里注册为 Added,否则 multistore 拒绝启动。升级前应同时核对二进制版本、高度环境变量、store 声明和迁移日志,而不是只看节点进程有没有起来。
09这套共识保证什么,不保证什么
它保证:在少于 1/3 投票权作恶的前提下,每个高度只有一个最终区块;终局之后不需要处理回滚;所有节点按同一顺序执行同一批交易;未被允许的操作员无法创建或编辑验证者。它不保证:验证者一定在线;许可名单的 authority 一定诚实;超过 1/3 的投票权不会串谋;验证者会替你保存数据。
几个常被混淆的边界:全节点不需要许可名单,任何人都可以同步和验证整条链;存储可用性由矿工、证明和修复流程负责,不由共识负责;5 秒是目标出块间隔,不是终局延迟的上限,投票轮次超时会把它拉长;许可制提高的是准入的可控性,不是去中心化程度。
把共识压缩成一句话:提议者按投票权轮值,严格超过 2/3 的预提交让区块最终确定;许可名单决定谁有资格成为验证者,但不改变「权重来自质押」这条规则。
Consensus is not “whoever computes fastest wins,” and it is not “miners package transactions.” On Falari, block production and voting belong to a permissioned validator set; miners store data and do not vote on blocks. They share one chain, but the jobs are different.
01What the consensus layer decides
Consensus decides two things: the order in which transactions enter blocks, and which height can no longer be rolled back. The EVM executes transactions and computes state roots, but it does not choose the order; CometBFT validators do. Every node executes the same transactions on the same parent and must arrive at the same state root before the chain continues.
Falari's consensus chain ID is falari-testnet; its EVM chain ID is 62026. They serve different purposes: the first appears in the validator vote-signing domain, the second in EIP-155 signatures from wallets and contracts. Treating the EVM chain ID as the consensus chain ID makes signatures verify in the wrong domain.
Validators are block producers: they hold full state, execute transactions, and vote on blocks. Full nodes also hold and verify all state but do not vote; anyone can run one without an allowlist. Storage miners are a separate role: they hold shards and submit proofs, and they do not participate in consensus voting.
02Three votes per height
Each height starts at round 0. CometBFT selects a proposer by stake-weighted round-robin; the proposer broadcasts a block. Validators check the parent, the transactions, and the state, then cast a prevote. Only after more than two-thirds of voting power prevotes for the same block do they cast precommit. When precommits also exceed two-thirds, the height is final.
propose proposer broadcasts one block
prevote validators check it, then sign block or nil
precommit after > 2/3 prevotes for that block
commit after > 2/3 precommits → height is final
timeout no decision → round + 1, new proposer
Commit signatures do not disappear: the precommits for height H travel with the block at H+1 as evidence that H is final. The target block interval is five seconds (timeout_commit), and create_empty_blocks=true means heights keep advancing even without transactions. If a round produces no decision, a timeout increments round, changes the proposer, and lets validators vote nil.
That is what finality means: under the assumption that less than one-third of voting power is Byzantine, two conflicting blocks cannot both gather more than two-thirds of precommits at the same height. To create a conflict, at least one-third of voting power must sign two blocks; that equivocation is attributable, recorded as evidence, and slashed.
03The threshold is voting power, not validator count
The bar is “more than two-thirds of voting power,” strictly greater, not greater-or-equal. Voting power comes from stake: self-delegation plus delegations, weighted by token amount. Block count, uptime, and rewards do not change it. One owner may run several validators, but each validator's weight is still its own stake.
| Equal validators | Signatures needed | Share | May be offline |
|---|---|---|---|
| 2 | 2 | 100% | 0 |
| 3 | 3 | 100% | 0 |
| 4 | 3 | 75% | 1 |
| 5 | 4 | 80% | 1 |
| 6 | 5 | 83.3% | 1 |
Three equal validators all have to sign, which is often misread: 2/3 is exactly two-thirds, not more than two-thirds. Four equal validators are the first set where “any three” suffices. With unequal weights the threshold is weighted, not a headcount: a validator holding more than two-thirds of voting power can reach it alone; conversely, a validator holding more than one-third can keep any block from reaching it.
The allowlist answers “who may enter,” not “how weight is distributed after entry.” Both have to hold for the consensus to mean anything.
04Today's testnet: three validators, concentrated risk
At the time of writing, the testnet has three consensus validators, each with 5,000,000 FAR self-staked and zero delegated, so voting power is one third each (about 33.33%) with a uniform 70% commission. Finality requires precommits strictly above two-thirds: with all three signatures it is 100%, and losing one drops it to 66.7% — exactly two-thirds, not more — so the chain stops finalizing rather than producing a minority chain. That is the cost of a three-node equal-weight set: no Byzantine margin and no maintenance window.
GET /rpc/status returns height, latest_finalized_height, and consensus_validators; GET /rpc/validators returns each validator's self-stake, delegated stake, and produced blocks. When healthy, latest_finalized_height normally trails the current height by 0–1 blocks. If it stops while height keeps advancing, blocks are being produced but votes are not reaching quorum.
Three equal validators mean any single outage drops voting power to exactly two-thirds, and finality stops. This is neither a high-availability configuration nor a mainnet target; it is the minimum set the testnet keeps while iterating quickly.
A mainnet set needs enough validators that “more than two-thirds” still holds with one machine down. With equal weights, four validators tolerate one offline (3/4 > 2/3); five or six still tolerate only one. Raising fault tolerance takes more than adding nodes: it also takes distributing the weight.
05Admission: the allowlist runs before the handler
The validator set is gated by x/validatorallow. Its state is two things: params (authority, enabled) and a set of allowed validator operator addresses. During the ante phase the chain runs ValidatorAdmissionDecorator, which scans every message in the transaction but intercepts only two types: MsgCreateValidator and MsgEditValidator. It extracts the validator operator address and looks it up; if the operator is not listed, the transaction is rejected before any handler runs.
Everything else is untouched: delegation, undelegation, transfers, and contract calls take their normal path. Anyone may delegate to an already-listed validator, but no one can conjure a new validator. The list is an admission gate, not a voting-power gate.
enabled=false is the devnet escape hatch: the check is skipped, while module state and queries still work. The module's default genesis is disabled so a fresh devnet boots without a list; mainnet genesis must switch it on explicitly and pass the genesis gate. The current testnet reports enabled=true with exactly the three consensus validators listed; GET /rpc/validators/allowlist returns the authority, count, and addresses.
There is one way to change the list: MsgUpdateValidatorAllowlist, signed by authority. The operation is idempotent and emits a validator_allowlist_updated event. In production the authority should be a committee multisig; the genesis gate rejects an empty authority, an empty list, or a list that omits any genesis validator.
One boundary must be stated plainly: removing an operator from the list only blocks future create or edit messages. It does not automatically evict a validator that is already producing blocks, and it does not unbond its stake. Actually removing an active validator still requires a staking-level action, or letting its node stop signing and be jailed. The list is an entrance, not an exit.
06Two signing keys, two jobs
A validator involves two signing keys. The first is the account/operator key: it holds and pays the self-delegation, signs MsgCreateValidator, and its validator address (valoper) is what the allowlist checks. In Cosmos SDK v0.54's MsgCreateValidator, the validator address and the funding account are two prefixes derived from the same key; the message has no separate owner field. The current testnet's /rpc/validators likewise shows owner and operator as the same address.
The second is the consensus key: Ed25519, stored in the node's priv_validator_key.json, used to sign proposals, prevotes, and precommits. Its public key is written into the validator record at creation and cannot be replaced in place through MsgEditValidator; rotating it in practice means creating a new validator and retiring the old one. Double-sign evidence is tied to this key and is slashed, so it must never be copied across nodes.
There is also a node key, used only for P2P connections and peer identity. It does not sign consensus votes and is not in the allowlist. Confusing it with the consensus key is a common operational mistake.
Separating the two keys bounds the blast radius: a leaked consensus key lets an attacker double-sign and get slashed, but cannot move the account's funds; a leaked account key can move funds, but cannot produce a valid consensus vote for the node. In production, keep the consensus key on the validator host or an HSM, and do not keep the account key long-term on the same publicly exposed machine.
07Rewards and voting power are separate ledgers
The validator stream is also balance-driven: at the year-1 full ramp on five-second blocks it tops out at 29.73 FAR per block (a validator pool of 750,000,000 FAR, paying 25% of its remaining balance per year). Each block first carves 2% into the permanent fund (permanent_fund_injection_bps 200); of the remainder, 30% goes directly to that block's proposer (validator_producer_share_bps 3000) and 70% to the fee collector, where x/staking and x/distribution split it by stake weight. If the proposer cannot be resolved or paid, its share falls back to the fee collector. The proposer share prices block production directly; the stake share is where delegation yield comes from.
The validator stream is independent of the storage stream. The storage stream is budgeted per epoch for miners and validators do not draw from it; the validator stream does not shrink when a miner fails a proof. The two share a chain and a permanent fund, but not a recipient set.
Voting power changes only with stake. More blocks, more rewards, or higher uptime do not add weight by themselves; only restaking rewards does. A jailed validator is temporarily removed from the active set, and its weight leaves with it. Reading “income” as “power” is another way to misread the system.
08Upgrades must land at the same height
Consensus demands determinism from state migrations, not just transaction execution. Every validator must run the same migration at the same height, or state roots diverge. Falari has two upgrade paths: an on-chain x/upgrade plan with a registered handler, and the height environment variables that testnet operators use after swapping the binary.
upgrade-info.json does not trigger a migration by itself. The app reads it at startup mainly to install the store loader for a new module; the migration itself runs from the upgrade handler or from a BeginBlocker height hook. Dropping the file without setting a height changes nothing.
FALARI_UPGRADE_V1_HEIGHT=<height> exact height
FALARI_AGENTKEY_TIERS_HEIGHT=<height> exact height
FALARI_STORAGE_TUNING_HEIGHT=<height> >= height, idempotent
FALARI_POOL_ADDRESS_HEIGHT=<height> >= height, idempotent
Hooks come in two shapes: exact-match for one-shot migrations, paired with a marker so a restart cannot run them twice; and greater-or-equal for idempotent parameter changes that may safely rerun after a replay or restart. Either way, all three validators must set the same height. If one migrates and the other does not, the app hash diverges immediately and the chain stops.
A new module adds a store problem: its store key must be declared as Added in the upgrade, or the multistore refuses to start. Before an upgrade, check the binary version, the height variables, the store declaration, and the migration log — not just whether the process came up.
09What this consensus guarantees, and what it does not
It guarantees: with less than one-third of voting power Byzantine, each height has only one final block; no reorg handling is needed after finality; every node executes the same transactions in the same order; and an operator outside the allowlist cannot create or edit a validator. It does not guarantee: validators stay online; the allowlist authority is honest; more than one-third of voting power will not collude; or validators will store your data.
Several boundaries are often confused: full nodes need no allowlist, and anyone can sync and verify the whole chain; storage availability belongs to miners, proofs, and repair, not to consensus; five seconds is a target block interval, not a ceiling on finality latency, since a timed-out round stretches it; and a permissioned set improves control over admission, not the degree of decentralisation.
Compressed into one sentence: the proposer rotates by voting power, precommits strictly above two-thirds finalize a block, and the allowlist decides who may become a validator without changing the rule that weight comes from stake.
Sources
- evm/app.go — CometBFT wiring, BeginBlocker height hooks, validatorallow migration
- evm/ante_validator_admission.go — the admission decorator
- evm/x/validatorallow/ — params, genesis checks, allowlist message server
- evm/cmd/genesis-gate/identity.go — mainnet allowlist requirements
- evm/upgrades.go — upgrade handlers and store loader
- evm/x/storage/keeper/token_release.go — per-block validator emission (2% fund carve, 30/70 proposer split)
- docs/development/en/08-constants.md — 5 s
timeout_commit, CometBFT v0.39.x - texplorer.falari.xyz/rpc/status · /rpc/validators · /rpc/validators/allowlist — live set