From 952964df068877aeafb8df0fcf5e4238b3eec240 Mon Sep 17 00:00:00 2001 From: Bradley Camacho <42678939+bradleycamacho@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:20:15 -0700 Subject: [PATCH 1/7] Port internal knowledge base info to doc --- pages/chain/differences.mdx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pages/chain/differences.mdx b/pages/chain/differences.mdx index 784911879..3f8f63e6a 100644 --- a/pages/chain/differences.mdx +++ b/pages/chain/differences.mdx @@ -11,6 +11,16 @@ import { Callout } from 'nextra/components' OP Mainnet is designed to be [EVM equivalent](https://web.archive.org/web/20231127160757/https://medium.com/ethereum-optimism/introducing-evm-equivalence-5c2021deb306) and introduces as few changes as possible to the Ethereum protocol. However, there are some minor differences between the behavior of Ethereum and OP Mainnet that developers should be aware of. +## Bridging + +### Bridging - Deposit Transactions + +Deposit transactions don't exist on L1's, and are how transactions on an L2 can be initiated from the L1. Importantly, this is how bridge applications can get L1 ETH or tokens into an L2 OP-Stack chain. You can read more on deposit transactions [here](/stack/protocol/rollup/deposit-flow). + +### Bridging - Withdrawal Transactions and Fault Proofs + +Withdrawal transactions are how the state of the L2 rollup can be proven to the L1. Often this involves users withdrawing tokens or ETH to the L1. Fault proofs are the mechanism by which withdrawal transactions are currently proven to the L1. You can read more about fault proofs [here](/stack/protocol/fault-proofs/explainer). + ## Opcodes | Opcode | Solidity Equivalent | Behavior | @@ -55,6 +65,8 @@ In all other cases, the transaction sender address is set according to the same Transactions on OP Mainnet must pay for an [L1 data fee](/stack/transactions/fees#the-l1-data-fee) on top of the standard [execution gas fee](/stack/transactions/fees#execution-gas-fee) you would expect on Ethereum. Refer to the guide on [OP Mainnet Transaction Fees](/stack/transactions/fees) for more information. +You can use the [JS library viem](https://viem.sh/op-stack) to estimate the entire transaction gas costs, including the L1 Data Fee. + ### EIP-1559 Parameters The base fee on OP Mainnet is, like Ethereum, computed via the [EIP-1559](https://notes.ethereum.org/@vbuterin/eip-1559-faq) mechanism. @@ -75,3 +87,15 @@ The EIP-1559 parameters used by OP Mainnet differ from those used by Ethereum as Unlike Ethereum, OP Mainnet does not have a large public mempool. The OP Mainnet Sequencer mempool is currently only visible to the Sequencer. The Sequencer executes transactions from the mempool in priority fee order (highest fee first). + +## Chain Finality + +Unlike L1s such as Ethereum OP-Stack chains have Unsafe, Safe, and Finalized Heads which indicate the state of finality for a given L2 block. Fault proofs do not impact the finalization of the L2 rollup, only the finalization of withdrawal transactions to the L1. You can read more about these [in the docs glossary](/resources/glossary#unsafe-l2-block). + +## What's Next + +There are various useful tools linked above. Here are a few more tools and links you may want to check out: + +* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP-Chains. It is similar to Ethers.js for op-stack chains. We had an SDK but that is deprecated now. + +* [Specs](https://specs.optimism.io/root.html): For more in-depth technical explanations and examples. From 738730364c2adc96f11853361bcdd939c8c3e281 Mon Sep 17 00:00:00 2001 From: Bradley Camacho <42678939+bradleycamacho@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:31:11 -0700 Subject: [PATCH 2/7] Coderabbit suggestions --- pages/chain/differences.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/chain/differences.mdx b/pages/chain/differences.mdx index 3f8f63e6a..5bfb5f340 100644 --- a/pages/chain/differences.mdx +++ b/pages/chain/differences.mdx @@ -96,6 +96,6 @@ Unlike L1s such as Ethereum OP-Stack chains have Unsafe, Safe, and Finalized Hea There are various useful tools linked above. Here are a few more tools and links you may want to check out: -* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP-Chains. It is similar to Ethers.js for op-stack chains. We had an SDK but that is deprecated now. +* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP-Chains. It is similar to Ethers.js for op-stack chains. * [Specs](https://specs.optimism.io/root.html): For more in-depth technical explanations and examples. From 2e47a6014cfff36ee520237c850e1a23117bf678 Mon Sep 17 00:00:00 2001 From: soyboy <85043086+sbvegan@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:33:57 -0600 Subject: [PATCH 3/7] porting changes over to OP Stack section --- pages/stack/differences.mdx | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/pages/stack/differences.mdx b/pages/stack/differences.mdx index 85e10a265..4f925b6d2 100644 --- a/pages/stack/differences.mdx +++ b/pages/stack/differences.mdx @@ -11,6 +11,16 @@ import { Callout } from 'nextra/components' OP Stack chains are designed to be [EVM equivalent](https://web.archive.org/web/20231127160757/https://medium.com/ethereum-optimism/introducing-evm-equivalence-5c2021deb306) and introduces as few changes as possible to the Ethereum protocol. However, there are some minor differences between the behavior of Ethereum and OP Stack chains that developers should be aware of. +## Bridging + +### Bridging - Deposit Transactions + +Deposit transactions don't exist on L1's, and are how transactions on an L2 can be initiated from the L1. Importantly, this is how bridge applications can get L1 ETH or tokens into an L2 OP-Stack chain. You can read more on deposit transactions [here](/stack/protocol/rollup/deposit-flow). + +### Bridging - Withdrawal Transactions and Fault Proofs + +Withdrawal transactions are how the state of the L2 rollup can be proven to the L1. Often this involves users withdrawing tokens or ETH to the L1. Fault proofs are the mechanism by which withdrawal transactions are currently proven to the L1. You can read more about fault proofs [here](/stack/protocol/fault-proofs/explainer). + ## Opcodes | Opcode | Solidity Equivalent | Behavior | @@ -55,13 +65,27 @@ In all other cases, the transaction sender address is set according to the same Transactions on OP Stack chains must pay for an [L1 data fee](/stack/transactions/fees#the-l1-data-fee) on top of the standard [execution gas fee](/stack/transactions/fees#execution-gas-fee) you would expect on Ethereum. Refer to the guide on [OP Stack Transaction Fees](/stack/transactions/fees) for more information. -### EIP-1559 Parameters +You can use the [JS library viem](https://viem.sh/op-stack) to estimate the entire transaction gas costs, including the L1 Data Fee. + +### EIP-1559 parameters The base fee on OP Stack is, like Ethereum, computed via the [EIP-1559](https://notes.ethereum.org/@vbuterin/eip-1559-faq) mechanism. The EIP-1559 parameters used by OP Stack differ per chain. ### Mempool rules -By default, OP Stack chains do not have a large public mempool like Ethereum. -OP Stack mempools are typically only visible to the Sequencer of the given chain and transactions are generally executed in priority fee order (highest fee first). -This is not a required behavior and certain chains may choose to have a public mempool. +Unlike Ethereum, OP Stack chains do not have a public mempool. +The OP Stack mempool is currently only visible to the Sequencer. +The Sequencer executes transactions from the mempool in priority fee order (highest fee first). + +## Chain Finality + +Unlike L1s such as Ethereum OP-Stack chains have Unsafe, Safe, and Finalized Heads which indicate the state of finality for a given L2 block. Fault proofs do not impact the finalization of the L2 rollup, only the finalization of withdrawal transactions to the L1. You can read more about these [in the docs glossary](/resources/glossary#unsafe-l2-block). + +## What's Next + +There are various useful tools linked above. Here are a few more tools and links you may want to check out: + +* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP-Chains. It is similar to Ethers.js for op-stack chains. + +* [Specs](https://specs.optimism.io/root.html): For more in-depth technical explanations and examples. From f05971bc6561e9139e984f0e28e8d4124b2fe269 Mon Sep 17 00:00:00 2001 From: soyboy <85043086+sbvegan@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:35:54 -0600 Subject: [PATCH 4/7] adding tag --- pages/stack/differences.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/stack/differences.mdx b/pages/stack/differences.mdx index 4f925b6d2..dd9f4e70f 100644 --- a/pages/stack/differences.mdx +++ b/pages/stack/differences.mdx @@ -1,6 +1,7 @@ --- title: Differences between Ethereum and OP Stack Chains lang: en-US +tags: ["eng-protocol"] description: Learn the minor differences between the behavior of Ethereum and OP Stack chains. --- From bbc01e960f89374630b3f4cf4f0afb84842a7999 Mon Sep 17 00:00:00 2001 From: soyboy <85043086+sbvegan@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:39:03 -0600 Subject: [PATCH 5/7] removing OPM diff page and adding redirect --- pages/chain/differences.mdx | 101 ------------------------------------ public/_redirects | 3 +- 2 files changed, 2 insertions(+), 102 deletions(-) delete mode 100644 pages/chain/differences.mdx diff --git a/pages/chain/differences.mdx b/pages/chain/differences.mdx deleted file mode 100644 index 4e1a0088f..000000000 --- a/pages/chain/differences.mdx +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: Differences between Ethereum and OP Mainnet -lang: en-US -description: Learn the minor differences between the behavior of OP Mainnet and Ethereum. ---- - -import { Callout } from 'nextra/components' - -# Differences between Ethereum and OP Mainnet - -OP Mainnet is designed to be [EVM equivalent](https://web.archive.org/web/20231127160757/https://medium.com/ethereum-optimism/introducing-evm-equivalence-5c2021deb306) and introduces as few changes as possible to the Ethereum protocol. -However, there are some minor differences between the behavior of Ethereum and OP Mainnet that developers should be aware of. - -## Bridging - -### Bridging - Deposit Transactions - -Deposit transactions don't exist on L1's, and are how transactions on an L2 can be initiated from the L1. Importantly, this is how bridge applications can get L1 ETH or tokens into an L2 OP-Stack chain. You can read more on deposit transactions [here](/stack/protocol/rollup/deposit-flow). - -### Bridging - Withdrawal Transactions and Fault Proofs - -Withdrawal transactions are how the state of the L2 rollup can be proven to the L1. Often this involves users withdrawing tokens or ETH to the L1. Fault proofs are the mechanism by which withdrawal transactions are currently proven to the L1. You can read more about fault proofs [here](/stack/protocol/fault-proofs/explainer). - -## Opcodes - -| Opcode | Solidity Equivalent | Behavior | -| ------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `COINBASE` | `block.coinbase` | Returns the address of the current Sequencer's fee wallet. Effectively the same as Ethereum with the caveat the value typically does not change from block to block. | -| `PREVRANDAO` | `block.prevrandao` | Set **pseudorandomly** for each block by the Sequencer as opposed to the stronger guarantees provided by [RANDAO](https://eips.ethereum.org/EIPS/eip-4399) on Ethereum. | -| `ORIGIN` | `tx.origin` | If the transaction is an L1 ⇒ L2 transaction triggered by a smart contract on L1, then `tx.origin` is set to the [aliased address](#address-aliasing) of the address that triggered the L1 ⇒ L2 transaction. Otherwise, this opcode behaves normally. | -| `CALLER` | `msg.sender` | If the transaction is an L1 ⇒ L2 transaction triggered by a smart contract on L1, and this is the first call frame (rather than an internal transaction from one contract to another), the same [address aliasing](#address-aliasing) behavior applies. | - -### Address aliasing - - - Address aliasing is an important security feature that impacts the behavior of transactions sent from L1 to L2 by smart contracts. - Make sure to read this section carefully if you are working with cross-chain transactions. - Note that the `CrossChainMessenger` contracts will handle address aliasing internally on your behalf. - - -When transactions are sent from L1 to L2 by an Externally Owned Account, the address of the sender of the transaction on L2 will be set to the address of the sender of the transaction on L1. -**However, the address of the sender of a transaction on L2 will be different if the transaction was triggered by a smart contract on L1**. - -Because of the behavior of the `CREATE` opcode, it is possible to create a contract on both L1 and on L2 that share the same address but have different bytecode. -Even though these contracts share the same address, they are fundamentally two different smart contracts and cannot be treated as the same contract. -As a result, the sender of a transaction sent from L1 to L2 by a smart contract cannot be the address of the smart contract on L1 or the smart contract on L1 could act as if it were the smart contract on L2 (because the two contracts share the same address). - -To prevent this sort of impersonation, the sender of a transaction is slightly modified when a transaction is sent from L1 to L2 by a smart contract. -Instead of appearing to be sent from the actual L1 contract address, the L2 transaction appears to be sent from an "aliased" version of the L1 contract address. -This aliased address is a constant offset from the actual L1 contract address such that the aliased address will never conflict with any other address on L2 and the original L1 address can easily be recovered from the aliased address. - -This change in sender address is only applied to L2 transactions sent by L1 smart contracts. -In all other cases, the transaction sender address is set according to the same rules used by Ethereum. - -| Transaction Source | Sender Address | -| ------------------------------------------------------- | ------------------------------------------------------------------ | -| L2 user (Externally Owned Account) | The user's address (same as in Ethereum) | -| L1 user (Externally Owned Account) | The user's address (same as in Ethereum) | -| L1 contract (using `OptimismPortal.depositTransaction`) | `L1_contract_address + 0x1111000000000000000000000000000000001111` | - -## Transactions - -### Transaction fees - -Transactions on OP Mainnet must pay for an [L1 data fee](/stack/transactions/fees#the-l1-data-fee) on top of the standard [execution gas fee](/stack/transactions/fees#execution-gas-fee) you would expect on Ethereum. -Refer to the guide on [OP Mainnet Transaction Fees](/stack/transactions/fees) for more information. - -You can use the [JS library viem](https://viem.sh/op-stack) to estimate the entire transaction gas costs, including the L1 Data Fee. - -### EIP-1559 parameters - -The base fee on OP Mainnet is, like Ethereum, computed via the [EIP-1559](https://notes.ethereum.org/@vbuterin/eip-1559-faq) mechanism. -The EIP-1559 parameters used by OP Mainnet differ from those used by Ethereum as follows. - -| Parameter | OP Mainnet value | Ethereum value (for reference) | -| ------------------------------------- | ---------------: | -----------------------------: | -| Block gas limit | 30,000,000 gas | 30,000,000 gas | -| Block gas target | 5,000,000 gas | 15,000,000 gas | -| EIP-1559 elasticity multiplier | 6 | 2 | -| EIP-1559 denominator | 250 | 8 | -| Maximum base fee increase (per block) | 2% | 12.5% | -| Maximum base fee decrease (per block) | 0.4% | 12.5% | -| Block time in seconds | 2 | 12 | - -### Mempool rules - -Unlike Ethereum, OP Mainnet does not have a large public mempool. -The OP Mainnet Sequencer mempool is currently only visible to the Sequencer. -The Sequencer executes transactions from the mempool in priority fee order (highest fee first). - -## Chain Finality - -Unlike L1s such as Ethereum OP-Stack chains have Unsafe, Safe, and Finalized Heads which indicate the state of finality for a given L2 block. Fault proofs do not impact the finalization of the L2 rollup, only the finalization of withdrawal transactions to the L1. You can read more about these [in the docs glossary](/resources/glossary#unsafe-l2-block). - -## What's Next - -There are various useful tools linked above. Here are a few more tools and links you may want to check out: - -* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP-Chains. It is similar to Ethers.js for op-stack chains. - -* [Specs](https://specs.optimism.io/root.html): For more in-depth technical explanations and examples. diff --git a/public/_redirects b/public/_redirects index 55ee480e3..3eb5cb69c 100644 --- a/public/_redirects +++ b/public/_redirects @@ -103,4 +103,5 @@ /stack/operators/features/op-txproxy /builders/chain-operators/tools/op-txproxy /stack/operators/features/proxyd /builders/chain-operators/tools/proxyd /builders/notices/granite-changes https://github.com/ethereum-optimism/docs/blob/ef619668ae44276edecdfd657157254b9809e2d6/pages/builders/notices/granite-changes.mdx -/builders/notices/fp-changes https://github.com/ethereum-optimism/docs/blob/ef619668ae44276edecdfd657157254b9809e2d6/pages/builders/notices/fp-changes.mdx \ No newline at end of file +/builders/notices/fp-changes https://github.com/ethereum-optimism/docs/blob/ef619668ae44276edecdfd657157254b9809e2d6/pages/builders/notices/fp-changes.mdx +/chain/differences /stack/differences \ No newline at end of file From 0b87d150d1b97ba1bdc4f55a7ed47ce16a404dc5 Mon Sep 17 00:00:00 2001 From: soyboy <85043086+sbvegan@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:44:32 -0600 Subject: [PATCH 6/7] removing nav link --- pages/chain/_meta.json | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/chain/_meta.json b/pages/chain/_meta.json index 26c4d8459..6c45f77d2 100644 --- a/pages/chain/_meta.json +++ b/pages/chain/_meta.json @@ -1,6 +1,5 @@ { "getting-started": "Getting started: OP Mainnet", - "differences": "Differences between Ethereum and OP Mainnet", "networks": "Networks and RPC Endpoints", "addresses": "Contract addresses", "tokenlist": "Bridged token addresses", From 1816ac8767cbfc2e45200c3cc1035c77e38b44ca Mon Sep 17 00:00:00 2001 From: soyboy <85043086+sbvegan@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:48:05 -0600 Subject: [PATCH 7/7] removing hyphens --- pages/stack/differences.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/stack/differences.mdx b/pages/stack/differences.mdx index dd9f4e70f..9d6e6250c 100644 --- a/pages/stack/differences.mdx +++ b/pages/stack/differences.mdx @@ -16,7 +16,7 @@ However, there are some minor differences between the behavior of Ethereum and O ### Bridging - Deposit Transactions -Deposit transactions don't exist on L1's, and are how transactions on an L2 can be initiated from the L1. Importantly, this is how bridge applications can get L1 ETH or tokens into an L2 OP-Stack chain. You can read more on deposit transactions [here](/stack/protocol/rollup/deposit-flow). +Deposit transactions don't exist on L1's, and are how transactions on an L2 can be initiated from the L1. Importantly, this is how bridge applications can get L1 ETH or tokens into an L2 OP Stack chain. You can read more on deposit transactions [here](/stack/protocol/rollup/deposit-flow). ### Bridging - Withdrawal Transactions and Fault Proofs @@ -81,12 +81,12 @@ The Sequencer executes transactions from the mempool in priority fee order (high ## Chain Finality -Unlike L1s such as Ethereum OP-Stack chains have Unsafe, Safe, and Finalized Heads which indicate the state of finality for a given L2 block. Fault proofs do not impact the finalization of the L2 rollup, only the finalization of withdrawal transactions to the L1. You can read more about these [in the docs glossary](/resources/glossary#unsafe-l2-block). +Unlike L1s such as Ethereum, OP Stack chains have Unsafe, Safe, and Finalized Heads which indicate the state of finality for a given L2 block. Fault proofs do not impact the finalization of the L2 rollup, only the finalization of withdrawal transactions to the L1. You can read more about these [in the docs glossary](/resources/glossary#unsafe-l2-block). ## What's Next There are various useful tools linked above. Here are a few more tools and links you may want to check out: -* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP-Chains. It is similar to Ethers.js for op-stack chains. +* [OP-viem](https://viem.sh/op-stack): JS framework that can handle many of these unique functions on OP Chains. It is similar to Ethers.js for OP Stack chains. * [Specs](https://specs.optimism.io/root.html): For more in-depth technical explanations and examples.