Skip to main content
This page provides comprehensive technical documentation for DVN (Decentralized Verifier Network) contracts, including interfaces, methods, events, errors, and data structures.

Core Interface

All DVNs must implement the ILayerZeroDVN interface to integrate with LayerZero’s Message Libraries.

ILayerZeroDVN


DVN Contract Methods

The LayerZero DVN contract extends the base Worker contract with multisig capabilities. Below are the key methods organized by access control.

Public / View Methods

getFee

Returns the fee for verifying a message to a specific destination.
Returns: Fee amount in native tokens.
This function will revert if the sender is on the denylist or not on the allowlist (when allowlist is enabled).

hashCallData

Generates a hash of execution parameters for signature verification.
Returns: Keccak256 hash of the packed parameters.

OnlyMessageLib Methods

These methods can only be called by authorized Message Libraries.

assignJob (ULN302)

Assigns a verification job for ULN302 messages.
Emits: None directly (fee calculation delegated to DVNFeeLib).

assignJob (ULNv2 Legacy)

Assigns a verification job for legacy ULNv2 messages.
Emits: VerifierFeePaid(uint256 fee)

assignJob (Read/CmdLib)

Assigns a verification job for lzRead commands.

OnlyAdmin Methods

These methods require the ADMIN_ROLE.

setDstConfig

Configures fee parameters for destination chains.
Emits: SetDstConfig(DstConfigParam[] params)

execute

Executes a batch of signed instructions. This is the primary method for submitting verifications.
Behavior:
  • Skips instructions with invalid VID
  • Skips expired instructions
  • Validates signatures against quorum
  • Prevents replay attacks via hash tracking
  • Emits events for failures but continues processing
Emits:
  • VerifySignaturesFailed(uint256 idx) - if signature validation fails
  • ExecuteFailed(uint256 index, bytes data) - if execution fails
  • HashAlreadyUsed(ExecuteParam param, bytes32 hash) - if instruction was already executed

withdrawFeeFromUlnV2

Withdraws accumulated fees from ULNv2 Message Library.

OnlySelf Methods

These methods can only be called by the contract itself (via signed execute).

setSigner

Adds or removes a signer from the multisig.
Function Signature: 0x31cb6105

setQuorum

Sets the required number of signatures for multisig operations.
Function Signature: 0x8585c945

Quorum Methods

quorumChangeAdmin

Allows the signer quorum to change the admin role without going through the standard execute flow.
Usage: The callData field should contain abi.encode(newAdminAddress).
This function ensures signers maintain ultimate control over the DVN. Even if the admin role is delegated to a service like Essence, signers can immediately reassign it.

Events

Core Events

Inherited Events (from Worker)


Errors

DVN Errors

DVNFeeLib Errors

Inherited Errors (from Worker)


Data Structures

DstConfig

Configuration for a destination chain’s fee parameters.

DstConfigParam

Parameter struct for setting destination configuration.

ExecuteParam

Parameters for executing a signed instruction.

AssignJobParam

Parameters passed when a verification job is assigned.

FeeParams (DVNFeeLib)

Parameters used for fee calculation.

Access Control Roles

The DVN contract uses role-based access control inherited from OpenZeppelin’s AccessControl.

Admin Role Permissions in Practice

The ADMIN_ROLE is an operational role, and its name overstates what it can do. It does not own the DVN or control verification on its own: the execute function validates a signer quorum on every message, so the admin alone cannot verify or forge messages. Signers keep ultimate control and can reassign the role at any time through quorumChangeAdmin. The role exists so that an operator can run day-to-day operations (fees, pricing, pathway configuration, and message submission) on a partner’s behalf. In the Essence/Gasolina model, LZ holds the admin role and pays for cross-chain message execution for the partner. The sections below describe when each ADMIN_ROLE-gated function is used.

Fee management

In the Essence/Gasolina model, Essence manages and collects fees and keeps pricing information onchain because LZ pays for cross-chain message execution. Apart from withdrawFeeFromUlnV2, these functions are inherited from the base Worker contract that the DVN extends.

Chain expansion

Both functions configure a new pathway when expanding to a new chain. Without them, the deploy-and-wire service cannot be operated on the partner’s behalf.

Execute

execute is the entry point the admin uses to submit signed verification instructions for the messages this DVN handles. Even though it is ADMIN_ROLE-gated, every instruction must carry a valid signer-quorum signature, so holding the admin role alone does not let the holder verify messages.
The admin cannot lock signers out. Independently of execute, the signer quorum can reassign the ADMIN_ROLE at any time by calling quorumChangeAdmin, which only requires a valid quorum signature. Ultimate control stays with the signers.

Role management

When called by an admin, grantRole and revokeRole operate only on the ADMIN_ROLE, letting the operator add or remove admin wallets. Additional admin wallets are used to parallelize message submission and scale delivery throughput to a chain, while revoking is used during wallet rotation. The ALLOWLIST, DENYLIST, and MESSAGE_LIB_ROLE roles cannot be changed by an admin directly; they are managed by the contract itself through signed execute calls, as enforced by the onlySelfOrAdmin modifier.

Constructor Parameters


State Variables