Skip to content
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

[adapter] Update how we handle type errors in some commands #20857

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
processed 3 tasks

init:
A: object(0,0)

task 1, lines 7-8:
//# programmable --sender A
//> 0: MakeMoveVec<std::string::utf8>([]);
Error: Transaction Effects Status: Error for type argument at index 0: A type was not found in the module specified.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: TypeArgumentError { argument_idx: 0, kind: TypeNotFound }, source: None, command: Some(0) } }

task 2, lines 10-11:
//# programmable --sender A --inputs 1
//> 0: MakeMoveVec<std::string::utf8>([Input(0)]);
Error: Transaction Effects Status: Error for type argument at index 0: A type was not found in the module specified.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: TypeArgumentError { argument_idx: 0, kind: TypeNotFound }, source: None, command: Some(0) } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0


//# init --addresses test=0x0 --accounts A

//# programmable --sender A
//> 0: MakeMoveVec<std::string::utf8>([]);

//# programmable --sender A --inputs 1
//> 0: MakeMoveVec<std::string::utf8>([Input(0)]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
processed 3 tasks

init:
A: object(0,0)

task 1, lines 7-8:
//# programmable --sender A
//> 0: MakeMoveVec<std::string::utf8>([]);
Error: Transaction Effects Status: MOVE VM INVARIANT VIOLATION.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: VMInvariantViolation, source: Some(VMError { major_status: TYPE_RESOLUTION_FAILURE, sub_status: None, message: Some("Cannot find std::string::utf8 in cache"), exec_state: None, location: Undefined, indices: [], offsets: [] }), command: Some(0) } }

task 2, lines 10-11:
//# programmable --sender A --inputs 1
//> 0: MakeMoveVec<std::string::utf8>([Input(0)]);
Error: Transaction Effects Status: MOVE VM INVARIANT VIOLATION.
Execution Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: VMInvariantViolation, source: Some(VMError { major_status: TYPE_RESOLUTION_FAILURE, sub_status: None, message: Some("Cannot find std::string::utf8 in cache"), exec_state: None, location: Undefined, indices: [], offsets: [] }), command: Some(0) } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0


//# init --addresses test=0x0 --accounts A --protocol-version 71

//# programmable --sender A
//> 0: MakeMoveVec<std::string::utf8>([]);

//# programmable --sender A --inputs 1
//> 0: MakeMoveVec<std::string::utf8>([Input(0)]);

3 changes: 2 additions & 1 deletion crates/sui-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@
"name": "Result",
"value": {
"minSupportedProtocolVersion": "1",
"maxSupportedProtocolVersion": "71",
"maxSupportedProtocolVersion": "72",
"protocolVersion": "6",
"featureFlags": {
"accept_zklogin_in_multisig": false,
Expand All @@ -1311,6 +1311,7 @@
"consensus_round_prober": false,
"consensus_round_prober_probe_accepted_rounds": false,
"consensus_smart_ancestor_selection": false,
"convert_type_argument_error": false,
"disable_invariant_violation_check_in_swap_loc": false,
"disallow_adding_abilities_on_upgrade": false,
"disallow_change_struct_type_params_on_upgrade": false,
Expand Down
14 changes: 13 additions & 1 deletion crates/sui-protocol-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tracing::{info, warn};

/// The minimum and maximum protocol versions supported by this build.
const MIN_PROTOCOL_VERSION: u64 = 1;
const MAX_PROTOCOL_VERSION: u64 = 71;
const MAX_PROTOCOL_VERSION: u64 = 72;

// Record history of protocol version allocations here:
//
Expand Down Expand Up @@ -204,6 +204,7 @@ const MAX_PROTOCOL_VERSION: u64 = 71;
// Add std::uq64_64 module to Move stdlib.
// Improve gas/wall time efficiency of some Move stdlib vector functions
// Version 71: [SIP-45] Enable consensus amplification.
// Version 72: Fix issue where `convert_type_argument_error` wasn't being used in all cases.

#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct ProtocolVersion(u64);
Expand Down Expand Up @@ -593,6 +594,10 @@ struct FeatureFlags {
// committed round for each authority, but allows to commit uncommitted blocks up to gc round (excluded) for that authority.
#[serde(skip_serializing_if = "is_false")]
consensus_linearize_subdag_v2: bool,

// Properly convert certain type argument errors in the execution layer.
#[serde(skip_serializing_if = "is_false")]
convert_type_argument_error: bool,
}

fn is_false(b: &bool) -> bool {
Expand Down Expand Up @@ -1746,6 +1751,10 @@ impl ProtocolConfig {
);
res
}

pub fn convert_type_argument_error(&self) -> bool {
self.feature_flags.convert_type_argument_error
}
}

#[cfg(not(msim))]
Expand Down Expand Up @@ -3119,6 +3128,9 @@ impl ProtocolConfig {
// Enable bursts for congestion control. (10x the per-commit budget)
cfg.allowed_txn_cost_overage_burst_per_object_in_commit = Some(185_000_000);
}
72 => {
cfg.feature_flags.convert_type_argument_error = true;
}
// Use this template when making changes:
//
// // modify an existing constant.
Expand Down
Loading
Loading