Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

sui-move: [7/x][move-package/lock] Move addr_subst and digest to dependency edge #854

Merged
merged 4 commits into from
Feb 14, 2023

Conversation

amnn
Copy link
Collaborator

@amnn amnn commented Jan 31, 2023

The initial design of DependencyGraph only allowed for one addr_subst and digest per package in the transitive dependency graph, but in actuality there can be as many of these as there are dependency edges to that package:

  • Different addr_subst for different packages P, Q depending on R allows the same address in R to appear as different addresses in P and Q.
  • If R is a dependency of P and a dev-dependency of Q, then its source digest may differ between the two.

Fixed by moving the subst and digest to be edge labels in the graph, rather than node labels.

Note that this also changes the lock file format in the following ways:

  • A package's dependencies are now no longer just the name of the dependency, but an inline table containing the name and optionally the digest and address substitution.
  • The key within the move table that contains all the transitive dependencies is now called package rather than dependency (this was mainly driven by the naming within the schema, which required a name for the new, richer format for a package's dependencies.)

Test Plan

move/language/tools/move-cli$ cargo nextest
move/language/tools/move-package$ cargo nextest

Stack

See also: #765 for main.

amnn added 4 commits January 31, 2023 14:43
The initial design of `DependencyGraph` only allowed for one
`addr_subst` and `digest` per package in the transitive dependency
graph, but in actuality there can be as many of these as there are
dependency edges to that package:

- Different `addr_subst` for different packages `P`, `Q` depending on
  `R` allows the same address in `R` to appear as different addresses
  in `P` and `Q`.
- If `R` is a dependency of `P` and a dev-dependency of `Q`, then its
  source digest may differ between the two.

Fixed by moving the `subst` and `digest` to be edge labels in the
graph, rather than node labels.

Note that this also changes the lock file format in the following
ways:

- A package's dependencies are now no longer just the name of the
  dependency, but an inline table containing the name and optionally
  the digest and address substitution.
- The key within the `move` table that contains all the transitive
  dependencies is now called `package` rather than `dependency` (this
  was mainly driven by the naming within the schema, which required a
  name for the new, richer format for a package's dependencies.)

Test Plan:

```
move/language/tools/move-cli$ cargo nextest
move/language/tools/move-package$ cargo nextest
```
Copy link
Member

@tzakian tzakian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me! Only question is about naming of one of the fields.

@amnn amnn merged commit 664915a into move-language:sui-move Feb 14, 2023
@amnn amnn deleted the sui-lock-7-rich-edges branch February 14, 2023 14:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants