bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 7쪽 중 5쪽
ould be the same
as the punitive damages paid to the validator in the case
of them sending an invalid block.
To disincentivise collators from sending invalid or over-
weight block candidates to validators, any validator may
place in the next block a transaction including the offend-
ing block alleging misbehaviour with the effect of transfer-
ring some or all of the funds in the misbehaving collator’s
account to the aggrieved validator. This type of trans-
action front-runs any others to ensure the collator cannot
remove the funds prior to the punishment. The amount of
funds transferred as damages is a dynamic parameter yet
POLKADOT: VISION FOR A HETEROGENEOUS MUL TI-CHAIN FRAMEWORK DRAFT 1 14
to be modelled but will likely be a proportion of the val-
idator block reward to reflect the level of grief caused. To
prevent malicious validators arbitrarily confiscating colla-
tors’ funds, the collator may appeal the validator’s deci-
sion with a jury of randomly chosen validators in return
for placing a small deposit. If they find in the valida-
tor’s favour, the deposit is consumed by them. If not, the
deposit is returned and the validator is fined (since the
validator is in a much more vaulted position, the fine will
likely be rather hefty).
6.6. Interchain Transaction Routing. Interchain
transaction routing is one of the essential maintenance
tasks of the relay-chain and its validators. This is the
logic which governs how a posted transaction (often short-
ened to simply “ post”) gets from being a desired output
from one source parachain to being a non-negotiable in-
put of another destination parachain without any trust
requirements.
We choose the wording above carefully; notably we
don’t require there to have been a transaction in the source
parachain to have explicitly sanctioned this post. The only
constraints we place upon our model is that parachains
must provide, packaged as a part of their overall block
processing output, the posts which are the result of the
block’s execution.
These posts are structured as several FIFO queues; the
number of lists is known as the routing base and may be
around 16. Notably, this number represents the quantity
of parachains we can support without having to resort to
multi-phase routing. Initially, Polkadot will support this
kind of direct routing, however we will outline one possible
multi-phase routing process (“hyper-routing”) as a means
of scaling out well past the initial set of parachains.
We assume that all participants know the sub-
groupings for next two blocks n, n + 1. In summary, the
routing system follows these stages:
• Collator S: Contact members of V alidators[n][S]
• Collator S: FOR EACH subgroup s: ensure at
least 1 member of V alidators[n][s] in contact
• Collator S: FOR EACH subgroup s: assume
egress[n− 1][s][S] is available (all incoming post
data to ‘S‘ from last block)
• Collator S: Compose block candidate b for S:
(b.header, b.ext, b.proof, b.receipt, b.egress)
• Collator S: Send proof information
proof[S] = ( b.header, b.ext, b.proof, b.receipt) to
V alidators[n][S]
• Collator S: Ensure external transaction data b.ext
is made available to other collators and validators
• Collator S: FOR EACH subgroup s:
Send egress information egress[n][S][s] =
(b.header, b.receipt, b.egress[s]) to the re-
ceiving sub-group’s members of next block
V alidators[n + 1][s]
• V alidatorV : Pre-connect all same-set members
for next block: let N = Chain[n + 1][V ]; connect
all validators v such that Chain[n + 1][v] = N
• V alidatorV : Collate all data ingress for this
block: FOR EACH subgroup s: Retrieve
egress[n− 1][s][Chain[n][V ]], get from other val-
idators v such that Chain[n][v] = Chain[n][V ].
Possibly going via randomly selected other val-
idators for proof of attempt.
• V alidatorV : Accept candidate proofs for this
block proof[Chain[n][V ]]. Vote block validity
• V alidatorV : Accept candidate egress data for
next block: FOR EACH subgroup s, accept
egress[n][s][N]. Vote block egress availability; re-
publish among interested validators v such that
Chain[n + 1][v] = Chain[n + 1][V ].
• V alidatorV : UNTIL CONSENSUS
Where: egress[n][f rom][to] is the current egress queue
information for posts going from parachain ‘from‘, to
parachain ‘to‘ in block number ‘n‘. Collator S is a col-
lator for parachain S. V alidators[n][s] is the set of val-
idators for parachain s at block number n. Conversely,
Chain[n][v] is the parachain to which validator v is as-
signed on block number n. block.egress[to] is the egress
queue of posts from some parachain block block whose
destination parachain is to.
Since collators collect (transaction) fees based upon
their blocks becoming canonical they are incentivised to
ensure that for each next-block destination, the subgroup’s
members are informed of the egress queue from the present
block. Validators are incentivised only to form a consen-
sus on a (parachain) block, as such they care little about
which collator’s block ultimately becomes canonical. In
principle, a validator could form an allegiance with a col-
lator and conspire to reduce the chances of other collators’
blocks becoming canonical, however this is both difficult
to arrange due to the random selection of validators for
parachains and could be defended against with a reduc-
tion in fees payable for parachain blocks which hold up
the consensus process.
6.6.1. External Data Availability. Ensuring a parachain’s
external data is actually available is a perennial issue with
decentralised systems aiming to distribute workload across
the network. At the heart of the issue is the availability
problem which states that since it is neither possible to
make a non-interactive proof of availability nor any sort
of proof of non-availability, for a BFT system to properly
validate any transition whose correctness relies upon the
availability of some external data, the maximum number
of acceptably Byzantine nodes, plus one, of the system
must attest to the data being available.
For a system to scale out properly, like Polkadot, this
invites a problem: if a constant proportion of validators
must attest to the availability of the data, and assuming
that validators will want to actually store the data be-
fore asserting it is available, then how do we avoid the
problem of the bandwidth/storage requirements increas-
ing with the system size (and therefore number of valida-
tors)? One possible answer would be to have a separate set
of validators (availability guarantors), whose order grows
sublinearly with the size of Polkadot as a whole. This is
described in 6.5.3.
We also have a secondary trick. As a group, colla-
tors have an intrinsic incentive to ensure that all data is
available for their chosen parachain since without it they
are unable to author further blocks from which they can
collect transaction fees. Collators also form a group, mem-
bership of which is varied (due to the random nature of
parachain validator groups) non-trivial to enter and easy
POLKADOT: VISION FOR A HETEROGENEOUS MUL TI-CHAIN FRAMEWORK DRAFT 1 15
to prove. Recent collators (perhaps of the last few thou-
sand blocks) are therefore allowed to issue challenges to
the availability of external data for a particular parachain
block to validators for a small bond.
Validators must contact those from the apparently of-
fending validator sub-group who testified and either ac-
quire and return the data to the collator or escalate the
matter by testifying to the lack of availability (direct re-
fusal to provide the data counts as a bond-confiscating of-
fence, therefore the misbehaving validator will likely just
drop the connection) and contacting additional validators
to run the same test. In the latter case, the collator’s bond
is returned.
Once a quorum of validators who can make such non-
availability testimonials is reached, they are released, the
misbehaving sub-group is punished, and the block re-
verted.
6.6.2. Posts Routing. Each parachain header includes an
egress-trie-root; this is the root of a trie containing the
routing-base bins, each bin being a concatenated list
of egress posts. Merkle proofs may be provided across
parachain validators to prove that a particular parachain’s
block had a particular egress queue for a particular desti-
nation parachain.
At the beginning of processing a parachain block, each
other parachain’s egress queue bound for said block is
merged into our block’s ingress queue. We assume strong,
probably CSPR 9, sub-block ordering to achieve a deter-
ministic operation that offers no favouritism between any
parachain block pairing. Collators calculate the new queue
and drain the egress queues according to the parachain’s
logic.
The contents of the ingress queue is written explicitly
into the parachain block. This has two main purposes:
firstly, it means that the parachain can be trustlessly syn-
chronised in isolation from the other parachains. Secondly,
it simplifies the data logistics should the entire ingress
queue not be able to be processed in a single block; val-
idators and collators are able to process following blocks
without having to source the queue’s data specially.
If the parachain’s ingress queue is above a threshold
amount at the end of block processing, then it is marked
saturated on the relay-chain and no further messages may
be delivered to it until it is cleared. Merkle proofs are
used to demonstrate fidelity of the collator’s operation in
the parachain block’s proof.
6.6.3. Critique. One minor flaw relating to this basic
mechanism is the post-bomb attack. This is where all
parachains send the maximum amount of posts possible
to a particular parachain. While this ties up the target’s
ingress queue at once, no damage is done over and above
a standard transaction DoS attack.
Operating normally, with a set of well-synchronised and
non-malicious collators and validators, for N parachains,
N× M total validators and L collators per parachain, we
can break down the total data pathways per block to:
Validator: M−1+ L+L: M−1 for the other validators
in the parachain set, L for each collator providing a can-
didate parachain block and a second L for each collator
of the next block requiring the egress payloads of the pre-
vious block. (The latter is actually more like worst-case
operation since it is likely that collators will share such
data.)
Collator: M + kN: M for a connection to each relevant
parachain block validator, kN for seeding the egress pay-
loads to some subset of each parachain validator group for
the next block (and possibly some favoured collator(s)).
As such, the data path ways per node grow linearly
with the overall complexity of the system. While this is
reasonable, as the system scales into hundreds or thou-
sands of parachains, some communication latency may be
absorbed in exchange for a lower complexity growth rate.
In this case, a multi-phase routing algorithm may be used
in order to reduce the number of instantaneous pathways
at a cost of introducing storage buffers and latency.
6.6.4. Hyper-cube Routing. Hyper-cube routing is a mech-
anism which can mostly be build as an extension to the
basic routing mechanism described above. Essentially,
rather than growing the node connectivity with the num-
ber of parachains and sub-group nodes, we grow only with
the logarithm of parachains. Posts may transit between
several parachains’ queues on their way to final delivery.
Routing itself is deterministic and simple. We begin by
limiting the number of bins in the ingress/egress queues;
rather than being the total number of parachains, they
are the routing-base (b) . This will be fixed as the number
of parachains changes, with the routing-exponent (e) in-
stead being raised. Under this model, our message volume
grows with O(be), with the pathways remaining constant
and the latency (or number of blocks required for delivery)
with O(e).
Our model of routing is a hypercube of e dimensions,
with each side of the cube having b possible locations.
Each block, we route messages along a single axis. We
alternate the axis in a round-robin fashion, thus guaran-
teeing worst-case delivery time of e blocks.
As part of the parachain processing, foreign-bound
messages found in the ingress queue are routed imme-
diately to the appropriate egress queue’s bin, given the
current block number (and thus routing dimension). This
process necessitates additional data transfer for each hop
on the delivery route, however this is a problem itself
which may be mitigated by using some alternative means
of data payload delivery and including only a reference,
rather than the full payload of the post in the post-trie.
An example of such a hyper-cube routing for a system
with 4 parachains, b = 2 and e = 2 might be:
Phase 0, on each message M:
• sub0: if Mdest∈{ 2, 3} then sendTo(2) else keep
• sub1: if Mdest∈{ 2, 3} then sendTo(3) else keep
• sub2: if Mdest∈{ 0, 1} then sendTo(0) else keep
• sub3: if Mdest∈{ 0, 1} then sendTo(1) else keep
Phase 1, on each message M:
• sub0: if Mdest∈{ 1, 3} then sendTo(1) else keep
• sub1: if Mdest∈{ 0, 2} then sendTo(0) else keep
• sub2: if Mdest∈{ 1, 3} then sendTo(3) else keep
• sub3: if Mdest∈{ 0, 2} then sendTo(2) else keep
The two dimensions here are easy to see as the first
two bits of the destination index; for the first block, the
higher-order bit alone is used. The second block deals
with the low-order bit. Once both happen (in arbitrary
order) then the post will be routed.
9cryptographically secure pseudo-random
POLKADOT: VISION FOR A HETEROGENEOUS MUL TI-CHAIN FRAMEWORK DRAFT 1 16
6.6.5. Maximising Serendipity. One alteration of the basic
proposal would see a fixed total of c2− c validators, with
c−1 validators in each sub-group. Each block, rather than
there being an unstructured repartitioning of validators
among parachains, instead for each parachain sub-group,
each validator would be assigned to a unique and different
parachain sub-group on the following block. This would
lead to the invariant that between any two blocks, for any
two pairings of parachain, there exists two validators who
have swapped parachain responsibilities. While this can-
not be used to gain absolute guarantees on availability
(a single validator will occasionally drop offline, even if
benevolent), it can nonetheless optimise the general case.
This approach is not without complications. The addi-
tion of a parachain would also necessitate a reorganisation
of the validator set. Furthermore the number of valida-
tors, being tied to the square of the number of parachains,
would start initially very small and eventually grow far
too fast, becoming untenable after around 50 parachains.
None of these are fundamental problems. In the first case,
reorganisation of validator sets is something that must be
done regularly anyway. Regarding the size of the validator
set, when too small, multiple validators may be assigned
to the same parachain, applying an integer factor to the
overall total of validators. A multi-phase routing mecha-
nism such as Hypercube Routing, discussed in 6.6.4 would
alleviate the requirement for large number of validators
when there is a large number of chains.
6.7. Parachain Validation. A validator’s main purpose
is to testify, as a well-bonded actor, that a parachain’s
block is valid, including but not limited to any state tran-
sition, any external transactions included, the execution of
any waiting posts in the ingress queue and the final state
of the egress queue. The process itself is fairly simple.
Once the validator sealed the previous block they are free
to begin working to provide a candidate parachain block
candidate for the next round of consensus.
Initially, the validator finds a parachain block candi-
date through a parachain collator (described next) or one
of its co-validators. The parachain block candidate data
includes the block’s header, the previous block’s header,
any external input data included (for Ethereum and Bit-
coin, such data would be referred to as transactions, how-
ever in principle they may include arbitrary data struc-
tures for arbitrary purposes), egress queue data and inter-
nal data to prove state-transition validity (for Ethereum
this would be the various state/storage trie nodes re-
quired to execute each transaction). Experimental evi-
dence shows this full dataset for a recent Ethereum block
to be at the most a few hundred KiB.
Simultaneously, if not yet done, the validator will be
attempting to retrieve information pertaining to the pre-
vious block’s transition, initially from the previous block’s
validators and later from all validators signing for the
availability of the data.
Once the validator has received such a candidate block,
they then validate it locally. The validation process is con-
tained within the parachain class’s validator module, a
consensus-sensitive software module that must be written
for any implementation of Polkadot (though in principle
a library with a C ABI could enable a single library to
be shared between implementations with the appropriate
reduction in safety coming from having only a single “ref-
erence” implementation).
The process takes the previous block’s header and ver-
ifies its identity through the recently agreed relay-chain
block in which its hash should be recorded. Once the par-
ent header’s validity is ascertained, the specific parachain
class’s validation function may be called. This is a sin-
gle function accepting a number of data fields (roughly
those given previously) and returning a simple Boolean
proclaiming the validity of the block.
Most such validation functions will first check the
header-fields which are able to be derived directly from
the parent block (e.g. parent hash, number). Following
this, they will populate any internal data structures as
necessary in order to process transactions and/or posts.
For an Ethereum-like chain this amounts to populating a
trie database with the nodes that will be needed for the
full execution of transactions. Other chain types may have
other preparatory mechanisms.
Once done, the ingress posts and external transac-
tions (or whatever the external data represents) will be
enacted, balanced according to chain’s specification. (A
sensible default might be to require all ingress posts be
processed before external transactions be serviced, how-
ever this should be for the parachain’s logic to decide.)
Through this enactment, a series of egress posts will be
created and it will be verified that these do indeed match
the collator’s candidate. Finally, the properly populated
header will be checked against the candidate’s header.
With a fully validated candidate block, the validator
can then vote for the hash of its header and send all requi-
site validation information to the co-validators in its sub-
group.
6.7.1. Parachain Collators. Parachain collators are un-
bonded operators who fulfill much of the task of miners
on the present-day blockchain networks. They are specific
to a particular parachain. In order to operate they must
maintain both the relay-chain and the fully synchronised
parachain.
The precise meaning of “fully synchronised” will de-
pend on the class of parachain, though will always in-
clude the present state of the parachain’s ingress queue.
In Ethereum’s case it also involves at least maintaining
a Merkle-tree database of the last few blocks, but might
also include various other data structures including Bloom
filters for account existence, familial information, logging
outputs and reverse lookup tables for block number.
In addition to keeping the two chains synchronised, it
must also “fish” for transactions by maintaining a transac-
tion queue and accepting properly validated transactions
from the public network. With the queue and chain, it is
able to create new candidate blocks for the validators cho-
sen at each block (whose identity is known since the relay-
chain is synchronised) and submit them, together with the
various ancillary information such as pr프로젝트로 돌아가기