-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: initial portal docs + minor cleanups #1469
Changes from 5 commits
ea8dca0
8f94a1a
5418d98
6af29cc
19b1ad8
36088a8
e139121
f267d43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,127 @@ | ||||||
--- | ||||||
title: Data Structures | ||||||
--- | ||||||
|
||||||
The `DataStructures` are structs that we are using throughout the message infrastructure and registry. | ||||||
|
||||||
**Links**: [Implementation](https://github.com/AztecProtocol/aztec-packages/blob/master/l1-contracts/src/core/libraries/DataStructures.sol). | ||||||
|
||||||
## `Entry` | ||||||
|
||||||
An entry for the messageboxes multi-sets. | ||||||
|
||||||
```solidity title="DataStructures.sol" | ||||||
struct Entry { | ||||||
uint64 fee; | ||||||
uint32 count; | ||||||
uint32 version; | ||||||
uint32 deadline; | ||||||
} | ||||||
``` | ||||||
|
||||||
| Name | Type | Description | | ||||||
| -------------- | ------- | ----------- | | ||||||
| `fee` | `uint64` | The fee provided to sequencer for including in the inbox. 0 if Outbox (as not applicable). | | ||||||
LHerskind marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| `count` | `uint32` | The occurrence of the entry in the dataset | | ||||||
| `version` | `uint32` | The version of the entry | | ||||||
| `deadline` | `uint32` | The consumption deadline of the message. | | ||||||
|
||||||
|
||||||
## `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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsure what exactly we want here, often it is just denoted |
||||||
|
||||||
```solidity title="DataStructures.sol" | ||||||
struct L1Actor { | ||||||
address actor; | ||||||
uint256 chainId; | ||||||
} | ||||||
``` | ||||||
|
||||||
| Name | Type | Description | | ||||||
| -------------- | ------- | ----------- | | ||||||
| `actor` | `address` | The ethereum address of the actor | | ||||||
LHerskind marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| `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 chainid for the entity. Used when specifying sender/recipient with an entity that is on L2. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, chainid should be replaced by version here actually. |
||||||
|
||||||
```solidity title="DataStructures.sol" | ||||||
struct L2Actor { | ||||||
bytes32 actor; | ||||||
uint256 version; | ||||||
} | ||||||
``` | ||||||
|
||||||
| Name | Type | Description | | ||||||
| -------------- | ------- | ----------- | | ||||||
| `actor` | `bytes32` | The aztec address of the actor. | | ||||||
| `version` | `uint256` | The version of the actor. Defines the rollup that the actor lives on. | | ||||||
LHerskind marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## `L1ToL2Message` | ||||||
|
||||||
A message that is sent from L1 to L2. | ||||||
|
||||||
```solidity title="DataStructures.sol" | ||||||
struct L1ToL2Msg { | ||||||
L1Actor sender; | ||||||
L2Actor recipient; | ||||||
bytes32 content; | ||||||
bytes32 secretHash; | ||||||
uint32 deadline; | ||||||
uint64 fee; | ||||||
} | ||||||
``` | ||||||
|
||||||
| 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. | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| `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. | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you explained in your other PR, but should we explain how to do a sha256 hash to a field ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
|
||||||
| `deadline` | `uint32` | The message consumption-deadline time in seconds. | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| `fee` | `uint64` | The fee that the sequencer will be paid for inclusion of the message. | | ||||||
LHerskind marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## `L2ToL1Message` | ||||||
|
||||||
A message that is sent from L2 to L1. | ||||||
|
||||||
```solidity title="DataStructures.sol" | ||||||
struct L2ToL1Msg { | ||||||
DataStructures.L2Actor sender; | ||||||
DataStructures.L1Actor recipient; | ||||||
bytes32 content; | ||||||
} | ||||||
``` | ||||||
|
||||||
| 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. | ||||||
|
||||||
```solidity title="DataStructures.sol" | ||||||
struct RegistrySnapshot { | ||||||
address rollup; | ||||||
address inbox; | ||||||
address outbox; | ||||||
uint256 blockNumber; | ||||||
} | ||||||
``` | ||||||
|
||||||
| Name | Type | Description | | ||||||
| -------------- | ------- | ----------- | | ||||||
| `rollup` | `address` | The address of the rollup contract for the snapshot. | | ||||||
| `inbox` | `address` | The address of the inbox contract for the snapshot. | | ||||||
| `outbox` | `address` | The address of the outbox contract for the snapshot. | | ||||||
| `blockNumber` | `uint256` | The blocknumber at which the snapshot was created. | | ||||||
LHerskind marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entry does not act like a multiset, it is an entry in a multiset.