From f2d96421ae2d7ae05cb69af06a208c7e753b69a5 Mon Sep 17 00:00:00 2001 From: Imran Jami Date: Tue, 4 Feb 2025 16:15:36 -0800 Subject: [PATCH 1/3] Update genesis.mdx --- .../chain-operators/deploy/genesis.mdx | 93 +++++++++---------- 1 file changed, 42 insertions(+), 51 deletions(-) diff --git a/pages/builders/chain-operators/deploy/genesis.mdx b/pages/builders/chain-operators/deploy/genesis.mdx index b25f92ac5..7b49c6e3d 100644 --- a/pages/builders/chain-operators/deploy/genesis.mdx +++ b/pages/builders/chain-operators/deploy/genesis.mdx @@ -4,40 +4,37 @@ lang: en-US description: Learn how to create a genesis file for the OP Stack. --- -import { Callout } from 'nextra/components' +import { Callout } from 'nextra/components'; # OP Stack genesis creation - - The recommended way to generate genesis and rollup configuration files is using `op-deployer`. - This ensures standardization and compatibility with the Superchain. - +The recommended way to generate genesis and rollup configuration files is using `op-deployer`. This ensures standardization and compatibility with the Superchain. The `op-deployer` tool simplifies the creation of genesis and rollup configuration files (`genesis.json` and `rollup.json`). These files are crucial for initializing the execution client (`op-geth`) and consensus client (`op-node`) for your network. The recommended flow for creating a genesis file and rollup configuration file on the OP Stack is as follows: -1. **Deploy the L1 contracts** using [op-deployer](/builders/chain-operators/tools/op-deployer). -2. **Generate** both the L2 genesis file (`genesis.json`) and the rollup configuration file (`rollup.json`) using op-deployer's `inspect` commands. -3. **Initialize** your off-chain components (e.g., execution client, consensus client). +1. **Deploy the L1 contracts** using [op-deployer](/builders/chain-operators/tools/op-deployer). +2. **Generate** both the L2 genesis file (`genesis.json`) and the rollup configuration file (`rollup.json`) using op-deployer's "inspect" commands. +3. **Initialize** your off-chain components (e.g., execution client, consensus client). ## Recommended method: using op-deployer ### Prerequisites -1. You have installed the `op-deployer` binary following the instructions in [deployer docs](/builders/chain-operators/tools/op-deployer#installation). - After installation, extract the `op-deployer` into your `PATH` and `cd op-deployer`. +1. You have installed the `op-deployer` binary following the instructions in [deployer docs](/builders/chain-operators/tools/op-deployer#installation). + After installation, extract the `op-deployer` into your `PATH` and `cd op-deployer`. -2. You have created and customized an intent file in a `.deployer` directory, typically by running: +2. You have created and customized an intent file in a `.deployer` directory, typically by running: - ```bash - ./bin/op-deployer init --l1-chain-id --l2-chain-ids --workdir .deployer - ``` + ```bash + ./bin/op-deployer init --l1-chain-id --l2-chain-ids --workdir .deployer + ``` - Replace `` and `` with their respective values, see a list of [`chainIds`](https://chainid.network/). + Replace `` and `` with their respective values, see a list of [`chainIds`](https://chainid.network/). -3. You have edited that intent file to your liking (roles, addresses, etc.). +3. You have edited that intent file to your liking (roles, addresses, etc.). ### Step 1: Deploy the L1 contracts @@ -51,9 +48,9 @@ To deploy your chain to L1, run: This command: -* Reads your intent file in `.deployer/.` -* Deploys the OP Stack contracts to the specified L1. -* Updates a local `state.json` file with the results of the deployment. +- Reads your intent file in `.deployer/.` +- Deploys the OP Stack contracts to the specified L1. +- Updates a local `state.json` file with the results of the deployment. ### Step 2: Generate your L2 genesis file and rollup file @@ -64,23 +61,23 @@ After your L1 contracts have been deployed, generate the L2 genesis and rollup c ./bin/op-deployer inspect rollup --workdir .deployer > .deployer/rollup.json ``` -* genesis.json is the file you will provide to your execution client (e.g. op-geth). -* rollup.json is the file you will provide to your consensus client (e.g. op-node). +- genesis.json is the file you will provide to your execution client (e.g. op-geth). +- rollup.json is the file you will provide to your consensus client (e.g. op-node). ### Step 3: Initialize your off-chain components Once you have `genesis.json` and `rollup.json`: -1. Initialize op-geth using genesis.json. -2. Configure op-node with rollup.json. -3. Set up additional off-chain infrastructure as needed (block explorer, indexers, etc.). For more on architecture, see [Architecture overview](/builders/chain-operators/architecture). +1. Initialize op-geth using genesis.json. +2. Configure op-node with rollup.json. +3. Set up additional off-chain infrastructure as needed (block explorer, indexers, etc.). For more on architecture, see [Architecture overview](/builders/chain-operators/architecture). ### Step 3: Get data Now that you have your `genesis.json` and `rollup.json` you can spin up a node on your network. You can also use the following inspect subcommands to get additional data: -````bash +```bash ./bin/op-deployer inspect l1 --workdir .deployer # outputs all L1 contract addresses for an L2 chain ./bin/op-deployer inspect deploy-config --workdir .deployer # outputs the deploy config for an L2 chain ``` @@ -92,11 +89,7 @@ file that represents the L2 genesis. You will provide this file to the execution client (op-geth) to initialize your network. There is also the rollup configuration file, `rollup.json`, which will be provided to the consensus client (op-node). - - The following genesis creation information is the legacy method for creating OP Stack configuration files. - This method is not recommended. It's preserved here for historical context. - - +The following genesis creation information is the legacy method for creating OP Stack configuration files. This method is not recommended. It's preserved here for historical context. ## Solidity script (Legacy) @@ -105,9 +98,7 @@ located in the monorepo to generate an "L2 state dump" and then pass this into t The foundry script can be found at [packages/contracts-bedrock/scripts/L2Genesis.s.sol](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/scripts/L2Genesis.s.sol). - -When generating the genesis file, please use the same `op-contracts/vX.Y.Z` release commit used for L1 contract deployments. - +When generating the genesis file, please use the same `op-contracts/vX.Y.Z` release commit used for L1 contract deployments. ### Configuration @@ -124,22 +115,22 @@ selected fork only, to the file at `STATE_DUMP_PATH`. The optional environment variable `OUTPUT_MODE` allows you to modify this behavior by setting it to one of the following values: -* `latest` (default) - only dump the selected fork's allocs. -* `all` - also dump all intermediary fork's allocs. This only works if - `STATE_DUMP_PATH` is not set. In this case, all allocs will be written to files - `/state-dump-.json`. Another path cannot currently be specified for this - use case. -* `none` - won't dump any allocs. Only makes sense for internal test usage. +- `latest` (default) - only dump the selected fork's allocs. +- `all` - also dump all intermediary fork's allocs. This only works if + `STATE_DUMP_PATH` is not set. In this case, all allocs will be written to files + `/state-dump-.json`. Another path cannot currently be specified for this + use case. +- `none` - won't dump any allocs. Only makes sense for internal test usage. ### Creation -* `CONTRACT_ADDRESSES_PATH` represents the deployment artifact that was - generated during a contract deployment. -* `DEPLOY_CONFIG_PATH` represents a path on the filesystem that points to a - deployment config. The same deploy config JSON file should be used for L1 contracts - deployment as when generating the L2 genesis allocs. -* `STATE_DUMP_PATH` represents the filepath at which the allocs will be - written to on disk. +- `CONTRACT_ADDRESSES_PATH` represents the deployment artifact that was + generated during a contract deployment. +- `DEPLOY_CONFIG_PATH` represents a path on the filesystem that points to a + deployment config. The same deploy config JSON file should be used for L1 contracts + deployment as when generating the L2 genesis allocs. +- `STATE_DUMP_PATH` represents the filepath at which the allocs will be + written to on disk. ```bash CONTRACT_ADDRESSES_PATH= \ @@ -147,7 +138,7 @@ DEPLOY_CONFIG_PATH= \ STATE_DUMP_PATH= \ forge script scripts/L2Genesis.s.sol:L2Genesis \ --sig 'runWithStateDump()' -```` +``` ## Subcommand (op-node genesis l2) @@ -169,7 +160,7 @@ go run cmd/main.go genesis l2 \ ## Next steps -* Learn how to [initialize](/builders/node-operators/configuration/base-config#initialization-via-genesis-file) - `op-geth` with your `genesis.json` file. -* Learn how to [initialize](https://docs.optimism.io/builders/node-operators/configuration/base-config#configuring-op-node) `op-node` with your `rollup.json` file. -* Learn more about the off chain [architecture](/builders/chain-operators/architecture). +- Learn how to [initialize](/builders/node-operators/configuration/base-config#initialization-via-genesis-file) + `op-geth` with your `genesis.json` file. +- Learn how to [initialize](https://docs.optimism.io/builders/node-operators/configuration/base-config#configuring-op-node) `op-node` with your `rollup.json` file. +- Learn more about the off chain [architecture](/builders/chain-operators/architecture). From 31e681f0ff514b2e0916e572ac056ae143af90da Mon Sep 17 00:00:00 2001 From: Imran Jami Date: Tue, 4 Feb 2025 16:26:43 -0800 Subject: [PATCH 2/3] test --- components/AskAIButton.tsx | 3 +-- lib/growthbook.ts | 17 ----------------- package.json | 1 - pages/_app.tsx | 27 ++++++++++++--------------- pnpm-lock.yaml | 28 ---------------------------- providers/GrowthbookProvider.tsx | 7 ------- theme.config.tsx | 3 +-- 7 files changed, 14 insertions(+), 72 deletions(-) delete mode 100644 lib/growthbook.ts delete mode 100644 providers/GrowthbookProvider.tsx diff --git a/components/AskAIButton.tsx b/components/AskAIButton.tsx index 7ce0372c4..6ec5c15a5 100644 --- a/components/AskAIButton.tsx +++ b/components/AskAIButton.tsx @@ -1,8 +1,7 @@ import { RiSparkling2Fill } from '@remixicon/react'; -import { useFeature } from '@growthbook/growthbook-react'; const AskAIButton = () => { - const enableDocsAIWidget = useFeature('enable_docs_ai_widget').on; + const enableDocsAIWidget = true; if (!enableDocsAIWidget) { return null; diff --git a/lib/growthbook.ts b/lib/growthbook.ts deleted file mode 100644 index fb3c8d6fa..000000000 --- a/lib/growthbook.ts +++ /dev/null @@ -1,17 +0,0 @@ -// lib/growthbook.ts -import { GrowthBook } from '@growthbook/growthbook-react'; - -if (!process.env.NEXT_PUBLIC_GROWTHBOOK_API_HOST || !process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY) { - throw new Error('NEXT_PUBLIC_GROWTHBOOK_API_HOST and NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY must be set'); -} - -export const growthbook = new GrowthBook({ - apiHost: process.env.NEXT_PUBLIC_GROWTHBOOK_API_HOST, - clientKey: process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY -}); - -try { - growthbook.init(); -} catch (error) { - console.error('Error initializing GrowthBook', error); -} diff --git a/package.json b/package.json index c085e0f0b..ec4d92339 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "@eth-optimism/contracts-ts": "^0.17.0", "@eth-optimism/tokenlist": "^9.0.9", "@feelback/react": "^0.3.4", - "@growthbook/growthbook-react": "^1.3.1", "@headlessui/react": "^2.1.8", "@remixicon/react": "^4.6.0", "algoliasearch": "^4.23.3", diff --git a/pages/_app.tsx b/pages/_app.tsx index b53a8a990..17c5e00f2 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -6,7 +6,6 @@ import * as gtag from '../utils/gtag'; import * as aa from 'search-insights'; import AlgoliaContext from '@/utils/contexts/AlgoliaContext'; import ScrollDispatcher from '@/components/ScrollDispatcher'; -import { CustomGrowthBookProvider } from '../providers/GrowthbookProvider'; export default function App({ Component, pageProps }) { const [queryID, setQueryID] = useState(null); @@ -29,19 +28,17 @@ export default function App({ Component, pageProps }) { }); return ( - - - - - - - + + + + + ); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d79c4710..9f97cb6b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,9 +28,6 @@ importers: '@feelback/react': specifier: ^0.3.4 version: 0.3.4(react@18.2.0) - '@growthbook/growthbook-react': - specifier: ^1.3.1 - version: 1.3.1(react@18.2.0) '@headlessui/react': specifier: ^2.1.8 version: 2.1.8(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -607,16 +604,6 @@ packages: '@floating-ui/utils@0.2.8': resolution: {integrity: sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==} - '@growthbook/growthbook-react@1.3.1': - resolution: {integrity: sha512-1ED2dG3lXrjVmxR2arOHmQEuasgcppaslgyxQxlykWJZ/UL5JpH59j6avOYgZzLlHkDfN1+Ic4X6Y/Vel4vK2g==} - engines: {node: '>=10'} - peerDependencies: - react: ^16.8.0-0 || ^17.0.0-0 || ^18.0.0-0 - - '@growthbook/growthbook@1.3.1': - resolution: {integrity: sha512-ewtwq6+86rRKwcYUXEmBVR1JuiEIYZhxow/Z52qyAxJwEHdXmpS4Yk8sVeVD9bphCwE2r0zuifxFkBxmnIL4Mg==} - engines: {node: '>=10'} - '@headlessui/react@1.7.17': resolution: {integrity: sha512-4am+tzvkqDSSgiwrsEpGWqgGo9dz8qU5M3znCkC4PgkpY4HcCZzEDEvozltGGGHIKl9jbXbZPSH5TWn4sWJdow==} engines: {node: '>=10'} @@ -1647,10 +1634,6 @@ packages: dom-accessibility-api@0.5.16: resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} - dom-mutator@0.6.0: - resolution: {integrity: sha512-iCt9o0aYfXMUkz/43ZOAUFQYotjGB+GNbYJiJdz4TgXkyToXbbRy5S6FbTp72lRBtfpUMwEc1KmpFEU4CZeoNg==} - engines: {node: '>=10'} - dompurify@3.0.6: resolution: {integrity: sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w==} @@ -4569,15 +4552,6 @@ snapshots: '@floating-ui/utils@0.2.8': {} - '@growthbook/growthbook-react@1.3.1(react@18.2.0)': - dependencies: - '@growthbook/growthbook': 1.3.1 - react: 18.2.0 - - '@growthbook/growthbook@1.3.1': - dependencies: - dom-mutator: 0.6.0 - '@headlessui/react@1.7.17(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: client-only: 0.0.1 @@ -5702,8 +5676,6 @@ snapshots: dom-accessibility-api@0.5.16: {} - dom-mutator@0.6.0: {} - dompurify@3.0.6: {} dot-case@3.0.4: diff --git a/providers/GrowthbookProvider.tsx b/providers/GrowthbookProvider.tsx deleted file mode 100644 index e20053b3e..000000000 --- a/providers/GrowthbookProvider.tsx +++ /dev/null @@ -1,7 +0,0 @@ -// components/GrowthBookProvider.tsx -import { GrowthBookProvider } from '@growthbook/growthbook-react'; -import { growthbook } from '../lib/growthbook'; - -export function CustomGrowthBookProvider({ children }: { children: React.ReactNode }) { - return {children}; -} diff --git a/theme.config.tsx b/theme.config.tsx index a7006267e..f562abfb6 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -6,7 +6,6 @@ import { FeelbackYesNo, PRESET_LIKE_DISLIKE } from '@feelback/react'; import '@feelback/react/styles/feelback.css'; import { Search } from './components/Search'; import { AskAIButton } from './components/AskAIButton'; -import { useFeature } from '@growthbook/growthbook-react'; const config: DocsThemeConfig = { logo: ( @@ -117,7 +116,7 @@ const config: DocsThemeConfig = { const { asPath, defaultLocale, locale } = useRouter(); const { frontMatter } = useConfig(); const url = 'https://docs.optimism.io' + (defaultLocale === locale ? asPath : `/${locale}${asPath}`); - const enableDocsAIWidget = useFeature('enable_docs_ai_widget').on; + const enableDocsAIWidget = true; return ( <> From 93c8a328dc2323b7fec6336a9d026b9f5d0691a4 Mon Sep 17 00:00:00 2001 From: Imran Jami Date: Tue, 4 Feb 2025 16:30:57 -0800 Subject: [PATCH 3/3] Update genesis.mdx --- pages/builders/chain-operators/deploy/genesis.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pages/builders/chain-operators/deploy/genesis.mdx b/pages/builders/chain-operators/deploy/genesis.mdx index 7b49c6e3d..3e3ae8604 100644 --- a/pages/builders/chain-operators/deploy/genesis.mdx +++ b/pages/builders/chain-operators/deploy/genesis.mdx @@ -77,10 +77,9 @@ Once you have `genesis.json` and `rollup.json`: Now that you have your `genesis.json` and `rollup.json` you can spin up a node on your network. You can also use the following inspect subcommands to get additional data: -```bash +````bash ./bin/op-deployer inspect l1 --workdir .deployer # outputs all L1 contract addresses for an L2 chain ./bin/op-deployer inspect deploy-config --workdir .deployer # outputs the deploy config for an L2 chain -``` ## Legacy method: using foundry script @@ -138,7 +137,7 @@ DEPLOY_CONFIG_PATH= \ STATE_DUMP_PATH= \ forge script scripts/L2Genesis.s.sol:L2Genesis \ --sig 'runWithStateDump()' -``` +```` ## Subcommand (op-node genesis l2)