Skip to content

Commit d9edc79

Browse files
authored
[cherry-pick] Fix issue in bytecode verifier. (#23858)
## Description Fix for a bytecode verifier issue. ## Test plan Local tests. --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [X] Protocol: Adds a new protocol version that fixes an issue in the bytecode verifier. - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
1 parent bdf0877 commit d9edc79

File tree

17 files changed

+1678
-24
lines changed

17 files changed

+1678
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
source: crates/sui-core/src/authority/execution_time_estimator.rs
3+
expression: snapshot_data
4+
---
5+
protocol_version: 97
6+
consensus_observations:
7+
- - MakeMoveVec
8+
- observations:
9+
- - 4
10+
- secs: 0
11+
nanos: 29000000
12+
- - 7
13+
- secs: 0
14+
nanos: 28000000
15+
- - 5
16+
- secs: 0
17+
nanos: 19000000
18+
- - 1
19+
- secs: 0
20+
nanos: 25000000
21+
stake_weighted_median:
22+
secs: 0
23+
nanos: 28000000
24+
- - MergeCoins
25+
- observations:
26+
- - 6
27+
- secs: 0
28+
nanos: 63000000
29+
- - 1
30+
- secs: 0
31+
nanos: 21000000
32+
- - 2
33+
- secs: 0
34+
nanos: 32000000
35+
- - 8
36+
- secs: 0
37+
nanos: 43000000
38+
stake_weighted_median:
39+
secs: 0
40+
nanos: 43000000
41+
- - SplitCoins
42+
- observations:
43+
- - 0
44+
- ~
45+
- - 9
46+
- secs: 0
47+
nanos: 76000000
48+
- - 5
49+
- secs: 0
50+
nanos: 54000000
51+
- - 5
52+
- secs: 0
53+
nanos: 35000000
54+
stake_weighted_median:
55+
secs: 0
56+
nanos: 54000000
57+
- - TransferObjects
58+
- observations:
59+
- - 0
60+
- ~
61+
- - 0
62+
- ~
63+
- - 0
64+
- ~
65+
- - 9
66+
- secs: 0
67+
nanos: 45000000
68+
stake_weighted_median:
69+
secs: 0
70+
nanos: 45000000
71+
- - Upgrade
72+
- observations:
73+
- - 9
74+
- secs: 0
75+
nanos: 425000000
76+
- - 6
77+
- secs: 0
78+
nanos: 485000000
79+
- - 10
80+
- secs: 0
81+
nanos: 827000000
82+
- - 4
83+
- secs: 0
84+
nanos: 587000000
85+
stake_weighted_median:
86+
secs: 0
87+
nanos: 587000000
88+
- - MoveEntryPoint:
89+
package: "0x0000000000000000000000000000000000000000000000000000000000000001"
90+
module: coin
91+
function: transfer
92+
type_arguments: []
93+
- observations:
94+
- - 7
95+
- secs: 0
96+
nanos: 404000000
97+
- - 6
98+
- secs: 0
99+
nanos: 162000000
100+
- - 9
101+
- secs: 0
102+
nanos: 268000000
103+
- - 8
104+
- secs: 0
105+
nanos: 0
106+
stake_weighted_median:
107+
secs: 0
108+
nanos: 268000000
109+
- - MoveEntryPoint:
110+
package: "0x0000000000000000000000000000000000000000000000000000000000000002"
111+
module: nft
112+
function: mint
113+
type_arguments: []
114+
- observations:
115+
- - 0
116+
- ~
117+
- - 0
118+
- ~
119+
- - 6
120+
- secs: 0
121+
nanos: 248000000
122+
- - 8
123+
- secs: 0
124+
nanos: 499000000
125+
stake_weighted_median:
126+
secs: 0
127+
nanos: 499000000
128+
transaction_estimates:
129+
- - coin_transfer_call
130+
- secs: 0
131+
nanos: 268000000
132+
- - mixed_move_calls
133+
- secs: 0
134+
nanos: 767000000
135+
- - native_commands_with_observations
136+
- secs: 0
137+
nanos: 340000000
138+
- - transfer_objects_3_items
139+
- secs: 0
140+
nanos: 180000000
141+
- - split_coins_4_amounts
142+
- secs: 0
143+
nanos: 270000000
144+
- - merge_coins_1_sources
145+
- secs: 0
146+
nanos: 86000000
147+
- - make_move_vec_4_elements
148+
- secs: 0
149+
nanos: 140000000
150+
- - mixed_commands
151+
- secs: 0
152+
nanos: 244000000
153+
- - upgrade_package
154+
- secs: 0
155+
nanos: 587000000

crates/sui-open-rpc/spec/openrpc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,12 +1294,13 @@
12941294
"name": "Result",
12951295
"value": {
12961296
"minSupportedProtocolVersion": "1",
1297-
"maxSupportedProtocolVersion": "96",
1297+
"maxSupportedProtocolVersion": "97",
12981298
"protocolVersion": "6",
12991299
"featureFlags": {
13001300
"abstract_size_in_object_runtime": false,
13011301
"accept_passkey_in_multisig": false,
13021302
"accept_zklogin_in_multisig": false,
1303+
"additional_borrow_checks": false,
13031304
"additional_consensus_digest_indirect_state": false,
13041305
"additional_multisig_checks": false,
13051306
"advance_epoch_start_time_in_safe_mode": true,

crates/sui-protocol-config/src/lib.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use tracing::{info, warn};
1919

2020
/// The minimum and maximum protocol versions supported by this build.
2121
const MIN_PROTOCOL_VERSION: u64 = 1;
22-
const MAX_PROTOCOL_VERSION: u64 = 96;
22+
const MAX_PROTOCOL_VERSION: u64 = 97;
2323

2424
// Record history of protocol version allocations here:
2525
//
@@ -264,6 +264,7 @@ const MAX_PROTOCOL_VERSION: u64 = 96;
264264
// Fix bug where MFP transaction shared inputs' debts were not loaded
265265
// Create Coin Registry object
266266
// Enable checkpoint artifacts digest in devnet.
267+
// Version 97: Enable additional borrow checks
267268

268269
#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
269270
pub struct ProtocolVersion(u64);
@@ -814,6 +815,10 @@ struct FeatureFlags {
814815
// If true charge for loads into the cache (i.e., fetches from storage) in the object runtime.
815816
#[serde(skip_serializing_if = "is_false")]
816817
object_runtime_charge_cache_load_gas: bool,
818+
819+
// If true, perform additional borrow checks
820+
#[serde(skip_serializing_if = "is_false")]
821+
additional_borrow_checks: bool,
817822
}
818823

819824
fn is_false(b: &bool) -> bool {
@@ -2247,6 +2252,10 @@ impl ProtocolConfig {
22472252
pub fn object_runtime_charge_cache_load_gas(&self) -> bool {
22482253
self.feature_flags.object_runtime_charge_cache_load_gas
22492254
}
2255+
2256+
pub fn additional_borrow_checks(&self) -> bool {
2257+
self.feature_flags.additional_borrow_checks
2258+
}
22502259
}
22512260

22522261
#[cfg(not(msim))]
@@ -4041,6 +4050,9 @@ impl ProtocolConfig {
40414050
// Enable Mysticeti fastpath handlers on mainnet.
40424051
cfg.feature_flags.mysticeti_fastpath = true;
40434052
}
4053+
97 => {
4054+
cfg.feature_flags.additional_borrow_checks = true;
4055+
}
40444056
// Use this template when making changes:
40454057
//
40464058
// // modify an existing constant.
@@ -4085,6 +4097,13 @@ impl ProtocolConfig {
40854097
(None, None)
40864098
};
40874099

4100+
let additional_borrow_checks = if signing_limits.is_some() {
4101+
// always turn on additional borrow checks during signing
4102+
true
4103+
} else {
4104+
self.additional_borrow_checks()
4105+
};
4106+
40884107
VerifierConfig {
40894108
max_loop_depth: Some(self.max_loop_depth() as usize),
40904109
max_generic_instantiation_length: Some(self.max_generic_instantiation_length() as usize),
@@ -4108,6 +4127,7 @@ impl ProtocolConfig {
41084127
.reject_mutable_random_on_entry_functions(),
41094128
bytecode_version: self.move_binary_format_version(),
41104129
max_variants_in_enum: self.max_move_enum_variants_as_option(),
4130+
additional_borrow_checks,
41114131
}
41124132
}
41134133

0 commit comments

Comments
 (0)