After the bunch of size optimization, we decided to add a GitHub action that will compare the sizes of contracts. During the implementation of the size, we found that the size of the contracts is not deterministic.
After investigation, we found the reason:
OpenBrush stores some metadata in the target folder. It requires access to the storage and adds some delays during the parallel compilation of the contract. The code is optimized in the different sequences, which may cause differences in the contract sizes in 10-150 bytes.
The solution is entirely to replace the code generated by ink::trait_definition and ink::contract macros and store all required information in the code on Rust level to avoid access to the storage.
After the bunch of size optimization, we decided to add a GitHub action that will compare the sizes of contracts. During the implementation of the size, we found that the size of the contracts is not deterministic.
After investigation, we found the reason: OpenBrush stores some metadata in the
target
folder. It requires access to the storage and adds some delays during the parallel compilation of the contract. The code is optimized in the different sequences, which may cause differences in the contract sizes in 10-150 bytes.The solution is entirely to replace the code generated by
ink::trait_definition
andink::contract
macros and store all required information in the code on Rust level to avoid access to the storage.