Skip to content

Commit

Permalink
rust: update toolchain to 1.80.0
Browse files Browse the repository at this point in the history
And update the prost dep version.

This reduces the binary size by 1692 bytes. 1332 bytes of it due to
the Rust 1.80 update, the rest due to the prost update.
  • Loading branch information
benma committed Jul 25, 2024
1 parent cb481ba commit 0c0f85d
Show file tree
Hide file tree
Showing 33 changed files with 426 additions and 722 deletions.
4 changes: 2 additions & 2 deletions .ci/run-container-ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# Copyright 2019 Shift Cryptosecurity AG
# Copyright 2020 Shift Crypto AG
# Copyright 2020-2024 Shift Crypto AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@
set -e
set -x

CONTAINER=shiftcrypto/firmware_v2:39
CONTAINER=shiftcrypto/firmware_v2:40

if [ "$1" == "pull" ] ; then
docker pull "$CONTAINER"
Expand Down
8 changes: 4 additions & 4 deletions src/rust/Cargo.lock

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

4 changes: 2 additions & 2 deletions src/rust/bitbox02-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ bitcoin_hashes = { version = "0.14.0", default-features = false, features = ["sm

[dependencies.prost]
# keep version in sync with tools/prost-build/Cargo.toml.
version = "0.12.1"
version = "0.13.1"
default-features = false
features = ["prost-derive"]
features = ["derive"]

[features]
ed25519 = [
Expand Down
6 changes: 3 additions & 3 deletions src/rust/bitbox02-rust/src/hww/api/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Shift Crypto AG
// Copyright 2020-2024 Shift Crypto AG
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -113,8 +113,8 @@ impl core::convert::From<UnlockError> for Error {
}
}

impl core::convert::From<prost::DecodeError> for Error {
fn from(_error: prost::DecodeError) -> Self {
impl core::convert::From<prost::UnknownEnumValue> for Error {
fn from(_error: prost::UnknownEnumValue) -> Self {
Error::InvalidInput
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rust/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.79.0"
channel = "1.80.0"
2 changes: 1 addition & 1 deletion src/rust/vendor/bip32-ed25519/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"files":{".github/workflows/ci.yml":"f465a052857e00c4a513784ae8527fca34a9a0b1075c7511bbf302b96d6e9e36","Cargo.toml":"4f133fb93e1cfba99cee3a46432e4927593e4a88d24594b4b62d15c5922c5a34","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"5530596cde343de2238ec3276d94599ff6e78b7b7a20f6143162b3eceb727f29","README.md":"99a18dfc2a588d8b8cb3c287dad52d2e76c2b2b3be0e7a95cce19f509e9d59d7","src/arbitrary.rs":"ecb52788eec1142459ab252c320a5f0e421eb63cf959260b16e689ccfc8f2590","src/bigint.rs":"756b33c8d971b282b43268671c08fb4d8af095a6ebb6e9dc0c750631650e4d14","src/lib.rs":"93a19d865e85bde9646e42ef6c6b5106d6876c71fcffedad4b2c523deeb6f951","tests/table_test.rs":"7cba52f2578cfaf44f7d01a14ae1ce3b2b21857079722b7f04a507ca2884d878","tests/testdata/gen_table.py":"2fd91055920d9ac4cfb6c004b96aca42aaf2e3cf074d0d49d48ada993abdaedf","tests/testdata/table.json":"9e37a43d759f793b091f87488ea4b6d733154a10d29554c5103e12d617ae70cd"},"package":null}
{"files":{".github/workflows/ci.yml":"f465a052857e00c4a513784ae8527fca34a9a0b1075c7511bbf302b96d6e9e36","Cargo.toml":"0a34a4a982d9e6dca40bd70859a657f9ed430cae3baf928157cc2cd07aa6e0b1","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"5530596cde343de2238ec3276d94599ff6e78b7b7a20f6143162b3eceb727f29","README.md":"99a18dfc2a588d8b8cb3c287dad52d2e76c2b2b3be0e7a95cce19f509e9d59d7","src/arbitrary.rs":"ecb52788eec1142459ab252c320a5f0e421eb63cf959260b16e689ccfc8f2590","src/bigint.rs":"756b33c8d971b282b43268671c08fb4d8af095a6ebb6e9dc0c750631650e4d14","src/lib.rs":"93a19d865e85bde9646e42ef6c6b5106d6876c71fcffedad4b2c523deeb6f951","tests/table_test.rs":"7cba52f2578cfaf44f7d01a14ae1ce3b2b21857079722b7f04a507ca2884d878","tests/testdata/gen_table.py":"2fd91055920d9ac4cfb6c004b96aca42aaf2e3cf074d0d49d48ada993abdaedf","tests/testdata/table.json":"9e37a43d759f793b091f87488ea4b6d733154a10d29554c5103e12d617ae70cd"},"package":null}
17 changes: 17 additions & 0 deletions src/rust/vendor/bip32-ed25519/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

bin = []
example = []
bench = []

[package]
edition = "2021"
name = "bip32-ed25519"
version = "0.2.0"
authors = ["Shift Crypto AG <[email protected]>"]
build = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "BIP32-Ed25519"
readme = "README.md"
keywords = ["no_std"]
Expand All @@ -23,6 +32,14 @@ categories = [
]
license = "MIT OR Apache-2.0"

[lib]
name = "bip32_ed25519"
path = "src/lib.rs"

[[test]]
name = "table_test"
path = "tests/table_test.rs"

[dependencies.curve25519-dalek]
version = "4"
default-features = false
Expand Down
2 changes: 1 addition & 1 deletion src/rust/vendor/prost-derive/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"files":{"Cargo.toml":"7d555d8783ebeebdb3c3190ff57fa833db7cbd14eecba8a5a101f87e7dca3f71","LICENSE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","README.md":"6c67fa1e48f14adfaf834f520f798ddfb79f90804f46cc215ee391a7d57913a4","src/field/group.rs":"0370fda09a6dc7e8e91cfab1a6638c0117f0b968bcc7d1a8f397c2bf00042481","src/field/map.rs":"a03791fc758802cdf4e75e197acd7975141377e3d1ad1273e6cefab2b7fddfe9","src/field/message.rs":"a5672412435bb9fafbd4a99b1a6c6d5bbf636a571959358a44196bfd69efc2d1","src/field/mod.rs":"108b98c676b780fbe55907a3c2825bdf77cd0f857292bfa82a78f5b20fa499c5","src/field/oneof.rs":"128e990b8bb711fdbadd35b711f127c02f64b84b5ca95307b428956896d15721","src/field/scalar.rs":"16a4210578e7e643d49b5c769078f8bf295dae738f3ba2b6e48af7291b9e7951","src/lib.rs":"0b86c9fdace3d3f942afad55f7aa21d4dc2c7d8447906d03fd9c650d311c47ee"},"package":"265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"}
{"files":{"Cargo.toml":"ead70d2c5042f3983e63d28a5056647d2606e29366a6e3f3ab6e659376c3ddd6","LICENSE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","README.md":"6c67fa1e48f14adfaf834f520f798ddfb79f90804f46cc215ee391a7d57913a4","src/field/group.rs":"0e2a468af54d9082d858f18d5276fd549349f0048d9aaf41a3493018a811d962","src/field/map.rs":"a03791fc758802cdf4e75e197acd7975141377e3d1ad1273e6cefab2b7fddfe9","src/field/message.rs":"736e160b4e470dc6d0f2fcbf12e704c590bc1880e5fe08933c440f1cf2e767b1","src/field/mod.rs":"541c1a346a0ff4fcb4610a5c9d379e99a7dbfe8981e5c1c902ddf6c395dfda0a","src/field/oneof.rs":"c0a55cb194d9651cbc63c2a19243a7e5fc197c170a9f44af87b30b07bad21b4e","src/field/scalar.rs":"61150549be0de070845018ae5aef8c42bebdae033e4e251bddbd0bd2a892c501","src/lib.rs":"a3e62b31b0e72438b41a8a2e69241640ace46b95936c4f93269bf650386e3c59"},"package":"18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca"}
14 changes: 6 additions & 8 deletions src/rust/vendor/prost-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

[package]
edition = "2021"
rust-version = "1.60"
rust-version = "1.70"
name = "prost-derive"
version = "0.12.1"
version = "0.13.1"
authors = [
"Dan Burkert <[email protected]>",
"Lucio Franco <[email protected]>",
"Casper Meijn <[email protected]>",
"Tokio Contributors <[email protected]>",
]
description = "A Protocol Buffers implementation for the Rust Language."
documentation = "https://docs.rs/prost-derive"
description = "Generate encoding and decoding implementations for Prost annotated types."
readme = "README.md"
license = "Apache-2.0"
repository = "https://github.com/tokio-rs/prost"
Expand All @@ -32,12 +32,10 @@ proc_macro = true
version = "1.0.1"

[dependencies.itertools]
version = ">=0.10, <0.12"
features = ["use_alloc"]
default-features = false
version = ">=0.10.1, <=0.13"

[dependencies.proc-macro2]
version = "1"
version = "1.0.60"

[dependencies.quote]
version = "1"
Expand Down
9 changes: 5 additions & 4 deletions src/rust/vendor/prost-derive/src/field/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ impl Field {
return Ok(None);
}

match unknown_attrs.len() {
0 => (),
1 => bail!("unknown attribute for group field: {:?}", unknown_attrs[0]),
_ => bail!("unknown attributes for group field: {:?}", unknown_attrs),
if !unknown_attrs.is_empty() {
bail!(
"unknown attribute(s) for group field: #[prost({})]",
quote!(#(#unknown_attrs),*)
);
}

let tag = match tag.or(inferred_tag) {
Expand Down
12 changes: 5 additions & 7 deletions src/rust/vendor/prost-derive/src/field/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ impl Field {
return Ok(None);
}

match unknown_attrs.len() {
0 => (),
1 => bail!(
"unknown attribute for message field: {:?}",
unknown_attrs[0]
),
_ => bail!("unknown attributes for message field: {:?}", unknown_attrs),
if !unknown_attrs.is_empty() {
bail!(
"unknown attribute(s) for message field: #[prost({})]",
quote!(#(#unknown_attrs),*)
);
}

let tag = match tag.or(inferred_tag) {
Expand Down
8 changes: 2 additions & 6 deletions src/rust/vendor/prost-derive/src/field/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,7 @@ fn bool_attr(key: &str, attr: &Meta) -> Result<Option<bool>, Error> {
}
match *attr {
Meta::Path(..) => Ok(Some(true)),
Meta::List(ref meta_list) => {
return Ok(Some(meta_list.parse_args::<LitBool>()?.value()));
}
Meta::List(ref meta_list) => Ok(Some(meta_list.parse_args::<LitBool>()?.value())),
Meta::NameValue(MetaNameValue {
value:
Expr::Lit(ExprLit {
Expand Down Expand Up @@ -310,9 +308,7 @@ pub(super) fn tag_attr(attr: &Meta) -> Result<Option<u32>, Error> {
return Ok(None);
}
match *attr {
Meta::List(ref meta_list) => {
return Ok(Some(meta_list.parse_args::<LitInt>()?.base10_parse()?));
}
Meta::List(ref meta_list) => Ok(Some(meta_list.parse_args::<LitInt>()?.base10_parse()?)),
Meta::NameValue(MetaNameValue {
value: Expr::Lit(ref expr),
..
Expand Down
12 changes: 5 additions & 7 deletions src/rust/vendor/prost-derive/src/field/oneof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ impl Field {
None => return Ok(None),
};

match unknown_attrs.len() {
0 => (),
1 => bail!(
"unknown attribute for message field: {:?}",
unknown_attrs[0]
),
_ => bail!("unknown attributes for message field: {:?}", unknown_attrs),
if !unknown_attrs.is_empty() {
bail!(
"unknown attribute(s) for message field: #[prost({})]",
quote!(#(#unknown_attrs),*)
);
}

let tags = match tags {
Expand Down
12 changes: 6 additions & 6 deletions src/rust/vendor/prost-derive/src/field/scalar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::fmt;

use anyhow::{anyhow, bail, Error};
Expand Down Expand Up @@ -47,10 +46,11 @@ impl Field {
None => return Ok(None),
};

match unknown_attrs.len() {
0 => (),
1 => bail!("unknown attribute: {:?}", unknown_attrs[0]),
_ => bail!("unknown attributes: {:?}", unknown_attrs),
if !unknown_attrs.is_empty() {
bail!(
"unknown attribute(s): #[prost({})]",
quote!(#(#unknown_attrs),*)
);
}

let tag = match tag.or(inferred_tag) {
Expand Down Expand Up @@ -272,7 +272,7 @@ impl Field {
pub fn methods(&self, ident: &TokenStream) -> Option<TokenStream> {
let mut ident_str = ident.to_string();
if ident_str.starts_with("r#") {
ident_str = ident_str[2..].to_owned();
ident_str = ident_str.split_off(2);
}

// Prepend `get_` for getter methods of tuple structs.
Expand Down
Loading

0 comments on commit 0c0f85d

Please sign in to comment.