diff --git a/Cargo.toml b/Cargo.toml index d4ad542a..cd9aa48b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ cargo-features = ["per-package-target"] [workspace] +resolver = "2" members = [ "apdu", diff --git a/fw/.cargo/config.toml b/fw/.cargo/config.toml index ca36f569..ac84d735 100644 --- a/fw/.cargo/config.toml +++ b/fw/.cargo/config.toml @@ -9,11 +9,9 @@ runner = "speculos.py --model nanox --display qt -a 5 --apdu-port 1237 --zoom 2" target = "nanosplus" rustflags = [ "-Z", "emit-stack-sizes", - "-C", "link-args=-Map=/tmp/ledger-mob.map", '--cfg=curve25519_dalek_bits="32"' ] - [unstable] build-std = [ "core", "compiler_builtins", "alloc" ] diff --git a/fw/Cargo.toml b/fw/Cargo.toml index 14f1e4f2..75c5d2ad 100644 --- a/fw/Cargo.toml +++ b/fw/Cargo.toml @@ -1,5 +1,8 @@ -cargo-features = ["per-package-target"] +cargo-features = ["per-package-target", "profile-rustflags"] + +[unstable] +profile-rustflags = true [package] name = "ledger-mob-fw" @@ -83,10 +86,12 @@ required-features = [ "applet" ] [profile.dev] #codegen-units = 1 panic = "abort" -debug = true +debug = 2 strip = "none" split-debuginfo = "off" opt-level = 'z' +lto = 'fat' +overflow-checks = true [profile.release] codegen-units = 1 @@ -96,15 +101,18 @@ strip = "none" split-debuginfo = "off" opt-level = 'z' lto = 'fat' +overflow-checks = true -# Rust/cargo bug precludes integer overflow checks -# when using LTO, see: -# https://github.com/rust-lang/rust/issues/108853 -#overflow-checks = true +# Disable overflow checks for compiler_builtins +# See: +# - https://github.com/rust-lang/cargo/issues/10118 +# - https://github.com/rust-lang/rust/issues/108853 +[profile.release.package.compiler_builtins] +debug-assertions = false +overflow-checks = false [patch.crates-io] - curve25519-dalek = { git = "https://github.com/dalek-cryptography/curve25519-dalek", rev = "99c0520aa79401b69fb51d38172cd58c6a256cfb" } ed25519-dalek = { git = "https://github.com/dalek-cryptography/ed25519-dalek.git", rev = "2931c688eb11341a1145e257bc41d8ecbe36277c" } x25519-dalek = { git = "https://github.com/mobilecoinfoundation/x25519-dalek.git", rev = "4fbaa3343301c62cfdbc3023c9f485257e6b718a" } diff --git a/fw/rust-toolchain b/fw/rust-toolchain deleted file mode 120000 index 2b5423bb..00000000 --- a/fw/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -rust-toolchain \ No newline at end of file diff --git a/fw/rust-toolchain b/fw/rust-toolchain new file mode 100644 index 00000000..5af69798 --- /dev/null +++ b/fw/rust-toolchain @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2023-01-04" +components = [ "rustfmt", "clippy", "rust-src" ]