From 2825d039538dd3ebb2deb84c5ae42e80ea2baa29 Mon Sep 17 00:00:00 2001 From: Pavel Fedotov <66903336+Pfed-prog@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:05:39 +0200 Subject: [PATCH 1/2] Improved formatting --- .../index.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md b/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md index 48ae1bed1cb..c7e9eeaf3e1 100644 --- a/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md +++ b/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md @@ -66,7 +66,7 @@ function get(uint id) returns (address,address) { } ``` -makes a difference of **0.28kb**. Chances are you can find many similar situations in your contracts and those can really add up to significant amounts. +Makes a difference of **0.28kb**. Chances are you can find many similar situations in your contracts and those can really add up to significant amounts. ### Shorten error message {#shorten-error-message} @@ -74,7 +74,6 @@ Long revert messages and in particular many different revert messages can bloat ```solidity require(msg.sender == owner, "Only the owner of this contract can call this function"); - ``` ```solidity @@ -101,7 +100,7 @@ You can also change the optimizer settings. The default value of 200 means that ### Avoid passing structs to functions {#avoid-passing-structs-to-functions} -If you are using the [ABIEncoderV2](https://solidity.readthedocs.io/en/v0.6.10/layout-of-source-files.html#abiencoderv2), it can help to not pass structs to a function. Instead of passing the parameter as a struct... +If you are using the [ABIEncoderV2](https://solidity.readthedocs.io/en/v0.6.10/layout-of-source-files.html#abiencoderv2), it can help to not pass structs to a function. Instead of passing the parameter as a struct: ```solidity function get(uint id) returns (address,address) { @@ -123,7 +122,7 @@ function _get(address addr1, address addr2) private view returns(address,address } ``` -... pass the required parameters directly. In this example we saved another **0.1kb**. +Pass the required parameters directly. In this example we saved another **0.1kb**. ### Declare correct visibility for functions and variables {#declare-correct-visibility-for-functions-and-variables} From 12c55827f50f04083f4d61073a515cd8c2d24009 Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Wed, 19 Nov 2025 06:29:48 -0700 Subject: [PATCH 2/2] formatting --- .../index.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md b/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md index c7e9eeaf3e1..f4f72973c52 100644 --- a/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md +++ b/public/content/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/index.md @@ -51,8 +51,6 @@ This one should be obvious. Functions increase a contract size quite a bit. ### Avoid additional variables {#avoid-additional-variables} -A simple change like this: - ```solidity function get(uint id) returns (address,address) { MyStruct memory myStruct = myStructs[id]; @@ -66,7 +64,7 @@ function get(uint id) returns (address,address) { } ``` -Makes a difference of **0.28kb**. Chances are you can find many similar situations in your contracts and those can really add up to significant amounts. +A simple change like this makes a difference of **0.28kb**. Chances are you can find many similar situations in your contracts and those can really add up to significant amounts. ### Shorten error message {#shorten-error-message} @@ -100,7 +98,7 @@ You can also change the optimizer settings. The default value of 200 means that ### Avoid passing structs to functions {#avoid-passing-structs-to-functions} -If you are using the [ABIEncoderV2](https://solidity.readthedocs.io/en/v0.6.10/layout-of-source-files.html#abiencoderv2), it can help to not pass structs to a function. Instead of passing the parameter as a struct: +If you are using the [ABIEncoderV2](https://solidity.readthedocs.io/en/v0.6.10/layout-of-source-files.html#abiencoderv2), it can help to not pass structs to a function. Instead of passing the parameter as a struct, pass the required parameters directly. In this example we saved another **0.1kb**. ```solidity function get(uint id) returns (address,address) { @@ -122,8 +120,6 @@ function _get(address addr1, address addr2) private view returns(address,address } ``` -Pass the required parameters directly. In this example we saved another **0.1kb**. - ### Declare correct visibility for functions and variables {#declare-correct-visibility-for-functions-and-variables} - Functions or variables that are only called from the outside? Declare them as `external` instead of `public`.