Skip to content

Commit

Permalink
[chore] Bump move version (MystenLabs#6334)
Browse files Browse the repository at this point in the history
* [chore] Bump move version

- Fix StructTag boxing
- Fix move unit tests
  • Loading branch information
tnowacki authored Nov 30, 2022
1 parent a6cfd1a commit 8abdb89
Show file tree
Hide file tree
Showing 46 changed files with 375 additions and 361 deletions.
77 changes: 39 additions & 38 deletions Cargo.lock

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ opt-level = 1
tokio = "1.22.0"

# Move dependencies
move-binary-format = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-bytecode-utils = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-bytecode-verifier = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-cli = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-compiler = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-core-types = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb", features = ["address20"] }
move-disassembler = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-package = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-stdlib = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-vm-runtime = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-unit-test = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-vm-test-utils = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-vm-types = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-command-line-common = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-transactional-test-runner = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-ir-types = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-prover = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-prover-boogie-backend = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-symbol-pool = { git = "https://github.com/move-language/move", rev = "0800fc79a98ca304bd449878f545cdcaff6f94bb" }
move-binary-format = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-bytecode-utils = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-bytecode-verifier = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-cli = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-compiler = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-core-types = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7", features = ["address20"] }
move-disassembler = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-package = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-stdlib = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-vm-runtime = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-unit-test = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-vm-test-utils = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-vm-types = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-command-line-common = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-transactional-test-runner = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-ir-types = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-prover = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-prover-boogie-backend = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }
move-symbol-pool = { git = "https://github.com/move-language/move", rev = "5bb2ac5a4a69e6f2df06183aec9b69c6d940f9f7" }

fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "3ac9fa490f2d7eecd133c87a7c616328a217b66a" }
fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "3ac9fa490f2d7eecd133c87a7c616328a217b66a", package = "fastcrypto-zkp" }
Expand Down
26 changes: 16 additions & 10 deletions crates/sui-adapter/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use move_binary_format::{
AbilitySet, CompiledModule, LocalIndex, SignatureToken, StructHandleIndex,
TypeParameterIndex,
},
file_format_common::VERSION_6,
};
use move_bytecode_verifier::VerifierConfig;
use move_core_types::{
Expand All @@ -29,6 +30,7 @@ use move_core_types::{
};
pub use move_vm_runtime::move_vm::MoveVM;
use move_vm_runtime::{
config::VMConfig,
native_extensions::NativeContextExtensions,
native_functions::NativeFunctionTable,
session::{SerializedReturnValues, Session},
Expand Down Expand Up @@ -65,14 +67,18 @@ macro_rules! assert_invariant {
}

pub fn new_move_vm(natives: NativeFunctionTable) -> Result<MoveVM, SuiError> {
MoveVM::new_with_verifier_config(
MoveVM::new_with_config(
natives,
VerifierConfig {
max_loop_depth: Some(5),
treat_friend_as_private: true,
max_generic_instantiation_length: Some(32),
max_function_parameters: Some(128),
max_basic_blocks: Some(1024),
VMConfig {
verifier: VerifierConfig {
max_loop_depth: Some(5),
treat_friend_as_private: true,
max_generic_instantiation_length: Some(32),
max_function_parameters: Some(128),
max_basic_blocks: Some(1024),
},
max_binary_format_version: VERSION_6,
paranoid_type_checks: false,
},
)
.map_err(|_| SuiError::ExecutionInvariantViolation)
Expand Down Expand Up @@ -281,15 +287,15 @@ fn execute_internal<
.into_iter()
.map(|(id, (write_kind, owner, ty, tag, value))| {
let abilities = session.get_type_abilities(&ty)?;
let layout = session.get_type_layout(&TypeTag::Struct(tag.clone()))?;
let layout = session.get_type_layout(&TypeTag::Struct(Box::new(tag.clone())))?;
let bytes = value.simple_serialize(&layout).unwrap();
Ok((id, (write_kind, owner, tag, abilities, bytes)))
})
.collect::<VMResult<_>>()?;
let user_events = user_events
.into_iter()
.map(|(_ty, tag, value)| {
let layout = session.get_type_layout(&TypeTag::Struct(tag.clone()))?;
let layout = session.get_type_layout(&TypeTag::Struct(Box::new(tag.clone())))?;
let bytes = value.simple_serialize(&layout).unwrap();
Ok((tag, bytes))
})
Expand Down Expand Up @@ -1336,7 +1342,7 @@ fn struct_tag_equals_sig_token(
struct_tag_equals_struct_inst(view, function_type_arguments, arg_type, *idx, args)
}
SignatureToken::TypeParameter(idx) => match &function_type_arguments[*idx as usize] {
TypeTag::Struct(s) => arg_type == s,
TypeTag::Struct(s) => arg_type == &**s,
_ => false,
},
_ => false,
Expand Down

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions crates/sui-core/src/gateway_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,12 @@ where
| TypeTag::Address
| TypeTag::Signer => (),
TypeTag::Vector(inner) => used_packages(packages, inner),
TypeTag::Struct(StructTag {
address,
type_params,
..
}) => {
TypeTag::Struct(st) => {
let StructTag {
address,
type_params,
..
} = &**st;
packages.push((*address).into());
for t in type_params {
used_packages(packages, t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ expression: common_costs_estimate
---
{
"MergeCoin": {
"computation_cost": 5970,
"storage_cost": 8814,
"computation_cost": 5972,
"storage_cost": 8816,
"storage_rebate": 0
},
"Publish": {
"computation_cost": 6774,
"storage_cost": 9935,
"computation_cost": 6775,
"storage_cost": 9937,
"storage_rebate": 0
},
"SharedCounterAssertValue": {
Expand All @@ -29,8 +29,8 @@ expression: common_costs_estimate
"storage_rebate": 0
},
"SplitCoin": {
"computation_cost": 5949,
"storage_cost": 8782,
"computation_cost": 5950,
"storage_cost": 8784,
"storage_rebate": 0
},
"TransferPortionSuiCoin": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ expression: common_costs_actual
---
{
"MergeCoin": {
"computation_cost": 715,
"computation_cost": 716,
"storage_cost": 32,
"storage_rebate": 0
},
"Publish": {
"computation_cost": 973,
"computation_cost": 974,
"storage_cost": 119,
"storage_rebate": 0
},
Expand Down
15 changes: 15 additions & 0 deletions crates/sui-framework/docs/bulletproofs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@



- [Constants](#@Constants_0)
- [Function `native_verify_full_range_proof`](#0x2_bulletproofs_native_verify_full_range_proof)
- [Function `verify_full_range_proof`](#0x2_bulletproofs_verify_full_range_proof)

Expand All @@ -14,6 +15,20 @@



<a name="@Constants_0"></a>

## Constants


<a name="0x2_bulletproofs_EBulletproofsVerificationFailed"></a>



<pre><code><b>const</b> <a href="bulletproofs.md#0x2_bulletproofs_EBulletproofsVerificationFailed">EBulletproofsVerificationFailed</a>: u64 = 5;
</code></pre>



<a name="0x2_bulletproofs_native_verify_full_range_proof"></a>

## Function `native_verify_full_range_proof`
Expand Down
61 changes: 7 additions & 54 deletions crates/sui-framework/docs/dynamic_object_field.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ for external tools. The difference is otherwise not observable from within Move.


- [Struct `Wrapper`](#0x2_dynamic_object_field_Wrapper)
- [Constants](#@Constants_0)
- [Function `add`](#0x2_dynamic_object_field_add)
- [Function `borrow`](#0x2_dynamic_object_field_borrow)
- [Function `borrow_mut`](#0x2_dynamic_object_field_borrow_mut)
Expand Down Expand Up @@ -54,58 +53,12 @@ for external tools. The difference is otherwise not observable from within Move.

</details>

<a name="@Constants_0"></a>

## Constants


<a name="0x2_dynamic_object_field_EBCSSerializationFailure"></a>

Failed to serialize the field's name


<pre><code><b>const</b> <a href="dynamic_object_field.md#0x2_dynamic_object_field_EBCSSerializationFailure">EBCSSerializationFailure</a>: u64 = 3;
</code></pre>



<a name="0x2_dynamic_object_field_EFieldAlreadyExists"></a>

The object already has a dynamic field with this name (with the value and type specified)


<pre><code><b>const</b> <a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldAlreadyExists">EFieldAlreadyExists</a>: u64 = 0;
</code></pre>



<a name="0x2_dynamic_object_field_EFieldDoesNotExist"></a>

Cannot load dynamic field.
The object does not have a dynamic field with this name (with the value and type specified)


<pre><code><b>const</b> <a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldDoesNotExist">EFieldDoesNotExist</a>: u64 = 1;
</code></pre>



<a name="0x2_dynamic_object_field_EFieldTypeMismatch"></a>

The object has a field with that name, but the value type does not match


<pre><code><b>const</b> <a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldTypeMismatch">EFieldTypeMismatch</a>: u64 = 2;
</code></pre>



<a name="0x2_dynamic_object_field_add"></a>

## Function `add`

Adds a dynamic object field to the object <code><a href="object.md#0x2_object">object</a>: &<b>mut</b> UID</code> at field specified by <code>name: Name</code>.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldAlreadyExists">EFieldAlreadyExists</a></code> if the object already has that field with that name.
Aborts with <code>EFieldAlreadyExists</code> if the object already has that field with that name.


<pre><code><b>public</b> <b>fun</b> <a href="dynamic_object_field.md#0x2_dynamic_object_field_add">add</a>&lt;Name: <b>copy</b>, drop, store, Value: store, key&gt;(<a href="object.md#0x2_object">object</a>: &<b>mut</b> <a href="object.md#0x2_object_UID">object::UID</a>, name: Name, value: Value)
Expand Down Expand Up @@ -140,8 +93,8 @@ Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFie
## Function `borrow`

Immutably borrows the <code><a href="object.md#0x2_object">object</a></code>s dynamic object field with the name specified by <code>name: Name</code>.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldDoesNotExist">EFieldDoesNotExist</a></code> if the object does not have a field with that name.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldTypeMismatch">EFieldTypeMismatch</a></code> if the field exists, but the value object does not have the
Aborts with <code>EFieldDoesNotExist</code> if the object does not have a field with that name.
Aborts with <code>EFieldTypeMismatch</code> if the field exists, but the value object does not have the
specified type.


Expand Down Expand Up @@ -173,8 +126,8 @@ specified type.
## Function `borrow_mut`

Mutably borrows the <code><a href="object.md#0x2_object">object</a></code>s dynamic object field with the name specified by <code>name: Name</code>.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldDoesNotExist">EFieldDoesNotExist</a></code> if the object does not have a field with that name.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldTypeMismatch">EFieldTypeMismatch</a></code> if the field exists, but the value object does not have the
Aborts with <code>EFieldDoesNotExist</code> if the object does not have a field with that name.
Aborts with <code>EFieldTypeMismatch</code> if the field exists, but the value object does not have the
specified type.


Expand Down Expand Up @@ -207,8 +160,8 @@ specified type.

Removes the <code><a href="object.md#0x2_object">object</a></code>s dynamic object field with the name specified by <code>name: Name</code> and returns
the bound object.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldDoesNotExist">EFieldDoesNotExist</a></code> if the object does not have a field with that name.
Aborts with <code><a href="dynamic_object_field.md#0x2_dynamic_object_field_EFieldTypeMismatch">EFieldTypeMismatch</a></code> if the field exists, but the value object does not have the
Aborts with <code>EFieldDoesNotExist</code> if the object does not have a field with that name.
Aborts with <code>EFieldTypeMismatch</code> if the field exists, but the value object does not have the
specified type.


Expand Down
24 changes: 24 additions & 0 deletions crates/sui-framework/docs/ecdsa.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@



- [Constants](#@Constants_0)
- [Function `ecrecover`](#0x2_ecdsa_ecrecover)
- [Function `decompress_pubkey`](#0x2_ecdsa_decompress_pubkey)
- [Function `keccak256`](#0x2_ecdsa_keccak256)
Expand All @@ -15,6 +16,29 @@



<a name="@Constants_0"></a>

## Constants


<a name="0x2_ecdsa_EFailToRecoverPubKey"></a>



<pre><code><b>const</b> <a href="ecdsa.md#0x2_ecdsa_EFailToRecoverPubKey">EFailToRecoverPubKey</a>: u64 = 0;
</code></pre>



<a name="0x2_ecdsa_EInvalidSignature"></a>



<pre><code><b>const</b> <a href="ecdsa.md#0x2_ecdsa_EInvalidSignature">EInvalidSignature</a>: u64 = 1;
</code></pre>



<a name="0x2_ecdsa_ecrecover"></a>

## Function `ecrecover`
Expand Down
15 changes: 15 additions & 0 deletions crates/sui-framework/docs/groth16.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Struct `PreparedVerifyingKey`](#0x2_groth16_PreparedVerifyingKey)
- [Struct `PublicProofInputs`](#0x2_groth16_PublicProofInputs)
- [Struct `ProofPoints`](#0x2_groth16_ProofPoints)
- [Constants](#@Constants_0)
- [Function `pvk_from_bytes`](#0x2_groth16_pvk_from_bytes)
- [Function `pvk_to_bytes`](#0x2_groth16_pvk_to_bytes)
- [Function `public_proof_inputs_from_bytes`](#0x2_groth16_public_proof_inputs_from_bytes)
Expand Down Expand Up @@ -123,6 +124,20 @@ A <code><a href="groth16.md#0x2_groth16_ProofPoints">ProofPoints</a></code> wrap

</details>

<a name="@Constants_0"></a>

## Constants


<a name="0x2_groth16_EInvalidVerifyingKey"></a>



<pre><code><b>const</b> <a href="groth16.md#0x2_groth16_EInvalidVerifyingKey">EInvalidVerifyingKey</a>: u64 = 7;
</code></pre>



<a name="0x2_groth16_pvk_from_bytes"></a>

## Function `pvk_from_bytes`
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-framework/sources/bcs.move
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module sui::bcs {
value = value + (byte << i);
i = i + 8;
};

value
}

Expand Down Expand Up @@ -270,7 +270,7 @@ module sui::bcs {
struct Info has drop { a: bool, b: u8, c: u64, d: u128, k: vector<bool>, s: address }

#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = ELenOutOfRange)]
fun test_uleb_len_fail() {
let value = vector[0xff, 0xff, 0xff, 0xff, 0xff];
let bytes = new(to_bytes(&value));
Expand All @@ -279,7 +279,7 @@ module sui::bcs {
}

#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = ENotBool)]
fun test_bool_fail() {
let bytes = new(to_bytes(&10u8));
let _fail = peel_bool(&mut bytes);
Expand Down
Loading

0 comments on commit 8abdb89

Please sign in to comment.