Skip to content

Commit

Permalink
rust: rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Jan 22, 2024
1 parent 89825f4 commit 8bdcd6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/rust/bitbox02-rust/src/hww/api/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ pub async fn process_api(request: &Request) -> Result<Response, Error> {
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),
Expand Down
8 changes: 5 additions & 3 deletions src/rust/bitbox02-rust/src/hww/api/ethereum/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
);
}
}

Expand Down

0 comments on commit 8bdcd6d

Please sign in to comment.