Skip to content

Commit 3cad559

Browse files
committed
interop: Specify deposit handling
1 parent 1b53492 commit 3cad559

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

specs/interop/derivation.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents**
4+
5+
- [Overview](#overview)
6+
- [Deposit Context](#deposit-context)
7+
- [Security Considerations](#security-considerations)
8+
9+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
10+
11+
## Overview
12+
13+
This is an experimental section and may be changed in the future. It is not required
14+
for the initial release.
15+
16+
### Deposit Context
17+
18+
Derivation is extended to create **deposit contexts**, which signifies the execution of a depositing transaction. A deposit context is scoped to a single block, commencing with the execution of the first deposited transaction and concluding immediately after the execution of the final deposited transaction within that block. As such, there is exactly one deposit context per block.
19+
20+
## Security Considerations
21+
22+
TODO

specs/interop/predeploys.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [`_target`](#_target)
1212
- [`ExecutingMessage` Event](#executingmessage-event)
1313
- [Reference implementation](#reference-implementation)
14+
- [Deposit Handling](#deposit-handling)
1415
- [`Identifier` Getters](#identifier-getters)
1516
- [L2ToL2CrossDomainMessenger](#l2tol2crossdomainmessenger)
1617
- [`relayMessage` Invariants](#relaymessage-invariants)
@@ -26,6 +27,9 @@
2627
- [L1Block](#l1block)
2728
- [Static Configuration](#static-configuration)
2829
- [Dependency Set](#dependency-set)
30+
- [Deposit Context](#deposit-context)
31+
- [`isDeposit`](#isdeposit)
32+
- [`setDepositing`](#setdepositing)
2933
- [Security Considerations](#security-considerations)
3034

3135
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -139,6 +143,12 @@ function executeMessage(Identifier calldata _id, address _target, bytes calldata
139143

140144
Note that the `executeMessage` function is `payable` to enable relayers to earn in the gas paying asset.
141145

146+
### Deposit Handling
147+
148+
A call to `executeMessage` reverts if the call is made in a [deposit context](./derivation.md#deposit-context). The deposit context status can be determined by callling `isDeposit` on the `L1Block` contract.
149+
150+
In the future, deposit handling will be modified to be more permissive. It will revert only in specific cases where interop dependency resolution is not feasible.
151+
142152
### `Identifier` Getters
143153

144154
The `Identifier` MUST be exposed via `public` getters so that contracts can call back to authenticate
@@ -416,6 +426,30 @@ dependency set called `dependencySet()`. This function MUST return the array of
416426
`L1Block` MUST also provide a public getter to get the dependency set size called `dependencySetSize()`. This function
417427
MUST return the length of the dependency set array.
418428

429+
### Deposit Context
430+
431+
The `L1Block` contract is updated with the following methods to support [deposit contexts](./derivation.md#deposit-context).
432+
433+
#### `isDeposit`
434+
435+
```solidity
436+
function isDeposit() (return bool)
437+
```
438+
439+
A new method added to `L1Block` indicating whether the current execution is in a [deposit context](./derivation.md#deposit-context). The method has the following signature:
440+
441+
442+
Only the `CrossL2Inbox` is authorized to call `isDeposit`.
443+
444+
#### `setDepositing`
445+
446+
```solidity
447+
function setDepositing(bool _isDepositing)
448+
```
449+
A new method added to indicate whether the current execution is in a deposit context.
450+
451+
Only the `DEPOSITOR_ACCOUNT` is authorized to call `setDepositing`.
452+
419453
## Security Considerations
420454

421455
TODO

specs/interop/upgrade.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
**Table of Contents**
66

77
- [Security Considerations](#security-considerations)
8+
- [Deposit Transactions During Upgrades](#deposit-transactions-during-upgrades)
89

910
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1011

@@ -29,3 +30,8 @@ The exact definitions for these upgrade transactions are still to be defined.
2930
## Security Considerations
3031

3132
TODO
33+
34+
35+
### Deposit Transactions During Upgrades
36+
37+
TODO

0 commit comments

Comments
 (0)