Skip to content

Commit 329adbe

Browse files
mina86jakmeiernagisa
authored
Update to rustc 1.70 (#9140)
With 1.70 toolchain, the contracts are by default compiled in a way which requires updates to wasmer 2.4.1 as well. I looked also into replacing usage of once_cell crate but sadly std::sync::OnceLock doesn’t implement wait method. Co-authored-by: Jakob Meier <[email protected]> Co-authored-by: Simonas Kazlauskas <[email protected]> Issue: near/create-near-app#2009 Issue: #9143
1 parent 02a8fb4 commit 329adbe

File tree

15 files changed

+43
-49
lines changed

15 files changed

+43
-49
lines changed

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version = "0.0.0" # managed by cargo-workspaces, see below
33
authors = ["Near Inc <[email protected]>"]
44
edition = "2021"
5-
rust-version = "1.69.0"
5+
rust-version = "1.70.0"
66
repository = "https://github.com/near/nearcore"
77
license = "MIT OR Apache-2.0"
88

@@ -316,14 +316,14 @@ trybuild = "1.0.11"
316316
turn = "0.6"
317317
validator = "0.12"
318318
wasm-encoder = "0.27.0"
319-
wasmer-compiler = { package = "wasmer-compiler-near", version = "=2.4.0" }
320-
wasmer-compiler-singlepass = { package = "wasmer-compiler-singlepass-near", version = "=2.4.0" }
321-
wasmer-engine = { package = "wasmer-engine-near", version = "=2.4.0" }
322-
wasmer-engine-universal = { package = "wasmer-engine-universal-near", version = "=2.4.0", features = ["compiler"] }
319+
wasmer-compiler = { package = "wasmer-compiler-near", version = "=2.4.1" }
320+
wasmer-compiler-singlepass = { package = "wasmer-compiler-singlepass-near", version = "=2.4.1" }
321+
wasmer-engine = { package = "wasmer-engine-near", version = "=2.4.1" }
322+
wasmer-engine-universal = { package = "wasmer-engine-universal-near", version = "=2.4.1", features = ["compiler"] }
323323
wasmer-runtime = { version = "0.18.0", package = "wasmer-runtime-near", features = ["default-backend-singlepass"], default-features = false }
324324
wasmer-runtime-core = { version = "0.18.2", package = "wasmer-runtime-core-near" }
325-
wasmer-types = { package = "wasmer-types-near", version = "=2.4.0" }
326-
wasmer-vm = { package = "wasmer-vm-near", version = "=2.4.0" }
325+
wasmer-types = { package = "wasmer-types-near", version = "=2.4.1" }
326+
wasmer-vm = { package = "wasmer-vm-near", version = "=2.4.1" }
327327
wasmparser = "0.78" # TODO: unify at least the versions of wasmparser we have in our codebase
328328
wasmprinter = "0.2"
329329
wasm-smith = "0.10"

chain/chain/src/store.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,6 +3280,7 @@ mod tests {
32803280
let genesis = chain.get_block_by_height(0).unwrap();
32813281
let signer = Arc::new(create_test_signer("test1"));
32823282
let mut short_fork = vec![];
3283+
#[allow(clippy::redundant_clone)]
32833284
let mut prev_block = genesis.clone();
32843285
for i in 1..(transaction_validity_period + 2) {
32853286
let mut store_update = chain.mut_store().store_update();
@@ -3300,6 +3301,7 @@ mod tests {
33003301
Err(InvalidTxError::Expired)
33013302
);
33023303
let mut long_fork = vec![];
3304+
#[allow(clippy::redundant_clone)]
33033305
let mut prev_block = genesis.clone();
33043306
for i in 1..(transaction_validity_period * 5) {
33053307
let mut store_update = chain.mut_store().store_update();
@@ -3524,6 +3526,7 @@ mod tests {
35243526
let mut chain = get_chain_with_epoch_length(1);
35253527
let genesis = chain.get_block_by_height(0).unwrap();
35263528
let signer = Arc::new(create_test_signer("test1"));
3529+
#[allow(clippy::redundant_clone)]
35273530
let mut prev_block = genesis.clone();
35283531
let mut blocks = vec![prev_block.clone()];
35293532
{

chain/client-primitives/src/types.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,14 @@ impl From<ShardSyncDownload> for ShardSyncDownloadView {
177177
}
178178
}
179179

180-
#[derive(Debug)]
180+
#[derive(Debug, Default)]
181181
pub struct StateSplitApplyingStatus {
182182
/// total number of parts to be applied
183183
pub total_parts: OnceCell<u64>,
184184
/// number of parts that are done
185185
pub done_parts: AtomicU64,
186186
}
187187

188-
impl StateSplitApplyingStatus {
189-
pub fn new() -> Self {
190-
StateSplitApplyingStatus { total_parts: OnceCell::new(), done_parts: AtomicU64::new(0) }
191-
}
192-
}
193-
194188
/// Stores status of shard sync and statuses of downloading shards.
195189
#[derive(Clone, Debug)]
196190
pub struct ShardSyncDownload {

chain/client/src/debug.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl ClientActor {
391391

392392
let mut blocks: HashMap<CryptoHash, DebugBlockStatus> = HashMap::new();
393393
let mut missed_heights: Vec<MissedHeightInfo> = Vec::new();
394-
let mut last_epoch_id = head.epoch_id.clone();
394+
let mut last_epoch_id = head.epoch_id;
395395
let initial_gas_price = self.client.chain.genesis_block().header().gas_price();
396396

397397
let mut height_to_fetch = starting_height.unwrap_or(header_head.height);
@@ -537,6 +537,7 @@ impl ClientActor {
537537
min(head.height + DEBUG_MAX_PRODUCTION_BLOCKS_TO_SHOW, estimated_epoch_end),
538538
);
539539

540+
#[allow(clippy::redundant_clone)]
540541
let mut epoch_id = head.epoch_id.clone();
541542
for height in
542543
head.height.saturating_sub(DEBUG_PRODUCTION_OLD_BLOCKS_TO_SHOW)..=max_height

chain/client/src/sync/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ impl StateSync {
11681168
state_split_scheduler: &dyn Fn(StateSplitRequest),
11691169
me: &Option<AccountId>,
11701170
) -> Result<(), near_chain::Error> {
1171-
let status = Arc::new(StateSplitApplyingStatus::new());
1171+
let status = Arc::new(StateSplitApplyingStatus::default());
11721172
chain.build_state_for_split_shards_preprocessing(
11731173
&sync_hash,
11741174
shard_id,

chain/client/src/tests/catching_up.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,6 @@ fn test_chunk_grieving() {
691691
let grieving_chunk_hash = Arc::new(RwLock::new(ChunkHash::default()));
692692
let unaccepted_block_hash = Arc::new(RwLock::new(CryptoHash::default()));
693693

694-
let _connectors1 = connectors.clone();
695-
696694
let block_prod_time: u64 = 3500;
697695
let (_, conn, _) = setup_mock_all_validators(
698696
vs,
@@ -852,7 +850,6 @@ fn test_all_chunks_accepted_common(
852850

853851
let verbose = false;
854852

855-
let _connectors1 = connectors.clone();
856853
let seen_chunk_same_sender = Arc::new(RwLock::new(HashSet::<(AccountId, u64, u64)>::new()));
857854
let requested = Arc::new(RwLock::new(HashSet::<(AccountId, Vec<u64>, ChunkHash)>::new()));
858855
let responded = Arc::new(RwLock::new(HashSet::<(CryptoHash, Vec<u64>, ChunkHash)>::new()));

integration-tests/src/tests/client/features/access_key_nonce_for_implicit_accounts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn get_status_of_tx_hash_collision_for_implicit_account(
132132

133133
let signer1 = InMemorySigner::from_seed("test1".parse().unwrap(), KeyType::ED25519, "test1");
134134

135-
let public_key = signer1.public_key.clone();
135+
let public_key = &signer1.public_key;
136136
let raw_public_key = public_key.unwrap_as_ed25519().0.to_vec();
137137
let implicit_account_id = AccountId::try_from(hex::encode(&raw_public_key)).unwrap();
138138
let implicit_account_signer =

pytest/tools/prober/prober_split.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,14 @@ def check_view_call(legacy_url, split_url):
113113
"method_name": "get_num",
114114
"args_base64": "e30="
115115
}
116-
legacy_response = json_rpc('query', params, legacy_url)
117-
split_response = json_rpc('query', params, split_url)
116+
legacy_resp = json_rpc('query', params, legacy_url)
117+
split_resp = json_rpc('query', params, split_url)
118118

119-
if legacy_response['result']['result'] != split_response['result'][
120-
'result']:
119+
if legacy_resp['result']['result'] != split_resp['result']['result']:
121120
logger.error(
122121
f'View call check failed, the legacy response and the split response are different'
123-
f'\nlegacy response\n{legacy_response}'
124-
f'\nsplit response\n{split_response}')
122+
f'\nlegacy response\n{legacy_resp}'
123+
f'\nsplit response\n{split_resp}')
125124
sys.exit(1)
126125

127126

runtime/near-vm-runner/src/tests/cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ fn test_wasmer2_artifact_output_stability() {
123123
let compiled_hashes = [
124124
16241863964906842660,
125125
9891733092817574479,
126-
10546692418763942004,
127-
13653435153125107606,
126+
17353479639813695155,
127+
14282522049460604929,
128128
10549554738494211661,
129-
11197084127324548219,
130-
6788687979647989853,
129+
15523181531223292814,
130+
1999054137996096555,
131131
];
132132
let mut got_compiled_hashes = Vec::with_capacity(seeds.len());
133133
for seed in seeds {

runtime/near-vm-runner/src/wasmer2_runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl Wasmer2Config {
220220
// major version << 6
221221
// minor version
222222
const WASMER2_CONFIG: Wasmer2Config = Wasmer2Config {
223-
seed: (1 << 10) | (10 << 6) | 0,
223+
seed: (1 << 10) | (11 << 6) | 0,
224224
engine: WasmerEngine::Universal,
225225
compiler: WasmerCompiler::Singlepass,
226226
};

runtime/near-vm/compiler-test-derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ macro_rules! parse_macro_input {
3232
pub fn compiler_test(attrs: TokenStream, input: TokenStream) -> TokenStream {
3333
let path: Option<ExprPath> = parse::<ExprPath>(attrs).ok();
3434
let mut my_fn: ItemFn = parse_macro_input!(input as ItemFn);
35-
let fn_name = my_fn.sig.ident.clone();
35+
let fn_name = &my_fn.sig.ident;
3636

3737
// Let's build the ignores to append an `#[ignore]` macro to the
3838
// autogenerated tests in case the test appears in the `ignores.txt` path;

runtime/runtime-params-estimator/emu-cost/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# our local base image
2-
FROM rust:1.69.0
2+
FROM rust:1.70.0
33

44
LABEL description="Container for builds"
55

runtime/runtime/src/actions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,13 +1376,13 @@ mod tests {
13761376
#[test]
13771377
fn test_validate_delegate_action_key_update_nonce() {
13781378
let (_, signed_delegate_action) = create_delegate_action_receipt();
1379-
let sender_id = signed_delegate_action.delegate_action.sender_id.clone();
1380-
let sender_pub_key = signed_delegate_action.delegate_action.public_key.clone();
1379+
let sender_id = &signed_delegate_action.delegate_action.sender_id;
1380+
let sender_pub_key = &signed_delegate_action.delegate_action.public_key;
13811381
let access_key = AccessKey { nonce: 19000000, permission: AccessKeyPermission::FullAccess };
13821382

13831383
let apply_state =
13841384
create_apply_state(signed_delegate_action.delegate_action.max_block_height);
1385-
let mut state_update = setup_account(&sender_id, &sender_pub_key, &access_key);
1385+
let mut state_update = setup_account(sender_id, sender_pub_key, &access_key);
13861386

13871387
// Everything is ok
13881388
let mut result = ActionResult::default();

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# This specifies the version of Rust we use to build.
33
# Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`.
44
# The version specified below, should be at least as high as the maximum `rust-version` within the workspace.
5-
channel = "1.69.0"
5+
channel = "1.70.0"
66
components = [ "rustfmt" ]
77
targets = [ "wasm32-unknown-unknown" ]

0 commit comments

Comments
 (0)