Skip to content

Commit

Permalink
interop: Specify deposit handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Inphi committed Jun 25, 2024
1 parent 1b53492 commit 3cad559
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
22 changes: 22 additions & 0 deletions specs/interop/derivation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Overview](#overview)
- [Deposit Context](#deposit-context)
- [Security Considerations](#security-considerations)

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

## Overview

This is an experimental section and may be changed in the future. It is not required
for the initial release.

### Deposit Context

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.

## Security Considerations

TODO
34 changes: 34 additions & 0 deletions specs/interop/predeploys.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [`_target`](#_target)
- [`ExecutingMessage` Event](#executingmessage-event)
- [Reference implementation](#reference-implementation)
- [Deposit Handling](#deposit-handling)
- [`Identifier` Getters](#identifier-getters)
- [L2ToL2CrossDomainMessenger](#l2tol2crossdomainmessenger)
- [`relayMessage` Invariants](#relaymessage-invariants)
Expand All @@ -26,6 +27,9 @@
- [L1Block](#l1block)
- [Static Configuration](#static-configuration)
- [Dependency Set](#dependency-set)
- [Deposit Context](#deposit-context)
- [`isDeposit`](#isdeposit)
- [`setDepositing`](#setdepositing)
- [Security Considerations](#security-considerations)

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

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

### Deposit Handling

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.

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.

### `Identifier` Getters

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

### Deposit Context

The `L1Block` contract is updated with the following methods to support [deposit contexts](./derivation.md#deposit-context).

#### `isDeposit`

```solidity
function isDeposit() (return bool)
```

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:


Only the `CrossL2Inbox` is authorized to call `isDeposit`.

#### `setDepositing`

```solidity
function setDepositing(bool _isDepositing)
```
A new method added to indicate whether the current execution is in a deposit context.

Only the `DEPOSITOR_ACCOUNT` is authorized to call `setDepositing`.

## Security Considerations

TODO
6 changes: 6 additions & 0 deletions specs/interop/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Table of Contents**

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

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

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

TODO


### Deposit Transactions During Upgrades

TODO

0 comments on commit 3cad559

Please sign in to comment.