Skip to main content

Data Structures

The DataStructures are structs that we are using throughout the message infrastructure and registry.

Links: Implementation.

L1Actor

An entity on L1, specifying the address and the chainId for the entity. Used when specifying sender/recipient with an entity that is on L1.

l1_actor
/**
* @notice Actor on L1.
* @param actor - The address of the actor
* @param chainId - The chainId of the actor
*/
struct L1Actor {
address actor;
uint256 chainId;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L11-L21
NameTypeDescription
actoraddressThe L1 address of the actor
chainIduint256The chainId of the actor. Defines the blockchain that the actor lives on.

L2Actor

An entity on L2, specifying the address and the version for the entity. Used when specifying sender/recipient with an entity that is on L2.

l2_actor
/**
* @notice Actor on L2.
* @param actor - The aztec address of the actor
* @param version - Ahe Aztec instance the actor is on
*/
struct L2Actor {
bytes32 actor;
uint256 version;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L23-L33
NameTypeDescription
actorbytes32The aztec address of the actor.
versionuint256The version of Aztec that the actor lives on.

L1ToL2Message

A message that is sent from L1 to L2.

l1_to_l2_msg
/**
* @notice Struct containing a message from L1 to L2
* @param sender - The sender of the message
* @param recipient - The recipient of the message
* @param content - The content of the message (application specific) padded to bytes32 or hashed if larger.
* @param secretHash - The secret hash of the message (make it possible to hide when a specific message is consumed on L2).
*/
struct L1ToL2Msg {
L1Actor sender;
L2Actor recipient;
bytes32 content;
bytes32 secretHash;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L35-L49
NameTypeDescription
senderL1ActorThe actor on L1 that is sending the message.
recipientL2ActorThe actor on L2 that is to receive the message.
contentfield (~254 bits)The field element containing the content to be sent to L2.
secretHashfield (~254 bits)The hash of a secret pre-image that must be known to consume the message on L2. Use the computeMessageSecretHash to compute it from a secret.

L2ToL1Message

A message that is sent from L2 to L1.

l2_to_l1_msg
/**
* @notice Struct containing a message from L2 to L1
* @param sender - The sender of the message
* @param recipient - The recipient of the message
* @param content - The content of the message (application specific) padded to bytes32 or hashed if larger.
* @dev Not to be confused with L2ToL1Message in Noir circuits
*/
struct L2ToL1Msg {
DataStructures.L2Actor sender;
DataStructures.L1Actor recipient;
bytes32 content;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L51-L64
NameTypeDescription
senderL2ActorThe actor on L2 that is sending the message.
recipientL1ActorThe actor on L1 that is to receive the message.
contentfield (~254 bits)The field element containing the content to be consumed by the portal on L1.

RegistrySnapshot

A snapshot of the registry values.

registry_snapshot
/**
* @notice Struct for storing address of cross communication components and the block number when it was updated
* @param rollup - The address of the rollup contract
* @param inbox - The address of the inbox contract
* @param outbox - The address of the outbox contract
* @param blockNumber - The block number of the snapshot
*/
struct RegistrySnapshot {
address rollup;
address inbox;
address outbox;
uint256 blockNumber;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L66-L80
NameTypeDescription
rollupaddressThe address of the rollup contract for the snapshot.
inboxaddressThe address of the inbox contract for the snapshot.
outboxaddressThe address of the outbox contract for the snapshot.
blockNumberuint256The block number at which the snapshot was created.