Skip to content

Conversation

@RonTuretzky
Copy link
Contributor

Summary

  • Add ExternalStorageSlot struct to represent external storage accesses (address + slot)
  • Add allowedExternalSlots parameter to verifyAndUpdate function
  • Verify each CALL operation's external storage reads against the allowed list
  • Include external slots in message hash for signature verification
  • Reverts with UnauthorizedExternalStorageAccess if an unauthorized slot is accessed

This enables on-chain verification that execution only read the external storage slots that were proven in the ZK proof, preventing operators from submitting state updates that depend on storage reads they didn't prove.

Test plan

  • All existing tests pass
  • forge build succeeds

…date

- Add ExternalStorageSlot struct to track external storage accesses
- Update verifyAndUpdate signature to include expectedExternalSlots parameter
- Add verification in StateChangeHandlerLib._runStateUpdates that CALL operations
  only access the expected external storage slots (as proven in ZK proof)
- Include expectedExternalSlots in message hash for signature verification
- Add ExternalStorageSlotMismatch error for mismatched slots
- Update tests with new parameter and CALL args encoding
@RonTuretzky RonTuretzky force-pushed the external-storage-verify branch from 6b93fb5 to 0c5329b Compare November 29, 2025 03:31
- Add 'value' field to ExternalStorageSlot struct to store expected value
- Verify all external storage slots by calling getStorageAt(bytes32) on target
  contracts and comparing returned value against expected value
- Remove per-CALL externalSlotsAccessed array - verification now happens upfront
- Update error to include expected and actual values for debugging
- Add tests for successful verification and mismatch detection
- CALL args now simplified to (address, uint256, bytes)
@RonTuretzky RonTuretzky force-pushed the external-storage-verify branch from e061658 to 5e78bee Compare November 29, 2025 03:34
Remove address(this) check since external slots are always for other contracts.
@RonTuretzky RonTuretzky force-pushed the external-storage-verify branch from 761a05f to 5b058f9 Compare November 29, 2025 03:39
…el call verification

- Rename ExternalStorageSlot to ExternalCall with (target, callData, expectedResult)
- Change expectedValue from bytes32 to bytes to support arbitrary return data
- Update StateChangeHandlerLib to verify external calls by replaying them
- Compare full return data using keccak256 hash comparison
- Rename error to ExternalCallResultMismatch with detailed info
- Update all tests to use new ExternalCall struct and verification pattern
- Add test for multiple external call verification
@RonTuretzky RonTuretzky force-pushed the external-storage-verify branch from d95742d to 881cc7c Compare November 29, 2025 16:59
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