Skip to content

Commit

Permalink
chore: Update Rust to 1.58.1 (#327)
Browse files Browse the repository at this point in the history
* Update to 1.58.1

* Update to new lints

* Add rust-version key to all crate manifests

* Set all crates to 2021 edition

* Test updated release workflow

* Add aggregate checks
  • Loading branch information
adamspofford-dfinity authored Mar 30, 2022
1 parent 40ce9da commit 0bc839c
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 28 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [ '1.55.0' ]
rust: [ '1.58.1' ]
os: [ ubuntu-latest ]

steps:
Expand All @@ -32,3 +32,12 @@ jobs:
run: cargo fmt --all -- --check
env:
RUST_BACKTRACE: 1
aggregate:
name: fmt:required
runs-on: ubuntu-latest
if: ${{ always() }}
needs: test
steps:
- name: Check fmt result
if: ${{ needs.test.result != 'success' }}
run: exit 1
11 changes: 10 additions & 1 deletion .github/workflows/ic-ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
ghc: '8.10.7'
spec: 'f771c6b3e7cdde413d3b960f63165c6ecf3e0b7c'
os: ubuntu-latest
rust: 1.55.0
rust: '1.58.1'

steps:
- uses: haskell/actions/setup@v1
Expand Down Expand Up @@ -145,3 +145,12 @@ jobs:
killall ic-ref
env:
RUST_BACKTRACE: 1
aggregate:
name: ic-ref:required
runs-on: ubuntu-latest
if: ${{ always() }}
needs: test
steps:
- name: Check ic-ref result
if: ${{ needs.test.result != 'success' }}
run: exit 1
2 changes: 1 addition & 1 deletion .github/workflows/icx_asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
rust: [ '1.55.0' ]
rust: [ '1.58.1' ]
dfx: [ '0.7.2', '0.8.4' ]

steps:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [ '1.55.0' ]
rust: [ '1.58.1' ]
os: [ ubuntu-latest ]

steps:
Expand All @@ -31,3 +31,12 @@ jobs:
run: cargo clippy --verbose --tests --benches -- -D clippy::all
env:
RUST_BACKTRACE: 1
aggregate:
name: lint:required
runs-on: ubuntu-latest
if: ${{ always() }}
needs: test
steps:
- name: Check lint result
if: ${{ needs.test.result != 'success' }}
run: exit 1
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
name: linux
binary_path: target/x86_64-unknown-linux-musl/release
binary_files: icx
rust: 1.50.0 # gmiam/rust-musl-action@master is only at 1.50.0 now
rust: '1.58.1'
- os: macos-latest
name: macos
binary_path: target/release
binary_files: icx
rust: 1.55.0
rust: '1.58.1'
steps:
- uses: actions/checkout@master

Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [ '1.55.0' ]
rust: [ '1.58.1' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
Expand Down Expand Up @@ -67,3 +67,12 @@ jobs:
# information. An alternative solution here is to install GNU tar, but
# flushing the disk cache seems to work, too.
sudo /usr/sbin/purge
aggregate:
name: test:required
runs-on: ubuntu-latest
if: ${{ always() }}
needs: test
steps:
- name: Check test result
if: ${{ needs.test.result != 'success' }}
run: exit 1
3 changes: 2 additions & 1 deletion ic-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ic-agent"
version = "0.14.0"
authors = ["DFINITY Stiftung <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Agent library to communicate with the Internet Computer, following the Public Specification."
homepage = "https://docs.rs/ic-agent"
documentation = "https://docs.rs/ic-agent"
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = ["api-bindings", "data-structures", "no-std"]
keywords = ["internet-computer", "agent", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

[dependencies]
async-trait = "0.1.51"
Expand Down
10 changes: 1 addition & 9 deletions ic-agent/src/agent/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@ use crate::{
use std::sync::Arc;

/// A builder for an [`Agent`].
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct AgentBuilder {
config: AgentConfig,
}

impl Default for AgentBuilder {
fn default() -> Self {
Self {
config: Default::default(),
}
}
}

impl AgentBuilder {
/// Create an instance of [Agent] with the information from this builder.
pub fn build(self) -> Result<Agent, AgentError> {
Expand Down
8 changes: 4 additions & 4 deletions ic-agent/src/identity/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use simple_asn1::{
#[derive(Clone, Debug)]
pub struct Secp256k1Identity {
private_key: EcKey<Private>,
public_key: EcKey<Public>,
_public_key: EcKey<Public>,
der_encoded_public_key: Vec<u8>,
}

Expand Down Expand Up @@ -58,7 +58,7 @@ impl Secp256k1Identity {
to_der(&asn1_block).expect("Cannot DER encode secp256k1 public key.");
Self {
private_key,
public_key,
_public_key: public_key,
der_encoded_public_key,
}
}
Expand All @@ -72,7 +72,7 @@ impl Identity for Secp256k1Identity {
fn sign(&self, msg: &[u8]) -> Result<Signature, String> {
let digest = sha256(msg);
let ecdsa_sig = EcdsaSig::sign(&digest, &self.private_key.clone())
.map_err(|err| format!("Cannot create secp256k1 signature: {}", err.to_string(),))?;
.map_err(|err| format!("Cannot create secp256k1 signature: {}", err))?;
let r = ecdsa_sig.r().to_vec();
let s = ecdsa_sig.s().to_vec();
let mut bytes = [0; 64];
Expand Down Expand Up @@ -186,7 +186,7 @@ N3d26cRxD99TPtm8uo2OuzKhSiq6EQ==

// Assert the secp256k1 signature is valid.
let digest = sha256(message);
let public_key = identity.public_key;
let public_key = identity._public_key;
let success = ecdsa_sig
.verify(&digest, &public_key)
.expect("Cannot verify secp256k1 signature.");
Expand Down
3 changes: 2 additions & 1 deletion ic-asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ic-asset"
version = "0.14.0"
authors = ["DFINITY Stiftung <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Library for storing files in an asset canister."
homepage = "https://docs.rs/ic-asset"
documentation = "https://docs.rs/ic-asset"
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = ["api-bindings", "data-structures"]
keywords = ["internet-computer", "assets", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

[dependencies]
anyhow = "1.0"
Expand Down
3 changes: 2 additions & 1 deletion ic-identity-hsm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ authors = ["DFINITY Stiftung <[email protected]>"]
description = "Identity implementation for HSM for the ic-agent package."
homepage = "https://docs.rs/ic-identity-hsm"
documentation = "https://docs.rs/ic-identity-hsm"
edition = "2018"
edition = "2021"
license = "Apache-2.0"
readme = "README.md"
categories = ["api-bindings", "data-structures", "no-std"]
keywords = ["internet-computer", "agent", "utility", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

[dependencies]
hex = "0.4.2"
Expand Down
3 changes: 2 additions & 1 deletion ic-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ic-utils"
version = "0.14.0"
authors = ["DFINITY Stiftung <[email protected]>"]
edition = "2018"
edition = "2021"
description = "Collection of utilities for Rust, on top of ic-agent, to communicate with the Internet Computer, following the Public Specification."
homepage = "https://docs.rs/ic-utils"
documentation = "https://docs.rs/ic-utils"
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = ["api-bindings", "data-structures", "no-std"]
keywords = ["internet-computer", "agent", "utility", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 2 additions & 1 deletion icx-asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "icx-asset"
version = "0.14.0"
authors = ["DFINITY Stiftung <[email protected]>"]
edition = "2018"
edition = "2021"
description = "CLI tool to manage assets on an asset canister on the Internet Computer."
homepage = "https://docs.rs/icx-asset"
documentation = "https://docs.rs/icx-asset"
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = ["command-line-interface"]
keywords = ["internet-computer", "agent", "icp", "dfinity", "asset"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 2 additions & 1 deletion icx-cert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "icx-cert"
version = "0.14.0"
authors = ["DFINITY Stiftung <[email protected]>"]
edition = "2018"
edition = "2021"
description = "CLI tool to download a document from the Internet Computer and pretty-print the contents of its IC-Certificate header."
homepage = "https://docs.rs/icx-cert"
documentation = "https://docs.rs/icx-cert"
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = ["command-line-interface"]
keywords = ["internet-computer", "agent", "icp", "dfinity", "certificate"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 2 additions & 1 deletion icx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "icx"
version = "0.14.0"
authors = ["DFINITY Stiftung <[email protected]>"]
edition = "2018"
edition = "2021"
description = "CLI tool to call canisters on the Internet Computer."
homepage = "https://docs.rs/icx"
documentation = "https://docs.rs/icx"
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = ["command-line-interface", "web-programming::http-client"]
keywords = ["internet-computer", "agent", "icp", "dfinity", "call"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]
rust-version = "1.58.1"

[[bin]]
name = "icx"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.55.0"
channel = "1.58.1"
components = ["rustfmt", "clippy"]

0 comments on commit 0bc839c

Please sign in to comment.