Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions EIPS/eip-7961.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## Motivation

EIP-7937 has maximum compatibility with existing EVM. It implements EVM64 simply as a group of additional opcodes (using a prefix opcode). This EIP defines an alternative method, using EOF container's code section. It has its pros and cons. The code size will obviously become shorter, due to not needing multibyte opcodes any more. On the other hand, interop with EVM system calls become more difficult because it cannot be done in an EVM64 code section. The advantages and disadvantages are discussed further in the Rationale section.
EIP-7937 has maximum compatibility with existing EVM. It implements EVM64 simply as a group of additional opcodes (using a prefix opcode). This EIP defines an alternative method, using EOF container's code section. It has its pros and cons. The code size will obviously become shorter, due to not needing multibyte opcodes any more. On the other hand, interop with EVM system calls becomes more difficult because it cannot be done in an EVM64 code section. The advantages and disadvantages are discussed further in the Rationale section.

## Specification

Expand Down Expand Up @@ -62,7 +62,7 @@

### Memory opcodes

`MLOAD64` (0x51) will load a 64-bits integer in little endian onto the stack. `MSTORE64` (0x52) will read an 64-bits integer from the stack, and store it to memory in little endian.
`MLOAD64` (0x51) will load a 64-bits integer in little endian onto the stack. `MSTORE64` (0x52) will read a 64-bits integer from the stack, and store it to memory in little endian.

The gas cost for both opcodes is `G_VERYLOW64`. The memory resizing costs count as 8 bytes.

Expand All @@ -80,7 +80,7 @@

`CALLF`, `RETF`, `RJUMP` are available in EVM64 mode. Their behaviors, including gas costs, are unchanged.

For flow operations RJUMPI and RJUMPV, the 64-bit mode has following changes:
For flow operations RJUMPI and RJUMPV, the 64-bit mode has the following changes:

* For `RJUMPI64` (0xe1), the condition popped from stack is only read for the last 64 bits. Gas cost is `G_RJUMPIV64`.
* For `RJUMPV64` (0xe2), the case popped from stack is only read for the last 64 bits. Gas cost is `G_RJUMPIV64`.
Expand All @@ -97,7 +97,7 @@

### Discussions

This alternative definition (compared with EIP-7937) has the advantage that the code size is now shorter (because no multibyte opcodes are needed). It however will only work with EOF contract but not "legacy" EVM. The interaction between EVM64 and "system calls" (those calls that reads Ethereum block values, addresses, balances and storages) will be more difficult. It's not "seamless" like EIP-7937 where one can enter/exit 64-bit mode at ease. Depending on how the 64-bit optimization works out, this may be an advantage or an disadvantage.
This alternative definition (compared with EIP-7937) has the advantage that the code size is now shorter (because no multibyte opcodes are needed). It however will only work with EOF contract but not "legacy" EVM. The interaction between EVM64 and "system calls" (those calls that read Ethereum block values, addresses, balances and storages) will be more difficult. It's not "seamless" like EIP-7937 where one can enter/exit 64-bit mode at ease. Depending on how the 64-bit optimization works out, this may be an advantage or an disadvantage.

The memory is, as usual, still shared during the entire execution. So in EVM64, the contract can always use the memory to push/fetch data.

Expand All @@ -105,7 +105,7 @@

No backward compatibility issues found.

<!-- TODO: Add test cases and reference implementation -->

Check warning on line 108 in EIPS/eip-7961.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

HTML comments are only allowed while `status` is one of: `Draft`, `Withdrawn`

warning[markdown-html-comments]: HTML comments are only allowed while `status` is one of: `Draft`, `Withdrawn` --> EIPS/eip-7961.md | 108 | <!-- TODO: Add test cases and reference implementation --> | = help: see https://ethereum.github.io/eipw/markdown-html-comments/

## Security Considerations

Expand Down