-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile contracts after state sync #4311
Comments
During today's discussion, @abacabadabacaba proposed a different idea: we should compile the contract when it is written to the state. More concretely, it means that we should invoke |
Note that another case where we might need to compile many contracts is when we upgrade our wasmer version. The data in the CompiledContractsCache depends on the specific engine version and config we use, and those might change, necessitating re-compilation of all of the contracts. I wonder if both catchup and wasmer upgrade use-cases should be served by the same code path? |
@matklad I don't think so. When a wasmer upgrade happens we have two options:
My suggestion is to decide based on when we plan to do this migration. If we are going to do it pretty soon I'd suggest a database migration since there are < 600 unique contracts on mainnet right now and the cost of recompiling them is not very high. Plus we can potentially recompile contracts in parallel (not sure whether it is easy to do though). |
In order to switch to the new costs shown in #4231, we need to make sure that when a contract is called, it is already compiled. Normally this is the case when we switch to compiling contracts at deployment time. However, after a node finishes state syncing to a shard, it does not have all the deployed contracts in the shard compiled and this may cause major issues when the contracts are called (the node would take much longer than expected to apply the chunk). As a result, we need to the following:
Note: we don't have to implement the second one for now since we only have one shard on mainnet.
The text was updated successfully, but these errors were encountered: