Skip to content

Add EIP: Restricted Behavior Transaction Type #9476

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

forshtat
Copy link
Contributor

ATTENTION: ERC-RELATED PULL REQUESTS NOW OCCUR IN ETHEREUM/ERCS

--

When opening a pull request to submit a new EIP, please use the suggested template: https://github.com/ethereum/EIPs/blob/master/eip-template.md

We have a GitHub bot that automatically merges some PRs. It will merge yours immediately if certain criteria are met:

  • The PR edits only existing draft PRs.
  • The build passes.
  • Your GitHub username or email address is listed in the 'author' header of all affected PRs, inside .
  • If matching on email address, the email address is the one publicly listed on your GitHub profile.

@github-actions github-actions bot added c-new Creates a brand new proposal s-draft This EIP is a Draft t-core labels Mar 12, 2025
@eth-bot
Copy link
Collaborator

eth-bot commented Mar 12, 2025

File EIPS/eip-7906.md

Requires 1 more reviewers from @g11tech, @lightclient, @SamWilsn

@eth-bot eth-bot added e-consensus Waiting on editor consensus e-review Waiting on editor to review labels Mar 12, 2025
@eth-bot eth-bot changed the title Add EIP: Restricted behavior transaction type Add EIP: Restricted Behavior Transaction Type Mar 12, 2025
@forshtat forshtat requested a review from eth-bot as a code owner March 12, 2025 16:19
@github-actions github-actions bot added the w-ci Waiting on CI to pass label Mar 12, 2025
EIPS/eip-0000.md Outdated
@@ -0,0 +1,282 @@
---
eip: 0000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eip: 0000
eip: 7906

Don't forget to also rename the file!

@github-actions github-actions bot removed the w-ci Waiting on CI to pass label Mar 13, 2025
EIPS/eip-7906.md Outdated
Comment on lines 13 to 20
## Abstract

Historically, transaction payloads in Ethereum only defined their inputs, while the behavior and the outcome of
transactions is only defined by the code permanently deployed on-chain.
With the growing complexity of the deployed codebases and the growing monetary value controlled by this code,
such an approach becomes increasingly more dangerous.

This proposal, for the first time, allows the transaction payload to define some guardrails, which will empower Ethereum users to restrict the behavior of the deployed on-chain codebases.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a concise, short technical summary that captures the essence of what the proposal accomplishes. Currently, it includes too many details about the problem and context, which belong in the Motivation section. Please revise it to focus on the proposal's key purpose (e.g., introducing guardrails for transactions) and its primary benefit (e.g., enhancing security and reducing risks), while avoiding problem details and clearly Communicating the proposal’s core purpose and essence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

EIPS/eip-7906.md Outdated
Comment on lines 43 to 226
* All opcodes (`0xffff`) - used to explicitly permit or ban all opcodes for an address
* `CALL` with value (`0xff00`) - used to explicitly permit or ban calls only if they carry a value in native currency
* Current contract deployment (`0xff01`) - preventing the specified address from having a code inserted in its place
* Reverted call (`0xff02`) - preventing the specified address from executing any reverted call

Consequently, all EIPs defining new opcodes must specify whether the opcode should be restricted by default or not.

### New opcode `TXRESTRICTHASH`

With the growing adoption of Account Abstraction, it is important to expose the `execution_restrictions` value
to the Smart Contract Wallets.

The new `TXRESTRICTHASH` opcode pushes the following value onto the stack:

```
keccak256(execution_restrictions)
```

### Revert Reason

When executed in a view mode, a `RESTRICTED_EXECUTION_TX_TYPE` transaction with an `execution_restrictions` violation
returns with the following revert reason:

```
error ExecutionRestrictionViolation(address _address, bytes32 _slot, bytes32 _opcode);
```

Where:

* `_address` - the violating contract's address
* `_slot` - the storage slot that has caused a violation, or `0x0` if not slot-related
* `_opcode` - the exact opcode that has caused the rule violation

### RLP-encoding of the "Execution Restrictions" Parameter

The value of the `execution_restrictions` parameter is expressed as a
two-element `[permitted_operations, banned_operations]` RLP tuple.

#### Permitted Operations

We define the following constants to express various [permitted operations](#storage-altering-operations):

* `0x00` - permit `READ` operation
* `0x01` - permit `DECREASE` operation
* `0x02` - permit `INCREASE` operation
* `0x03` - permit `DELTA` operation
* `0x04` - permit `WRITE` operation

The `DELTA`, `INCREASE`, and `DECREASE` operations are expressed as a two-element `[operation, value]` RLP tuple.

The `permitted_operations` parameter is represented by an array of the following internal structure:

1. Address of an account with explicitly permitted operations.
2. Account balance permitted operation type, expressed as `[operation, value]` RLP tuple.
3. An array of permitted operations per storage slot.
If left empty, all slots are permitted for arbitrary read and write.
If the same slot ID appears multiple types, each operation is permitted for the given slot.
* Storage Slot Identifier
* Permitted "operation"
* Maximum permitted amount (optional)
4. An array of explicitly permitted [Restricted Opcodes](#opcodes-restricted-by-default).

Example of a `permitted_operations` encoding:

```
rlp(
[
[0xAddress1, [0x01, 0xde0b6b3a7640000], [[0xSlotID1, [0x00]], [0xSlotID2, [0x01]], ["0xF4", "0xF5"]]],
[0xAddress2, [0x02, de0b6b3a7640000], [0xSlotID, [0x02, 0x777]]],
[0xAddress3, [], [0xSlotID, [0x00]]],
]
)
```

#### Banned Operations

* `0x00` - ban `ANY` operation
* `0x01` - ban `DECREASE` operation
* `0x02` - ban `INCREASE` operation
* `0x04` - ban `WRITE` operation

The `banned_operations` parameter is represented by an array of the following internal structure:

1. Address of an account with explicitly banned operations
2. Account balance banned operation type, expressed as `operation` value.
3. An array of banned operations per storage slot. If left empty, all slots are banned for `ANY` operation.
* Storage Slot Identifier
* Banned "operation"
4. An array of explicitly banned opcodes. May contain any valid opcode value.

Example of a `banned_operations` encoding:

```
rlp(
[
[0xAddress1, 0x01, [[0xSlotID1, 0x00], [0xSlotID2, 0x01], ["0xF4", "0xF5"]]],
[0xAddress2, 0x04, [0xSlotID, 0x02]], []],
]
)
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use RFC 2119 keywords (e.g., MUST, SHOULD, MAY) in the Specification section to clearly define enforceable requirements and ensure alignment with EIP guidelines.
For example; "In case any of the specified restrictions is violated, the entire transaction is reverted on-chain and its gas is paid until the point of the restriction violation". Should be - "If any of the specified restrictions are violated, the transaction MUST revert on-chain, and its gas MUST be paid up to the point of the violation".

EIPS/eip-7906.md Outdated
Comment on lines 136 to 137
With the growing adoption of Account Abstraction, it is important to expose the `execution_restrictions` value
to the Smart Contract Wallets.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This explains more about why certain design choices were made and belongs in the rationale section.

We introduce a new [EIP-2718](./eip-2718.md) transaction, "restricted execution transaction", where the `TransactionType` is `RESTRICTED_EXECUTION_TX_TYPE` and the `TransactionPayload` is the RLP serialization of the following:

```
rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, value, data, access_list, authorization_list, execution_restrictions, signature_y_parity, signature_r, signature_s])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is authorization_list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EIP-7702 authorization tuples. I followed the naming from the EIP-7702 itself:

The authorization_list is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA. The transaction is considered invalid if the length of authorization_list is zero.

Should I remove the mention of authorization_list from this EIP or provide a link and an explanation of what this value means? I assumed that as EIP-7702 will be part of Ethereum very soon there is no need to re-explain it or "require" it specifically, am I wrong here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think require: 7702 in header sorts of resolve the dependency specification and terminolgy assumption

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please require all the transaction types EIPs you are trying to addess

Co-authored-by: Sam Wilson <[email protected]>
Copy link

github-actions bot commented Apr 1, 2025

The commit 97c8585 (as a parent of 85be0fc) contains errors.
Please inspect the Run Summary for details.


## Abstract

This proposal allows the transaction payload to define write protections for balances and storage slots that are to be enforced on the consensus level.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't insert line breaks by yourself unless introducing a new para, html render will auto render as per the screen size. similarly for the entire EIP


In case any of the specified restrictions is violated, the entire transaction MUST **revert on-chain** and its gas MUST be paid until the point of the restriction violation.

The transaction is considered to be a valid transaction that can be included in a block and pays its own gas regardless of the contents of the `execution_restrictions` parameter.
Copy link
Contributor

@g11tech g11tech Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please specify execution_restrictions grammar upfront and its encoding here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-new Creates a brand new proposal e-consensus Waiting on editor consensus e-review Waiting on editor to review s-draft This EIP is a Draft t-core w-ci Waiting on CI to pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants