From 8bdcd6dc807488681b1ab0cb0a895d283f2d2c2a Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Mon, 22 Jan 2024 16:26:50 +0100 Subject: [PATCH] rust: rustfmt --- src/rust/bitbox02-rust/src/hww/api/ethereum.rs | 4 +++- src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rust/bitbox02-rust/src/hww/api/ethereum.rs b/src/rust/bitbox02-rust/src/hww/api/ethereum.rs index db0dc6e1c..54f33c9ca 100644 --- a/src/rust/bitbox02-rust/src/hww/api/ethereum.rs +++ b/src/rust/bitbox02-rust/src/hww/api/ethereum.rs @@ -80,7 +80,9 @@ pub async fn process_api(request: &Request) -> Result { Request::Pub(ref request) => pubrequest::process(request).await, Request::SignMsg(ref request) => signmsg::process(request).await, Request::Sign(ref request) => sign::process(&sign::Transaction::Legacy(request)).await, - Request::SignEip1559(ref request) => sign::process(&sign::Transaction::Eip1559(request)).await, + Request::SignEip1559(ref request) => { + sign::process(&sign::Transaction::Eip1559(request)).await + } Request::AntikleptoSignature(_) => Err(Error::InvalidInput), Request::SignTypedMsg(ref request) => sign_typed_msg::process(request).await, Request::TypedMsgValue(_) => Err(Error::InvalidInput), diff --git a/src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs b/src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs index 85baa81dc..bf6c3cd6b 100644 --- a/src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs +++ b/src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs @@ -158,7 +158,7 @@ pub fn compute_eip1559(params: &ParamsEIP1559) -> Result<[u8; 32], ()> { // 2) hash len and encoded tx elements let mut hasher = Hasher(Keccak256::new()); - hasher.write(&[0x02]); // prefix the rlp encoding with transaction type before hashing + hasher.write(&[0x02]); // prefix the rlp encoding with transaction type before hashing hash_header(&mut hasher, RLP_SMALL_TAG, RLP_LARGE_TAG, counter.0 as u16); hash_params_eip1559(&mut hasher, params); Ok(hasher.0.finalize().into()) @@ -1565,10 +1565,12 @@ mod tests { }, expected_sighash: *b"\x45\x7c\x06\xaf\x8c\xb6\x60\x30\xde\xc9\x39\x2d\x0e\x3d\x3a\xae\xb4\xad\xa8\xe5\xc7\x11\x38\x21\x86\xa5\x68\x75\x5d\x5a\xba\xb9", }, - ]; for test in tests.iter() { - assert_eq!(compute_eip1559(&test.params).unwrap(), test.expected_sighash); + assert_eq!( + compute_eip1559(&test.params).unwrap(), + test.expected_sighash + ); } }