Skip to content

Commit

Permalink
fix: Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerkleplant committed Dec 15, 2023
1 parent 3ae51b1 commit 17dd294
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 45 deletions.
20 changes: 5 additions & 15 deletions test/curves/secp256k1/Secp256k1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ contract Secp256k1Test is Test {
assertEq(pk.y, point.y);
}

function testFuzz_PublicKey_toProjectivePoint(PublicKey memory pk)
public
{
function testFuzz_PublicKey_toProjectivePoint(PublicKey memory pk) public {
ProjectivePoint memory jPoint = wrapper.toProjectivePoint(pk);

assertEq(jPoint.x, pk.x);
Expand All @@ -196,7 +194,7 @@ contract Secp256k1Test is Test {
//--------------------------------------------------------------------------
// Test: (De)Serialization

/*
/*
//----------------------------------
// Private Key
Expand Down Expand Up @@ -347,8 +345,7 @@ contract Secp256k1Test is Test {
function test_PublicKey_asBytes_ViaGenerator() public {
assertEq(GENERATOR_BYTES_UNCOMPRESSED, wrapper.toBytes(Secp256k1.G()));
}
*/

*/
}

/**
Expand Down Expand Up @@ -381,10 +378,7 @@ contract Secp256k1Wrapper {
return sk.isValid();
}

function toPublicKey(SecretKey sk)
public
returns (PublicKey memory)
{
function toPublicKey(SecretKey sk) public returns (PublicKey memory) {
return sk.toPublicKey();
}

Expand Down Expand Up @@ -468,11 +462,7 @@ contract Secp256k1Wrapper {
return Secp256k1.publicKeyFromBytes(blob);
}

function toBytes(PublicKey memory pk)
public
pure
returns (bytes memory)
{
function toBytes(PublicKey memory pk) public pure returns (bytes memory) {
return pk.toBytes();
}
}
23 changes: 11 additions & 12 deletions test/signatures/ECDSA.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ contract ECDSATest is Test {

PublicKey memory pk = sk.toPublicKey();
assertTrue(
pk.verify(
Message.deriveEthereumSignedMessageHash(message), sig1
)
pk.verify(Message.deriveEthereumSignedMessageHash(message), sig1)
);
assertTrue(
pk.verify(
Expand Down Expand Up @@ -389,11 +387,11 @@ contract ECDSAWrapper {
return pk.verify(message, sig);
}

function verify(
PublicKey memory pk,
bytes32 digest,
Signature memory sig
) public pure returns (bool) {
function verify(PublicKey memory pk, bytes32 digest, Signature memory sig)
public
pure
returns (bool)
{
return pk.verify(digest, sig);
}

Expand Down Expand Up @@ -432,10 +430,11 @@ contract ECDSAWrapper {
return sk.sign(digest);
}

function signEthereumSignedMessageHash(
SecretKey sk,
bytes memory message
) public view returns (Signature memory) {
function signEthereumSignedMessageHash(SecretKey sk, bytes memory message)
public
view
returns (Signature memory)
{
return sk.signEthereumSignedMessageHash(message);
}

Expand Down
30 changes: 12 additions & 18 deletions test/signatures/Schnorr.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ contract SchnorrTest is Test {
);
vm.expectRevert("PublicKeyInvalid()");
wrapper.verify(
pk,
keccak256(message),
Secp256k1.secretKeyFromUint(1).sign(message)
pk, keccak256(message), Secp256k1.secretKeyFromUint(1).sign(message)
);
}

Expand Down Expand Up @@ -162,14 +160,10 @@ contract SchnorrTest is Test {

PublicKey memory pk = sk.toPublicKey();
assertTrue(
pk.verify(
Message.deriveEthereumSignedMessageHash(message), sig1
)
pk.verify(Message.deriveEthereumSignedMessageHash(message), sig1)
);
assertTrue(
pk.verify(
Message.deriveEthereumSignedMessageHash(message), sig2
)
pk.verify(Message.deriveEthereumSignedMessageHash(message), sig2)
);
}

Expand Down Expand Up @@ -247,11 +241,11 @@ contract SchnorrWrapper {
return pk.verify(message, sig);
}

function verify(
PublicKey memory pk,
bytes32 digest,
Signature memory sig
) public pure returns (bool) {
function verify(PublicKey memory pk, bytes32 digest, Signature memory sig)
public
pure
returns (bool)
{
return pk.verify(digest, sig);
}

Expand All @@ -272,10 +266,10 @@ contract SchnorrWrapper {
return sk.sign(digest);
}

function signEthereumSignedMessageHash(
SecretKey sk,
bytes memory message
) public returns (Signature memory) {
function signEthereumSignedMessageHash(SecretKey sk, bytes memory message)
public
returns (Signature memory)
{
return sk.signEthereumSignedMessageHash(message);
}

Expand Down

0 comments on commit 17dd294

Please sign in to comment.