1

Warning: Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries.

2
  • 1
    when I test my dev stuff on local chain I just modify the parameter MaxCodeSize in params/protocol_params.go and work as usual. But if you want to deploy on the Main Net you need to split your code between different contracts and use Call()s. It is a little bit of gas overhead but you can't do anything about it
    – Nulik
    Jan 26, 2023 at 15:07
  • Another discussion: ethereum.stackexchange.com/questions/132449/…
    – 0xSanson
    Jan 26, 2023 at 15:27

2 Answers 2

1

Do you have the public GitHub? I can take a look to give you the fastest solutions.

If not. You can try Diamond Standard to split your code. Also, you can do some gas optimizations: move views in another contract if they are complex and name it ContractViews, reorder the variables to fulfill 32 bytes, remove the "public" indicator from variables, use libraries that can be deployed separately, use immutable and constant if is possible, optimize the algorithms from functions.

1
  • 1
    yes, i deployed with optimiser and with these technique, just now for more functionality in contracts i will follow Diamond Standard to split your code and i will separate the libraries and other contracts. Jan 27, 2023 at 9:03
2

best to start with reading these downsizing guidlines: https://ethereum.org/en/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.