qerthm.blogg.se

Optimism ethereum
Optimism ethereum













optimism ethereum

See here if you want additional details (opens new window). Note: There are actually multiple contracts in Uniswap, so this explanation is a bit simplified. Helena Hacker forks Uniswap (opens new window) to create her own exchange (on L2), called Hackswap. It is possible that we will want to trust one of the contracts, but not the other. The problem with two identical source addresses (the L1 contract and the L2 contract) is that we extend trust based on the address. However, that is a separate issue from address aliasing because address aliasing also affects msg.sender. Note that in general, tx.origin should not be used for authorization (opens new window). Therefore, if the value of tx.origin is affected by the rules defined above, the top-level value of msg.sender will also be impacted.

optimism ethereum

The value of msg.sender at the top-level (the very first contract being called) is always equal to tx.origin. L1 contract (using CanonicalTransactionChain.enqueue) The value of tx.origin is determined as follows: Call source To prevent this problem the behavior of the ORIGIN and CALLER opcodes ( tx.origin and msg.sender) differs slightly between L1 and L2. This can break trust assumptions, because one contract may be trusted and another be untrusted (see below). # Address Aliasingīecause of the behavior of the CREATE opcode, it is possible for a user to create a contract on L1 and on L2 that share the same address but have different bytecode.

optimism ethereum

It is NOT possible to call this contract directly, it will throw an error. Please note that ETH was previously accessible as an ERC20 token, but this feature has been removed as part of OVM 2.0.įor tooling developers and infrastructure providers, please note that ETH is still represented internally as an ERC20 token at the address 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000 (opens new window).Īs a result, user balances will always be zero inside the state trie and the user's actual balance will be stored in the aforementioned token's storage. 2021), the process of using ETH on L2 is identical to the process of using ETH in Ethereum.

optimism ethereum

#OPTIMISM ETHEREUM UPDATE#

# Accessing the latest L1 block numberĪs of the OVM 2.0 update (Nov. The TIMESTAMP opcode ( block.timestamp in Solidity) uses the timestamp of the transaction itself. If you want access to the current time, you should use block.timestamp (the TIMESTAMP opcode) instead. This is important because it means that block.number is currently NOT a reliable source of timing information. 2021), each transaction on L2 is placed in a separate block and blocks are NOT produced at a constant rate. However, as of the OVM 2.0 release of Optimism (Nov. Similarly, in Optimism, block.number corresponds to the current L2 block number. On Ethereum, the NUMBER opcode ( block.number in Solidity) corresponds to the current Ethereum block number. # Block Numbers and Timestamps # Block production is not constant See section on Block Numbers and Timestamps for more information. Typically this block number will lag by up to 15 minutes behind the actual latest L1 block number. Returns the block number of the last L1 block known by the L2 system. If the transaction is an L1 ⇒ L2 transaction, then tx.origin is set to the aliased address of the address that triggered the L1 ⇒ L2 transaction. Currently returns the OVM_SequencerFeeVault address ( 0x420.011). # Opcode Differences # Modified Opcodes Opcode You should be aware of these descrepancies when building apps on top of Optimism. It's important to note that there are various minor discrepancies between the behavior of Optimism and Ethereum.















Optimism ethereum