Skip to content

Commit

Permalink
Use o1js's v2 foreignCurve and ecdsa support
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceManiac committed Jul 15, 2024
1 parent bd77e20 commit 426c615
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/contracts/mina-delegation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"o1js"
],
"dependencies": {
"o1js": "^1.4.0"
"o1js": "^1.5.0"
},
"devDependencies": {
"eslint-plugin-o1js": "^0.4.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/contracts/mina-delegation/src/delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import {
Struct,
UInt8,
ZkProgram,
createEcdsa,
createForeignCurve,
createEcdsaV2,
createForeignCurveV2,
} from 'o1js';

// ----------------------------------------------------------------------------
// Common data types

/** A Mina foreign curve for Secp256k1, like Ethereum uses. */
export class Secp256k1 extends createForeignCurve(Crypto.CurveParams.Secp256k1) {
export class Secp256k1 extends createForeignCurveV2(Crypto.CurveParams.Secp256k1) {
/** Convert a standard hex public key into this provable struct. */
static fromHex(publicKey: `0x${string}`): Secp256k1 {
if (publicKey.startsWith('0x04') && publicKey.length === 4 + 64 + 64) {
Expand All @@ -35,7 +35,7 @@ export class Secp256k1 extends createForeignCurve(Crypto.CurveParams.Secp256k1)
}

/** A Mina-provable ECDSA signature on the Secp256k1 curve, like Ethereum uses. */
export class Ecdsa extends createEcdsa(Secp256k1) {
export class Ecdsa extends createEcdsaV2(Secp256k1) {
// o1js-provided fromHex is good enough
}

Expand Down

0 comments on commit 426c615

Please sign in to comment.