-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MOVE] Format all source files to be consistent #4526
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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: 2 additions & 1 deletion
3
aptos-move/framework/aptos-framework/sources/account.spec.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,6 @@ | ||
spec aptos_framework::account { | ||
spec create_signer { // TODO: temporary mockup. | ||
spec create_signer { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
} |
14 changes: 9 additions & 5 deletions
14
aptos-move/framework/aptos-framework/sources/aggregator/aggregator.spec.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,21 +1,25 @@ | ||
spec aptos_framework::aggregator { | ||
spec module { | ||
pragma verify=false; | ||
pragma verify = false; | ||
} | ||
|
||
spec add { // TODO: temporary mockup. | ||
spec add { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
|
||
spec sub { // TODO: temporary mockup. | ||
spec sub { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
|
||
spec read { // TODO: temporary mockup. | ||
spec read { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
|
||
spec destroy { // TODO: temporary mockup. | ||
spec destroy { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
aptos-move/framework/aptos-framework/sources/aggregator/aggregator_factory.spec.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,9 +1,10 @@ | ||
spec aptos_framework::aggregator_factory { | ||
spec module { | ||
pragma verify=false; | ||
pragma verify = false; | ||
} | ||
|
||
spec new_aggregator { // TODO: temporary mockup. | ||
spec new_aggregator { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
} |
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: 1 addition & 1 deletion
2
aptos-move/framework/aptos-framework/sources/aggregator/optional_aggregator.spec.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,5 @@ | ||
spec aptos_framework::optional_aggregator { | ||
spec module { | ||
pragma verify=false; | ||
pragma verify = false; | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
aptos-move/framework/aptos-framework/sources/chain_status.spec.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
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 |
---|---|---|
|
@@ -95,18 +95,18 @@ module aptos_framework::code { | |
/// The developer is responsible for not breaking memory layout of any resources he already | ||
/// stored on chain. | ||
public fun upgrade_policy_arbitrary(): UpgradePolicy { | ||
UpgradePolicy{policy: 0} | ||
UpgradePolicy { policy: 0 } | ||
} | ||
|
||
/// Whether a compatibility check should be performed for upgrades. The check only passes if | ||
/// a new module has (a) the same public functions (b) for existing resources, no layout change. | ||
public fun upgrade_policy_compat(): UpgradePolicy { | ||
UpgradePolicy{policy: 1} | ||
UpgradePolicy { policy: 1 } | ||
} | ||
|
||
/// Whether the modules in the package are immutable and cannot be upgraded. | ||
public fun upgrade_policy_immutable(): UpgradePolicy { | ||
UpgradePolicy{policy: 2} | ||
UpgradePolicy { policy: 2 } | ||
} | ||
|
||
/// Whether the upgrade policy can be changed. In general, the policy can be only | ||
|
@@ -121,7 +121,7 @@ module aptos_framework::code { | |
system_addresses::assert_aptos_framework(aptos_framework); | ||
let addr = signer::address_of(package_owner); | ||
if (!exists<PackageRegistry>(addr)) { | ||
move_to(package_owner, PackageRegistry{packages: vector[metadata]}) | ||
move_to(package_owner, PackageRegistry { packages: vector[metadata] }) | ||
} else { | ||
vector::push_back(&mut borrow_global_mut<PackageRegistry>(addr).packages, metadata) | ||
} | ||
|
@@ -138,7 +138,7 @@ module aptos_framework::code { | |
|
||
let addr = signer::address_of(owner); | ||
if (!exists<PackageRegistry>(addr)) { | ||
move_to(owner, PackageRegistry{packages: vector::empty()}) | ||
move_to(owner, PackageRegistry { packages: vector::empty() }) | ||
}; | ||
|
||
// Checks for valid dependencies to other packages | ||
|
@@ -178,8 +178,8 @@ module aptos_framework::code { | |
if (features::code_dependency_check_enabled()) | ||
request_publish_with_allowed_deps(addr, module_names, allowed_deps, code, policy.policy) | ||
else | ||
// The new `request_publish_with_allowed_deps` has not yet rolled out, so call downwards | ||
// compatible code. | ||
// The new `request_publish_with_allowed_deps` has not yet rolled out, so call downwards | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks bad. Can we throw {} around the if/else? |
||
// compatible code. | ||
request_publish(addr, module_names, code, policy.policy) | ||
} | ||
|
||
|
@@ -195,10 +195,10 @@ module aptos_framework::code { | |
|
||
/// Checks whether the given package is upgradable, and returns true if a compatibility check is needed. | ||
fun check_upgradability( | ||
old_pack: &PackageMetadata, new_pack: &PackageMetadata, new_modules: &vector<String>) { | ||
old_pack: &PackageMetadata, new_pack: &PackageMetadata, new_modules: &vector<String>) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a good formatting rule. The parameters should not be intended the same as the body |
||
assert!(old_pack.upgrade_policy.policy < upgrade_policy_immutable().policy, | ||
error::invalid_argument(EUPGRADE_IMMUTABLE)); | ||
assert!(can_change_upgrade_policy_to( old_pack.upgrade_policy, new_pack.upgrade_policy), | ||
assert!(can_change_upgrade_policy_to(old_pack.upgrade_policy, new_pack.upgrade_policy), | ||
error::invalid_argument(EUPGRADE_WEAKER_POLICY)); | ||
let old_modules = get_module_names(old_pack); | ||
let i = 0; | ||
|
@@ -243,7 +243,7 @@ module aptos_framework::code { | |
// Allow all modules from this address, by using "" as a wildcard in the AllowedDep | ||
let account = dep.account; | ||
let module_name = string::utf8(b""); | ||
vector::push_back(&mut allowed_module_deps, AllowedDep{account, module_name}); | ||
vector::push_back(&mut allowed_module_deps, AllowedDep { account, module_name }); | ||
i = i + 1; | ||
continue | ||
}; | ||
|
@@ -272,7 +272,7 @@ module aptos_framework::code { | |
while (k < r) { | ||
let account = dep.account; | ||
let module_name = vector::borrow(&dep_pack.modules, k).name; | ||
vector::push_back(&mut allowed_module_deps, AllowedDep{account, module_name}); | ||
vector::push_back(&mut allowed_module_deps, AllowedDep { account, module_name }); | ||
k = k + 1; | ||
}; | ||
break | ||
|
@@ -290,7 +290,7 @@ module aptos_framework::code { | |
/// requires to be upgradable for maintenance and evolution, and is configured to be `compatible`. | ||
fun is_policy_exempted_address(addr: address): bool { | ||
addr == @1 || addr == @2 || addr == @3 || addr == @4 || addr == @5 || | ||
addr == @6 || addr == @7 || addr == @8 || addr == @9 || addr == @10 | ||
addr == @6 || addr == @7 || addr == @8 || addr == @9 || addr == @10 | ||
} | ||
|
||
/// Get the names of the modules in a package. | ||
|
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,13 +1,15 @@ | ||
spec aptos_framework::code { | ||
spec module { | ||
pragma verify=false; | ||
pragma verify = false; | ||
} | ||
|
||
spec request_publish { // TODO: temporary mockup. | ||
spec request_publish { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
|
||
spec request_publish_with_allowed_deps { // TODO: temporary mockup. | ||
spec request_publish_with_allowed_deps { | ||
// TODO: temporary mockup. | ||
pragma opaque; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just kill this TODO. Whoever wants to add this back in the future can go through the history and find it.