forked from diem/diem
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move cli] doctor command for detecting inconsistencies in storage
This command does a bunch of sanity checks to ensure that the storage directory is well-formed. For now: - All modules verify - All modules link - All resources deserialize w.r.t the current version of their declaring module It does this in the obvious way: iterating through the global storage, collecting each module/resource, and doing the check. This is useful for detecting breaking changes (both code and data layout) after-the-fact, as well as bugs in the CLI. I was motivated to create this check when I noticed a bug where `move publish` sometimes publishes a module `M` without publishing library modules. If you run `move doctor` on such a state, it would catch the issue. I am planning to add `move doctor` to a bunch of the publish tests once I fix this bug. It will also be useful for testing the `--ignore-breaking-changes` flag in diem#6753. Closes: diem#6971
- Loading branch information
1 parent
a8c817a
commit 7b756d6
Showing
11 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
language/tools/move-cli/tests/testsuite/data_breaking_change/args.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
publish src/modules/ | ||
publish M.move | ||
run src/scripts/publish.move --signers 0xA | ||
doctor | ||
publish --ignore-breaking-changes M.move | ||
doctor |
4 changes: 4 additions & 0 deletions
4
language/tools/move-cli/tests/testsuite/data_breaking_change/src/modules/M.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
address 0x2 { | ||
module M { | ||
resource struct R { f: u64 } | ||
|
||
public fun publish(account: &signer) { | ||
move_to(account, R { f: 10 }) | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
language/tools/move-cli/tests/testsuite/data_breaking_change/src/scripts/publish.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
script { | ||
use 0x2::M; | ||
fun publish(account: &signer) { | ||
M::publish(account) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
language/tools/move-cli/tests/testsuite/linking_breaking_change/args.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
publish src/modules/ | ||
publish M.move | ||
doctor | ||
publish --ignore-breaking-changes M.move | ||
doctor |
10 changes: 10 additions & 0 deletions
10
language/tools/move-cli/tests/testsuite/linking_breaking_change/src/modules/M2.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
address 0x2 { | ||
module M2 { | ||
use 0x2::M; | ||
|
||
public fun h() { | ||
M::f(); | ||
M::g(); | ||
} | ||
} | ||
} |