bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 3쪽 중 2쪽
y generated packets from compromised
DVNs. Burn is a convenience function to allow OApps
to clear a packet without knowing the packet contents;
this is useful if a faulty Security Stack commits an in-
valid hash to the endpoint, or if an OApp needs to clear
a nilified nonce.
3.1.1 Out-of-order lossless delivery
We lay out two non-negotiable consistency requirements
for LayerZero’s message channel: lossless and exactly-
once delivery. Censorship resistant channels must be
lossless, and exactly-once delivery is required to prevent
replay attacks. Both of these requirements are crucial
for network integrity, and are guaranteed by the protocol
provided the underlying blockchain is not faulty.
Channels in LayerZero are necessarily separated and
isolated by path (Table 2), as any lossless channel shared
5
Routine Arguments Description
send Sends a message through LayerZero.
path The path of the channel through which to send the message.
payload Data transmit to the receiver.
Message Options Byte array of arguments to be interpreted by MessageLib (optional).
getInboundNonce Returns the largest nonce with all predecessors received.
path The path corresponding to the message channel.
skip Called by the receiver to skip verification and delivery of a nonce.
path The path of the channel to skip a nonce on.
nonce The nonce of the message to skip (must be the inbound nonce + 1).
clear Called by the receiver to skip a nonce that has been verified.
path The path to skip a nonce on.
guid The GUID of the nonce to skip.
message The contents of the message to skip.
lzReceive Called by the executor to receive a message from the channel.
path The path of the channel to receive a message from.
nonce Output parameter for the nonce of the received message.
GUID The GUID of the received message.
message The message to receive.
extraData Any extra data requested by the receiver.
nilify Called by the receiver to temporarily invalidate a nonce.
path The path of the channel to nilify a message on.
nonce The nonce of the packet to nilify.
payloadHash The hash of the payload to nilify.
burn Called by the receiver to delete and skip a nonce.
path The path of the channel to burn a message on.
nonce The nonce of the packet to burn.
payloadHash The hash of the payload to burn.
Table 3: LayerZero core messaging API.
by two different OApps must sacrifice channel valid-
ity or liveness; an adversarial application can trivially
deny liveness of a shared channel by refusing to ver-
ify a packet, but allowing other applications to forcibly
skip the malicious OApp’s packets constitutes censor-
ship. Each channel maintains a logical clock imple-
mented by a gapless, strictly monotonically increasing
positive integer nonce, and each message sent over the
channel is assigned exactly one nonce. On the destina-
tion Endpoint, each nonce is mapped to exactly one veri-
fied payload hash (Section 3.2), and the channel enforces
that each delivered payload corresponds to the verified
hash of the relevant nonce. LayerZero guarantees that
the delivery of a packet implies all other packets on the
same channel with lower nonces are delivered, deliver-
able, or skipped.
On a given channel, suppose two messages mk and
mk+1 are assigned positive integer nonces k and k +
1 respectively. The gapless nonce guarantees that
¬(∃m j s.t. mk → m j ∧ m j → mk+1) where → is the
happens-before relation. More informally, there can be
no packet with a nonce between k and k + 1. This is the
weakest possible, and by extension most flexible, condi-
tion for losslessness. Stronger conditions (e.g., strictly
in-order delivery) can be imposed on top of this abstrac-
tion if desired.
Censorship resistance is implemented by enforcing
that no nonce can be delivered unless all previous nonces
have been committed or skipped. For example, a packet
with nonce N can only be delivered if all packets with
nonce 1 , . . . ,N − 1 are either committed or explicitly
skipped by the receiver. We term the largest nonce that
can be executed to be the inbound nonce.
Lossless and exactly-once delivery can be achieved
using strictly in-order verification and execution, as
demonstrated by Zarick et al. [6]. However, delivery or-
der enforcement can result in artificial throughput limits
on certain blockchains and complicates offchain infras-
tructure. In LayerZero we relax this ordering constraint,
implementing out-of-order delivery that maintains chan-
nel integrity and does not introduce any additional on-
chain computational overhead.
The only efficient onchain implementation of an un-
censorable channel with lossless, exactly-once, out-of-
6
Endpoint EndpointSender Receiver
Sender Receiver
send (msg1)
send (msg2)
msg1
msg2
commit (2)
commit (1)
lzReceive (msg1)
lzReceive (msg2)
msg1, msg2 (unordered)
msg1 Sent
msg2 Sent
msg2 Verified
msg1 Verified
msg1 Executable
msg2 Executable
msg1 Received
msg2 Received
outboundNonce++
outboundNonce++
Figure 5: A packet is Sent after source transaction incre-
ments the nonce, Verified after it is committed into the
Endpoint, and Received after delivery (execution).
order delivery is to track the highest delivered nonce,
which we term thelazy inbound nonce. The lazy inbound
nonce begins at zero, and packets can only be executed if
all packets starting from the lazy inbound nonce until the
packet nonce are verified. Every time a packet is deliv-
ered (or skipped), the lazy inbound nonce is updated to
the maximum of the current lazy inbound nonce and the
nonce of the delivered packet.
The only other theoretical algorithm that can achieve
efficient lossless and exactly-once delivery is updating
the lazy inbound nonce upon verification rather than ex-
ecution. This does not work in practice, because a sin-
gle packet commit could result in an arbitrarily large up-
date in the lazy inbound nonce. For example, if nonce 2
through 1000 have been committed before nonce 1, the
commit of nonce 1 must iterate through 1000 nonces to
update the lazy inbound nonce. This creates a situation
where if the number of iterations exceeds the limits of the
underlying blockchain, the corresponding channel will
permanently lose liveness.
On the other hand, updating the lazy inbound nonce on
execution can indeed run into computational limits, but
permissionlessly retrying execution at a lower nonce will
succeed. It is possible for an uninterrupted sequence of
undeliverable messages (i.e., messages that will always
revert on execution) to cause temporary loss of channel
liveness if the sequence is longer than the blockchain it-
eration limit. This scenario can easily be rectified by the
OApp owner calling clear (Table 3) to skip execution
of these undeliverable packets.
To enforce exactly-once delivery, we flag each packet
after it is successfully received. In LayerZero, this is im-
plemented by deleting the verified hash of a packet from
the lossless channel after it is delivered and disallowing
verification of nonces less than or equal to the lazy in-
bound nonce.
We illustrate the lossless channel in Figure 5 through a
simplified view of the lifecycle of a LayerZero packet. In
this example, the OApp asynchronously sends two mes-
sages from the source chain to the destination chain, and
each packet can be in one of three states: Sent, Veri-
fied, or Received. A packet is Sent after the source End-
point assigns a nonce to the packet, after which the re-
quested DVNs verify it on the destination MessageLib.
The packet transitions into the Verified state after an ex-
ecutor calls commitVerification (shown as “commit”
in Figure 5), which checks that the packet has been veri-
fied by the OApp Security Stack.
Once a packet and all preceding packets have been
committed, the executor calls lzReceive to deliver the
packet and, barring reversion of the transaction, the
packet transitions into the Received state. If one or more
preceding nonces have not been committed, the lossless
channel will revert to prevent censorship.
3.2 MessageLib
The MessageLib Registry is a collection of MessageLibs,
each of which are responsible for securely emitting pack-
ets on the source chain and verifying them on the desti-
nation MessageLib. Each standalone MessageLib imple-
ments extrinsic security, necessitating adaptation to un-
derlying environmental changes and precluding a fully
immutable design of the MessageLib Registry. Mes-
sageLib verifies the payload hash of each packet, com-
mitting the verified payload hash to the endpoint after
the extrinsic security requirement (e.g., DVN threshold)
is fulfilled.
To provide extensibility for extrinsic security while
protecting existing OApps against in-place updates, we
structure the MessageLib Registry as an append-only
registry of immutable libraries, each of which can im-
plement any arbitrary verification mechanism so long as
it conforms to the protocol interface. This design avoids
7
1 0xAAAAAAAA...
2 0xBBBBBBBB...
3 0xCCCCCCCC...
4 0xDDDDDDDD...
5 0xEEEEEEEEE...
6 0xFFFFFFFFF ...
Nonce Hash
Source
1
2
3
4
5
6
0xAA. . .
0xBB. . .
0xCC. . .
0xDD. . .
0xEE. . .
0xFF. . .
Required Optional
(OptionalThreshold = 2)
Nonce Hash DVN A DVN B DVN C DVN N
DestinationDVN A
DVN C
DVN B
DVN N
Verifying
Verifying
Verifiable
Verifiable
Verifiable
Verified
Status
Figure 6: The Ultra Light Node enforces (onchain) the configured required DVNs, optional DVNs, and Option-
alThreshold. Verification is neither lossless nor ordered, and messages can be committed to the channel as soon as the
Security Stack is fulfilled.
the trap of validation lock-in that most messaging ser-
vices fall into, and ensures that LayerZero can be ex-
tended to take advantage of the most secure and efficient
verification algorithms in every scenario.
This design may seem counterintuitive at first, as it
precludes any in-place software updates and thus appears
to prevent the protocol admin from addressing software
bugs. However, giving a single entity the power to uni-
laterally fix issues in-place also gives them the ability
to introduce new vulnerabilities. This in turn invalidates
any long-term protocol security invariants, as a malicious
change in the code can easily violate them. Our decision
to commit to immutable libraries in MessageLib presents
higher barriers to introducing new code and bugfixes, but
is crucial in realizing intrinsic security in LayerZero.
We argue this append-only design is the only way
to implement intrinsic security without compromising
extensibility. In theory, a single non-upgradable Mes-
sageLib that is completely bug-free and perfectly op-
timized provides intrinsic end-to-end security, but is
impractical even in this unrealistic scenario. Changes
in the execution environment (e.g., removal or addi-
tion of opcodes), consensus mechanism (e.g., validator
election protocol), and evolving application preferences
for verification algorithms necessitate protocol updates.
Any scheme that allows in-place modifications of Mes-
sageLibs is inherently not intrinsically secure; OApps are
placing their trust in the developers, auditors, or gover-
nance structure of the protocol administrator, and there is
no practical way to guarantee that the security of updated
code will match or exceed the existing MessageLibs.
OMPs must allow extensions, but at the same time guar-
antee that the extrinsic security of previous versions is
never impacted by these code additions. Ergo, the only
design that provides intrinsically secure updates is to ap-
pend new versions of the codebase to an immutable reg-
istry of library versions.
Each MessageLib operates independently and handles
the following tasks: (1) accept the message from the
Endpoint, (2) encode and emit the packet (Table 2) to
DVNs and executors, paying any necessary fees, (3) ver-
ify the packet on the destination chain, and (4) commit
the verified message to the destination Endpoint. All
other tasks are handled by executors, minimizing the
code size of MessageLib and allowing easy addition of
features through the implementation and operation of
new executors. No party, including the LayerZero ad-
min, is permitted to modify or remove libraries once they
are added to the MessageLib registry.
Note that losslessness is enforced in the immutable
endpoint (execution layer), not in MessageLib (verifica-
tion layer). As we explain in Section 3.2.1, MessageLib
can commit verified packet hashes into the endpoint out
of order and with gaps. However, packets cannot be con-
sumed from the lossless channel if there are gaps in the
sequence of verified packets.
3.2.1 Ultra Light Node
The Ultra Light Node (ULN) is the baseline MessageLib
included in every LayerZero deployment, and allows
the composition of up to 254 DVNs through customiz-
able two-tier quorum semantics. ULN implements the
minimal set of fundamental features necessary for any
verification algorithm and is thus universally compati-
ble with all blockchains. Each OApp Security Stack
that is configured to use the ULN includes a set of
required DVNs (X), optional DVNs, and a threshold
(OptionalT hreshold ). X DVNs are required, and a
packet can only be delivered if all X required DVNs and
at least OptionalT hreshold optional DVNs total have
8
signed the corresponding payload hash. After the neces-
sary DVN signatures have been aggregated on the ULN,
the corresponding packet can be committed to the End-
point. The required DVN model allows OApps to place
a lower bound on the extrinsic security of the verification
layer, as no message can be verified without a signature
from the most secure DVN in the required set. This de-
sign delegates the majority of extrinsic security to the
DVNs while still enforcing the Security Stack onchain.
We illustrate an example of the Ultra Light Node ver-
ification semantics in Figure 6. The OApp Security
Stack includes required DVN (DVNA) and N −1 optional
DVNs (DVNB, DVNC, ...) with an OptionalThreshold of
1. This gives DVN A “veto” power, and also requires at
least one of the optional DVNs to verify the packet be-
fore it can be committed. Nonce 1 has been committed to
the messaging channel (Verified). Nonces 2, 3, and 6 are
committable (verifiable) as the Security Stack has been
fulfilled, but are not committed until an executor calls
commitVerification. Nonces 4 and 5 are not committable
because they have not fulfilled the required verifier set
and OptionalThreshold respectively.
This composable verification primitive gives OApps
the ability to trade off cost and security, allows OApps
to easily configure client diversity in their DVN set, and
minimizes the engineering cost of upgrading extrinsic
security (no onchain code extensions). The importance
of client diversity cannot be understated, as even a non-
compromised DVN is subject to buggy code.
3.2.2 MessageLib versioning and migration
MessageLibs are identifiable through a unique ID paired
with semantic ( major.minor) version, and a message
can only be sent between two Endpoints if both imple-
ment a MessageLib with the same major version. Ma-
jor versions determine packet serialization and deserial-
ization compatibility, while minor versions are reserved
for bugfixes and other non-breaking changes. The packet
version of each LayerZero message is mapped to a Mes-
sageLib version, which DVNs use to identify which Mes-
sageLib to submit packet verification to on the destina-
tion blockchain. Each OApp Security Stack specifies
the sendLibrary and receiveLibrary to use for each
chain it spans. The sendLibrary is the ID and version
of the library to use when sending messages, and the
receiveLibrary is the ID and version of the library to
use when receiving messages. This configurability en-
ables OApps to customize Security Stack cost and se-
curity based on their individual needs. For rapid proto-
typing, LayerZero implements an opt-in mechanism to
allow OApps to lazily resolve their Security Stack to the
defaults chosen and maintained by the LayerZero admin,
but OApp owners are strongly encouraged to explicitly
set their Security Stack for production applications. Mes-
sages cannot be received on a path until an OApp has
set their Security Stack or opted into the default Security
Stack for that path.
The impossibility of coordinating atomic transactions
over an asynchronous network [2, 5] necessitates a live
migration protocol when reconfiguring the OApp Secu-
rity Stack.
Upgrading to a MessageLib with the same major ver-
sion, but different minor version (e.g., 1.1 → 1.2) is
achieved by simply setting the sendLibrary and/or
receiveLibrary to the desired version. Migrating be-
tween MessageLibs with different major versions (e.g.,
1.2 → 2.0) is more involved. First, the OApp sets a grace
period for the old receiveLibrary (1.2) during which
receiveLibrary 1.2 can continue to receive messages
even if the sendLibrary is configured to 2.0 by the
OApp. Next, the OApp sets thesendLibrary to the new
version (2.0). After this point all new messages carry the
new packet version, but both receiveLibrary 1.2 and
2.0 can verify messages until the grace period elapses.
After the grace period elapses, only 2.0 is authorized
to verify messages. If the grace period ends before all
version 1.2 in-flight messages are committed to the des-
tination Endpoint, packet delivery will temporarily halt
and the OApp must reconfigure receiveLibrary back
to the previous version (1.2) to commit all in-flight mes-
sages before updating receiveLibrary to 2.0 again.
In this way, LayerZero implements intrinsically secure,
frictionless live migration between MessageLib versions.
3.3 Decentralized Verifier Network
The datalink in LayerZero is designed on the fundamen-
tal observation that connecting two blockchains with-
out the assumption of synchrony requires communica-
tion through one or more third parties [5]. A conse-
quence of the potentially-offchain nature of DVNs is
the impossibility of guaranteeing long-term immutability
and availability, and as such a permissioned verification
model is inherently unable to provide strong guarantees
of channel liveness. Thus, we have opted to implement
a permissionless, configurable verification model in Lay-
erZero, where anyone can operate and permissionlessly
integrate their own DVN with LayerZero. Decentralized
Verifier Networks, as the name suggests, are composed
internally of a set of verifiers that collectively perform
distributed consensus to safely and reliably read packet
hashes from the source blockchain; this design impor-
tantly allows for client diversity within a single DVN,
minimizing the chance of a single faulty verifier causing
protocol outages or errors.
This model overcomes two glaring shortcomings of
other messaging services: shared security and finite fault
9
Type Structure
Execution gas [ TYPE 1, executionGas ]
Gas and native drop [ TYPE 2, executionGas, nativedropAmount, receiverAddress ]
Composite [ TYPE 3, [ workerID, opType, length, command ], ... ]
Table 4: Message Options starts with a magic number to identify the options type, followed by type-specific options.
Type 1 and 2 are specialized for setting execution gas limits and sending additional native gas tokens as part of an
omnichain transaction respectively. Type 3 embeds arguments for an arbitrary set of offchain workers.
Original
Security Stack
Reconfigured
Security Stack
Reconfigure
Figure 7: OApps can easily reconfigure their Security
Stack to exclude faulty DVNs.
tolerance. Existing cross-chain messaging services pro-
vide a single shared security configuration that is shared
across all clients, and this is suboptimal in two ways: it
gives OApps no recourse if the protocol-specified verifier
set is compromised or faulty, and it requires the majority
of OApps to choose between an unnecessarily expensive
or excessively risky security configuration for the task
at hand. Finite fault tolerance is a problem that plagues
all messaging services with a permissioned verification
model, as the failure of the entire finite-s프로젝트로 돌아가기