Skip to content

Commit

Permalink
fix: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
nhtyy committed Nov 21, 2024
1 parent 933426c commit 44f929a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ impl Syscall for Keccak256PermuteSyscall {
let start_clk = rt.clk;
let state_ptr = arg1;
if arg2 != 0 {
eprintln!("Expected arg2 to be 0, got {arg2}, this violates the Keccak precompile invariant.");
eprintln!(
"Expected arg2 to be 0, got {arg2}, this violates the Keccak precompile invariant."
);
return rt.invariant_violated();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Syscall for Sha256ExtendSyscall {
let w_ptr = arg1;
if arg2 != 0 {
eprintln!("Warning: sha256_extend syscall arg2 is not zero, this violates the precompile invariants");

return rt.invariant_violated();
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/executor/src/syscalls/precompiles/uint256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Syscall for Uint256MulSyscall {

let x_ptr = arg1;
let y_ptr = arg2;

// Check alignment.
if x_ptr % 4 > 0 || y_ptr % 4 > 0 {
eprintln!("Uint256 Precompile: Ptr alignment violation.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<E: EllipticCurve> Syscall for WeierstrassAddAssignSyscall<E> {
arg2: u32,
) -> Option<u32> {
let event = create_ec_add_event::<E>(rt, arg1, arg2)?;

let syscall_event =
rt.rt.syscall_event(event.clk, syscall_code.syscall_id(), arg1, arg2, event.lookup_id);
match E::CURVE_TYPE {
Expand Down
2 changes: 1 addition & 1 deletion crates/curves/src/edwards/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub fn decompress(compressed_point: &CompressedEdwardsY) -> Option<AffinePoint<E
x = modulus - &x;
}

Some(AffinePoint::new(x, y.clone()))
Some(AffinePoint::new(x, y.clone()))
}

#[cfg(test)]
Expand Down
5 changes: 4 additions & 1 deletion crates/curves/src/weierstrass/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ impl WeierstrassParameters for Secp256k1Parameters {
}
}

pub fn secp256k1_decompress<E: EllipticCurve>(bytes_be: &[u8], sign: u32) -> Option<AffinePoint<E>> {
pub fn secp256k1_decompress<E: EllipticCurve>(
bytes_be: &[u8],
sign: u32,
) -> Option<AffinePoint<E>> {
let computed_point =
k256::AffinePoint::decompress(bytes_be.into(), Choice::from(sign as u8)).into_option()?;

Expand Down
5 changes: 4 additions & 1 deletion crates/curves/src/weierstrass/secp256r1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ impl WeierstrassParameters for Secp256r1Parameters {
}
}

pub fn secp256r1_decompress<E: EllipticCurve>(bytes_be: &[u8], sign: u32) -> Option<AffinePoint<E>> {
pub fn secp256r1_decompress<E: EllipticCurve>(
bytes_be: &[u8],
sign: u32,
) -> Option<AffinePoint<E>> {
let computed_point =
p256::AffinePoint::decompress(bytes_be.into(), Choice::from(sign as u8)).into_option()?;

Expand Down

0 comments on commit 44f929a

Please sign in to comment.