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

contracts-bedrock: improve CrossL2Inbox devex #11322

Merged
merged 7 commits into from
Aug 7, 2024
Merged

Commits on Aug 7, 2024

  1. contracts-bedrock: improve CrossL2Inbox devex

    Improve the `CrossL2Inbox` devex by creating an alternative entrypoint.
    This design was not considered previously because there was a "top level
    call" restriction, aka the "only EOA" invariant. This was to allow for
    static analysis of transactions, keeping resource usage lower for
    validating transactions when building blocks or at the mempool layer.
    Since 3074/7702 render the enforcement of only eoa impossible,  we decided
    to op/acc and lean into the approach of allowing subcalls to trigger
    `ExecutingMessage` events.
    
    This new interface allows another contract to be the entrypoint,
    the idea is that the user sends the `Identifier` and the serialized
    log (message) to whatever contract that they want and then pass it to
    `CrossL2Inbox.validateMessage` which then emits the event that consensus
    validates. This allows the calling smart contract to be aware of the
    schema for the log and deserialize it however they see fit. Since the
    serialized logs are done with the following algorithm:
    
    ```go
    msg := make([]byte, 0)
    for _, topic := range log.Topics {
        msg = append(msg, topic.Bytes()...)
    }
    msg = append(msg, log.Data...)
    ```
    
    It is very easy to use `abi.decode` to decode a log, given that solidity
    was used to `emit` it. The topics are `bytes32` and then the data is
    abi encoded given the schema of the event itself. Unused parts like
    `topic[0]` (hash of the event name) can be dropped when decoding if
    they are not required.
    tynes committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    fc03ce1 View commit details
    Browse the repository at this point in the history
  2. ctb: fix typo

    tynes committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    e23ac47 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    97463c7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a57ccc6 View commit details
    Browse the repository at this point in the history
  5. update version and semver-lock file

    AmadiMichael authored and tynes committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    ffc9aba View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e082b32 View commit details
    Browse the repository at this point in the history
  7. tests: fix

    tynes committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    3f93ad8 View commit details
    Browse the repository at this point in the history