Skip to content

feat: interop access list#14873

Closed
agusduha wants to merge 2 commits intoethereum-optimism:developfrom
defi-wonderland:sc-feat/access-list
Closed

feat: interop access list#14873
agusduha wants to merge 2 commits intoethereum-optimism:developfrom
defi-wonderland:sc-feat/access-list

Conversation

@agusduha
Copy link
Contributor

@agusduha agusduha commented Mar 14, 2025

Description

Introducing a new validation mechanism for cross-chain message execution using transaction access-lists. The CrossL2Inbox contract will implement gas introspection to validate ExecutingMessage transactions. Each cross-chain message must be pre-declared in the transaction's access list.

Tests

We have added full unit test coverage for the functionality. However, we still need to define a proper way to test the access list behavior and gather more samples to thoroughly test the client's on-chain checksum calculation equivalence. This topic remains open for discussion.

Additional context

Design doc: ethereum-optimism/design-docs#214
Specs: ethereum-optimism/specs#612

Co-authored-by: @skeletor-spaceman @0xng @0xDiscotech

* feat: access list poc

* chore: remove is deposit tests

* fix: natspec and enhance comments

* chore: remove l1 block interop on solidity files

* fix: pr fixes

* chore: remove go logic over l1 block interop

* chore: remove some l1 block interop stuff on solidity side

* chore: remove from frozen files

* chore: remove missing l1 block interop stuff on go tests

* refactor: improve natspec and comments

* feat: add is warm tests

* feat: wip trying to integrate with common test

* fix: integrate with common test reading artifact json

* fix: pre-pr and tests

* fix: tests

* fix: tests

Co-authored-by: 0xng <ng@defi.sucks>
Co-authored-by: skeletor-spaceman <skeletor@defi.sucks>

* fix: pr review comments

* fix: op e2e inbox interface

---------

Co-authored-by: agusduha <agusnduha@gmail.com>
Co-authored-by: 0xng <ng@defi.sucks>
Co-authored-by: skeletor-spaceman <skeletor@defi.sucks>
@agusduha agusduha requested review from a team as code owners March 14, 2025 16:40
@tynes
Copy link
Contributor

tynes commented Mar 14, 2025

/ci authorize 3ac6e5d

Copy link
Contributor

@clabby clabby left a comment

Choose a reason for hiding this comment

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

The removal of the L1Block logic in solidity + Go looks good. Couple comments on the contract, but nothing super important.

Glad to approve in a bit 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Small pref for readability:

Suggested change
bytes32 internal constant _MSB_MASK = 0x00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
bytes32 internal constant _MSB_MASK = bytes32(~uint256(0xff << 248));;

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushed here

Copy link
Contributor

Choose a reason for hiding this comment

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

^ same

Suggested change
bytes32 internal constant _TYPE_3_MASK = 0x0300000000000000000000000000000000000000000000000000000000000000;
bytes32 internal constant _TYPE_3_MASK = bytes32(uint256(0x03 << 248));

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushed here

Copy link
Contributor

Choose a reason for hiding this comment

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

You can get away with shifting these values on the stack rather than having to touch memory w/ abi.encodePacked

bytes32 idPacked = bytes32(uint256(uint256(_id.blockNumber) << 128 | uint256(_id.timestamp) << 64 | uint256(_id.logIndex)) & type(uint192).max);

Copy link
Collaborator

Choose a reason for hiding this comment

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

we wanted to make the "most traditional" solidity way possible. we can add a gas-optimized yul version later on.

/// @param _id The identifier of the message.
/// @param _msgHash The hash of the message.
/// @return checksum_ The checksum of the message.
function _calculateChecksum(Identifier memory _id, bytes32 _msgHash) internal pure returns (bytes32 checksum_) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For all of the 64-byte hashes in this function, it'd be a bit more efficient to just use [0x00, 0x40) rather than having to allocate net-new memory w/ abi.encodePacked. Not blocking though if you consider the readability hit concerning.

Copy link
Contributor

Choose a reason for hiding this comment

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

Original spec PR had yul to do exactly that, but readability of abi.encodePacked won over that.

Comment on lines 12 to 14
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just to reduce ABI encoded size? It is an ABI breaking change to the contract.

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated 4d33c8b

Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

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

LGTM, but I think this is still blocked on the Identifier ABI decision

@agusduha
Copy link
Contributor Author

Follows on the internal PR #14883

@agusduha agusduha closed this Mar 14, 2025
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.

6 participants

Comments