From dbbf77ea0d049b267a00a0ce6a3866a88055f751 Mon Sep 17 00:00:00 2001 From: Daniel Helm Date: Tue, 31 Oct 2023 16:22:11 -0500 Subject: [PATCH 01/46] add TabsContent, needs styling --- src/components/Tabs/TabsContent.tsx | 103 +++++++++++++++++++++ src/components/Tabs/index.ts | 2 + src/content/docs/en/article-components.mdx | 54 +++++++++++ 3 files changed, 159 insertions(+) create mode 100644 src/components/Tabs/TabsContent.tsx diff --git a/src/components/Tabs/TabsContent.tsx b/src/components/Tabs/TabsContent.tsx new file mode 100644 index 000000000..f076839ee --- /dev/null +++ b/src/components/Tabs/TabsContent.tsx @@ -0,0 +1,103 @@ +/** @jsxImportSource preact */ +import type { ComponentChild } from "preact" +import { useRef } from "preact/hooks" +import { useTabState } from "./useTabState" +import styles from "./Tabs.module.css" +import { clsx } from "~/lib" +const tabSlotKey = "tab." as const +const panelSlotKey = "panel." as const + +type TabSlot = `${typeof tabSlotKey}${string}` +type PanelSlot = `${typeof panelSlotKey}${string}` + +function isTabSlotEntry(entry: [string, ComponentChild]): entry is [TabSlot, ComponentChild] { + const [key] = entry + return key.startsWith(tabSlotKey) +} + +function isPanelSlotEntry(entry: [string, ComponentChild]): entry is [PanelSlot, ComponentChild] { + const [key] = entry + return key.startsWith(panelSlotKey) +} + +function getBaseKeyFromTab(slot: TabSlot) { + return slot.replace(new RegExp(`^${tabSlotKey}`), "") +} + +function getBaseKeyFromPanel(slot: PanelSlot) { + return slot.replace(new RegExp(`^${panelSlotKey}`), "") +} + +type Props = { + [key: TabSlot | PanelSlot]: ComponentChild + sharedStore?: string +} + +export function TabsContent({ sharedStore, ...slots }: Props) { + const tabs = Object.entries(slots).filter(isTabSlotEntry) + const panels = Object.entries(slots).filter(isPanelSlotEntry) + + /** Used to focus next and previous tab on arrow key press */ + const tabButtonRefs = useRef>({}) + + const firstPanelKey = panels[0] ? getBaseKeyFromPanel(panels[0][0]) : "" + const [curr, setCurrStore] = useTabState(firstPanelKey, sharedStore) + + function moveFocus(event: KeyboardEvent) { + if (event.key === "ArrowLeft") { + const currIdx = tabs.findIndex(([key]) => getBaseKeyFromTab(key) === curr) + if (currIdx > 0) { + const [prevTabKey] = tabs[currIdx - 1] + setCurrStore(getBaseKeyFromTab(prevTabKey)) + tabButtonRefs.current[prevTabKey]?.focus() + } + } + if (event.key === "ArrowRight") { + const currIdx = tabs.findIndex(([key]) => getBaseKeyFromTab(key) === curr) + if (currIdx < tabs.length - 1) { + const [nextTabKey] = tabs[currIdx + 1] + setCurrStore(getBaseKeyFromTab(nextTabKey)) + tabButtonRefs.current[nextTabKey]?.focus() + } + } + } + + return ( +
+
+ {tabs.map(([key, content]) => ( + + ))} +
+ {panels.map(([key, content]) => ( + + ))} +
+ ) +} \ No newline at end of file diff --git a/src/components/Tabs/index.ts b/src/components/Tabs/index.ts index 08cf2bf26..ffe2d6fc7 100644 --- a/src/components/Tabs/index.ts +++ b/src/components/Tabs/index.ts @@ -1 +1,3 @@ export { Tabs } from "./Tabs" + +export { TabsContent } from "./TabsContent" diff --git a/src/content/docs/en/article-components.mdx b/src/content/docs/en/article-components.mdx index 96b4a2f63..aedeb15fa 100644 --- a/src/content/docs/en/article-components.mdx +++ b/src/content/docs/en/article-components.mdx @@ -13,6 +13,7 @@ import priceAggr from "../../../assets/images/contract-devs/price-aggr.png" import ToggleElement from "../../../components/ToggleElement.astro" import Aside from "../../../components/Aside.astro" import MarkmapView from "../../../components/MarkmapView/index.astro" +import { Tabs, TabsContent } from "../../../components/Tabs" This is body text right under the article title. It typically is just paragraph text that's pretty straightforward. Then there's **bold text**, and _italic text_, and **_bold-italic text_**, and `inline-code` and **`bold inline code`** and even _`italic inline code`_ and **_`bold italic inline code`_**. And of course don't forget [links](#), and [**bold links**](#), and [_italic links_](#), and [**_bold-italic links_**](#). @@ -162,3 +163,56 @@ stateDiagram ExecutionState --> ConstraintBuilder step_context --> ConstraintBuilder ``` + +### Tabs + + + npm + yarn + ```console npm install @chainlink/hardhat-chainlink ``` + ```console yarn add @chainlink/hardhat-chainlink ``` + + +### Tabs + + +Subscription +Direct funding + + +For Chainlink VRF v2 to fulfill your requests, you must maintain a sufficient amount of LINK in your subscription balance. Gas cost calculation includes the following variables: + +- **Gas price:** The current gas price, which fluctuates depending on network conditions. + +- **Callback gas:** The amount of gas used for the callback request that returns your requested random values. + +- **Verification gas:** The amount of gas used to verify randomness on-chain. + +The gas price depends on current network conditions. The callback gas depends on your callback function, and the number of random values in your request. The cost of each request is final only after the transaction is complete, but you define the limits you are willing to spend for the request with the following variables: + +- **Gas lane:** The maximum gas price you are willing to pay for a request in wei. Define this limit by specifying the appropriate `keyHash` in your request. The limits of each gas lane are important for handling gas price spikes when Chainlink VRF bumps the gas price to fulfill your request quickly. + +- **Callback gas limit:** Specifies the maximum amount of gas you are willing to spend on the callback request. Define this limit by specifying the `callbackGasLimit` value in your request. + + + + +For Chainlink VRF v2 to fulfill your requests, you must have a sufficient amount of LINK in your consuming contract. Gas cost calculation includes the following variables: + +- **Gas price:** The current gas price, which fluctuates depending on network conditions. + +- **Callback gas:** The amount of gas used for the callback request that returns your requested random values. The callback gas depends on your callback function and the number of random values in your request. Set the **callback gas limit** to specify the maximum amount of gas you are willing to spend on the callback request. + +- **Verification gas:** The amount of gas used to verify randomness on-chain. + +- **Wrapper overhead gas:** The amount of gas used by the VRF Wrapper contract. See the [Request and Receive Data](/vrf/v2/direct-funding#request-and-receive-data) section for details about the VRF v2 Wrapper contract design. + +Because the consuming contract directly pays the LINK for the request, the cost is calculated during the request and not during the callback when the randomness is fulfilled. Test your callback function to learn how to correctly estimate the callback gas limit. + +- If the gas limit is underestimated, the callback fails and the consuming contract is still charged for the work done to generate the requested random values. +- If the gas limit is overestimated, the callback function will be executed but your contract is not refunded for the excess gas amount that you paid. + +Make sure that your consuming contracts are funded with enough LINK tokens to cover the transaction costs. If the consuming contract doesn't have enough LINK tokens, your request will revert. + + + From eac51fbd6e0e41fb87b2c5e28265b63601b1572f Mon Sep 17 00:00:00 2001 From: dembelekaro <157847339+dembelekaro@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:23:41 +0000 Subject: [PATCH 02/46] Corrected sentence structures overview.md --- src/content/docs/en/getting-started/overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/en/getting-started/overview.md b/src/content/docs/en/getting-started/overview.md index acddb22f3..9af2eb9bc 100644 --- a/src/content/docs/en/getting-started/overview.md +++ b/src/content/docs/en/getting-started/overview.md @@ -10,7 +10,7 @@ whatsnext: { "User Guide": "/user-guide/", "Building on Scroll": "/developers/" #### Welcome to the Scroll docs! -Scroll is a security-focused scaling solution for Ethereum, using innovations in scaling design and zero knowledge proofs to build a new layer on Ethereum. The Scroll network is more accessible, more responsive, and can support more users at once than Ethereum alone, and if you've ever used or developed an application on Ethereum, you'll be right at home on Scroll. +Scroll is a security-focused scaling solution for Ethereum, using innovations in scaling design and zero knowledge proofs to build a new layer on Ethereum. The Scroll network is more accessible, more responsive and can support more users at once than Ethereum alone. If you've ever used or developed an application on Ethereum, you'll be right at home on Scroll. Want to try out the Scroll Sepolia testnet with free assets before using Scroll? Check out our [User Guide](/user-guide/). @@ -20,7 +20,7 @@ Scroll is building the technology to scale Ethereum. While Ethereum is the leading blockchain network for powering decentralized applications, its popularity also brings higher costs, creating a barrier to adoption for the next wave of users and developers. -Leveraging cutting-edge research in zero knowledge proofs (”zk”), Scroll is building a Layer 2 rollup network on Ethereum. The team, in open-source collaboration with others in the Ethereum community, has created a “zkEVM” that allows for all activity on the network, which behaves just like Ethereum, to be secured by smart contracts _on_ Ethereum. The network publishes all of the transactions to Ethereum, and the zkEVM creates and publishes cryptographic "proofs" that the Scroll network is following the rules of Ethereum. +Leveraging cutting-edge research in zero knowledge (”zk”) proofs , Scroll is building a Layer 2 rollup network on Ethereum. The team, in open-source collaboration with others in the Ethereum community, has created a “zkEVM” that allows for all activity on the network, which behaves just like Ethereum, to be secured by smart contracts _on_ Ethereum. The network publishes all of the transactions to Ethereum, and the zkEVM creates and publishes cryptographic "proofs" that the Scroll network is following the rules of Ethereum. Ultimately, Ethereum smart contracts verify that every transaction on Scroll is valid for these proofs, lending the network incredible security, decentralization, and censorship resistance. This level of security and scalability for Ethereum is only possible with recent breakthroughs in zero knowledge cryptography, blockchain protocol design, and hardware acceleration. From 392d15f3a560bc99443b7529e14d127760536bf1 Mon Sep 17 00:00:00 2001 From: pafaecks <134436264+pafaecks@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:17:58 +0100 Subject: [PATCH 03/46] Update execution-node.mdx --- src/content/docs/en/technology/sequencer/execution-node.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/technology/sequencer/execution-node.mdx b/src/content/docs/en/technology/sequencer/execution-node.mdx index b51fd0476..4eaca9336 100644 --- a/src/content/docs/en/technology/sequencer/execution-node.mdx +++ b/src/content/docs/en/technology/sequencer/execution-node.mdx @@ -72,7 +72,7 @@ Scroll adds a few validation rules in addition to Ethereum's block validation ru The Scroll execution node inherits most of Ethereum's behaviours. However, we needed to make some breaking changes to `l2geth` to enable more efficient proving. This section provides a non-exhaustive list of the modifications, along with their rationale. -- **State and storage tree**: Ethereum uses the MPT (Merkle-Partricia Trie) as its state and contract storage data structure. This trie's structure and the fact that it uses Keccak hash would make it prohibitively expensive for ZK circuits. `l2geth` instead uses [zkTrie](/technology/sequencer/zktrie): a binary Merkle trie with Poseidon hash for its state and contract storage. +- **State and storage tree**: Ethereum uses the MPT (Merkle-Patricia Trie) as its state and contract storage data structure. This trie's structure and the fact that it uses Keccak hash would make it prohibitively expensive for ZK circuits. `l2geth` instead uses [zkTrie](/technology/sequencer/zktrie): a binary Merkle trie with Poseidon hash for its state and contract storage. - **StateAccount**: The modification of state account is described in the [Accounts and State](/technology/chain/accounts). - **EVM**: The modifications are described in the [EVM Differences from Ethereum](/technology/chain/differences) - **Transaction fees** From 71848f2139a83b60e0a822c2a9ca6cc794f88bf7 Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:02:11 +0200 Subject: [PATCH 04/46] Update common-errors.mdx --- src/content/docs/en/user-guide/common-errors.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/user-guide/common-errors.mdx b/src/content/docs/en/user-guide/common-errors.mdx index f1f1b52b8..39f6b65bd 100644 --- a/src/content/docs/en/user-guide/common-errors.mdx +++ b/src/content/docs/en/user-guide/common-errors.mdx @@ -32,7 +32,7 @@ If no error or console logs appear, this is likely due to a nonce issue, please ## Block Explorer shows "Internal server error" -Use an incognito window, or open your browser developer console and remove the `_explorer_key` cookie (or all cookies). [See this guide for how to remove cookies.](https://www.contentstack.com/docs/developers/how-to-guides/clear-caches-and-cookies-in-different-browsers/). +Use an incognito window, or open your browser developer console and remove the `_explorer_key` cookie (or all cookies). [See this guide for how to remove cookies](https://www.contentstack.com/docs/developers/how-to-guides/clear-caches-and-cookies-in-different-browsers/). ## Sending max amount of Ether in MetaMask results in a "Failed" error From 8888204e2ac1824c34576f9cb2686e3ec7ac7d8a Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:05:12 +0200 Subject: [PATCH 05/46] Update verifying-smart-contracts.mdx --- src/content/docs/en/developers/verifying-smart-contracts.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/en/developers/verifying-smart-contracts.mdx b/src/content/docs/en/developers/verifying-smart-contracts.mdx index be119ed8c..a9322d6af 100644 --- a/src/content/docs/en/developers/verifying-smart-contracts.mdx +++ b/src/content/docs/en/developers/verifying-smart-contracts.mdx @@ -78,7 +78,7 @@ npx hardhat verify --network scrollSepolia 0xD9880690bd717189cC3Fbe7B9020F27fae7 ``` @@ -127,4 +127,4 @@ forge verify-contract \ \ No newline at end of file + From 4df922ac334db9bba883d92a8460c981be7a04b6 Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:07:38 +0200 Subject: [PATCH 06/46] Update l1-and-l2-bridging.mdx --- src/content/docs/en/developers/l1-and-l2-bridging.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/docs/en/developers/l1-and-l2-bridging.mdx b/src/content/docs/en/developers/l1-and-l2-bridging.mdx index b30000ef4..9971f29ce 100644 --- a/src/content/docs/en/developers/l1-and-l2-bridging.mdx +++ b/src/content/docs/en/developers/l1-and-l2-bridging.mdx @@ -26,12 +26,12 @@ In addition to token transfers, the Scroll Messenger contract enables cross-chai -There are many entry points from the user to the Scroll bridge. This will depend on what you want to do and how you want to do it. If you want to send ETH or ERC20 tokens, you should use the `GatewayRouter` . If you want to send NFTs, you should use the `L1ERC721Gateway` or `L1ERC1155Gateway`. If you want to send arbitrary data, you should use the `L1ScrollMessenger`. All Gateway transfers use the Scroll Messenger to send assets cross-chain, whose job is to append the transactions to the Message Queue for L2 inclusion. +There are many entry points from the user to the Scroll bridge. This will depend on what you want to do and how you want to do it. If you want to send ETH or ERC20 tokens, you should use the `GatewayRouter`. If you want to send NFTs, you should use the `L1ERC721Gateway` or `L1ERC1155Gateway`. If you want to send arbitrary data, you should use the `L1ScrollMessenger`. All Gateway transfers use the Scroll Messenger to send assets cross-chain, whose job is to append the transactions to the Message Queue for L2 inclusion. ## L2 Gateway architecture -Regarding possible permissionlessly callable entry points, the L2 Gateway Architecture is very similar to L1. The difference is that when sending a message from L2, calling the `appendMessage` function will store the message in an append-only binary merkle tree (aka withdraw tree) in the `L2MessageQueue`. When a new message is sent to the `L2MessageQueue`, the relayer will detect it and store it in the database. When the block is finalized, it will generate a proof of the new merkle path and pass it to the L1geth node to execute on `L1ScrollMessenger` . All finalized withdraw roots will be stored in the rollup contract so we can verify the proof against them. In the next Scroll versions, the Relayer won't be needed since all users will be able to finalize the transaction on L1. +Regarding possible permissionlessly callable entry points, the L2 Gateway Architecture is very similar to L1. The difference is that when sending a message from L2, calling the `appendMessage` function will store the message in an append-only binary merkle tree (aka withdraw tree) in the `L2MessageQueue`. When a new message is sent to the `L2MessageQueue`, the relayer will detect it and store it in the database. When the block is finalized, it will generate a proof of the new merkle path and pass it to the L1geth node to execute on `L1ScrollMessenger`. All finalized withdraw roots will be stored in the rollup contract so we can verify the proof against them. In the next Scroll versions, the Relayer won't be needed since all users will be able to finalize the transaction on L1. -In the upcoming sections, we will explore the technical aspects of the bridge, including the smart contract API required to utilize its capabilities. Detailed guides with code examples are provided in the Developer Guides section to assist developers and users in understanding and implementing these functionalities. \ No newline at end of file +In the upcoming sections, we will explore the technical aspects of the bridge, including the smart contract API required to utilize its capabilities. Detailed guides with code examples are provided in the Developer Guides section to assist developers and users in understanding and implementing these functionalities. From bd521d7ada33366da44b458ed3df3381ad1cafaa Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:11:12 +0200 Subject: [PATCH 07/46] Update erc1155-token-bridge.mdx --- .../en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx b/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx index 082ab18fd..274334aea 100644 --- a/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx +++ b/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx @@ -158,5 +158,5 @@ Update the mapping that connects an ERC1155 token contract from L2 to L1. | Parameter | Description | | --------- | ------------------------------------------------- | -| \_l1Token | The address of th ERC1155 token in L1. | +| \_l1Token | The address of the ERC1155 token in L1. | | \_l2Token | The address of corresponding ERC1155 token in L2. | From 76537cf4d2ab5a43dce2bfd07c1ca469719a3e07 Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:13:00 +0200 Subject: [PATCH 08/46] Update index.mdx --- src/content/docs/en/technology/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/technology/index.mdx b/src/content/docs/en/technology/index.mdx index 927303aa8..ae9168a7b 100644 --- a/src/content/docs/en/technology/index.mdx +++ b/src/content/docs/en/technology/index.mdx @@ -16,7 +16,7 @@ import Architecture from "./_images/arch.png" As illustrated in the figure above, Scroll chain consists of three layers: - **Settlement Layer**: provides data availability and ordering for the canonical Scroll chain, verifies validity proofs, and allows users and dapps to send messages and assets between Ethereum and Scroll. We use Ethereum as the Settlement Layer and deploy the bridge and rollup contract onto the Ethereum. -- **Sequencing Layer**: contains a *Execution Node* that executes the transactions submitted to the Scroll sequencer and the transactions submitted to the L1 bridge contract and produces L2 blocks, and a *Rollup Node* that batches transactions, posts transaction data and block information to Ethereum for data availability, and submits validity proofs to Ethereum for finality. +- **Sequencing Layer**: contains an *Execution Node* that executes the transactions submitted to the Scroll sequencer and the transactions submitted to the L1 bridge contract and produces L2 blocks, and a *Rollup Node* that batches transactions, posts transaction data and block information to Ethereum for data availability, and submits validity proofs to Ethereum for finality. - **Proving Layer**: consists of a pool of provers that are responsible for generating the zkEVM validity proofs that verify the correctness of L2 transactions, and a coordinator that dispatches the proving tasks to provers and relays the proofs to the Rollup Node to finalize on the Ethereum. This section of the documentation provides comprehensive information on the Scroll protocol specification, bridging protocol, sequencer, and zkEVM circuit. From f06ca9e9b1b2f907ea1945ac4d384df023074041 Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:14:35 +0200 Subject: [PATCH 09/46] Update transactions.mdx --- src/content/docs/en/technology/chain/transactions.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/technology/chain/transactions.mdx b/src/content/docs/en/technology/chain/transactions.mdx index d22a3402a..6a10f078c 100644 --- a/src/content/docs/en/technology/chain/transactions.mdx +++ b/src/content/docs/en/technology/chain/transactions.mdx @@ -24,7 +24,7 @@ Note that [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) and [EIP-1559](htt ### L1 Message Transaction -We introduce a new type of transactions `L1MessageTx` for L1 initiated transactions. This type of transaction is initiated on the L1 bridge contract. Every time a new message is appended to the `L1MessageQueue` contract on L1, the L2 sequeuncer will create a corresponding `L1MessageTx` transaction to be included in the L2 blocks. Because the signature was already implicitly verified when users submitted the transaction on L1, `L1MessageTx` transactions don't have signature. +We introduce a new type of transactions `L1MessageTx` for L1 initiated transactions. This type of transaction is initiated on the L1 bridge contract. Every time a new message is appended to the `L1MessageQueue` contract on L1, the L2 sequencer will create a corresponding `L1MessageTx` transaction to be included in the L2 blocks. Because the signature was already implicitly verified when users submitted the transaction on L1, `L1MessageTx` transactions don't have signature. The `L1MessageTx` transaction type is `0x7E` and its payload is defined as follows. From 0420f2cc223b0e7f836a73e3596ad4672183f4aa Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:15:50 +0200 Subject: [PATCH 10/46] Update blocks.mdx --- src/content/docs/en/technology/chain/blocks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/technology/chain/blocks.mdx b/src/content/docs/en/technology/chain/blocks.mdx index eb6f716d6..90ac5c4a0 100644 --- a/src/content/docs/en/technology/chain/blocks.mdx +++ b/src/content/docs/en/technology/chain/blocks.mdx @@ -27,7 +27,7 @@ The block header in Scroll mirrors the structure of Ethereum's. However, certain | `gasLimit` | The maximum gas allowed in the block. | | `gasUsed` | The gas used in the block. | | `timestamp` | The block time. | -| `extraData` | Signature by the block's signer, followd by arbitrary additional data. | +| `extraData` | Signature by the block's signer, followed by arbitrary additional data. | | `mixHash` | Always 0. | | `nonce` | Always 0. | | `baseFee` | Currently empty in Scroll because we haven't enabled the EIP-1559. | From 028a8f98e609031708ed488d345e57bdd1497b16 Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:17:47 +0200 Subject: [PATCH 11/46] Update withdraw-gateways.mdx --- src/content/docs/en/technology/bridge/withdraw-gateways.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/technology/bridge/withdraw-gateways.mdx b/src/content/docs/en/technology/bridge/withdraw-gateways.mdx index 5b0053981..5bd0a1862 100644 --- a/src/content/docs/en/technology/bridge/withdraw-gateways.mdx +++ b/src/content/docs/en/technology/bridge/withdraw-gateways.mdx @@ -82,7 +82,7 @@ The withdraw of ERC20 tokens works as follows. The withdrawal of standard and custom ERC20 tokens works in the same way as follows. 3. The `L2StandardERC20Gateway` or `L2CustomERC20Gateway` contract burns the withdrawn ERC20 token, encodes the withdrawal into a message, and sends it to `L2ScrollMessenger`. -4. The L1 withdrawal execution transaction calls `L1ScrollMessenger.relayMessageWithProof` function to finalize the withdrawals on L1. In the case of standard or custome ERC20 token withdrawal, the transaction calls `finalizeWithdrawERC20` function on the `L1StandardERC20Gateway` or `L1CustomERC20Gateway` contract respectively. +4. The L1 withdrawal execution transaction calls `L1ScrollMessenger.relayMessageWithProof` function to finalize the withdrawals on L1. In the case of standard or custom ERC20 token withdrawal, the transaction calls `finalizeWithdrawERC20` function on the `L1StandardERC20Gateway` or `L1CustomERC20Gateway` contract respectively. - In the `L1StandardERC20Gateway` contract, if this is the first withdrawal transaction of a ERC20 token, `finalizeWithdrawERC20` function will update the mapping from L1 token address to its L2 token address in the `tokenMapping`. 5. The L1 ERC20 token gateway releases the locked ERC20 tokens by transferring them from itself to the recipient address on L1. 6. If the user calls `withdrawERC20AndCall` on L2, the gateways will call the target L1 contract with additional data. From f4621edf61bb804da99e95aa59f7cc418bea01a0 Mon Sep 17 00:00:00 2001 From: mcisb <83702309+KyryloKilin@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:19:13 +0200 Subject: [PATCH 12/46] Update kzg-commitment-scheme.md --- .../docs/en/learn/zero-knowledge/kzg-commitment-scheme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/learn/zero-knowledge/kzg-commitment-scheme.md b/src/content/docs/en/learn/zero-knowledge/kzg-commitment-scheme.md index 1ff01ca4b..41f5ca162 100644 --- a/src/content/docs/en/learn/zero-knowledge/kzg-commitment-scheme.md +++ b/src/content/docs/en/learn/zero-knowledge/kzg-commitment-scheme.md @@ -51,7 +51,7 @@ There are established methods of conducting trusted setup ceremonies with weak t - Given a commitment $c = [P(\tau)]_1$, an evaluation $P(a) = b$, and a proof $\pi = [Q(\tau)]_1$ - Verify that $e(\pi, [\tau - a]_2) = e(c - [b]_1, h)$ - - Some algebra shows that this is equivalent to checking that that the quotient polynomial is correctly formed at $\tau$: $Q(\tau) = \frac{P(\tau) -b}{\tau-a}$ + - Some algebra shows that this is equivalent to checking that the quotient polynomial is correctly formed at $\tau$: $Q(\tau) = \frac{P(\tau) -b}{\tau-a}$ $$ \begin{align*} & e(\pi, [\tau - a]_2) = e(c - [b]_1, h) \\ \iff From 930802fa3f4b1a4cf4c894cb6c0497d0dfeb04cd Mon Sep 17 00:00:00 2001 From: markscroller <161376758+markscroller@users.noreply.github.com> Date: Mon, 26 Feb 2024 22:59:04 +0300 Subject: [PATCH 13/46] typo fix "th" --- .../en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx b/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx index 082ab18fd..274334aea 100644 --- a/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx +++ b/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx @@ -158,5 +158,5 @@ Update the mapping that connects an ERC1155 token contract from L2 to L1. | Parameter | Description | | --------- | ------------------------------------------------- | -| \_l1Token | The address of th ERC1155 token in L1. | +| \_l1Token | The address of the ERC1155 token in L1. | | \_l2Token | The address of corresponding ERC1155 token in L2. | From 23345a609acb3a39b77c5642b29d6720538070cc Mon Sep 17 00:00:00 2001 From: markscroller <161376758+markscroller@users.noreply.github.com> Date: Mon, 26 Feb 2024 23:00:16 +0300 Subject: [PATCH 14/46] typo fix "messagner" --- .../l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx b/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx index b46d30062..ca8d12ea3 100644 --- a/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx +++ b/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx @@ -33,7 +33,7 @@ All Gateway contracts will form the message and send it to the `L1ScrollMessenge address of the `L1ScrollMessenger`. -When a new block gets created on L1, the Watcher will detect the message on the `L1MessageQueue` and will pass it to the Relayer service, which will submit the transaction to the L2 via the l2geth node. Finally, the l2geth node will pass the transaction to the `L2ScrollMessagner` contract for execution on L2. +When a new block gets created on L1, the Watcher will detect the message on the `L1MessageQueue` and will pass it to the Relayer service, which will submit the transaction to the L2 via the l2geth node. Finally, the l2geth node will pass the transaction to the `L2ScrollMessenger` contract for execution on L2. ## Withdraw ETH and ERC20 tokens from L2 From f15e0fcbe49ec346da904ae5022f26eae79211da Mon Sep 17 00:00:00 2001 From: Cuong Duong Date: Tue, 5 Mar 2024 14:13:19 +0700 Subject: [PATCH 15/46] Update erc1155-token-bridge.mdx Update the description of param _tokenIds --- .../en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx b/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx index 082ab18fd..73e4f11f9 100644 --- a/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx +++ b/src/content/docs/en/developers/l1-and-l2-bridging/erc1155-token-bridge.mdx @@ -52,7 +52,7 @@ interface IScrollERC1155 { /// @notice Batch mint some token to recipient's account. /// @dev Gateway Utilities, only gateway contract can call /// @param _to The address of recipient. - /// @param _tokenIds The token id to mint. + /// @param _tokenIds The list of token ids to mint. /// @param _amounts The list of corresponding amount of token to mint. /// @param _data The data passed to recipient function batchMint( From 5e67db0e8fe09c3d98e3217cb8c621d8465ac96d Mon Sep 17 00:00:00 2001 From: Cuong Duong Date: Tue, 5 Mar 2024 15:03:28 +0700 Subject: [PATCH 16/46] Update eth-and-erc20-token-bridge.mdx Update exactly the description of burn token (not mint) --- .../l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx b/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx index b46d30062..e9b0ab44b 100644 --- a/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx +++ b/src/content/docs/en/developers/l1-and-l2-bridging/eth-and-erc20-token-bridge.mdx @@ -76,7 +76,7 @@ interface IScrollStandardERC20 { /// @param _amount The amount of token to mint. function mint(address _to, uint256 _amount) external; - /// @notice Mint some token from account. + /// @notice Burn some token from account. /// @dev Gateway Utilities, only gateway contract can call /// @param _from The address of account to burn token. /// @param _amount The amount of token to mint. From 13e81b185aa264a5e2b3b5f28f94281a3e597cfc Mon Sep 17 00:00:00 2001 From: Maxime Servais <43566493+Maxservais@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:28:59 +0100 Subject: [PATCH 17/46] Update faucet.mdx Adding Ethereum Sepolia faucet that's well funded and resistant to bots --- src/content/docs/en/user-guide/faucet.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/en/user-guide/faucet.mdx b/src/content/docs/en/user-guide/faucet.mdx index c889c7581..abb02d090 100644 --- a/src/content/docs/en/user-guide/faucet.mdx +++ b/src/content/docs/en/user-guide/faucet.mdx @@ -21,6 +21,7 @@ Here are a few Sepolia faucet apps: - [https://faucet.quicknode.com/drip](https://faucet.quicknode.com/drip) - [https://faucet.chainstack.com](https://faucet.chainstack.com) - [https://infura.io/faucet/sepolia](https://infura.io/faucet/sepolia) +- [https://www.ethereum-ecosystem.com/faucets/ethereum-sepolia](https://www.ethereum-ecosystem.com/faucets/ethereum-sepolia) Once you receive ETH on Sepolia, you should see it in your wallet on the _Sepolia Network_. It may take a few seconds for them to appear, but you can check the status by looking for a transaction to your address on a [Sepolia Block Explorer](https://sepolia.etherscan.io/). From e27e4b24e1b31f5f62ac36efd28d9da9bf72e38a Mon Sep 17 00:00:00 2001 From: Shawn | Automata <131737202+Shawn-ata@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:22:23 +0800 Subject: [PATCH 18/46] Update faucet_add_sepolia_eth_scroll_support_by_automata Added faucet support for Sepolia and Scroll Sepolia, backed by Automata Network Proof of Machinehood --- src/content/docs/en/user-guide/faucet.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/docs/en/user-guide/faucet.mdx b/src/content/docs/en/user-guide/faucet.mdx index c889c7581..e616641e4 100644 --- a/src/content/docs/en/user-guide/faucet.mdx +++ b/src/content/docs/en/user-guide/faucet.mdx @@ -21,6 +21,7 @@ Here are a few Sepolia faucet apps: - [https://faucet.quicknode.com/drip](https://faucet.quicknode.com/drip) - [https://faucet.chainstack.com](https://faucet.chainstack.com) - [https://infura.io/faucet/sepolia](https://infura.io/faucet/sepolia) +- [https://www.sepoliafaucet.io/](https://www.sepoliafaucet.io/) Once you receive ETH on Sepolia, you should see it in your wallet on the _Sepolia Network_. It may take a few seconds for them to appear, but you can check the status by looking for a transaction to your address on a [Sepolia Block Explorer](https://sepolia.etherscan.io/). @@ -37,3 +38,4 @@ If you don't want to interact with the bridge, some faucets directly distribute - [https://faucet.quicknode.com/scroll/sepolia](https://faucet.quicknode.com/scroll/sepolia) - [https://bwarelabs.com/faucets/scroll-testnet](https://bwarelabs.com/faucets/scroll-testnet) - [https://scroll.faucetme.pro](https://scroll.faucetme.pro) +- [https://www.l2faucet.com/scroll](https://www.l2faucet.com/scroll) From 72ec8dc095bb82a7b94695ba10dde2e5dee758bc Mon Sep 17 00:00:00 2001 From: Daniel Helm Date: Wed, 13 Mar 2024 17:38:47 -0500 Subject: [PATCH 19/46] adds dencun / cancun info and precompile limits --- .../en/developers/developer-quickstart.mdx | 4 ++++ .../ethereum-and-scroll-differences.mdx | 19 +++++++++++++++++++ .../docs/en/technology/chain/differences.mdx | 7 +++++++ 3 files changed, 30 insertions(+) diff --git a/src/content/docs/en/developers/developer-quickstart.mdx b/src/content/docs/en/developers/developer-quickstart.mdx index 302f4f214..9ff76a872 100644 --- a/src/content/docs/en/developers/developer-quickstart.mdx +++ b/src/content/docs/en/developers/developer-quickstart.mdx @@ -83,6 +83,10 @@ Use the table below to configure your Ethereum tools to the Scroll Sepolia Testn Contracts](/developers/verifying-smart-contracts). + + ### Hardhat Modify your Hardhat config file `hardhat.config.ts` to point at the Scroll Sepolia Testnet public RPC. diff --git a/src/content/docs/en/developers/ethereum-and-scroll-differences.mdx b/src/content/docs/en/developers/ethereum-and-scroll-differences.mdx index 5d73ae02b..dfba37f60 100644 --- a/src/content/docs/en/developers/ethereum-and-scroll-differences.mdx +++ b/src/content/docs/en/developers/ethereum-and-scroll-differences.mdx @@ -20,6 +20,7 @@ For open-source contributors and infrastructure builders, please contact our tea ## EVM Opcodes + | Opcode | Solidity equivalent | Scroll Behavior | | --------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------- | | `BLOCKHASH` | `block.blockhash` | Returns `keccak(chain_id \|\| block_number)` for the last 256 blocks. | @@ -28,6 +29,10 @@ For open-source contributors and infrastructure builders, please contact our tea | `BASEFEE` | `block.basefee` | Disabled.[^eip1559] If the opcode is encountered, the transaction will be reverted. | | `SELFDESTRUCT` | `selfdestruct` | Disabled. If the opcode is encountered, the transaction will be reverted.[^willadpot] | + + [^eip1559]: We have currently disabled EIP-1559 on Scroll. [^willadpot]: Will change to adopt Ethereum’s solution in the future. @@ -41,6 +46,20 @@ The `ecPairing` precompile is supported, but the number of points(sets, pairs) i The other EVM precompiles are all supported: `ecRecover`, `identity`, `ecAdd`, `ecMul`. +### Precompile Limits + +Because of a bounded size of the zkEVM circuits, there is an upper limit on the number of calls that can be made for some precompiles. These transactions will not revert, but simply be skipped by the sequencer if they cannot fit into the space of the circuit. Read more about the [Circuit Capacity Checker](/en/technology/sequencer/execution-node#circuit-capacity-checker). + +| Precompile / Opcode | Limit | +| ------------------- | ----- | +| `keccak256` | 3157 | +| `ecRecover` | 119 | +| `modexp` | 23 | +| `ecAdd` | 50 | +| `ecMul` | 50 | +| `ecPairing` | 2 | + + ## State Account ### **Additional Fields** diff --git a/src/content/docs/en/technology/chain/differences.mdx b/src/content/docs/en/technology/chain/differences.mdx index bbb6dac52..94c693e53 100644 --- a/src/content/docs/en/technology/chain/differences.mdx +++ b/src/content/docs/en/technology/chain/differences.mdx @@ -7,6 +7,8 @@ permalink: "technology/chain/differences" whatsnext: { "Bridge": "/technology/bridge/cross-domain-messaging/" } --- +import Aside from "../../../../components/Aside.astro" + ## Opcodes | Opcode | Scroll Behavior | @@ -44,3 +46,8 @@ EIPs imported from the Shanghai fork: - [EIP-3651](https://eips.ethereum.org/EIPS/eip-3651): Warm `COINBASE` - [EIP-3855](https://eips.ethereum.org/EIPS/eip-3855): `PUSH0` instruction - [EIP-3860](https://eips.ethereum.org/EIPS/eip-3860): Limit and meter initcode + + + From ebe5d8084c5563dd1765b0fed7160619806199ca Mon Sep 17 00:00:00 2001 From: zhengqi zhang <770166635@qq.com> Date: Mon, 18 Mar 2024 21:35:29 +0800 Subject: [PATCH 20/46] Upgrade to Astro v3 --- .nvmrc | 2 +- .tool-versions | 2 +- astro.config.ts | 19 +- integrations/youtube-embed.ts | 25 - package-lock.json | 5950 +++++++++++------ package.json | 16 +- src/components/ClickToZoom.astro | 2 +- src/components/Header/Header.astro | 6 +- src/env.d.ts | 2 +- src/layouts/HomeLayout.astro | 10 +- src/layouts/MainLayout.astro | 11 +- src/pages/zh/index.astro | 2 +- src/scripts/click-to-zoom.ts | 46 +- src/scripts/copy-to-clipboard.ts | 49 +- .../design-system/components/typography.css | 11 + tsconfig.json | 5 +- 16 files changed, 3901 insertions(+), 2257 deletions(-) delete mode 100644 integrations/youtube-embed.ts diff --git a/.nvmrc b/.nvmrc index 7fd023741..13480246a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.15.0 +v18.14.1 \ No newline at end of file diff --git a/.tool-versions b/.tool-versions index eedff58c8..ac4d6020f 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -nodejs 16.16.0 +nodejs 18.14.1 diff --git a/astro.config.ts b/astro.config.ts index 00e9a466b..1dd265072 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -5,7 +5,6 @@ import svgr from "vite-plugin-svgr" import astroI18next from "astro-i18next" import { astroCallouts, asideAutoImport } from "./integrations/astro-callouts" import { solidityRemixCode, codeSampleAutoImport } from "./integrations/solidity-remix" -import { youtubeEmbed } from "./integrations/youtube-embed" import mdx from "@astrojs/mdx" import rehypeSlug from "rehype-slug" import rehypeAutolinkHeadings from "rehype-autolink-headings" @@ -13,7 +12,6 @@ import rehypeKatex from "rehype-katex" import rehypeMermaid from "rehype-mermaidjs" import remarkGfm from "remark-gfm" import remarkMath from "remark-math" -import image from "@astrojs/image" import AutoImport from "astro-auto-import" import sitemap from "@astrojs/sitemap" @@ -23,6 +21,7 @@ import tailwind from "@astrojs/tailwind" // https://astro.build/config export default defineConfig({ site: "https://docs.scroll.io", + scopedStyleStrategy: "where", legacy: { astroFlavoredMarkdown: true, }, @@ -39,14 +38,11 @@ export default defineConfig({ }), astroCallouts(), solidityRemixCode(), - youtubeEmbed(), mdx(), - image(), tailwind({ - // Example: Disable injecting a basic `base.css` import on every page. - // Useful if you need to define and/or import your own custom `base.css`. - config: { applyBaseStyles: false }, + applyBaseStyles: false, }), + astroI18next(), ], vite: { @@ -61,7 +57,14 @@ export default defineConfig({ [ rehypeAutolinkHeadings, { - behavior: "append", + behavior: "wrap", + properties: {}, + content: { + type: "element", + tagName: "span", + properties: { className: ["icon", "icon-link"] }, + children: [], + }, }, ], [ diff --git a/integrations/youtube-embed.ts b/integrations/youtube-embed.ts deleted file mode 100644 index 85b3f191a..000000000 --- a/integrations/youtube-embed.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Add Youtube import to MD pages. - * Remove when astro supports 3rd party integration officially. - */ - -import type { AstroIntegration } from "astro" - -const CodeSampleTagName = "YouTube" -/** - * Astro integration that sets up the remark plugin and auto-imports the `