Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jwasinger committed Jul 22, 2024
1 parent 09461ed commit 91fda55
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions EIPS/eip-7747.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
eip: 7747
description: Expanded-width modular arithmetic operations for the EVM

Check failure on line 3 in EIPS/eip-7747.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `description` is out of order

error[preamble-order]: preamble header `description` is out of order --> EIPS/eip-7747.md | 3 | description: Expanded-width modular arithmetic operations for the EVM | = help: `description` should come after `title` = help: see https://ethereum.github.io/eipw/preamble-order/
title: EVM Modular Arithmetic Extensions
status: Draft
type: Standards track
type: Standards Track

Check failure on line 5 in EIPS/eip-7747.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `type` is out of order

error[preamble-order]: preamble header `type` is out of order --> EIPS/eip-7747.md | 5 | type: Standards Track | = help: `type` should come after `status`
author: Jared Wasinger (@jwasinger), Alex Beregszaszi (@axic)
discussions-to: https://ethereum-magicians.org/t/eip-7747-evm-modular-arithmetic-extensions/20608
status: Draft
category: Core
created: 2024-07-20
requires: EOF

Check failure on line 11 in EIPS/eip-7747.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

preamble header `requires` items must be unsigned integers

error[preamble-uint-requires]: preamble header `requires` items must be unsigned integers --> EIPS/eip-7747.md:11:10 | 11 | requires: EOF | ^^^^ not a non-negative integer | = help: see https://ethereum.github.io/eipw/preamble-uint-requires/
Expand Down Expand Up @@ -158,7 +159,7 @@ def gas_setmod(element_size64bit: int) -> int:

When expanding EVM memory, expansion cost will now consider the size of all allocated field contexts in the current call frame.

### Rationale
## Rationale

By restricting that a modulus must be odd, and ensuring that inputs to arithmetic operations will be reduced by the modulus, modular arithmetic operations can be optimized:
* The reduction step for modular addition/subtraction can be implemented using only addition and subtraction.
Expand Down Expand Up @@ -196,11 +197,11 @@ In the graphs below, benchmark execution time is expressed in gas via scaling by
The implementations of the arithmetic are constant time. Modular addition/subtraction are linear with respect to modulus size. Modular multiplication scales quadratically with modulus size.

###### `ADDMODX`
![Alt text](https://github.com/jwasinger/evmmax-bench-plot/blob/5284df958171bc95ee9dcf47c995cffac7a136b0/charts/addmodx.png?raw=true)
![Alt text](../assets/addmodx.png)
###### `SUBMODX`
![Alt text](https://github.com/jwasinger/evmmax-bench-plot/blob/5284df958171bc95ee9dcf47c995cffac7a136b0/charts/submodx.png?raw=true)
![Alt text](../assets/submodx.png)
###### `MULMODX`
![Alt text](https://github.com/jwasinger/evmmax-bench-plot/blob/5284df958171bc95ee9dcf47c995cffac7a136b0/charts/mulmodx.png?raw=true)
![Alt text](../assets/mulmodx.png)

Check failure on line 204 in EIPS/eip-7747.md

View workflow job for this annotation

GitHub Actions / EIP Walidator

body has extra section(s)

error[markdown-order-section]: body has extra section(s) --> EIPS/eip-7747.md | 204 | ![Alt text](../assets/mulmodx.png) | = help: see https://ethereum.github.io/eipw/markdown-order-section/
---

##### `SETMODX`
Expand All @@ -211,7 +212,7 @@ The implementations of the arithmetic are constant time. Modular addition/subtr

---

### Security Considerations
## Security Considerations

#### Memory Attacks via forcing cache-misses

Expand Down
Binary file added assets/eip-7747/addmodx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/eip-7747/mulmodx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/eip-7747/submodx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 91fda55

Please sign in to comment.