Skip to content
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

No LaTex :( #4686

Merged
merged 1 commit into from
Jan 15, 2022
Merged
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
23 changes: 13 additions & 10 deletions EIPS/eip-4573.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,21 @@ The promised `n_outputs` words are known (at validation time) to be available on
### Memory Costs

Presently,`MSTORE` is defined as

$μ′_{m}[μ_{s}[0] . . . (μ_{s}[0] + 31)] ≡ μ_{s}[1]$,
$μ′_{i} ≡ max(μ_{i},⌊(μ_{s}[0]+32)÷32⌋)$

where $μ_{i}$ is the number of active words of memory above 0.
```
memory[stack[0]...(stack[0]+31) := stack[1]
memory_size' = max(memory_size,floor(stack[0]+32)÷32))
```
where `memory_size` is the number of active words of memory above 0.

We propose to treat memory addresses as signed, so the formula for `MSTOREFP` needs to be

$μ′_{m}[μ_{s}[0] . . . (μ_{s}[0] + 31)] ≡ μ_{s}[1]$,
$μ′_{j} ≡ max(μ_{j},⌊|μ_{s}[0]|+32)÷32⌋)$

where $μ_{j}$ is the number of active words of memory below 0.
```
memory'[stack[0]...(stack[0]+31) ≡ stack[1]
if (stack[0])+32)÷32) < 0
negative_memory_size' = max(negative_memory_size,floor(-(stack[0])+32)÷32))
else
positive_memory_size' = max(positive_memory_size,floor((stack[0])+32)÷32))
```
where `negative_memory_size` is the number of active words of memory below 0, and `positive_memory_size` is the number of active words of memory above 0.

## Rationale

Expand Down