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

fix(EVM): Replace hardcoded memory offsets (N-01) #1168

Merged
Merged
Show file tree
Hide file tree
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
32 changes: 16 additions & 16 deletions system-contracts/contracts/EvmEmulator.yul
Original file line number Diff line number Diff line change
Expand Up @@ -91,35 +91,35 @@ object "EvmEmulator" {
}

function GASPRICE_CACHE_OFFSET() -> offset {
offset := mul(24, 32)
offset := add(ORIGIN_CACHE_OFFSET(), 32)
}

function COINBASE_CACHE_OFFSET() -> offset {
offset := mul(25, 32)
offset := add(GASPRICE_CACHE_OFFSET(), 32)
}

function BLOCKTIMESTAMP_CACHE_OFFSET() -> offset {
offset := mul(26, 32)
offset := add(COINBASE_CACHE_OFFSET(), 32)
}

function BLOCKNUMBER_CACHE_OFFSET() -> offset {
offset := mul(27, 32)
offset := add(BLOCKTIMESTAMP_CACHE_OFFSET(), 32)
}

function PREVRANDAO_CACHE_OFFSET() -> offset {
offset := mul(28, 32)
offset := add(BLOCKNUMBER_CACHE_OFFSET(), 32)
}

function GASLIMIT_CACHE_OFFSET() -> offset {
offset := mul(29, 32)
offset := add(PREVRANDAO_CACHE_OFFSET(), 32)
}

function CHAINID_CACHE_OFFSET() -> offset {
offset := mul(30, 32)
offset := add(GASLIMIT_CACHE_OFFSET(), 32)
}

function BASEFEE_CACHE_OFFSET() -> offset {
offset := mul(31, 32)
offset := add(CHAINID_CACHE_OFFSET(), 32)
}

function LAST_RETURNDATA_SIZE_OFFSET() -> offset {
Expand Down Expand Up @@ -3220,35 +3220,35 @@ object "EvmEmulator" {
}

function GASPRICE_CACHE_OFFSET() -> offset {
offset := mul(24, 32)
offset := add(ORIGIN_CACHE_OFFSET(), 32)
}

function COINBASE_CACHE_OFFSET() -> offset {
offset := mul(25, 32)
offset := add(GASPRICE_CACHE_OFFSET(), 32)
}

function BLOCKTIMESTAMP_CACHE_OFFSET() -> offset {
offset := mul(26, 32)
offset := add(COINBASE_CACHE_OFFSET(), 32)
}

function BLOCKNUMBER_CACHE_OFFSET() -> offset {
offset := mul(27, 32)
offset := add(BLOCKTIMESTAMP_CACHE_OFFSET(), 32)
}

function PREVRANDAO_CACHE_OFFSET() -> offset {
offset := mul(28, 32)
offset := add(BLOCKNUMBER_CACHE_OFFSET(), 32)
}

function GASLIMIT_CACHE_OFFSET() -> offset {
offset := mul(29, 32)
offset := add(PREVRANDAO_CACHE_OFFSET(), 32)
}

function CHAINID_CACHE_OFFSET() -> offset {
offset := mul(30, 32)
offset := add(GASLIMIT_CACHE_OFFSET(), 32)
}

function BASEFEE_CACHE_OFFSET() -> offset {
offset := mul(31, 32)
offset := add(CHAINID_CACHE_OFFSET(), 32)
}

function LAST_RETURNDATA_SIZE_OFFSET() -> offset {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,35 @@ function ORIGIN_CACHE_OFFSET() -> offset {
}

function GASPRICE_CACHE_OFFSET() -> offset {
offset := mul(24, 32)
offset := add(ORIGIN_CACHE_OFFSET(), 32)
}

function COINBASE_CACHE_OFFSET() -> offset {
offset := mul(25, 32)
offset := add(GASPRICE_CACHE_OFFSET(), 32)
}

function BLOCKTIMESTAMP_CACHE_OFFSET() -> offset {
offset := mul(26, 32)
offset := add(COINBASE_CACHE_OFFSET(), 32)
}

function BLOCKNUMBER_CACHE_OFFSET() -> offset {
offset := mul(27, 32)
offset := add(BLOCKTIMESTAMP_CACHE_OFFSET(), 32)
}

function PREVRANDAO_CACHE_OFFSET() -> offset {
offset := mul(28, 32)
offset := add(BLOCKNUMBER_CACHE_OFFSET(), 32)
}

function GASLIMIT_CACHE_OFFSET() -> offset {
offset := mul(29, 32)
offset := add(PREVRANDAO_CACHE_OFFSET(), 32)
}

function CHAINID_CACHE_OFFSET() -> offset {
offset := mul(30, 32)
offset := add(GASLIMIT_CACHE_OFFSET(), 32)
}

function BASEFEE_CACHE_OFFSET() -> offset {
offset := mul(31, 32)
offset := add(CHAINID_CACHE_OFFSET(), 32)
}

function LAST_RETURNDATA_SIZE_OFFSET() -> offset {
Expand Down
Loading