3 files changed
The new script
constructorSizeCheck.ts added to the
token-bridge-contracts repository performs a constructor size check on specific contracts using the
hardhat library. It compares the length of the constructor bytecode for each contract with expected lengths, throwing an error if they don't match, and logs a success message if all checks pass.
The pull request introduces a new script,
constructorSizeCheck.ts, to the
scripts/ci directory in the
token-bridge-contracts repository. This script is designed to perform a constructor size check on certain contracts due to the atomic token bridge creator implementation.
The script utilizes the
hardhat library and defines a constant
CONTRACTS_TO_EXPECTED_CONSTRUCTOR_SIZE, which is a record of contract names and their expected constructor sizes. The main function of the script initiates the constructor size check by iterating over the entries in
CONTRACTS_TO_EXPECTED_CONSTRUCTOR_SIZE. It retrieves the constructor bytecode for each contract, calculates its length, and throws an error if the length does not match the expected length.
The script also includes two helper functions:
_lengthInBytes. The former is used to extract the constructor bytecode from the creation and deployed bytecode of a contract, while the latter calculates the length of the constructor bytecode in bytes.
If no issues are found during the constructor size check, a success message is logged to the console, indicating that the contracts have passed the constructor size check.
Last updated 13 days ago
Last updated 04/12 00:17