Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Consider resetting xDomainMessageSender after relaying a message  #309

@cwhinfrey

Description

@cwhinfrey

Is your feature request related to a problem? Please describe.
xDomainMessageSender will continue to return the sender of the last message until the next message is relayed.

This shouldn't be an issue for the most part since relayMessage has a reentrancy guard and every contract consuming xDomainMessageSender should also be checking that msg.sender is the Optimism messenger. That being said, it could lead to some weird behavior and is easy to fix.

Describe the solution you'd like
Consider either zeroing out xDomainMessageSender after the calls here and here or setting is to an address like 0x000000000000000000000000000000000000dead. Either one should result in some gas savings since the transaction will always reset the storage slot to the same value that it was at the beginning of the transaction. Each option will have slightly different gas implications (I'd recommend setting to the dead address).

Basically, it should improve security and save a bit of gas.

Describe alternatives you've considered
Leave as is

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions