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

Rust 1.65.0 #736

Merged
merged 6 commits into from
Nov 30, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test-bridge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
container:
image: ghcr.io/anoma/namada:wasm-0.6.1
image: ghcr.io/anoma/namada:wasm-0.11.0
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2022-05-20]
nightly_version: [nightly-2022-11-03]
mold_version: [1.6.0]
make:
- name: ABCI
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
container:
image: ghcr.io/anoma/namada:wasm-0.8.0
image: ghcr.io/anoma/namada:wasm-0.11.0
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2022-05-20]
nightly_version: [nightly-2022-11-03]
mold_version: [1.6.0]
make:
- name: ABCI
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2022-05-20]
nightly_version: [nightly-2022-11-03]
make:
- name: Clippy
command: clippy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2022-05-20]
nightly_version: [nightly-2022-11-03]
make:
- name: Audit
command: audit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
nightly_version: [nightly-2022-05-20]
nightly_version: [nightly-2022-11-03]
mdbook_version: [rust-lang/[email protected]]
mdbook_mermaid: [badboy/[email protected]]
mdbook_linkcheck: [Michael-F-Bryan/[email protected]]
Expand Down
3 changes: 1 addition & 2 deletions apps/src/bin/anoma-wallet/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ fn address_or_alias_find(ctx: Context, args: args::AddressOrAliasFind) {
message."
);
} else if args.alias.is_some() {
if let Some(address) =
wallet.find_address(&args.alias.as_ref().unwrap())
if let Some(address) = wallet.find_address(args.alias.as_ref().unwrap())
{
println!("Found address {}", address.to_pretty_string());
} else {
Expand Down
4 changes: 2 additions & 2 deletions apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ impl Context {

let chain_dir = global_args
.base_dir
.join(&global_config.default_chain_id.as_str());
.join(global_config.default_chain_id.as_str());
let genesis_file_path = global_args
.base_dir
.join(format!("{}.toml", global_config.default_chain_id.as_str()));
let wallet = Wallet::load_or_new_from_genesis(
&chain_dir,
genesis_config::open_genesis_config(&genesis_file_path)?,
genesis_config::open_genesis_config(genesis_file_path)?,
);

// If the WASM dir specified, put it in the config
Expand Down
10 changes: 5 additions & 5 deletions apps/src/lib/client/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ pub async fn query_proposal_result(
cli::safe_exit(1)
}

let file = File::open(&path.join("proposal"))
let file = File::open(path.join("proposal"))
.expect("Proposal file must exist.");
let proposal: OfflineProposal =
serde_json::from_reader(file).expect(
Expand Down Expand Up @@ -1410,11 +1410,11 @@ pub async fn query_tx_response(
// applied to the blockchain
let query_event_opt =
response_block_results.end_block_events.and_then(|events| {
(&events)
events
.iter()
.find(|event| {
event.type_str == tx_query.event_type()
&& (&event.attributes).iter().any(|tag| {
&& event.attributes.iter().any(|tag| {
tag.key.as_ref() == "hash"
&& tag.value.as_ref() == tx_query.tx_hash()
})
Expand All @@ -1429,8 +1429,8 @@ pub async fn query_tx_response(
)
})?;
// Reformat the event attributes so as to ease value extraction
let event_map: std::collections::HashMap<&str, &str> = (&query_event
.attributes)
let event_map: std::collections::HashMap<&str, &str> = query_event
.attributes
.iter()
.map(|tag| (tag.key.as_ref(), tag.value.as_ref()))
.collect();
Expand Down
15 changes: 7 additions & 8 deletions apps/src/lib/client/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ pub async fn join_network(
// Write consensus key to tendermint home
tendermint_node::write_validator_key(
&tm_home_dir,
&*pre_genesis_wallet.consensus_key,
&pre_genesis_wallet.consensus_key,
);

// Derive the node ID from the node key
Expand Down Expand Up @@ -400,8 +400,7 @@ pub fn init_network(
archive_dir,
}: args::InitNetwork,
) {
let mut config =
genesis_config::open_genesis_config(&genesis_path).unwrap();
let mut config = genesis_config::open_genesis_config(genesis_path).unwrap();

// Update the WASM checksums
let checksums =
Expand Down Expand Up @@ -679,7 +678,7 @@ pub fn init_network(
fs::rename(&temp_dir, &chain_dir).unwrap();

// Copy the WASM checksums
let wasm_dir_full = chain_dir.join(&config::DEFAULT_WASM_DIR);
let wasm_dir_full = chain_dir.join(config::DEFAULT_WASM_DIR);
fs::create_dir_all(&wasm_dir_full).unwrap();
fs::copy(
&wasm_checksums_path,
Expand All @@ -696,16 +695,16 @@ pub fn init_network(
.join(config::DEFAULT_BASE_DIR);
let temp_validator_chain_dir =
validator_dir.join(temp_chain_id.as_str());
let validator_chain_dir = validator_dir.join(&chain_id.as_str());
let validator_chain_dir = validator_dir.join(chain_id.as_str());
fs::create_dir_all(&validator_chain_dir)
.expect("Couldn't create validator directory");
// Rename the generated directories for validators from `temp_chain_id`
// to `chain_id`
std::fs::rename(&temp_validator_chain_dir, &validator_chain_dir)
std::fs::rename(temp_validator_chain_dir, &validator_chain_dir)
.unwrap();

// Copy the WASM checksums
let wasm_dir_full = validator_chain_dir.join(&config::DEFAULT_WASM_DIR);
let wasm_dir_full = validator_chain_dir.join(config::DEFAULT_WASM_DIR);
fs::create_dir_all(&wasm_dir_full).unwrap();
fs::copy(
&wasm_checksums_path,
Expand Down Expand Up @@ -1052,7 +1051,7 @@ pub fn write_tendermint_node_key(
.create(true)
.write(true)
.truncate(true)
.open(&node_key_path)
.open(node_key_path)
.expect("Couldn't create validator node key file");
serde_json::to_writer_pretty(file, &tm_node_keypair_json)
.expect("Couldn't write validator node key file");
Expand Down
22 changes: 10 additions & 12 deletions apps/src/lib/config/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ pub mod genesis_config {

Validator {
pos_data: GenesisValidator {
address: Address::decode(&config.address.as_ref().unwrap())
address: Address::decode(config.address.as_ref().unwrap())
.unwrap(),
staking_reward_address: Address::decode(
&config.staking_reward_address.as_ref().unwrap(),
config.staking_reward_address.as_ref().unwrap(),
)
.unwrap(),
tokens: token::Amount::whole(config.tokens.unwrap_or_default()),
Expand Down Expand Up @@ -354,8 +354,7 @@ pub mod genesis_config {
let token_vp_config = wasm.get(token_vp_name).unwrap();

TokenAccount {
address: Address::decode(&config.address.as_ref().unwrap())
.unwrap(),
address: Address::decode(config.address.as_ref().unwrap()).unwrap(),
vp_code_path: token_vp_config.filename.to_owned(),
vp_sha256: token_vp_config
.sha256
Expand All @@ -373,7 +372,7 @@ pub mod genesis_config {
.iter()
.map(|(alias_or_address, amount)| {
(
match Address::decode(&alias_or_address) {
match Address::decode(alias_or_address) {
Ok(address) => address,
Err(decode_err) => {
if let Some(alias) =
Expand Down Expand Up @@ -436,8 +435,7 @@ pub mod genesis_config {
let account_vp_config = wasm.get(account_vp_name).unwrap();

EstablishedAccount {
address: Address::decode(&config.address.as_ref().unwrap())
.unwrap(),
address: Address::decode(config.address.as_ref().unwrap()).unwrap(),
vp_code_path: account_vp_config.filename.to_owned(),
vp_sha256: account_vp_config
.sha256
Expand All @@ -459,7 +457,7 @@ pub mod genesis_config {
.iter()
.map(|(address, hex)| {
(
storage::Key::parse(&address).unwrap(),
storage::Key::parse(address).unwrap(),
hex.to_bytes().unwrap(),
)
})
Expand Down Expand Up @@ -500,8 +498,8 @@ pub mod genesis_config {
let token_accounts = config
.token
.unwrap_or_default()
.iter()
.map(|(_name, cfg)| {
.values()
.map(|cfg| {
load_token(
cfg,
&wasms,
Expand Down Expand Up @@ -822,8 +820,8 @@ pub fn genesis() -> Genesis {
((&validator.account_key).into(), default_key_tokens),
]);
let token_accounts = address::tokens()
.into_iter()
.map(|(address, _)| TokenAccount {
.into_keys()
.map(|address| TokenAccount {
address,
vp_code_path: vp_token_path.into(),
vp_sha256: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Shell {
CheckTxType::New => MempoolTxType::NewTransaction,
CheckTxType::Recheck => MempoolTxType::RecheckTransaction,
};
Ok(Response::CheckTx(self.mempool_validate(&*tx.tx, r#type)))
Ok(Response::CheckTx(self.mempool_validate(&tx.tx, r#type)))
}
Request::ListSnapshots(_) => {
Ok(Response::ListSnapshots(Default::default()))
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub type Result<T> = std::result::Result<T, Error>;
pub fn reset(config: config::Ledger) -> Result<()> {
// simply nuke the DB files
let db_path = &config.db_dir();
match std::fs::remove_dir_all(&db_path) {
match std::fs::remove_dir_all(db_path) {
Err(e) if e.kind() == std::io::ErrorKind::NotFound => (),
res => res.map_err(Error::RemoveDB)?,
};
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ mod tests {
assert_eq!(gas, key.len() as u64);
let (result, gas) = storage.read(&key).expect("read failed");
let read_value: u64 =
types::decode(&result.expect("value doesn't exist"))
types::decode(result.expect("value doesn't exist"))
.expect("decoding failed");
assert_eq!(read_value, value);
assert_eq!(gas, key.len() as u64 + value_bytes_len as u64);
Expand Down
2 changes: 1 addition & 1 deletion apps/src/lib/node/ledger/storage/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ impl DB for RocksDB {

// Write the new key-val
self.0
.put(&subspace_key.to_string(), value)
.put(subspace_key.to_string(), value)
.map_err(|e| Error::DBError(e.into_string()))?;

Ok(size_diff)
Expand Down
6 changes: 3 additions & 3 deletions apps/src/lib/node/ledger/tendermint_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub async fn run(

// init and run a tendermint node child process
let output = Command::new(&tendermint_path)
.args(&["init", &mode, "--home", &home_dir_string])
.args(["init", &mode, "--home", &home_dir_string])
.output()
.await
.map_err(Error::Init)?;
Expand All @@ -110,7 +110,7 @@ pub async fn run(
update_tendermint_config(&home_dir, config).await?;

let mut tendermint_node = Command::new(&tendermint_path);
tendermint_node.args(&[
tendermint_node.args([
"start",
"--proxy_app",
&ledger_address,
Expand Down Expand Up @@ -170,7 +170,7 @@ pub fn reset(tendermint_dir: impl AsRef<Path>) -> Result<()> {
let tendermint_dir = tendermint_dir.as_ref().to_string_lossy();
// reset all the Tendermint state, if any
std::process::Command::new(tendermint_path)
.args(&[
.args([
"reset-state",
"unsafe-all",
// NOTE: log config: https://docs.tendermint.com/master/nodes/logging.html#configuring-log-levels
Expand Down
7 changes: 2 additions & 5 deletions apps/src/lib/wallet/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl Store {
if alias.is_empty() {
println!(
"Empty alias given, defaulting to {}.",
alias = Into::<Alias>::into(pkh.to_string())
Into::<Alias>::into(pkh.to_string())
);
}
if self.keys.contains_key(&alias) {
Expand All @@ -366,10 +366,7 @@ impl Store {
address: Address,
) -> Option<Alias> {
if alias.is_empty() {
println!(
"Empty alias given, defaulting to {}.",
alias = address.encode()
);
println!("Empty alias given, defaulting to {}.", address.encode());
}
if self.addresses.contains_left(&alias) {
match show_overwrite_confirmation(&alias, "an address") {
Expand Down
4 changes: 2 additions & 2 deletions docker/namada-wasm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This docker is used for deterministic wasm builds

# The version should be matching the version set in wasm/rust-toolchain.toml
FROM rust:1.61.0-bullseye
FROM rust:1.65.0-bullseye

WORKDIR /__w/namada/namada

# The version should be matching the version set above
RUN rustup toolchain install 1.61.0 --profile minimal
RUN rustup toolchain install 1.65.0 --profile minimal
RUN rustup target add wasm32-unknown-unknown

# Download binaryen and extract wasm-opt
Expand Down
2 changes: 1 addition & 1 deletion docker/namada/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM lukemathwalker/cargo-chef:latest-rust-1.61.0 AS chef
FROM lukemathwalker/cargo-chef:latest-rust-1.65.0 AS chef
WORKDIR /app

FROM chef AS planner
Expand Down
9 changes: 4 additions & 5 deletions encoding_spec/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,11 @@ fn md_fmt_type(type_name: impl AsRef<str>) -> String {
fn write_generated_code_notice(
file: &mut std::fs::File,
) -> Result<(), Box<dyn std::error::Error>> {
let path = std::file!();
writeln!(
file,
"<!--- THIS PAGE IS GENERATED FROM CODE: {}. Do not edit manually! -->",
std::file!()
"<!--- THIS PAGE IS GENERATED FROM CODE: {path}. Do not edit \
manually! -->",
)?;
Ok(())
}
Expand All @@ -390,9 +391,7 @@ fn escape_fragment_anchor(string: impl AsRef<str>) -> String {
// mdBook turns headings fragment links to lowercase
string
.as_ref()
.replace('>', "")
.replace('<', "")
.replace(',', "")
.replace(['>', '<', ','], "")
.replace(' ', "-")
.replace(':', "")
.to_ascii_lowercase()
Expand Down
Loading