Commit 8ef4058d authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #4545 from ethereum-optimism/jm/sbn-specs

specs: Document starting timestamp and block num vars
parents 5d0a3af6 4c1d0c27
...@@ -83,11 +83,14 @@ interface RequiredDeployConfig { ...@@ -83,11 +83,14 @@ interface RequiredDeployConfig {
/** /**
* Starting block number for the output oracle. * Starting block number for the output oracle.
* Must be greater than or equal to the first Bedrock block. The first L2 output will correspond
* to this value plus the submission interval.
*/ */
l2OutputOracleStartingBlockNumber?: number l2OutputOracleStartingBlockNumber?: number
/** /**
* Starting timestamp for the output oracle. * Starting timestamp for the output oracle.
* MUST be the same as the timestamp of the L2OO start block.
*/ */
l2OutputOracleStartingTimestamp?: number l2OutputOracleStartingTimestamp?: number
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
- [Proposing L2 Output Commitments](#proposing-l2-output-commitments) - [Proposing L2 Output Commitments](#proposing-l2-output-commitments)
- [L2 Output Commitment Construction](#l2-output-commitment-construction) - [L2 Output Commitment Construction](#l2-output-commitment-construction)
- [L2 Output Oracle Smart Contract](#l2-output-oracle-smart-contract) - [L2 Output Oracle Smart Contract](#l2-output-oracle-smart-contract)
- [Configuration](#configuration)
- [Security Considerations](#security-considerations) - [Security Considerations](#security-considerations)
- [L1 Reorgs](#l1-reorgs) - [L1 Reorgs](#l1-reorgs)
- [Summary of Definitions](#summary-of-definitions) - [Summary of Definitions](#summary-of-definitions)
...@@ -42,10 +43,11 @@ described [below](#l2-output-commitment-construction). ...@@ -42,10 +43,11 @@ described [below](#l2-output-commitment-construction).
If there is no newly finalized output, the service continues querying until it receives one. It then submits this If there is no newly finalized output, the service continues querying until it receives one. It then submits this
output, and the appropriate timestamp, to the [L2 Output Root](#l2-output-root-smart-contract) contract's output, and the appropriate timestamp, to the [L2 Output Root](#l2-output-root-smart-contract) contract's
`proposeL2Output()` function. The timestamp MUST be the next multiple of the `SUBMISSION_INTERVAL` value. `proposeL2Output()` function. The timestamp block number must correspond to the `startingBlockNumber` plus the next
multiple of the `SUBMISSION_INTERVAL` value.
The proposer may also delete the most recent output root by calling the `deleteL2Output()` function. The proposer may also delete multiple output roots by calling the `deleteL2Outputs()` function and specifying the
The function can be called repeatedly if it is necessary to roll back the state further. index of the first output to delete, this will also delete all subsequent outputs.
> **Note regarding future work:** In the initial version of the system, the proposer will be the same entity as the > **Note regarding future work:** In the initial version of the system, the proposer will be the same entity as the
> sequencer, which is a trusted role. In the future proposers will need to submit a bond in order to post L2 output > sequencer, which is a trusted role. In the future proposers will need to submit a bond in order to post L2 output
...@@ -96,12 +98,23 @@ The exact number is yet to be determined, and will depend on the design of the f ...@@ -96,12 +98,23 @@ The exact number is yet to be determined, and will depend on the design of the f
The L2 Output Oracle contract implements the following interface: The L2 Output Oracle contract implements the following interface:
```js ```solidity
/**
* @notice The number of the first L2 block recorded in this contract.
*/
uint256 public startingBlockNumber;
/**
* @notice The timestamp of the first L2 block recorded in this contract.
*/
uint256 public startingTimestamp;
/** /**
* @notice Accepts an L2 outputRoot and the timestamp of the corresponding L2 block. The * @notice Accepts an L2 outputRoot and the timestamp of the corresponding L2 block. The
* timestamp must be equal to the current value returned by `nextTimestamp()` in order to be * timestamp must be equal to the current value returned by `nextTimestamp()` in order to be
* accepted. * accepted.
* This function may only be called by the Proposer. * This function may only be called by the Proposer.
*
* @param _l2Output The L2 output of the checkpoint block. * @param _l2Output The L2 output of the checkpoint block.
* @param _l2BlockNumber The L2 block number that resulted in _l2Output. * @param _l2BlockNumber The L2 block number that resulted in _l2Output.
* @param _l1Blockhash A block hash which must be included in the current chain. * @param _l1Blockhash A block hash which must be included in the current chain.
...@@ -115,18 +128,27 @@ The L2 Output Oracle contract implements the following interface: ...@@ -115,18 +128,27 @@ The L2 Output Oracle contract implements the following interface:
) )
/** /**
* @notice Deletes the most recent output. * @notice Deletes all output proposals after and including the proposal that corresponds to
* @param _l2Output The value of the most recent output. Used to prevent erroneously deleting * the given output index. Only the challenger address can delete outputs.
* the wrong root *
* @param _l2OutputIndex Index of the first L2 output to be deleted. All outputs after this
* output will also be deleted.
*/ */
function deleteL2Output(bytes32 _l2Output) external function deleteL2Outputs(uint256 _l2OutputIndex) external
/** /**
* @notice Computes the block number of the next L2 block that needs to be checkpointed. * @notice Computes the block number of the next L2 block that needs to be checkpointed.
*/ */
function getNextBlockNumber() public view returns (uint256) { function getNextBlockNumber() public view returns (uint256)
``` ```
### Configuration
The `startingBlockNumber` must be at least the number of the first Bedrock block.
The `startingTimestamp` MUST be the same as the timestamp of the start block.
The first `outputRoot` proposed will thus be at height `startingBlockNumber + SUBMISSION_INTERVAL`
## Security Considerations ## Security Considerations
### L1 Reorgs ### L1 Reorgs
...@@ -140,7 +162,7 @@ will not match that of the block with that number and the call will revert. ...@@ -140,7 +162,7 @@ will not match that of the block with that number and the call will revert.
### Constants ### Constants
| Name | Value | Unit | | Name | Value | Unit |
| --------------------- | ------ | ------- | | --------------------- | ----- | ------- |
| `SUBMISSION_INTERVAL` | `1800` | seconds | | `SUBMISSION_INTERVAL` | TBD | blocks |
| `L2_BLOCK_TIME` | `2` | seconds | | `L2_BLOCK_TIME` | `2` | seconds |
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment