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

Update to rustc 1.70 #9140

Merged
merged 14 commits into from
Jun 19, 2023
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version = "0.0.0" # managed by cargo-workspaces, see below
authors = ["Near Inc <hello@nearprotocol.com>"]
edition = "2021"
rust-version = "1.69.0"
rust-version = "1.70.0"
repository = "https://github.com/near/nearcore"
license = "MIT OR Apache-2.0"

Expand Down Expand Up @@ -316,14 +316,14 @@ trybuild = "1.0.11"
turn = "0.6"
validator = "0.12"
wasm-encoder = "0.27.0"
wasmer-compiler = { package = "wasmer-compiler-near", version = "=2.4.0" }
wasmer-compiler-singlepass = { package = "wasmer-compiler-singlepass-near", version = "=2.4.0" }
wasmer-engine = { package = "wasmer-engine-near", version = "=2.4.0" }
wasmer-engine-universal = { package = "wasmer-engine-universal-near", version = "=2.4.0", features = ["compiler"] }
wasmer-compiler = { package = "wasmer-compiler-near", version = "=2.4.1" }
wasmer-compiler-singlepass = { package = "wasmer-compiler-singlepass-near", version = "=2.4.1" }
wasmer-engine = { package = "wasmer-engine-near", version = "=2.4.1" }
wasmer-engine-universal = { package = "wasmer-engine-universal-near", version = "=2.4.1", features = ["compiler"] }
wasmer-runtime = { version = "0.18.0", package = "wasmer-runtime-near", features = ["default-backend-singlepass"], default-features = false }
wasmer-runtime-core = { version = "0.18.2", package = "wasmer-runtime-core-near" }
wasmer-types = { package = "wasmer-types-near", version = "=2.4.0" }
wasmer-vm = { package = "wasmer-vm-near", version = "=2.4.0" }
wasmer-types = { package = "wasmer-types-near", version = "=2.4.1" }
wasmer-vm = { package = "wasmer-vm-near", version = "=2.4.1" }
wasmparser = "0.78" # TODO: unify at least the versions of wasmparser we have in our codebase
wasmprinter = "0.2"
wasm-smith = "0.10"
Expand Down
3 changes: 3 additions & 0 deletions chain/chain/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3280,6 +3280,7 @@ mod tests {
let genesis = chain.get_block_by_height(0).unwrap();
let signer = Arc::new(create_test_signer("test1"));
let mut short_fork = vec![];
#[allow(clippy::redundant_clone)]
let mut prev_block = genesis.clone();
for i in 1..(transaction_validity_period + 2) {
let mut store_update = chain.mut_store().store_update();
Expand All @@ -3300,6 +3301,7 @@ mod tests {
Err(InvalidTxError::Expired)
);
let mut long_fork = vec![];
#[allow(clippy::redundant_clone)]
let mut prev_block = genesis.clone();
for i in 1..(transaction_validity_period * 5) {
let mut store_update = chain.mut_store().store_update();
Expand Down Expand Up @@ -3524,6 +3526,7 @@ mod tests {
let mut chain = get_chain_with_epoch_length(1);
let genesis = chain.get_block_by_height(0).unwrap();
let signer = Arc::new(create_test_signer("test1"));
#[allow(clippy::redundant_clone)]
let mut prev_block = genesis.clone();
let mut blocks = vec![prev_block.clone()];
{
Expand Down
8 changes: 1 addition & 7 deletions chain/client-primitives/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,14 @@ impl From<ShardSyncDownload> for ShardSyncDownloadView {
}
}

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct StateSplitApplyingStatus {
/// total number of parts to be applied
pub total_parts: OnceCell<u64>,
/// number of parts that are done
pub done_parts: AtomicU64,
}

impl StateSplitApplyingStatus {
pub fn new() -> Self {
StateSplitApplyingStatus { total_parts: OnceCell::new(), done_parts: AtomicU64::new(0) }
}
}

/// Stores status of shard sync and statuses of downloading shards.
#[derive(Clone, Debug)]
pub struct ShardSyncDownload {
Expand Down
3 changes: 2 additions & 1 deletion chain/client/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl ClientActor {

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

let mut height_to_fetch = starting_height.unwrap_or(header_head.height);
Expand Down Expand Up @@ -537,6 +537,7 @@ impl ClientActor {
min(head.height + DEBUG_MAX_PRODUCTION_BLOCKS_TO_SHOW, estimated_epoch_end),
);

#[allow(clippy::redundant_clone)]
let mut epoch_id = head.epoch_id.clone();
for height in
head.height.saturating_sub(DEBUG_PRODUCTION_OLD_BLOCKS_TO_SHOW)..=max_height
Expand Down
2 changes: 1 addition & 1 deletion chain/client/src/sync/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ impl StateSync {
state_split_scheduler: &dyn Fn(StateSplitRequest),
me: &Option<AccountId>,
) -> Result<(), near_chain::Error> {
let status = Arc::new(StateSplitApplyingStatus::new());
let status = Arc::new(StateSplitApplyingStatus::default());
chain.build_state_for_split_shards_preprocessing(
&sync_hash,
shard_id,
Expand Down
3 changes: 0 additions & 3 deletions chain/client/src/tests/catching_up.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,6 @@ fn test_chunk_grieving() {
let grieving_chunk_hash = Arc::new(RwLock::new(ChunkHash::default()));
let unaccepted_block_hash = Arc::new(RwLock::new(CryptoHash::default()));

let _connectors1 = connectors.clone();

let block_prod_time: u64 = 3500;
let (_, conn, _) = setup_mock_all_validators(
vs,
Expand Down Expand Up @@ -852,7 +850,6 @@ fn test_all_chunks_accepted_common(

let verbose = false;

let _connectors1 = connectors.clone();
let seen_chunk_same_sender = Arc::new(RwLock::new(HashSet::<(AccountId, u64, u64)>::new()));
let requested = Arc::new(RwLock::new(HashSet::<(AccountId, Vec<u64>, ChunkHash)>::new()));
let responded = Arc::new(RwLock::new(HashSet::<(CryptoHash, Vec<u64>, ChunkHash)>::new()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn get_status_of_tx_hash_collision_for_implicit_account(

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

let public_key = signer1.public_key.clone();
let public_key = &signer1.public_key;
let raw_public_key = public_key.unwrap_as_ed25519().0.to_vec();
let implicit_account_id = AccountId::try_from(hex::encode(&raw_public_key)).unwrap();
let implicit_account_signer =
Expand Down
11 changes: 5 additions & 6 deletions pytest/tools/prober/prober_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,14 @@ def check_view_call(legacy_url, split_url):
"method_name": "get_num",
"args_base64": "e30="
}
legacy_response = json_rpc('query', params, legacy_url)
split_response = json_rpc('query', params, split_url)
legacy_resp = json_rpc('query', params, legacy_url)
split_resp = json_rpc('query', params, split_url)

if legacy_response['result']['result'] != split_response['result'][
'result']:
if legacy_resp['result']['result'] != split_resp['result']['result']:
logger.error(
f'View call check failed, the legacy response and the split response are different'
f'\nlegacy response\n{legacy_response}'
f'\nsplit response\n{split_response}')
f'\nlegacy response\n{legacy_resp}'
f'\nsplit response\n{split_resp}')
sys.exit(1)


Expand Down
8 changes: 4 additions & 4 deletions runtime/near-vm-runner/src/tests/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ fn test_wasmer2_artifact_output_stability() {
let compiled_hashes = [
16241863964906842660,
9891733092817574479,
10546692418763942004,
13653435153125107606,
17353479639813695155,
14282522049460604929,
10549554738494211661,
11197084127324548219,
6788687979647989853,
15523181531223292814,
1999054137996096555,
];
let mut got_compiled_hashes = Vec::with_capacity(seeds.len());
for seed in seeds {
Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm-runner/src/wasmer2_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl Wasmer2Config {
// major version << 6
// minor version
const WASMER2_CONFIG: Wasmer2Config = Wasmer2Config {
seed: (1 << 10) | (10 << 6) | 0,
seed: (1 << 10) | (11 << 6) | 0,
engine: WasmerEngine::Universal,
compiler: WasmerCompiler::Singlepass,
};
Expand Down
2 changes: 1 addition & 1 deletion runtime/near-vm/compiler-test-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ macro_rules! parse_macro_input {
pub fn compiler_test(attrs: TokenStream, input: TokenStream) -> TokenStream {
let path: Option<ExprPath> = parse::<ExprPath>(attrs).ok();
let mut my_fn: ItemFn = parse_macro_input!(input as ItemFn);
let fn_name = my_fn.sig.ident.clone();
let fn_name = &my_fn.sig.ident;

// Let's build the ignores to append an `#[ignore]` macro to the
// autogenerated tests in case the test appears in the `ignores.txt` path;
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime-params-estimator/emu-cost/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# our local base image
FROM rust:1.69.0
FROM rust:1.70.0

LABEL description="Container for builds"

Expand Down
6 changes: 3 additions & 3 deletions runtime/runtime/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1376,13 +1376,13 @@ mod tests {
#[test]
fn test_validate_delegate_action_key_update_nonce() {
let (_, signed_delegate_action) = create_delegate_action_receipt();
let sender_id = signed_delegate_action.delegate_action.sender_id.clone();
let sender_pub_key = signed_delegate_action.delegate_action.public_key.clone();
let sender_id = &signed_delegate_action.delegate_action.sender_id;
let sender_pub_key = &signed_delegate_action.delegate_action.public_key;
let access_key = AccessKey { nonce: 19000000, permission: AccessKeyPermission::FullAccess };

let apply_state =
create_apply_state(signed_delegate_action.delegate_action.max_block_height);
let mut state_update = setup_account(&sender_id, &sender_pub_key, &access_key);
let mut state_update = setup_account(sender_id, sender_pub_key, &access_key);

// Everything is ok
let mut result = ActionResult::default();
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# This specifies the version of Rust we use to build.
# Individual crates in the workspace may support a lower version, as indicated by `rust-version` field in each crate's `Cargo.toml`.
# The version specified below, should be at least as high as the maximum `rust-version` within the workspace.
channel = "1.69.0"
channel = "1.70.0"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]