From b9dd6ae0bc7e017ffb9a90956ca7d852b3a4b62d Mon Sep 17 00:00:00 2001 From: Pete Date: Mon, 23 Jun 2025 07:48:46 -0500 Subject: [PATCH 01/21] pushing barebones structure for increasing smart contract size limit --- .../11-smart-contract-size-limit.mdx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 8e8c3e59ce..b1af225f0e 100644 --- a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -6,3 +6,38 @@ sme: content_type: how-to tags: ['hide-from-search'] --- + + +Arbitrum chains do support an increased smart contract size limit of 96kB. + + + + + + + + + + + +You can use our Arbitrum chain (Orbit) SDK and configure the parameters [`MaxCodeSize` and `MaxInitCodeSize`](https://docs.arbitrum.io/launch-arbitrum-chain/faq-troubleshooting/troubleshooting-building-arbitrum-chain#can-i-increase-the-maximum-contract-size-for-my-arbitrum-chain:~:text=MaxCodeSize%20and%20MaxInitCodeSize) when calling [`prepareNodeConfig`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts#L43). + + + + + + + +To be deployed onchain, the size of your uncompressed WebAssembly (WASM) file must not exceed 128Kb, while the compressed binary must not exceed 24KB. Stylus conforms with the same contract size limit as the EVM to remain fully interoperable with all smart contracts on Arbitrum chains. + +cargo-stylus, the Stylus CLI tool, automatically compresses your WASM programs, but there are additional steps that you can take to further reduce the size of your binaries. + +Your options fall into two categories: Rust compiler flags, and third-party optimization tools. \ No newline at end of file From 6371c6e0c8d407d41e41d5a5ce8bb24b9c5332c4 Mon Sep 17 00:00:00 2001 From: Pete Date: Mon, 23 Jun 2025 07:49:00 -0500 Subject: [PATCH 02/21] yarn format --- .../11-smart-contract-size-limit.mdx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index b1af225f0e..6ea5c45aa7 100644 --- a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -8,36 +8,35 @@ tags: ['hide-from-search'] --- -Arbitrum chains do support an increased smart contract size limit of 96kB. + +Arbitrum chains do support an increased smart contract size limit of 96kB. - - - - + You can use our Arbitrum chain (Orbit) SDK and configure the parameters [`MaxCodeSize` and `MaxInitCodeSize`](https://docs.arbitrum.io/launch-arbitrum-chain/faq-troubleshooting/troubleshooting-building-arbitrum-chain#can-i-increase-the-maximum-contract-size-for-my-arbitrum-chain:~:text=MaxCodeSize%20and%20MaxInitCodeSize) when calling [`prepareNodeConfig`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts#L43). - - + To be deployed onchain, the size of your uncompressed WebAssembly (WASM) file must not exceed 128Kb, while the compressed binary must not exceed 24KB. Stylus conforms with the same contract size limit as the EVM to remain fully interoperable with all smart contracts on Arbitrum chains. cargo-stylus, the Stylus CLI tool, automatically compresses your WASM programs, but there are additional steps that you can take to further reduce the size of your binaries. -Your options fall into two categories: Rust compiler flags, and third-party optimization tools. \ No newline at end of file +Your options fall into two categories: Rust compiler flags, and third-party optimization tools. From feb8dd72393f416b5c926ac5446334d073f4690c Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:01:14 -0500 Subject: [PATCH 03/21] adding new content --- .../11-smart-contract-size-limit.mdx | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 6ea5c45aa7..076f7aefad 100644 --- a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -7,36 +7,36 @@ content_type: how-to tags: ['hide-from-search'] --- - +For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit is fixed at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. -Arbitrum chains do support an increased smart contract size limit of 96kB. +However, if you're launching a custom Arbitrum chain (a Layer 2 or Layer 3 chain built using the Arbitrum stack), the limit can be increased up to 96 kB. - +## Why the limit? +The limit exists because larger contracts require more resources to process and verify, making them potential vectors for denial-of-service (DoS) attacks if not properly constrained. The original EIP-170, which addressed the issue of smart contract size, was designed with this in mind. - +## Benefits of increasing the smart contract size limit +Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: +Support for More Complex and Feature-Rich Contracts: Larger contracts can incorporate extensive logic, libraries, and functionalities without requiring the need to split code across multiple contracts. This consolidation is beneficial for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. - +- **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. +- **Simplified development and maintenance**: Developers can write cleaner, more modular code without artificial splitting, making it easier to audit, debug, and upgrade contracts. Cleaner code streamlines the development process and reduces complexity in reasoning about the codebase. +- **Enhanced customization for specific use cases**: On Orbit chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. - +## Drawbacks of increasing the smart contract size limit +While beneficial for complexity, raising the limit introduces trade-offs, particularly in costs, security, and performance. These are more pronounced in Rollup environments, such as Arbitrum, where transactions get posted to the Ethereum Layer 1. -You can use our Arbitrum chain (Orbit) SDK and configure the parameters [`MaxCodeSize` and `MaxInitCodeSize`](https://docs.arbitrum.io/launch-arbitrum-chain/faq-troubleshooting/troubleshooting-building-arbitrum-chain#can-i-increase-the-maximum-contract-size-for-my-arbitrum-chain:~:text=MaxCodeSize%20and%20MaxInitCodeSize) when calling [`prepareNodeConfig`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts#L43). +- **Higher deployment costs**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size. +- **Potential security risks**: Increasing code complexity increases the surface area for vulnerabilities, making audits more challenging and raising the risk of exploits. Larger contracts may also complicate fraud-proof mechanisms in optimistic rollups, such as Arbitrum, potentially making disputes more resource-intensive and time-consuming. +- **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the original EIP-170 limit design was to mitigate such issues. +- **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Orbit chain, reducing flexibility if you need to migrate in the future. +- **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. +Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. - +How to Configure +1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. +2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) (for deployed contract code size) and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) (for initialization code size during deployment). +3. These parameters are defined in the SDK's `prepareChainConfig.ts` file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29). + +4. Note that once the chain deploys, the smart contract limits are unchangeable via upgrades—you must set them during initial configuration. - - - - -To be deployed onchain, the size of your uncompressed WebAssembly (WASM) file must not exceed 128Kb, while the compressed binary must not exceed 24KB. Stylus conforms with the same contract size limit as the EVM to remain fully interoperable with all smart contracts on Arbitrum chains. - -cargo-stylus, the Stylus CLI tool, automatically compresses your WASM programs, but there are additional steps that you can take to further reduce the size of your binaries. - -Your options fall into two categories: Rust compiler flags, and third-party optimization tools. +This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24 kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128 kB, depending on the setup). You can learn more about Stylus in this section. From c14ace93feac5656698809cd9c1fb303469ae322 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:01:37 -0500 Subject: [PATCH 04/21] yarn format --- .../11-smart-contract-size-limit.mdx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 076f7aefad..b703ebd2d3 100644 --- a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -12,10 +12,12 @@ For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart co However, if you're launching a custom Arbitrum chain (a Layer 2 or Layer 3 chain built using the Arbitrum stack), the limit can be increased up to 96 kB. ## Why the limit? + The limit exists because larger contracts require more resources to process and verify, making them potential vectors for denial-of-service (DoS) attacks if not properly constrained. The original EIP-170, which addressed the issue of smart contract size, was designed with this in mind. ## Benefits of increasing the smart contract size limit -Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: + +Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: Support for More Complex and Feature-Rich Contracts: Larger contracts can incorporate extensive logic, libraries, and functionalities without requiring the need to split code across multiple contracts. This consolidation is beneficial for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. - **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. @@ -23,6 +25,7 @@ Support for More Complex and Feature-Rich Contracts: Larger contracts can incorp - **Enhanced customization for specific use cases**: On Orbit chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. ## Drawbacks of increasing the smart contract size limit + While beneficial for complexity, raising the limit introduces trade-offs, particularly in costs, security, and performance. These are more pronounced in Rollup environments, such as Arbitrum, where transactions get posted to the Ethereum Layer 1. - **Higher deployment costs**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size. @@ -30,13 +33,14 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic - **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the original EIP-170 limit design was to mitigate such issues. - **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Orbit chain, reducing flexibility if you need to migrate in the future. - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. -Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. + Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. How to Configure + 1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. 2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) (for deployed contract code size) and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) (for initialization code size during deployment). 3. These parameters are defined in the SDK's `prepareChainConfig.ts` file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29). - + 4. Note that once the chain deploys, the smart contract limits are unchangeable via upgrades—you must set them during initial configuration. This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24 kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128 kB, depending on the setup). You can learn more about Stylus in this section. From 03f425c65f64550f8c76decac4f50fe7d77a3495 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:03:12 -0500 Subject: [PATCH 05/21] styling --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index b703ebd2d3..6e300aa3ba 100644 --- a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -35,7 +35,7 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. -How to Configure +## How to Configure 1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. 2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) (for deployed contract code size) and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) (for initialization code size during deployment). From 43f956dd737000908047cde6bee7d1427cac7802 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:09:53 -0500 Subject: [PATCH 06/21] removed smart-contract-size-limit from excludeRoutes --- .../common-configurations/11-smart-contract-size-limit.mdx | 5 ++--- website/docusaurus.config.js | 3 +-- website/sidebars.js | 5 +++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 6e300aa3ba..413ed3cc93 100644 --- a/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/arbitrum-docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -4,7 +4,6 @@ description: 'Learn how to configure smart contract size limits on your Arbitrum author: sme: content_type: how-to -tags: ['hide-from-search'] --- For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit is fixed at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. @@ -39,8 +38,8 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic 1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. 2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) (for deployed contract code size) and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) (for initialization code size during deployment). -3. These parameters are defined in the SDK's `prepareChainConfig.ts` file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29). +3. These parameters are defined in the SDK's [`prepareChainConfig.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29) file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts). 4. Note that once the chain deploys, the smart contract limits are unchangeable via upgrades—you must set them during initial configuration. -This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24 kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128 kB, depending on the setup). You can learn more about Stylus in this section. +This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24 kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128 kB, depending on the setup). You can learn more about [Stylus in this section](/stylus/gentle-introduction.mdx). diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index d15b1e77ad..5869481f39 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -145,7 +145,6 @@ const config = { 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/08-batch-posting-assertion-control', 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/09-sequencer-timing-adjustments', 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/10-per-batch-gas-cost', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit', 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/12-customizing-anytrust', 'launch-arbitrum-chain/02-start-your-journey', 'launch-arbitrum-chain/03-arbitrum-license', @@ -162,7 +161,7 @@ const config = { 'launch-arbitrum-chain/reference/arbitrum-chain-configuration-parameters', 'launch-arbitrum-chain/reference/arbitrum-chain-fast-block-times', 'launch-arbitrum-chain/reference/arbitrum-chain-sequencer-configuration', - 'launch-arbitrum-chain/reference/arbitrum-chain-smart-contract-size-limit', + 'launch-arbitrum-chain/reference/arbitrum-chain-smart-contract-size-limit' ], maxHits: 10, }, diff --git a/website/sidebars.js b/website/sidebars.js index 59d63fded8..f7243a2239 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -286,6 +286,11 @@ const sidebars = { id: 'launch-arbitrum-chain/configure-your-chain/common-configurations/enable-post-4844-blobs', label: `Enable blob transactions`, }, + { + type: 'doc', + id: 'launch-arbitrum-chain/configure-your-chain/common-configurations/smart-contract-size-limit', + label: `Configure the smart contract size limit`, + }, { type: 'category', label: 'Data Availability Committees', From b7c393e9a584c9af8cca2850accb942f097c834a Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:10:26 -0500 Subject: [PATCH 07/21] removed smart-contract-size-limit from excludeRoutes list --- website/docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 5869481f39..53189990f4 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -161,7 +161,7 @@ const config = { 'launch-arbitrum-chain/reference/arbitrum-chain-configuration-parameters', 'launch-arbitrum-chain/reference/arbitrum-chain-fast-block-times', 'launch-arbitrum-chain/reference/arbitrum-chain-sequencer-configuration', - 'launch-arbitrum-chain/reference/arbitrum-chain-smart-contract-size-limit' + 'launch-arbitrum-chain/reference/arbitrum-chain-smart-contract-size-limit', ], maxHits: 10, }, From abb874f0dd57563812127497f8fdda51c61ace53 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:18:56 -0500 Subject: [PATCH 08/21] adjusting docusaurus.config.js to latest from master --- website/docusaurus.config.js | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index e2387c6d4e..0edf673c5d 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -216,36 +216,6 @@ const config = { }, ], require.resolve('docusaurus-plugin-fathom'), - [ - 'docusaurus-lunr-search', - { - excludeRoutes: [ - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/04-stake-and-validator-configurations', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/05-arbos-configuration', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/06-gas-optimization-tools', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/08-batch-posting-assertion-control', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/09-sequencer-timing-adjustments', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/10-per-batch-gas-cost', - 'launch-arbitrum-chain/02-configure-your-chain/common-configurations/12-customizing-anytrust', - 'launch-arbitrum-chain/02-start-your-journey', - 'launch-arbitrum-chain/03-arbitrum-license', - 'launch-arbitrum-chain/04-maintain-your-chain/01-bridging', - 'launch-arbitrum-chain/04-maintain-your-chain/02-monitoring', - 'launch-arbitrum-chain/04-maintain-your-chain/04-guidance/01-decentralization-security', - 'launch-arbitrum-chain/04-maintain-your-chain/04-guidance/02-guidance-on-altda', - 'launch-arbitrum-chain/06-third-party-integrations/03-integrations', - 'launch-arbitrum-chain/07-arbitrum-node-runners/arbitrum-chain-node-providers', - 'launch-arbitrum-chain/08-ecosystem-support/01-arbitrum-chain-portal', - 'launch-arbitrum-chain/08-ecosystem-support/03-get-listed-arbitrum-chain-platforms', - 'launch-arbitrum-chain/how-tos/how-to-configure-your-chain', - 'launch-arbitrum-chain/reference/arbitrum-chain-batch-poster-configuration', - 'launch-arbitrum-chain/reference/arbitrum-chain-configuration-parameters', - 'launch-arbitrum-chain/reference/arbitrum-chain-fast-block-times', - 'launch-arbitrum-chain/reference/arbitrum-chain-sequencer-configuration', - ], - maxHits: 10, - }, - ], require.resolve('docusaurus-plugin-sass'), ], themeConfig: @@ -419,4 +389,4 @@ if (isRunningLocally && isRunningOnWindows) { config.themeConfig.prism.darkTheme = require('prism-react-renderer/themes/palenight'); } -module.exports = config; +module.exports = config; \ No newline at end of file From 3de23beaf4b0e331b4a853a27af0de79ef7d8e18 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 16 Jul 2025 08:19:15 -0500 Subject: [PATCH 09/21] yarn --- website/docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 0edf673c5d..4559bfd8d9 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -389,4 +389,4 @@ if (isRunningLocally && isRunningOnWindows) { config.themeConfig.prism.darkTheme = require('prism-react-renderer/themes/palenight'); } -module.exports = config; \ No newline at end of file +module.exports = config; From df40a7054b0df5b5b379e4d54bb49be7673ed4aa Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:58:42 -0500 Subject: [PATCH 10/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 413ed3cc93..3356e85084 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -21,7 +21,7 @@ Support for More Complex and Feature-Rich Contracts: Larger contracts can incorp - **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. - **Simplified development and maintenance**: Developers can write cleaner, more modular code without artificial splitting, making it easier to audit, debug, and upgrade contracts. Cleaner code streamlines the development process and reduces complexity in reasoning about the codebase. -- **Enhanced customization for specific use cases**: On Orbit chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. +- **Enhanced customization for specific use cases**: On Arbitrum (Orbit) chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. ## Drawbacks of increasing the smart contract size limit From 68c2f6c0483e90466400592785518971cf2d7341 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:58:47 -0500 Subject: [PATCH 11/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 3356e85084..351488ab42 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -17,7 +17,7 @@ The limit exists because larger contracts require more resources to process and ## Benefits of increasing the smart contract size limit Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: -Support for More Complex and Feature-Rich Contracts: Larger contracts can incorporate extensive logic, libraries, and functionalities without requiring the need to split code across multiple contracts. This consolidation is beneficial for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. +- **Support for more complex and feature-rich contracts**: Larger contracts can incorporate extensive logic, libraries, and functionalities without the need to split code across multiple contracts. This consolidation is helpful for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. - **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. - **Simplified development and maintenance**: Developers can write cleaner, more modular code without artificial splitting, making it easier to audit, debug, and upgrade contracts. Cleaner code streamlines the development process and reduces complexity in reasoning about the codebase. From be84af324e4476fe7dc1aa3d2ecee3c5ee568fd1 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:59:04 -0500 Subject: [PATCH 12/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 351488ab42..d991622d5e 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -29,7 +29,7 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic - **Higher deployment costs**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size. - **Potential security risks**: Increasing code complexity increases the surface area for vulnerabilities, making audits more challenging and raising the risk of exploits. Larger contracts may also complicate fraud-proof mechanisms in optimistic rollups, such as Arbitrum, potentially making disputes more resource-intensive and time-consuming. -- **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the original EIP-170 limit design was to mitigate such issues. +- **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the purpose of the EIP-170 limit was to mitigate such issues. - **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Orbit chain, reducing flexibility if you need to migrate in the future. - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. From 7f49a9395492214836ece4bda77d5e7afdba4fb4 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:59:09 -0500 Subject: [PATCH 13/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index d991622d5e..eac41e642f 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -30,7 +30,7 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic - **Higher deployment costs**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size. - **Potential security risks**: Increasing code complexity increases the surface area for vulnerabilities, making audits more challenging and raising the risk of exploits. Larger contracts may also complicate fraud-proof mechanisms in optimistic rollups, such as Arbitrum, potentially making disputes more resource-intensive and time-consuming. - **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the purpose of the EIP-170 limit was to mitigate such issues. -- **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Orbit chain, reducing flexibility if you need to migrate in the future. +- **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum (Orbit) chain, reducing flexibility if you need to migrate in the future. - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. From ff3c234e39747b290f069c1bde919fee7dec5512 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:59:16 -0500 Subject: [PATCH 14/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index eac41e642f..6fe596fe7f 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -32,7 +32,7 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic - **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the purpose of the EIP-170 limit was to mitigate such issues. - **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum (Orbit) chain, reducing flexibility if you need to migrate in the future. - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. - Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs. However, we recommend sticking to defaults unless necessary. +Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs, but we recommend sticking to defaults unless necessary. ## How to Configure From 50d37d75738488ec4f3e3c71abe385167d86fa2e Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:59:21 -0500 Subject: [PATCH 15/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 6fe596fe7f..b3d3c60c2a 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -34,7 +34,7 @@ While beneficial for complexity, raising the limit introduces trade-offs, partic - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs, but we recommend sticking to defaults unless necessary. -## How to Configure +## How to configure 1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. 2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) (for deployed contract code size) and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) (for initialization code size during deployment). From cb3e0c78f54cf08b6afa75461dc3514c83fc3914 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 31 Jul 2025 13:59:28 -0500 Subject: [PATCH 16/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index b3d3c60c2a..d82eca3842 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -37,7 +37,7 @@ Overall, increasing the limit is ideal for specialized Arbitrum chains where com ## How to configure 1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. -2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) (for deployed contract code size) and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) (for initialization code size during deployment). +2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) for deployed contract code size, and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) for initialization code size during deployment. 3. These parameters are defined in the SDK's [`prepareChainConfig.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29) file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts). 4. Note that once the chain deploys, the smart contract limits are unchangeable via upgrades—you must set them during initial configuration. From 3a28d66beee59098a381d1a7737a099a11be6151 Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 1 Aug 2025 07:04:10 -0500 Subject: [PATCH 17/21] addressing feedback --- .../11-smart-contract-size-limit.mdx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index d82eca3842..77261c8863 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -1,9 +1,11 @@ --- -title: 'Smart contract size limit' -description: 'Learn how to configure smart contract size limits on your Arbitrum chain' -author: -sme: -content_type: how-to +title: 'Configure the smart contract size limit' +sidebar_label: 'Smart Contract Size Limit' +description: 'Learn more about benefits, drawbacks, and how to configure the smart contract size limit.' +user_story: 'I want to increase the smart contract size limit on my Arbitrum chain.' +content_type: 'how-to' +author: pete-vielhaber +sme: pete-vielhaber --- For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit is fixed at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. @@ -17,6 +19,7 @@ The limit exists because larger contracts require more resources to process and ## Benefits of increasing the smart contract size limit Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: + - **Support for more complex and feature-rich contracts**: Larger contracts can incorporate extensive logic, libraries, and functionalities without the need to split code across multiple contracts. This consolidation is helpful for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. - **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. @@ -27,12 +30,11 @@ Increasing the smart contract code size limit (from the default 24 kB up to 96 k While beneficial for complexity, raising the limit introduces trade-offs, particularly in costs, security, and performance. These are more pronounced in Rollup environments, such as Arbitrum, where transactions get posted to the Ethereum Layer 1. -- **Higher deployment costs**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size. -- **Potential security risks**: Increasing code complexity increases the surface area for vulnerabilities, making audits more challenging and raising the risk of exploits. Larger contracts may also complicate fraud-proof mechanisms in optimistic rollups, such as Arbitrum, potentially making disputes more resource-intensive and time-consuming. - **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the purpose of the EIP-170 limit was to mitigate such issues. -- **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum (Orbit) chain, reducing flexibility if you need to migrate in the future. +- **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum (Orbit) chain, reducing flexibility if you need to migrate in the future. - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. -Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs, but we recommend sticking to defaults unless necessary. + Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs, but we recommend sticking to defaults unless necessary. +- **Higher contract deployment costs (users)**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size for users. ## How to configure From 6dc776fbe85ce4b37c79f5cf8ab55a686e73612b Mon Sep 17 00:00:00 2001 From: Pete Date: Mon, 18 Aug 2025 12:59:48 -0500 Subject: [PATCH 18/21] Update docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gaël Blanchemain --- .../common-configurations/11-smart-contract-size-limit.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 77261c8863..b6e054bf15 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -8,7 +8,7 @@ author: pete-vielhaber sme: pete-vielhaber --- -For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit is fixed at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. +For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit has been set at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. However, if you're launching a custom Arbitrum chain (a Layer 2 or Layer 3 chain built using the Arbitrum stack), the limit can be increased up to 96 kB. From 30f918259091049cdc6b121f9cc62473457a3d4a Mon Sep 17 00:00:00 2001 From: Pete Date: Tue, 26 Aug 2025 11:57:10 -0500 Subject: [PATCH 19/21] made a comment for review --- .../common-configurations/11-smart-contract-size-limit.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index b6e054bf15..319d71253c 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -10,18 +10,19 @@ sme: pete-vielhaber For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit has been set at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. -However, if you're launching a custom Arbitrum chain (a Layer 2 or Layer 3 chain built using the Arbitrum stack), the limit can be increased up to 96 kB. +However, if you're launching a custom Arbitrum chain (L2/L3), the limit can be increased up to 96 kB. ## Why the limit? -The limit exists because larger contracts require more resources to process and verify, making them potential vectors for denial-of-service (DoS) attacks if not properly constrained. The original EIP-170, which addressed the issue of smart contract size, was designed with this in mind. +The limit exists because larger contracts require more resources to process and verify, making them potential vectors for denial-of-service (DoS) attacks if not properly constrained. EIP-170, which addressed the issue of smart contract size, was designed with this in mind. ## Benefits of increasing the smart contract size limit Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: -- **Support for more complex and feature-rich contracts**: Larger contracts can incorporate extensive logic, libraries, and functionalities without the need to split code across multiple contracts. This consolidation is helpful for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. + +- **Support for more complex and feature-rich contracts**: Larger contracts can incorporate extensive logic, libraries, and functionality without the need to split code across multiple contracts. This consolidation is helpful for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. - **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. - **Simplified development and maintenance**: Developers can write cleaner, more modular code without artificial splitting, making it easier to audit, debug, and upgrade contracts. Cleaner code streamlines the development process and reduces complexity in reasoning about the codebase. - **Enhanced customization for specific use cases**: On Arbitrum (Orbit) chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. From 581b76bb0ae356ed8a0ec84782d7efd4ccfe1532 Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 26 Nov 2025 15:22:26 -0600 Subject: [PATCH 20/21] Styling --- .../11-smart-contract-size-limit.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index 53c9ba6eec..cdc71f3085 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -8,7 +8,7 @@ tags: ['hide-from-search'] unlisted: true --- -For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit has been set at 24 kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. +For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit has been set at 24kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. However, if you're launching a custom Arbitrum chain (L2/L3), the limit can be increased up to 96 kB. @@ -25,24 +25,24 @@ Increasing the smart contract code size limit (from the default 24 kB up to 96 k - **Support for more complex and feature-rich contracts**: Larger contracts can incorporate extensive logic, libraries, and functionality without the need to split code across multiple contracts. This consolidation is helpful for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. - **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. - **Simplified development and maintenance**: Developers can write cleaner, more modular code without artificial splitting, making it easier to audit, debug, and upgrade contracts. Cleaner code streamlines the development process and reduces complexity in reasoning about the codebase. -- **Enhanced customization for specific use cases**: On Arbitrum (Orbit) chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. +- **Enhanced customization for specific use cases**: On Arbitrum chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. ## Drawbacks of increasing the smart contract size limit While beneficial for complexity, raising the limit introduces trade-offs, particularly in costs, security, and performance. These are more pronounced in Rollup environments, such as Arbitrum, where transactions get posted to the Ethereum Layer 1. - **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the purpose of the EIP-170 limit was to mitigate such issues. -- **Compatibility and portability issues**: Contracts exceeding the standard 24 kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum (Orbit) chain, reducing flexibility if you need to migrate in the future. +- **Compatibility and portability issues**: Contracts exceeding the standard 24kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum chain, reducing flexibility if you need to migrate in the future. - **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs, but we recommend sticking to defaults unless necessary. - **Higher contract deployment costs (users)**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size for users. ## How to configure -1. Use the [Arbitrum chain (Orbit) SDK](https://github.com/OffchainLabs/arbitrum-orbit-sdk) to prepare your chain's configuration. +1. Use the [Arbitrum chain SDK](https://github.com/OffchainLabs/arbitrum-chain-sdk) to prepare your chain's configuration. 2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) for deployed contract code size, and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) for initialization code size during deployment. 3. These parameters are defined in the SDK's [`prepareChainConfig.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29) file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts). 4. Note that once the chain deploys, the smart contract limits are unchangeable via upgrades—you must set them during initial configuration. -This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24 kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128 kB, depending on the setup). You can learn more about [Stylus in this section](/stylus/gentle-introduction.mdx). +This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128kB, depending on the setup). You can learn more about [Stylus in this section](/stylus/gentle-introduction.mdx). From 7f1a40cd7ac55447b51a6c94fa29bd2954cd0110 Mon Sep 17 00:00:00 2001 From: Pete Date: Fri, 28 Nov 2025 12:19:32 -0600 Subject: [PATCH 21/21] Adding new content for increasing the smart contract size limit --- .../11-smart-contract-size-limit.mdx | 172 +++++++++++++++--- 1 file changed, 142 insertions(+), 30 deletions(-) diff --git a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx index cdc71f3085..f8038b0704 100644 --- a/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx +++ b/docs/launch-arbitrum-chain/02-configure-your-chain/common-configurations/11-smart-contract-size-limit.mdx @@ -1,48 +1,160 @@ --- title: 'Smart contract size limit' -description: 'Learn how to configure smart contract size limits on your Arbitrum chain' -author: -sme: +description: 'Learn about how to configure the smart contract size limits on your Arbitrum chain' +author: pete-vielhaber +sme: jason-w123 content_type: how-to -tags: ['hide-from-search'] -unlisted: true --- -For standard public Arbitrum chains (such as Arbitrum One or Nova), the smart contract code size limit has been set at 24kB, as enforced by [EIP-170](https://eips.ethereum.org/EIPS/eip-170). This limit is not configurable for end-users or developers deploying contracts on these chains. +Arbitrum chains generally enforce a 24KB limit on smart contract code size during deployment, as defined by [EIP-170](https://eips.ethereum.org/EIPS/eip-170) for compatibility with the Ethereum Virtual Machine (EVM). This limit applies to both EVM bytecode and Stylus (WebAssembly-based) contracts to ensure interoperability across the ecosystem. -However, if you're launching a custom Arbitrum chain (L2/L3), the limit can be increased up to 96 kB. +The limit exists primarily to prevent denial-of-service (DoS) attacks and to bound the network's state size and verification logic. Without it, large contracts could be called cheaply in terms of gas but impose significant computational or storage burdens on nodes, potentially leading to network congestion or excessive resource usage. -## Why the limit? +It is possible to increase the smart contract size limit, but this only applies to custom Arbitrum chains (Layer 2 or Layer 3 Rollups built on the Arbitrum stack). For these, it is possible to raise the limit to 96KB during chain configuration. On public chains like Arbitrum One, the limit remains fixed at 24KB. The only way to modify the limit is a network upgrade (e.g., via proposals like [EIP-7907](https://eips.ethereum.org/EIPS/eip-7907), which is under exploration to replace the limit with a more flexible mechanism). -The limit exists because larger contracts require more resources to process and verify, making them potential vectors for denial-of-service (DoS) attacks if not properly constrained. EIP-170, which addressed the issue of smart contract size, was designed with this in mind. +## Recommendations for setting the limit include: -## Benefits of increasing the smart contract size limit +- Stick to the default of 24KB unless your use case requires larger contracts, as higher limits can increase state growth and strain node infrastructure. +- If increasing, test the configuration thoroughly on a testnet to ensure stability and performance. +- Avoid setting it to the maximum (96KB) unnecessarily, as this could exacerbate DoS risks or verification overhead. +- Once deployed, the limit is immutable, so plan carefully. -Increasing the smart contract code size limit (from the default 24 kB up to 96 kB) enables greater flexibility in development, particularly for complex applications. Key benefits include: +## Pros of increasing the smart contract size limit - +- **Enables more complex and feature-rich contracts**: Developers can include additional logic, libraries, or functionalities in a single contract without needing to split them into multiple smaller ones, which simplifies development and reduces overhead from inter-contract calls. +- **Reduces reliance on workarounds**: Avoids patterns like proxies (e.g., delegatecall) or the Diamond Standard, which add complexity, potential security risks (e.g., new attack vectors), and gas inefficiencies. +- **Improves developer experience**: Allows for building advanced dApps or protocols that might otherwise hit the default 24KB limit, making it easier to deploy comprehensive systems, especially in custom chains like Arbitrum. +- **Customizability in Rollups**: In Arbitrum chains, increasing up to 96KB provides flexibility for specific use cases, such as those requiring larger WebAssembly (Stylus) code, while maintaining compatibility within the ecosystem. +- **Potential for innovation**: Supports larger codebases that could incorporate more on-chain computations or integrations, fostering more sophisticated decentralized applications. -- **Support for more complex and feature-rich contracts**: Larger contracts can incorporate extensive logic, libraries, and functionality without the need to split code across multiple contracts. This consolidation is helpful for applications such as DeFi protocols, games, or enterprise solutions that require intricate computations or integrations, thereby reducing the need for workarounds like proxy patterns. -- **Reduced gas costs for execution**: By consolidating code into a single contract, you avoid expensive inter-contract calls (e.g., via proxies or delegates), which can lower overall runtime gas consumption. Proxy patterns, often used to bypass size limits, add overhead and increase the cost of calls. -- **Simplified development and maintenance**: Developers can write cleaner, more modular code without artificial splitting, making it easier to audit, debug, and upgrade contracts. Cleaner code streamlines the development process and reduces complexity in reasoning about the codebase. -- **Enhanced customization for specific use cases**: On Arbitrum chains, this aligns with other customizations (e.g., gas tokens or block times), enabling tailored environments for high-throughput needs, such as gaming or AI-driven apps, where larger contracts can handle domain-specific logic efficiently. +## Cons of increasing the smart contract size limit -## Drawbacks of increasing the smart contract size limit +- **Heightened risk of denial-of-service (DoS) attacks**: Larger contracts can be exploited by attackers to impose disproportionate computational or storage burdens on nodes, as calls might remain relatively cheap while requiring more resources to process (e.g., reading from disk, preprocessing, or Merkle proofs). +- **Increased state bloat and storage demands**: Bigger contracts contribute to faster growth of the blockchain's state, raising storage costs and potentially straining node infrastructure, which could lead to higher operational expenses or reduced network performance. +- **Performance degradation**: Nodes may experience slower transaction processing, execution, or verification times due to handling larger code sizes, impacting overall scalability and efficiency, especially in high-throughput environments like Arbitrum Rollups. +- **Compatibility issues**: Exceeding Ethereum's standard 24KB limit (from EIP-170) could reduce interoperability with mainnet Ethereum or other EVM-compatible chains, limiting portability and requiring custom optimizations. +- **Irreversibility and planning challenges**: In custom Arbitrum chains, the limit is set at deployment and cannot be changed later, so that poor configuration could lock in long-term risks; additionally, it may necessitate higher gas costs for larger contracts to mitigate abuses, increasing user expenses. +- **Security and maintenance concerns**: Larger codebases are more complex to audit and maintain, potentially introducing more bugs or vulnerabilities, and they could exacerbate network congestion without proper management. -While beneficial for complexity, raising the limit introduces trade-offs, particularly in costs, security, and performance. These are more pronounced in Rollup environments, such as Arbitrum, where transactions get posted to the Ethereum Layer 1. +## To configure the smart contract size limit for a custom Arbitrum chain -- **Performance and network efficiency concerns**: Although EVM execution charges gas per opcode (not code size), large contracts could lead to slower node processing or higher resource demands on validators/sequencers. This slower processing might exacerbate DoS risks on your chain, as the purpose of the EIP-170 limit was to mitigate such issues. -- **Compatibility and portability issues**: Contracts exceeding the standard 24kB limit (enforced on public chains like Arbitrum One or Ethereum) cannot be deployed elsewhere without modifications. This restriction limits interoperability and could lock you into your Arbitrum chain, reducing flexibility if you need to migrate in the future. -- **Irreversibility**: The limit must be set during initial chain configuration and cannot be changed post-deployment, so poor choices could lead to long-term inefficiencies. - Overall, increasing the limit is ideal for specialized Arbitrum chains where complexity outweighs costs, but we recommend sticking to defaults unless necessary. -- **Higher contract deployment costs (users)**: Larger contracts require more bytecode in the initialization code, which increases the transaction size and, consequently, the calldata costs posted to Ethereum L1. In Rollups, this can significantly raise deployment fees, as costs scale with data size for users. +The smart contract size limit must be set during the initial configuration and deployment of a custom chain (Layer 2 or Layer 3 Rollup). It is not possible to modify it post-deployment due to the lack of a versioning mechanism for such parameters. The limit applies to both deployed contract code (`MaxCodeSize`) and initialization code during deployment (`MaxInitCodeSize`). Both are configurable up to 96KB (98,304 bytes), which is higher than the default 24KB (24,576 bytes) inherited from Ethereum's [EIP-170](https://eips.ethereum.org/EIPS/eip-170) for compatibility. -## How to configure +### Key specifics -1. Use the [Arbitrum chain SDK](https://github.com/OffchainLabs/arbitrum-chain-sdk) to prepare your chain's configuration. -2. When calling the `prepareNodeConfig` function, modify the relevant parameters: [`MaxCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L29) for deployed contract code size, and [`MaxInitCodeSize`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/9fd3d39504832f94a31d9c5773f4514bd7be6eee/src/prepareChainConfig.ts#L30) for initialization code size during deployment. -3. These parameters are defined in the SDK's [`prepareChainConfig.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/src/prepareChainConfig.ts#L29) file. An example implementation is available in the SDK's [`examples/prepare-node-config/index.ts`](https://github.com/OffchainLabs/arbitrum-orbit-sdk/blob/main/examples/prepare-node-config/index.ts). - -4. Note that once the chain deploys, the smart contract limits are unchangeable via upgrades—you must set them during initial configuration. +- **Default values**: 24KB (24,576 bytes) for both `MaxCodeSize` and `MaxInitCodeSize` if not explicitly set. +- **Maximum values**: 96KB (98,304 bytes) for each. Setting higher is not supported and may cause deployment failures or compatibility issues. +- **Where applicable**: Only in custom Arbitrum chains. Public chains like Arbitrum One or Nova remain fixed at 24KB without a network-wide upgrade. +- **Requirements**: You'll need the Arbitrum Chain SDK (installed via `npm install @offchainlabs/chain-sdk` or similar), a funded wallet on the parent chain (e.g., Ethereum or Arbitrum One), and access to deployment tools like Hardhat or Foundry for integration. +- **Process overview**: + 1. Prepare the chain configuration using the Chain SDK's `prepareChainConfig` function, where you specify the parameters. + 2. Use this config in `prepareNodeConfig` to generate the full node configuration (e.g., for nitro-node.toml). + 3. Deploy the chain contracts to the parent chain. + 4. Run the node with the generated config. +- **Warnings**: + - This change is immutable after deployment—plan carefully. + - Higher limits increase risks like state bloat, slower node performance, and potential DoS vulnerabilities. + - Test on a devnet or testnet first to ensure stability. + - Ensure values are in bytes (not KB) when setting them in code. -This customization applies to both EVM-compatible contracts and Stylus (WebAssembly-based) contracts on Arbitrum chains. However, Stylus contracts must also adhere to compression limits (e.g., 24kB Brotli-compressed in some cases, with potentially higher uncompressed equivalents of ~128kB, depending on the setup). You can learn more about [Stylus in this section](/stylus/gentle-introduction.mdx). +### Code examples + +The example below assumes you've set up a project with the SDK installed and have environment variables for your private key and RPC URLs. + +#### 1. Basic chain configuration (setting the parameters) + +This snippet shows how to prepare the chain config JSON, including the size limit parameters. Place this in a file like `prepareChainConfigExample.ts`. + +```typescript +import { prepareChainConfig } from '@offchainlabs/chain-sdk'; // Import the function from the SDK + +// Define the parameters for your custom Arbitrum chain +const orbitChainParams = { + chainId: 123456, // Your unique chain ID (must not conflict with existing chains) + homesteadBlock: 0, // Typically 0 for new chains + eip155Block: 0, // Typically 0 + // ... other standard Ethereum chain config params as needed + + arbitrum: { + // Arbitrum-specific extensions + MaxCodeSize: 98304, // Set to 96KB (98,304 bytes) for deployed contract code size limit + MaxInitCodeSize: 98304, // Set to 96KB for init code size during contract deployment + // Note: Init code can often be set higher (e.g., 2x MaxCodeSize) if needed for complex constructors, + // but stick to <= 96KB to avoid issues. Default is 24576 bytes (24KB) if omitted. + // Warning: Higher values may increase state size and node resource demands. + // Other Arbitrum params like DataAvailabilityCommittee: true/false can go here + }, +}; + +// Prepare the chain config JSON using the SDK function +const chainConfig = prepareChainConfig(orbitChainParams); + +// Output the config (e.g., for use in deployment or node setup) +console.log(JSON.stringify(chainConfig, null, 2)); + +// You can now use this chainConfig in deployment scripts or pass it to prepareNodeConfig. +``` + +Run this with `ts-node prepareChainConfigExample.ts` to generate the config JSON. + +#### 2. Full node configuration and deployment example + +This extends the above to prepare the full node config (e.g., for running a sequencer or validator node). Place this in a file like `deployOrbitChain.ts`. It assumes you're deploying to a parent chain like Sepolia (testnet). + +```typescript +import { prepareChainConfig, prepareNodeConfig } from '@offchainlabs/chain-sdk'; // Import SDK functions +import { ethers } from 'ethers'; // For wallet and provider (install via npm) +import { writeFileSync } from 'fs'; // For saving config files + +// Load environment variables (e.g., from .env file) +const parentChainRpcUrl = process.env.PARENT_RPC_URL; // e.g., https://sepolia.infura.io/v3/YOUR_KEY +const privateKey = process.env.PRIVATE_KEY; // Your wallet private key (funded with ETH) + +// Step 1: Prepare chain config with increased size limits +const orbitChainParams = { + chainId: 123456, + nativeToken: '0x0000000000000000000000000000000000000000', // ETH as native token (or custom ERC20 address) + arbitrum: { + MaxCodeSize: 98304, // Increase to max 96KB for larger contracts + MaxInitCodeSize: 98304, // Matching increase for init code + // Additional params: e.g., InitialChainOwner: '0xYourAddress' for governance + }, +}; + +const chainConfig = prepareChainConfig(orbitChainParams); + +// Step 2: Set up provider and wallet for deployment +const parentProvider = new ethers.JsonRpcProvider(parentChainRpcUrl); +const wallet = new ethers.Wallet(privateKey, parentProvider); + +// Step 3: Prepare node config (generates nitro-node config like chain.toml) +const nodeConfig = await prepareNodeConfig({ + chainName: 'my-arbitrum-chain', // Name for your chain + chainConfig, // Pass the prepared chain config here + parentChainId: 11155111, // e.g., Sepolia chain ID + // Other options: batchPosterPrivateKey, validatorPrivateKey, etc. + // Note: This generates a config object or file with settings for the node, + // including the immutable chain params like size limits. +}); + +// Save the node config to a file (e.g., for running the node) +writeFileSync('my-arbitrum-chain.toml', nodeConfig); // Adjust format as needed (TOML or JSON) + +// Step 4: Deploy the core contracts to the parent chain +// Use the SDK's deployment functions (simplified; refer to full docs for complete script) +const deploymentResult = await deployOrbitChain({ + wallet, + chainConfig, + // ... other deployment params like data availability settings +}); + +console.log('Chain deployed! Contracts:', deploymentResult.contractAddresses); +console.log('Use the generated my-arbitrum-chain.toml to run your node.'); + +// Post-deployment: Run the nitro node with Docker or binary, pointing to the config file. +// Example command: docker run --rm -v $(pwd)/my-arbitrum-chain.toml:/config.toml offchainlabs/nitro-node --conf.file /config.toml +``` + +Run this with `ts-node deployOrbitChain.ts`. This script deploys the chain and generates the node config with your custom limits embedded. + +For exact SDK function signatures and more options (e.g., data availability committees or custom gas tokens), refer to the official Arbitrum Chain SDK repository on GitHub. Always test in a development environment, as incorrect configs can lead to failed deployments or insecure chains. If your contracts still exceed the limit, consider optimizations such as code splitting or using Stylus to create more efficient WASM-based contracts.