Data Structures
The DataStructures
are structs that we are using throughout the message infrastructure and registry.
Links: Implementation (GitHub link).
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#L13-L23
Name | Type | Description |
---|---|---|
actor | address | The L1 address of the actor |
chainId | uint256 | The 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#L25-L35
Name | Type | Description |
---|---|---|
actor | bytes32 | The aztec address of the actor. |
version | uint256 | The 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).
* @param index - Global leaf index on the L1 to L2 messages tree.
*/
struct L1ToL2Msg {
L1Actor sender;
L2Actor recipient;
bytes32 content;
bytes32 secretHash;
uint256 index;
}
Source code: l1-contracts/src/core/libraries/DataStructures.sol#L37-L53
Name | Type | Description |
---|---|---|
sender | L1Actor | The actor on L1 that is sending the message. |
recipient | L2Actor | The actor on L2 that is to receive the message. |
content | field (~254 bits) | The field element containing the content to be sent to L2. |
secretHash | field (~254 bits) | The hash of a secret pre-image that must be known to consume the message on L2. Use computeSecretHash (GitHub link) 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#L55-L68
Name | Type | Description |
---|---|---|
sender | L2Actor | The actor on L2 that is sending the message. |
recipient | L1Actor | The actor on L1 that is to receive the message. |
content | field (~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 blockNumber - The block number of the snapshot
*/
struct RegistrySnapshot {
address rollup;
uint256 blockNumber;
}
Source code: l1-contracts/src/governance/libraries/DataStructures.sol#L14-L24
Name | Type | Description |
---|---|---|
rollup | address | The address of the rollup contract for the snapshot. |
blockNumber | uint256 | The block number at which the snapshot was created. |