From c13d5d973c2221b227e3e7a07187f01fe8c90ceb Mon Sep 17 00:00:00 2001 From: Boris Oncev Date: Fri, 14 Jun 2024 07:18:09 +0200 Subject: [PATCH] Fix compilation for trezor device with new mintlayer code --- common/protob/messages-mintlayer.proto | 1 + core/SConscript.bootloader | 4 +++- core/SConscript.firmware | 6 +++++- .../extmod/modtrezormintlayer/modtrezormintlayer-utils.h | 2 +- core/embed/rust/src/lib.rs | 1 + python/docs/OPTIONS.rst | 6 +++--- rust/trezor-client/Cargo.toml | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/common/protob/messages-mintlayer.proto b/common/protob/messages-mintlayer.proto index e8a098aef9..1344c60617 100644 --- a/common/protob/messages-mintlayer.proto +++ b/common/protob/messages-mintlayer.proto @@ -49,6 +49,7 @@ message MintlayerGetPublicKey { */ message MintlayerPublicKey { required bytes public_key = 1; + required bytes chain_code = 2; } /** diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index 00529e0eb1..d2c8acfc98 100644 --- a/core/SConscript.bootloader +++ b/core/SConscript.bootloader @@ -236,7 +236,9 @@ def cargo_build(): '--no-default-features', '--features ' + ','.join(features), '-Z build-std=core', - '-Z build-std-features=panic_immediate_abort', + '-Z build-std=alloc', + '-Z build-std=panic_abort,std', + # '-Z build-std-features=panic_immediate_abort', ] bindgen_macros = tools.get_bindgen_defines(env.get("CPPDEFINES"), ALLPATHS) diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 4021efc261..0511d9854f 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -694,6 +694,8 @@ if FROZEN: SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/zcash/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/mintlayer/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/mintlayer/sign_tx/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Mintlayer*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/webauthn/*.py')) @@ -790,7 +792,9 @@ def cargo_build(): '--no-default-features', '--features ' + ','.join(features), '-Z build-std=core', - '-Z build-std-features=panic_immediate_abort', + '-Z build-std=alloc', + '-Z build-std=panic_abort,std', + # '-Z build-std-features=panic_immediate_abort', ] env.get('ENV')['TREZOR_MODEL'] = TREZOR_MODEL diff --git a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h index 856e66e097..c7ebe579ff 100644 --- a/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h +++ b/core/embed/extmod/modtrezormintlayer/modtrezormintlayer-utils.h @@ -20,7 +20,7 @@ STATIC mp_obj_t mod_trezormintlayer_utils_mintlayer_encode_utxo_input( mp_buffer_info_t hash = {0}; mp_get_buffer_raise(tx_hash, &hash, MP_BUFFER_READ); if (hash.len != 32) { - printf("invalid hash len: %ld", hash.len); + printf("invalid hash len: %ld", (long int)hash.len); mp_raise_ValueError("Invalid hash"); } uint32_t idx = trezor_obj_get_uint(index); diff --git a/core/embed/rust/src/lib.rs b/core/embed/rust/src/lib.rs index f7ed967596..0d4342ff35 100644 --- a/core/embed/rust/src/lib.rs +++ b/core/embed/rust/src/lib.rs @@ -39,6 +39,7 @@ pub mod translations; pub mod ui; pub mod strutil; +#[cfg(feature = "micropython")] pub mod mintlayer; #[cfg(feature = "debug")] diff --git a/python/docs/OPTIONS.rst b/python/docs/OPTIONS.rst index c0f01ca40a..f26a7c4062 100644 --- a/python/docs/OPTIONS.rst +++ b/python/docs/OPTIONS.rst @@ -189,8 +189,9 @@ Miscellaneous debug features. --help Show this message and exit. Commands: - record Record screen changes into a specified directory. - send-bytes Send raw bytes to Trezor. + prodtest-t1 Perform a prodtest on Model One. + record Record screen changes into a specified directory. + send-bytes Send raw bytes to Trezor. Device management commands - setup, recover seed, wipe, etc. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -212,7 +213,6 @@ Device management commands - setup, recover seed, wipe, etc. authenticate Get information to verify the authenticity of the device. backup Perform device seed backup. load Upload seed and custom configuration to the device. - prodtest-t1 Perform a prodtest on Model One. reboot-to-bootloader Reboot device into bootloader mode. recover Start safe recovery workflow. sd-protect Secure the device with SD card protection. diff --git a/rust/trezor-client/Cargo.toml b/rust/trezor-client/Cargo.toml index 091a1ec321..291a86ee51 100644 --- a/rust/trezor-client/Cargo.toml +++ b/rust/trezor-client/Cargo.toml @@ -49,7 +49,7 @@ tracing-subscriber = "0.3" serial_test = "2.0.0" [features] -default = ["bitcoin", "ethereum", "solana"] +default = ["bitcoin", "ethereum", "solana", "mintlayer"] # Client implementations bitcoin = ["dep:bitcoin", "unicode-normalization"]