An article to understand how Polkadot performs effective sharding between parachains
PolkaWorld
2020-08-06 03:30
本文约1833字,阅读全文需要约7分钟
Polkadot's availability and validity protocol.

Editor's Note: This article comes fromPolkaWorld(ID:gh_6c4c2038ddba), reproduced by Odaily with authorization.

), reproduced by Odaily with authorization.

Polkadot's Availability and Validity (AnV: Availability and Validity) protocol enables the entire network to be effectively sharded between parallel chains, while having strong security guarantees.

secondary title

  • Phases of the AnV Protocol

  • The Availability and Validity Protocol (AnV Protocol) is divided into six phases.

  • Parallel chain stage

  • Relay Chain Commit Phase

  • Availability and Unavailability Subagreement

  • angler objection procedure

Invokes the Byzantine Fault Tolerance finality gadget to solidify the chain

secondary title

The parachain phase of the AnV protocol is when the collators of the parachain propose candidate blocks to the validators currently assigned to the parachain.

A candidate block is a new block from a parachain collator, which may or may not be valid, and must pass a validity check before being included in the relay chain.

secondary title

Relay Chain Commit Phase

  • Validators then check the candidate block against the validation functionality provided by that parachain's registration code. If the verification is successful, the validator passes the candidate block to other validators in the gossip network. However, if validation fails, the validator immediately considers the candidate block invalid.

  • Candidate receipts are prepared when more than half of the parachain validators agree that a particular parachain candidate block is a valid state transition. Candidate receipts will eventually be included in the relay chain state. This includes:

  • Parachain ID

  • Collector's ID and signature

  • Candidate receipt hash of the parent block

  • The Merkle root of the erasure-coded fragment of the block

  • Any Merkle roots that emit messages

  • block hash

After the block is executed, the state root of the parachain

The above information is all constant, but the actual PoV block of the parachain is of variable length, which is enough information for anyone with access to the full PoV block to verify the state transitions contained within.

Availability and Unavailability Subagreement

During the availability and unavailability sub-protocol phases, validators circulate erasure coding fragments in the network. At least 1/3 + 1 validators must report that they have their code field. Once the validator threshold is reached, the network can consider the PoV block for the parachain.

secondary title

erasure coding

Erasure coding converts a message into a longer code, making it possible to recover the original message from a subset of the code without requiring parts of the code. The code is the original message stuffed with some extra data, allowing the code to be reconstructed in case of erasure.

In Polkadot, erasure codes are used to keep the parachain state available to the system without requiring all validators to keep tabs on all parachains. Instead, validators share smaller data and can later reconstruct the entire data under the assumption that 1/3 + 1 validators can contribute their respective data.

Note: The 1/3 + 1 threshold of validators that must respond in order to construct complete parachain state data corresponds to Polkadot's security assumptions about Byzantine nodes.

fisherman

Anglers are full nodes of parachains, similar to Collators, but play a different role in their relationship with the Polkadot network. Instead of packing state transitions and producing the next parachain block as collators do, anglers will observe the entire process and ensure invalid state transitions are not included. Fishermen need to moderately pledge a part of tokens on the relay chain, which is different from collectors who do not require chips on the relay chain. If misconduct is found to have occurred during the production process of the parachain, the fisherman will submit an invalidation report. If the reported misconduct is proven correct, they will be rewarded handsomely, but if they are proven wrong, they may lose part of their stake. Anglers are thus similar to bounty hunters, who are paid handsomely when they complete a job and otherwise have no steady pay.

secondary title

How to run a fisherman node

The requirements to run a Angler node are expected to be relatively modest compared to the staking requirements of a validator node. Registering the "fishing" status on the relay chain will require a certain amount of tokens. If a phisher submits an incorrect invalidation report, the protocol could slash these tokens significantly. The slash risk exists to prevent phishers from spamming the network, since re-establishing parachain state is an expensive process for the relay chain.

PolkaWorld
作者文库