Skip to content

What should the value of tx.origin and msg.sender be for L1 to L2 transactions? #246

Discussion options

You must be logged in to vote

We've made a final decision here, we're standardizing with Arbitrum and using the same address aliasing scheme that they use for message passing! Specifically, we use the following aliasing function:

    uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);

    function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {
        unchecked {
            l2Address = address(uint160(l1Address) + offset);
        }
    }

This aliasing ONLY applies for contracts sending messages to L2. If an EOA sends a message to L2 then the address is NOT aliased. Here's the relevant code from the CTC:

        address sender;
        if (msg.sender == tx.o…

Replies: 0 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@smartcontracts
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@romanovskaia21
Comment options

Comment options

You must be logged in to vote
2 replies
@smartcontracts
Comment options

@fredlacs
Comment options

Answer selected by smartcontracts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants