Skip to content

Commit

Permalink
BFT-457: Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Jun 11, 2024
1 parent 6920c29 commit 7ec466d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions node/libs/crypto/src/secp256k1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub struct Signature {
/// Standard Recover ID.
///
/// To verify signatures with Solidity, for example with the [OpenZeppelin](https://docs.openzeppelin.com/contracts/2.x/api/cryptography#ECDSA-recover-bytes32-bytes-)
/// library, we need to shift this by 27 when it's serailized to bytes. See [ECDSA.sol](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/de4154710bcc7c6ca5417097f34ce14e9205c3ac/contracts/utils/cryptography/ECDSA.sol#L128-L136).
/// library, we need to shift this by 27 when it's serialized to bytes. See [ECDSA.sol](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/de4154710bcc7c6ca5417097f34ce14e9205c3ac/contracts/utils/cryptography/ECDSA.sol#L128-L136).
recid: k256::ecdsa::RecoveryId,
}

Expand Down Expand Up @@ -269,10 +269,10 @@ impl ByteFmt for AggregateSignature {
fn normalize_recovery_id(v: u8) -> u8 {
match v {
// Case 0: raw/bare
v @ 0..=26 => (v % 4) as u8,
v @ 0..=26 => v % 4,
// Case 2: non-eip155 v value
v @ 27..=34 => ((v - 27) % 4) as u8,
v @ 27..=34 => (v - 27) % 4,
// Case 3: eip155 V value
v @ 35.. => ((v - 1) % 2) as u8,
v @ 35.. => (v - 1) % 2,
}
}
2 changes: 1 addition & 1 deletion node/libs/crypto/src/secp256k1/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn prop_sign_verify_agg_fail() {
fn test_ethereum_example() {
let unhex = |h| hex::decode(h).unwrap();
// Hexadecimal values from the web3js example.
// The rawTransaction isn't used becuase it itself contains the signature and isn't what has been hashed.
// The rawTransaction isn't used because it itself contains the signature and isn't what has been hashed.
let mh = "88cfbd7e51c7a40540b233cf68b62ad1df3e92462f1c6018d6d67eae0f3b08f5";
let sk = "4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318";
let r = "c9cf86333bcb065d140032ecaab5d9281bde80f21b9687b3e94161de42d51895";
Expand Down

0 comments on commit 7ec466d

Please sign in to comment.