Skip to content

Add SolSlot and SolMapping for Solidity storage layouts - #1605

Merged
sbillig merged 1 commit into
masterfrom
feat/std-sol-storage
Sep 28, 2026
Merged

sbillig merged 1 commit into
masterfrom
feat/std-sol-storage

Conversation

@cburgdorf

Copy link
Copy Markdown
Collaborator

std::evm::SolSlot works with Solidity's storage layout at a runtime slot:

  • read/write access a packed state variable at a byte offset without touching its neighbours, via the new SolPacked trait for bool, Address, all integer widths including the sol:: wrappers, and FixedBytes<N>.
  • read_bytes/read_string/write_bytes/write_string use Solidity's bytes/string layout; a write clears words left behind by a longer previous value.

std::evm::SolMapping derives mapping slots like Solidity for a runtime root, including nested mappings. The custom-width sol:: integers implement StorageKey, sign-extended like abi.encode.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T12:26:57.788952Z 2904b5e New commits
🔒 Security Review ✅ Completed 2026-09-28T12:28:08.936678Z 2904b5e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 522c7a7df9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ingots/std/src/evm/sol_slot.fe Resolved
Comment thread ingots/std/src/abi/sol/types.fe Resolved
Comment thread ingots/std/src/evm/sol_slot.fe Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41e17633ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ingots/std/src/evm/sol_slot.fe Resolved
Comment thread ingots/std/src/evm/sol_slot.fe Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43852ac763

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ingots/std/src/evm/sol_slot.fe Resolved
`std::evm::SolSlot` works with Solidity's storage layout at a runtime
slot:
- `read`/`write` access a packed state variable at a byte offset without
  touching its neighbours, via the new `SolPacked` trait for `bool`,
  `Address`, all integer widths including the `sol::` wrappers, and
  `FixedBytes<N>`. A field that would extend past the slot, or a
  non-canonical `Address` or `FixedBytes<N>`, reverts instead of being
  truncated.
- `read_bytes`/`read_string`/`write_bytes`/`write_string` use Solidity's
  `bytes`/`string` layout; a write clears words left behind by a longer
  previous value. A head whose length contradicts its short/long
  marker panics with 0x22, like Solidity.

`std::evm::SolMapping` derives `mapping` slots like Solidity for a
runtime root, including nested mappings. The custom-width `sol::`
integers implement `StorageKey`, sign-extended like `abi.encode`.

@sbillig sbillig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the current head; no blocking findings.

@sbillig
sbillig merged commit 27cd5dd into master Sep 28, 2026
9 checks passed
@sbillig
sbillig deleted the feat/std-sol-storage branch September 28, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants