Proto: when activating alpha from genesis, set AI before computing rights for first cycles (doesn't affect mainnet)
What
In the migration from genesis to alpha (so only for tests and some testnets), move the initialization of Adaptive Issuance before the initialization of the baking rights of bootstrap accounts for the first consensus_rights_delay + 1 cycles.
Why
Because on mainnet and ghostnet, AI is already active before the migration to alpha, so it makes sense for baking rights to be computed with AI even before alpha is fully activated. Also, removing the obsolete internal field adaptive_issuance_enable in !15789 (merged) will cause this change in behavior anyway, and it's easier to update the tests first in a separate MR.
How
The change to the protocol code itself is minimal. However, it causes the baking powers of all bootstrap accounts to be different in all tests that activate alpha directly from genesis. This requires updating several tests that hard-code values such as rewards or expected sampling.
Manually testing the MR
The reworked sampling test now has logs at the info level:
dune exec src/proto_alpha/lib_protocol/test/integration/consensus/main.exe -- -m "committee sampling" -i
Also, check that it's not flaky:
dune exec src/proto_alpha/lib_protocol/test/integration/consensus/main.exe -- -m "committee sampling" --loop
Just run the CI for the other affected tests.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) - [N/A] Document any change to the user interface, including configuration parameters (see node configuration)
-
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else).