Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schnorr: Adds Schnorr implementation for upcoming EIP #26

Merged
merged 19 commits into from
Sep 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
...
  • Loading branch information
pmerkleplant committed Aug 30, 2024
commit a830dfff498fe8ad3de5e0055bfbcbaf1e1cc00f
9 changes: 5 additions & 4 deletions src/offchain/secp256k1/signatures/SchnorrOffchain2.sol
Original file line number Diff line number Diff line change
@@ -24,10 +24,10 @@ import {
} from "../../../onchain/secp256k1/Secp256k1.sol";

import {
Schnorr2,
Schnorr,
Signature,
SignatureCompressed
} from "../../../onchain/secp256k1/signatures/Schnorr2.sol";
} from "../../../onchain/secp256k1/signatures/Schnorr.sol";

/**
* @title SchnorrOffchain
@@ -40,12 +40,12 @@ import {
* @author verklegarden
* @custom:repository github.com/verklegarden/crysol
*/
library SchnorrOffchain2 {
library SchnorrOffchain {
using Secp256k1Offchain for SecretKey;
using Secp256k1 for SecretKey;
using Secp256k1 for PublicKey;

using SchnorrOffchain2 for SecretKey;
using SchnorrOffchain for SecretKey;

// ~~~~~~~ Prelude ~~~~~~~
// forgefmt: disable-start
@@ -89,6 +89,7 @@ library SchnorrOffchain2 {
// Note that public key derivation fails if secret key is invalid.
PublicKey memory pk = sk.toPublicKey();

// TODO: Use same nonce mechanism as in BIP-340.
// Derive deterministic nonce k ∊ [1, Q).
//
// Note that modulo bias is acceptable on secp256k1.
2 changes: 1 addition & 1 deletion src/onchain/common/Nonce.sol
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ library Nonce {
/// @dev Note that nonce is not bounded to any field.
///
/// @dev Providing a salt adds additional entropy to allow for multiple
/// tries in case returned nonce is not valid for the specific scheme.
/// tries in case returned nonce is not valid for a specific scheme.
///
/// @dev The nonce is derived via H(sk ‖ pk ‖ digest ‖ salt).
function deriveFrom(uint sk, bytes memory pk, bytes32 digest, bytes32 salt)
Loading