Skip to content

Commit

Permalink
fix: Formatting and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerkleplant committed Jun 27, 2024
1 parent 8f81931 commit 44d666e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/onchain/secp256k1/Secp256k1Arithmetic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ library Secp256k1Arithmetic {
}

/// @dev Returns whether point `point` is the identity.
///
/// @dev Note that the identity is represented via:
/// point.x = point.y = type(uint).max
///
/// @dev Note that the identity is also called point at infinity.
function isIdentity(Point memory point) internal pure returns (bool) {
return (point.x | point.y) == 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/onchain/secp256k1/signatures/ECDSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ library ECDSA {
/// @custom:invariant No valid public key's address is zero.
/// ∀ pk ∊ PublicKey: pk.isValid() → pk.toAddress() != address(0)
function verify(
PublicKey memory pl,
PublicKey memory pk,
bytes memory message,
Signature memory sig
) internal pure returns (bool) {
if (!pl.isValid()) {
if (!pk.isValid()) {
revert("PublicKeyInvalid()");
}

bytes32 digest = keccak256(message);

return pl.toAddress().verify(digest, sig);
return pk.toAddress().verify(digest, sig);
}

/// @dev Returns whether public key `pk` signs via ECDSA signature `sig`
Expand Down
4 changes: 3 additions & 1 deletion test/onchain/secp256k1/Secp256k1Arithmetic.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ contract Secp256k1ArithmeticTest is Test {
assertEq(blob, hex"00");
}

function testFuzz_Point_toEncoded_RevertsIf_PointNotOnCurve(Point memory point) public {
function testFuzz_Point_toEncoded_RevertsIf_PointNotOnCurve(
Point memory point
) public {
vm.assume(!point.isOnCurve());

vm.expectRevert("PointNotOnCurve()");
Expand Down

0 comments on commit 44d666e

Please sign in to comment.