Closed arthurgousset closed 4 months ago
Notes-to-self:
Source: Google Sheet > Compile times
Currently, the create_and_migrate_anvil_devchain.sh
script takes ~8.5min to run from start to finish, of which 6.6min or 77% is taken up by compilations. Only 2min or 23% is taken up by migration transactions.
It takes about ~6.6min to compile the contracts, because there are 2 compilation runs, where a single compilation takes ~3.3 minutes.
We can perhaps reduce the time it takes to run the migrations, by reducing the number of compilations.
A summary of the logs and times are below.
As of https://github.com/celo-org/celo-monorepo/pull/11003/commits/545efbc0f77b9cb7943c34ae0b038d391356668a, I managed to cut the time it takes to run the script by 34% or 2.9min.
It currently takes 5.6min vs 8.5min before.
I used a temporary directory to only build and deploy the libraries. This avoids building all contracts when only a few library contracts need to be built and deployed.
Next, I'll clean my branch and will mark it as ready for review.
As of https://github.com/celo-org/celo-monorepo/pull/11003/commits/200b9f27b48fecddfa1a544bad24edcd31ddc02f, the script takes 4.8min vs 8.5min before. That's a 44% improvement.
Source: Google Sheet > Compile times
I marked this PR as ready for review.
Description
Before, all contracts were compiled twice during the Foundry migrations when only selected libraries had to be compiled and deployed.
Now, only libraries are compiled and deployed first, then all contracts are compiled and deployed second. The Foundry migrations take 4.8min vs 8.5min before, or a 44% improvement.
Source: Google Sheet > Compile times
Changes
deploy_libraries.sh
) that exclusively compiles and deploys libraries needed by subsequent contract deployments.create_and_migrate_anvil_devchain.sh
todeploy_libraries.sh
Other changes
@celo-contracts
remapping (although I'm not sure this was strictly necessary)Tested
Yes, CI runs the foundry migrations. Although we don't have any integration or e2e tests using the Foundry devchain.
Related issues
Backwards compatibility
Yes, optimises migration script run time, but doesn't change migration script.
Documentation
Documented with code comments in the migration script.