Skip to content

feat(confidential_storage): new semantics for s and c store/load#180

Merged
samlaf merged 8 commits intoseismicfrom
feat--change-cload-to-also-be-allowed-to-load-public-storage
Jan 22, 2026
Merged

feat(confidential_storage): new semantics for s and c store/load#180
samlaf merged 8 commits intoseismicfrom
feat--change-cload-to-also-be-allowed-to-load-public-storage

Conversation

@samlaf
Copy link
Copy Markdown
Contributor

@samlaf samlaf commented Jan 22, 2026

See committed README changes for explanation of new semantics. TLDR is that we are implementing these new semantics, after some audit discussions.

(0, public) (x, public) (0, private) (x, private)
SLOAD 0 x HALT HALT
CLOAD 0 x 0 x
SSTORE(y) (y, public) (y, public) HALT HALT
CSTORE(y) (y, private) HALT (y, private) (y, private)

Note

Had to update CI semantic tests to point to SeismicSystems/seismic-solidity#130 in order to fix tests. We should change back CI once that PR merges after audit. Added a note in that PR.

@samlaf samlaf requested a review from cdrappi as a code owner January 22, 2026 15:00
@samlaf samlaf marked this pull request as draft January 22, 2026 15:00
samlaf added a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 22, 2026
We updated the semantics of confidential storage opcodes in SeismicSystems/seismic-revm#180. The changes here are needed to reflect the new semantics.
This change makes reading a failing semantic test's error output much eaiser to parse for humans.
@samlaf samlaf changed the title feat(cload): change semantic to also allow reading public storage feat(confidential_storage): new semantics for s and c store/load Jan 22, 2026
Comment on lines +99 to +101
# Temporarily checking out the test--new-storage-opcode-semantics branch that fixes storage opcode semantic tests.
# TODO(samlaf): switch back to seismic (default) branch after we merge https://github.com/SeismicSystems/seismic-solidity/pull/130
git clone -b test--new-storage-opcode-semantics https://github.com/SeismicSystems/seismic-solidity.git "$TEMP_DIR/seismic-solidity"
Copy link
Copy Markdown
Contributor Author

@samlaf samlaf Jan 22, 2026

Choose a reason for hiding this comment

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

Fixed the semantic tests in a branch of seismic-solidity. Once that PR merges, we should remove this.

@samlaf samlaf marked this pull request as ready for review January 22, 2026 21:55
Copy link
Copy Markdown
Contributor

@cdrappi cdrappi left a comment

Choose a reason for hiding this comment

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

ship it

Ok(state_load) => {
// Privacy check: CSTORE cannot overwrite non-zero public slots
if !state_load.data.present_value.is_private
&& !state_load.data.present_value.value.is_zero()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

/// | SLOAD | 0 | x | HALT | HALT |
/// | CLOAD | 0 | x | 0 | x |
/// | SSTORE(y) | (y, public) | (y, public) | HALT | HALT |
/// | CSTORE(y) | (y, private) | HALT | (y, private) | (y, private) |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wow that's great

@samlaf samlaf merged commit e2ab654 into seismic Jan 22, 2026
6 checks passed
@samlaf samlaf deleted the feat--change-cload-to-also-be-allowed-to-load-public-storage branch January 22, 2026 23:07
cdrappi pushed a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 23, 2026
We updated the semantics of confidential storage opcodes in SeismicSystems/seismic-revm#180. The changes here are needed to reflect the new semantics.
cdrappi pushed a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 23, 2026
We updated the semantics of confidential storage opcodes in SeismicSystems/seismic-revm#180. The changes here are needed to reflect the new semantics.
samlaf added a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 24, 2026
This implements checks to prevent solidity devs from writing yul blocks that would result in runtime errors according to the new semantics implemented in revm: SeismicSystems/seismic-revm#180
samlaf added a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 26, 2026
…#136)

Add some basic shielded storage type checking to solc's analysis phase
so as to prevent compilation of programs that would clearly halt at
runtime (for example trying to sload a private slot).

This is effectively adding (very basic) type checking for the new opcode
semantic rules that were recently changed in revm:
SeismicSystems/seismic-revm#180

## Tests

Moved a few semantic tests to become syntaxTests, since the same
programs now fail to compile (with a type error) and so can't be input
to revm in semantic tests.

## Notes

This PR will affect
#112 since the
semantic tests there will no longer be able to be used since they won't
type check... 2 solutions:
1. we merge that PR without tests
2. we try to come up with some test that would trick the basic
type-checker implemented by this PR yet still generate a CSTORE followed
by SSTORE that would then need to fail at runtime in revm. Question at
that point though is whether that semantic test shouldnt become a syntax
test and the type-checker here shouldnt be augmented to catch that... :D
samlaf added a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 26, 2026
…#136)

Add some basic shielded storage type checking to solc's analysis phase
so as to prevent compilation of programs that would clearly halt at
runtime (for example trying to sload a private slot).

This is effectively adding (very basic) type checking for the new opcode
semantic rules that were recently changed in revm:
SeismicSystems/seismic-revm#180

## Tests

Moved a few semantic tests to become syntaxTests, since the same
programs now fail to compile (with a type error) and so can't be input
to revm in semantic tests.

## Notes

This PR will affect
#112 since the
semantic tests there will no longer be able to be used since they won't
type check... 2 solutions:
1. we merge that PR without tests
2. we try to come up with some test that would trick the basic
type-checker implemented by this PR yet still generate a CSTORE followed
by SSTORE that would then need to fail at runtime in revm. Question at
that point though is whether that semantic test shouldnt become a syntax
test and the type-checker here shouldnt be augmented to catch that... :D
samlaf added a commit to SeismicSystems/seismic-solidity that referenced this pull request Jan 27, 2026
…#136)

Add some basic shielded storage type checking to solc's analysis phase
so as to prevent compilation of programs that would clearly halt at
runtime (for example trying to sload a private slot).

This is effectively adding (very basic) type checking for the new opcode
semantic rules that were recently changed in revm:
SeismicSystems/seismic-revm#180

## Tests

Moved a few semantic tests to become syntaxTests, since the same
programs now fail to compile (with a type error) and so can't be input
to revm in semantic tests.

## Notes

This PR will affect
#112 since the
semantic tests there will no longer be able to be used since they won't
type check... 2 solutions:
1. we merge that PR without tests
2. we try to come up with some test that would trick the basic
type-checker implemented by this PR yet still generate a CSTORE followed
by SSTORE that would then need to fail at runtime in revm. Question at
that point though is whether that semantic test shouldnt become a syntax
test and the type-checker here shouldnt be augmented to catch that... :D
cdrappi pushed a commit to SeismicSystems/seismic-solidity that referenced this pull request Mar 3, 2026
We updated the semantics of confidential storage opcodes in SeismicSystems/seismic-revm#180. The changes here are needed to reflect the new semantics.
cdrappi pushed a commit to SeismicSystems/seismic-solidity that referenced this pull request Mar 3, 2026
…#136)

Add some basic shielded storage type checking to solc's analysis phase
so as to prevent compilation of programs that would clearly halt at
runtime (for example trying to sload a private slot).

This is effectively adding (very basic) type checking for the new opcode
semantic rules that were recently changed in revm:
SeismicSystems/seismic-revm#180

## Tests

Moved a few semantic tests to become syntaxTests, since the same
programs now fail to compile (with a type error) and so can't be input
to revm in semantic tests.

## Notes

This PR will affect
#112 since the
semantic tests there will no longer be able to be used since they won't
type check... 2 solutions:
1. we merge that PR without tests
2. we try to come up with some test that would trick the basic
type-checker implemented by this PR yet still generate a CSTORE followed
by SSTORE that would then need to fail at runtime in revm. Question at
that point though is whether that semantic test shouldnt become a syntax
test and the type-checker here shouldnt be augmented to catch that... :D
samlaf added a commit to SeismicSystems/seismic-reth that referenced this pull request Mar 18, 2026
2 main changes from revm:
1. CLOAD is now allowed to read public storage (had to fix a test). See
SeismicSystems/seismic-revm#180
- this is a pretty old PR now, its even on the seismic branch and not
the audit branch. We were just pointing to a very old commit.
2. SeismicHaltReason no longer exists. Changed invalid public/private
access to reverts instead of halts. See
SeismicSystems/seismic-revm#210 for more details
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