From 9666ddafd0a9753d7650a8da120910d91985dd28 Mon Sep 17 00:00:00 2001 From: derekpierre Date: Thu, 13 Nov 2025 15:44:44 -0500 Subject: [PATCH 1/2] Update `nucypher-core` depdendency to 0.15.1-dev.3 for latest changes regarding nonce value being provided as uint256 string. --- package.json | 4 ++-- packages/pre/package.json | 2 +- packages/shared/package.json | 2 +- packages/taco/package.json | 2 +- packages/test-utils/package.json | 2 +- pnpm-lock.yaml | 32 ++++++++++++++++---------------- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index ce60d59eb..293f8fb8f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@changesets/cli": "^2.28.1", - "@nucypher/nucypher-core": "^0.15.1-dev.2", + "@nucypher/nucypher-core": "^0.15.1-dev.3", "ethers": "^5.8.0" }, "devDependencies": { @@ -65,7 +65,7 @@ ] }, "overrides": { - "@nucypher/nucypher-core": "^0.15.1-dev.2", + "@nucypher/nucypher-core": "^0.15.1-dev.3", "glob-parent@<5.1.2": ">=5.1.2", "node-forge@<1.0.0": ">=1.0.0", "node-forge@<1.3.0": ">=1.3.0", diff --git a/packages/pre/package.json b/packages/pre/package.json index 59e2fb337..0bbd16163 100644 --- a/packages/pre/package.json +++ b/packages/pre/package.json @@ -38,7 +38,7 @@ "typedoc": "typedoc" }, "dependencies": { - "@nucypher/nucypher-core": "^0.15.1-dev.2", + "@nucypher/nucypher-core": "^0.15.1-dev.3", "@nucypher/shared": "workspace:*", "ethers": "^5.8.0" }, diff --git a/packages/shared/package.json b/packages/shared/package.json index 3b875bc99..d43c4865b 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -43,7 +43,7 @@ "@ethersproject/abi": "^5.8.0", "@ethersproject/providers": "^5.8.0", "@nucypher/nucypher-contracts": "^0.26.0-alpha.2", - "@nucypher/nucypher-core": "^0.15.1-dev.2", + "@nucypher/nucypher-core": "^0.15.1-dev.3", "axios": "^1.8.4", "deep-equal": "^2.2.3", "ethers": "^5.8.0", diff --git a/packages/taco/package.json b/packages/taco/package.json index b90f88388..986f27d1f 100644 --- a/packages/taco/package.json +++ b/packages/taco/package.json @@ -42,7 +42,7 @@ }, "dependencies": { "@astronautlabs/jsonpath": "^1.1.2", - "@nucypher/nucypher-core": "^0.15.1-dev.2", + "@nucypher/nucypher-core": "^0.15.1-dev.3", "@nucypher/shared": "workspace:*", "@nucypher/taco-auth": "workspace:*", "ethers": "^5.8.0", diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 3aedd9779..a2b8d436f 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -29,7 +29,7 @@ "lint:fix": "pnpm lint --fix" }, "dependencies": { - "@nucypher/nucypher-core": "^0.15.1-dev.2", + "@nucypher/nucypher-core": "^0.15.1-dev.3", "@nucypher/shared": "workspace:*", "@nucypher/taco-auth": "workspace:*", "axios": "^1.8.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e47fe5732..510962eda 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,7 +5,7 @@ settings: excludeLinksFromLockfile: false overrides: - '@nucypher/nucypher-core': ^0.15.1-dev.2 + '@nucypher/nucypher-core': ^0.15.1-dev.3 glob-parent@<5.1.2: '>=5.1.2' node-forge@<1.0.0: '>=1.0.0' node-forge@<1.3.0: '>=1.3.0' @@ -19,8 +19,8 @@ importers: specifier: ^2.28.1 version: 2.29.5 '@nucypher/nucypher-core': - specifier: ^0.15.1-dev.2 - version: 0.15.1-dev.2 + specifier: ^0.15.1-dev.3 + version: 0.15.1-dev.3 ethers: specifier: ^5.8.0 version: 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) @@ -491,8 +491,8 @@ importers: packages/pre: dependencies: '@nucypher/nucypher-core': - specifier: ^0.15.1-dev.2 - version: 0.15.1-dev.2 + specifier: ^0.15.1-dev.3 + version: 0.15.1-dev.3 '@nucypher/shared': specifier: workspace:* version: link:../shared @@ -516,8 +516,8 @@ importers: specifier: ^0.26.0-alpha.2 version: 0.26.0-alpha.2 '@nucypher/nucypher-core': - specifier: ^0.15.1-dev.2 - version: 0.15.1-dev.2 + specifier: ^0.15.1-dev.3 + version: 0.15.1-dev.3 axios: specifier: ^1.8.4 version: 1.10.0 @@ -565,8 +565,8 @@ importers: specifier: ^1.1.2 version: 1.1.2 '@nucypher/nucypher-core': - specifier: ^0.15.1-dev.2 - version: 0.15.1-dev.2 + specifier: ^0.15.1-dev.3 + version: 0.15.1-dev.3 '@nucypher/shared': specifier: workspace:* version: link:../shared @@ -624,8 +624,8 @@ importers: packages/test-utils: dependencies: '@nucypher/nucypher-core': - specifier: ^0.15.1-dev.2 - version: 0.15.1-dev.2 + specifier: ^0.15.1-dev.3 + version: 0.15.1-dev.3 '@nucypher/shared': specifier: workspace:* version: link:../shared @@ -2548,8 +2548,8 @@ packages: '@nucypher/nucypher-contracts@0.26.0-alpha.2': resolution: {integrity: sha512-Vo5AeJ+7iqj1PNpIKfgajkVK7BGNETre8fxDtKyYSaW+9SNXh5ext7eacdvDRdQg/EDmhk0IItch1wXVyVydtQ==} - '@nucypher/nucypher-core@0.15.1-dev.2': - resolution: {integrity: sha512-B8VgjWPD5Lrxj9sPYZW5o4MQuWgmmg0ZuxRNIUiRZRgc3y8NsU9SII822flaU2L3I2pdEUvHz1pQFhgoDAs+kQ==} + '@nucypher/nucypher-core@0.15.1-dev.3': + resolution: {integrity: sha512-0MJ8XvH2X5OyEx+f2i9A2iA+KosHzxZbOt8V3Ye6ZDlMC5N4aeDOEJ02ftwnc0C0NO0CPqTuLlYGbrreW57K+w==} '@nucypher/shared@0.5.0': resolution: {integrity: sha512-Y+0oEgVtoud4BP/pvj2elPm5igrQ8AAUwYYmUiLpXNqQMRF4zFnYaGbl+xhKk45CYG8S9cDKJEN8nopzVADTNw==} @@ -12105,14 +12105,14 @@ snapshots: '@nucypher/nucypher-contracts@0.26.0-alpha.2': {} - '@nucypher/nucypher-core@0.15.1-dev.2': {} + '@nucypher/nucypher-core@0.15.1-dev.3': {} '@nucypher/shared@0.5.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@ethersproject/abi': 5.8.0 '@ethersproject/providers': 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@nucypher/nucypher-contracts': 0.25.0 - '@nucypher/nucypher-core': 0.15.1-dev.2 + '@nucypher/nucypher-core': 0.15.1-dev.3 axios: 1.10.0 deep-equal: 2.2.3 ethers: 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) @@ -12138,7 +12138,7 @@ snapshots: '@nucypher/taco@0.6.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)': dependencies: '@astronautlabs/jsonpath': 1.1.2 - '@nucypher/nucypher-core': 0.15.1-dev.2 + '@nucypher/nucypher-core': 0.15.1-dev.3 '@nucypher/shared': 0.5.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@nucypher/taco-auth': 0.3.0(bufferutil@4.0.9)(ethers@5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10) ethers: 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) From 108eebbe8dff4a53080ea71217de82f559083f19 Mon Sep 17 00:00:00 2001 From: derekpierre Date: Thu, 13 Nov 2025 15:45:43 -0500 Subject: [PATCH 2/2] Update call to (Packed)UserOperation class in `nucypher-core` to provide nonce as a string. Update tests to account for nonce being returned as a string. --- packages/shared/src/types.ts | 8 +++-- packages/shared/test/porter.test.ts | 44 ++++++++++++++-------------- packages/taco/test/taco-sign.test.ts | 5 ++-- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/packages/shared/src/types.ts b/packages/shared/src/types.ts index 8d5ea9f0c..25eef5be0 100644 --- a/packages/shared/src/types.ts +++ b/packages/shared/src/types.ts @@ -41,6 +41,10 @@ function getBigIntValue(value: bigint | number): bigint { return typeof value === 'bigint' ? value : BigInt(value); } +function getUint256String(value: bigint | number): string { + return getBigIntValue(value).toString(); +} + function getUint8ArrayValue(value: `0x${string}` | Uint8Array): Uint8Array { return value instanceof Uint8Array ? value : fromHexString(value); } @@ -50,7 +54,7 @@ export function toCoreUserOperation( ): UserOperation { const userOp = new UserOperation( userOperation.sender, - getBigIntValue(userOperation.nonce), + getUint256String(userOperation.nonce), // nonce as string to support big numbers getUint8ArrayValue(userOperation.callData), getBigIntValue(userOperation.callGasLimit), getBigIntValue(userOperation.verificationGasLimit), @@ -99,7 +103,7 @@ export function toCorePackedUserOperation( ): PackedUserOperation { const packedUserOp = new PackedUserOperation( packedUserOperation.sender, - getBigIntValue(packedUserOperation.nonce), + getUint256String(packedUserOperation.nonce), // nonce as string to support big numbers getUint8ArrayValue(packedUserOperation.initCode), getUint8ArrayValue(packedUserOperation.callData), getUint8ArrayValue(packedUserOperation.accountGasLimits), diff --git a/packages/shared/test/porter.test.ts b/packages/shared/test/porter.test.ts index 046894664..2e43b906b 100644 --- a/packages/shared/test/porter.test.ts +++ b/packages/shared/test/porter.test.ts @@ -3,11 +3,9 @@ import axios, { HttpStatusCode } from 'axios'; import { beforeAll, describe, expect, it, MockInstance, vi } from 'vitest'; import { - PackedUserOperation, PackedUserOperationSignatureRequest, SessionStaticSecret, SignatureResponse, - UserOperation, UserOperationSignatureRequest, } from '@nucypher/nucypher-core'; @@ -19,6 +17,8 @@ import { initialize, PorterClient, toBase64, + toCorePackedUserOperation, + toCoreUserOperation, toHexString, Ursula, } from '../src'; @@ -238,16 +238,16 @@ describe('PorterClient Signing', () => { const createUserOpSignatureRequest = () => new UserOperationSignatureRequest( - new UserOperation( - '0x000000000000000000000000000000000000000a', - BigInt(123), // nonce - fromHexString('0xabc'), // callData - BigInt(456), // callGasLimit - BigInt(789), // verificationGasLimit - BigInt(101112), // preVerificationGasLimit - BigInt(131415), // maxFeePerGas - BigInt(161718), // maxPriorityFeePerGas - ), + toCoreUserOperation({ + sender: '0x000000000000000000000000000000000000000a', + nonce: BigInt(123), + callData: fromHexString('0xabc'), + callGasLimit: BigInt(456), + verificationGasLimit: BigInt(789), + preVerificationGas: BigInt(101112), + maxFeePerGas: BigInt(131415), + maxPriorityFeePerGas: BigInt(161718), + }), 1, // cohort ID BigInt(1), // chain ID '0.8.0', @@ -284,16 +284,16 @@ describe('PorterClient Signing', () => { it('should successfully sign a PackedUserOperation', async () => { const packedUserOperationSignatureRequest = new PackedUserOperationSignatureRequest( - new PackedUserOperation( - '0x000000000000000000000000000000000000000a', - BigInt(123), // nonce - fromHexString('0xabc'), // initCode - fromHexString('0xdef'), // callData - fromHexString('0x01020304'), // accountGasLimits - BigInt(101112), // preVerificationGas - fromHexString('0x05060708'), // gasFees - fromHexString('0x090a0b0c'), // paymasterAndData - ), + toCorePackedUserOperation({ + sender: '0x000000000000000000000000000000000000000a', + nonce: BigInt(123), + initCode: fromHexString('0xabc'), + callData: fromHexString('0xdef'), + accountGasLimits: fromHexString('0x01020304'), + preVerificationGas: BigInt(101112), + gasFees: fromHexString('0x05060708'), + paymasterAndData: fromHexString('0x090a0b0c'), + }), 1, // cohort ID BigInt(1), // chain ID 'mdt', diff --git a/packages/taco/test/taco-sign.test.ts b/packages/taco/test/taco-sign.test.ts index fcce85295..c9a10cf98 100644 --- a/packages/taco/test/taco-sign.test.ts +++ b/packages/taco/test/taco-sign.test.ts @@ -39,7 +39,8 @@ function checkPackedUserOpEquality( op2: PackedUserOperation, ) { expect(op1.sender).toEqual(op2.sender); - expect(toBigInt(op1.nonce)).toEqual(op2.nonce); + + expect(toBigInt(op1.nonce).toString()).toEqual(`${op2.nonce}`); // nonce as string internally to support big numbers const initCode = op1.initCode instanceof Uint8Array @@ -77,7 +78,7 @@ function checkPackedUserOpEquality( function checkUserOpEquality(op1: UserOperationToSign, op2: UserOperation) { expect(op1.sender).toEqual(op2.sender); - expect(toBigInt(op1.nonce)).toEqual(op2.nonce); + expect(toBigInt(op1.nonce).toString()).toEqual(`${op2.nonce}`); // nonce as string internally to support big numbers const callData = op1.callData instanceof Uint8Array