refine_to_single_linkage

Function refine_to_single_linkage 

Source
pub fn refine_to_single_linkage<E: ExecutionErrorTrait>(
    txn: &mut Transaction,
    linkage_analysis: &LinkageAnalyzer,
    package_store: &dyn PackageStore,
) -> Result<(), E>
Expand description

Replace each command’s per-call linkage with a single linkage shared by the whole transaction.

Done in two passes:

  1. Fold every command’s package and type-argument constraints into one ResolutionTable, unifying as we go (an error here means the commands cannot agree on a single set of package versions).
    • Top level functions are pinned exact, while their dependencies are pinned exact or at_least based on the visibility of the top-level function. Type-argument packages are always at_least.
    • Publishes and upgrades introduce their own constraints to the linkage, but only if they have an init function (otherwise they do not contribute to the linkage). See comments on each of the command arms for details on this.
  2. Write the resulting unified linkage back into every MoveCall.

Because all calls end up sharing one linkage, every package version selection is consistent across the transaction.