Skip to content

ZeroEkkusu/max-code-size-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Max Code Size Tester

Test MAX_CODE_SIZE of your EVM.

MAX_CODE_SIZE refers to the maximum length of a smart contract's runtime bytecode.

Runtime bytecode is different from creation bytecode. For example, the Solidity compiler generates creation bytecode (binary) from source code (Solidity). When this creation bytecode is deployed onchain, it gets executed, and returns runtime bytecode, which is set as the code of the smart contract.

Usage

Caution

This program deploys a smart contract onchain to verify MAX_CODE_SIZE. If run in a production environment, it will incur real transaction costs. Use only in test networks unless you fully understand the implications.

I have read and understood the above warning. Show me the usage instructions.

Prerequisites

curl -L https://foundry.paradigm.xyz | bash

Get

git clone git@github.com:ZeroEkkusu/max-code-size-tester.git
cd max-code-size-tester
forge install

Run

forge script MaxCodeSizeTester \
  --rpc-url <rpc_url> \
  --broadcast \
  --private-key <private_key> \
  --sig "run(uint256)" \
  <code_size>

It is recommended to test code_size of

  • $max - 1$
  • $max$
  • $max + 1$

where $max$ is the MAX_CODE_SIZE of the EVM in bytes.

Only $max + 1$ should fail.

License

​ Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


© 2024 Zero Ekkusu

About

Test the `MAX_CODE_SIZE` of your EVM chain.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks