• s0me0ne-unkn0wn's avatar
    Do not re-prepare PVFs if not needed (#4211) · c26cf3f6
    s0me0ne-unkn0wn authored
    Currently, PVFs are re-prepared if any execution environment parameter
    changes. As we've recently seen on Kusama and Polkadot, that may lead to
    a severe finality lag because every validator has to re-prepare every
    PVF. That cannot be avoided altogether; however, we could cease
    re-preparing PVFs when a change in the execution environment can't lead
    to a change in the artifact itself. For example, it's clear that
    changing the execution timeout cannot affect the artifact.
    
    In this PR, I'm introducing a separate hash for the subset of execution
    environment parameters that changes only if a preparation-related
    parameter changes. It introduces some minor code duplication, but
    without that, the scope of changes would be much bigger.
    
    TODO:
    - [x] Add a test to ensure the artifact is not re-prepared if
    non-preparation-related parameter is changed
    - [x] Add a test to ensure the artifact is re-prepared if a
    preparation-related parameter is changed
    - [x] Add comments, warnings, and, possibly, a test to ensure a new
    parameter ever added to the executor environment parameters will be
    evaluated by the author of changes with respect to its artifact
    preparation impact and added to the new hash preimage if needed.
    
    Closes #4132
    c26cf3f6