From 61c78da7281e5b65c9477c110e05a1ef7f4f8523 Mon Sep 17 00:00:00 2001 From: CedarMist <134699267+CedarMist@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:53:50 +0000 Subject: [PATCH] contracts: sr25519 support --- contracts/contracts/Sapphire.sol | 10 +++ contracts/package.json | 7 +- contracts/test/signing.ts | 104 ++++++++++++++++++++++++- pnpm-lock.yaml | 126 +++++++++++++++++++------------ runtime/Cargo.lock | 19 ++--- runtime/Cargo.toml | 4 +- runtime/Makefile | 2 +- 7 files changed, 204 insertions(+), 68 deletions(-) diff --git a/contracts/contracts/Sapphire.sol b/contracts/contracts/Sapphire.sol index f891c54a..555f226d 100644 --- a/contracts/contracts/Sapphire.sol +++ b/contracts/contracts/Sapphire.sol @@ -318,6 +318,9 @@ library Sapphire { * - `4` (`Secp256k1PrehashedKeccak256`) * - `5` (`Secp256k1PrehashedSha256`) * + * ##### sr25519: 1,000 gas + * - `6` (`sr25519`) + * * ##### Secp256r1: 4,000 gas * - `7` (`Secp256r1PrehashedSha256`) * @@ -343,6 +346,11 @@ library Sapphire { * byte X coordinate). * Secret key: 48 bytes * + * ##### sr25519 + * + * Public key: 32 bytes + * Secret key: 96 bytes (64 byte secret key, 32 byte public key) + * * #### Example * * ```solidity @@ -401,6 +409,7 @@ library Sapphire { * (32 bytes) as context, empty message. * - `5` (`Secp256k1PrehashedSha256`): 3,000 gas, pre-existing hash (32 * bytes) as context, empty message. + * - `6` (`sr25519`): 1,500 gas, bytes (e.g. 'substrate) as context, arbitrary length message * - `7` (`Secp256r1PrehashedSha256`): 9,000 gas, pre-existing hash (32 * bytes) as context, empty message. * - `8` (`Secp384r1PrehashedSha384`): 43,200 gas, pre-existing hash (32 @@ -462,6 +471,7 @@ library Sapphire { * - `3` (`Secp256k1Oasis`): 3,000 gas * - `4` (`Secp256k1PrehashedKeccak256`): 3,000 gas * - `5` (`Secp256k1PrehashedSha256`): 3,000 gas + * - `6` (`sr25519`): 2,000 gas * - `7` (`Secp256r1PrehashedSha256`): 7,900 gas * - `8` (`Secp384r1PrehashedSha384`): 37,920 gas * diff --git a/contracts/package.json b/contracts/package.json index abe630b3..86166f63 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -25,12 +25,13 @@ "contracts" ], "devDependencies": { + "@noble/hashes": "1.3.2", "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", "@nomicfoundation/hardhat-ethers": "^3.0.5", "@oasisprotocol/client": "^0.1.1-alpha.2", + "@oasisprotocol/sapphire-ethers-v6": "workspace:^", "@oasisprotocol/sapphire-hardhat": "workspace:^", "@oasisprotocol/sapphire-paratime": "workspace:^", - "@oasisprotocol/sapphire-ethers-v6": "workspace:^", "@typechain/ethers-v6": "^0.5.1", "@typechain/hardhat": "^9.1.0", "@types/chai": "^4.3.3", @@ -45,6 +46,7 @@ "ethers": "6.x", "hardhat": "^2.22.2", "hardhat-watcher": "^2.5.0", + "micro-sr25519": "^0.1.0", "npm-run-all": "^4.1.5", "prettier": "^2.7.1", "prettier-plugin-solidity": "1.0.0-beta.24", @@ -53,8 +55,7 @@ "solidity-coverage": "^0.8.2", "ts-node": "^10.9.1", "typechain": "^8.3.2", - "typescript": "^4.8.3", - "@noble/hashes": "1.3.2" + "typescript": "^4.8.3" }, "dependencies": { "@openzeppelin/contracts": "^5.0.2" diff --git a/contracts/test/signing.ts b/contracts/test/signing.ts index 09c77232..3faae326 100644 --- a/contracts/test/signing.ts +++ b/contracts/test/signing.ts @@ -6,6 +6,8 @@ import { ethers } from 'hardhat'; import { SigningTests__factory } from '../typechain-types/factories/contracts/tests'; import { SigningTests } from '../typechain-types/contracts/tests/SigningTests'; +import * as sr25519 from 'micro-sr25519'; +import { getBytes, hexlify, keccak256 } from 'ethers'; function randomBytesUnlike(len: number, orig: Buffer): Buffer { do { @@ -205,7 +207,107 @@ describe('Signing', function () { ); }); - // TODO: implement Sr25519 + it('sr25519', async () => { + // Try sr25519 (alg=6) + // 32 byte context, empty message + const sha256_kp = await se.testKeygen(6, randomBytes(32)); + await testSignThenVerify( + se, + 6, + sha256_kp, + randomBytes(32), + EMPTY_BUFFER, + 32, + 0, + ); + + // Key derivation from polkadot test cases + // See: https://github.com/polkadot-js/wasm/blob/10010830094e7d033bd11b16c5e3bc01a7045309/packages/wasm-crypto/src/rs/sr25519.rs#L176 + const secretSeed = getBytes( + '0xfac7959dbfe72f052e5a0c3c8d6530f202b02fd8f9f5ca3580ec8deb7797479e', + ); + const secretKey = sr25519.secretFromSeed(secretSeed); + const publicKey = sr25519.getPublicKey(secretKey); + expect(hexlify(publicKey)).eq( + '0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a', + ); + + // Known valid signature + const msg = new TextEncoder().encode('message to sign'); + const sig = getBytes( + '0x48ce2c90e08651adfc8ecef84e916f6d1bb51ebebd16150ee12df247841a5437951ea0f9d632ca165e6ab391532e75e701be6a1caa88c8a6bcca3511f55b4183', + ); + const sigSigner = getBytes( + '0xf84d048da2ddae2d9d8fd6763f469566e8817a26114f39408de15547f6d47805', + ); + + // Verify JS implementation matches polkadot test case signature + const isValid = sr25519.verify(msg, sig, sigSigner); + expect(isValid).eq(true); + + const CONTEXT = new TextEncoder().encode('substrate'); + + // Verify on-chain implementation also works + const result = await se.testVerify(6, sigSigner, CONTEXT, msg, sig); + expect(result).eq(true); + + // Test key generation on-chian matches JS implementation + const generatedKey = await se.testKeygen(6, secretSeed); + expect(hexlify(getBytes(generatedKey.secretKey).slice(0, 64))).eq( + hexlify(secretKey), + ); + expect(generatedKey.publicKey).eq(hexlify(publicKey)); + + // 64 byte secret, appended with 32 byte public key + expect(getBytes(generatedKey.publicKey).length).eq(32); + expect(getBytes(generatedKey.secretKey).length).eq(96); + expect(hexlify(getBytes(generatedKey.secretKey).slice(64))).eq( + generatedKey.publicKey, + ); + + // JS can verify on-chain signed message + const onchainSigned = await se.testSign( + 6, + generatedKey.secretKey, + CONTEXT, + msg, + ); + const jsVerify = sr25519.verify( + msg, + getBytes(onchainSigned), + getBytes(generatedKey.publicKey), + ); + expect(jsVerify).eq(true); + // And on-chain can verify on-chain signed message + expect( + await se.testVerify( + 6, + generatedKey.publicKey, + CONTEXT, + msg, + onchainSigned, + ), + ).eq(true); + + // JS roundtrip with on-chain generated keypair + const jsSigned = sr25519.sign( + getBytes(generatedKey.secretKey).slice(0, 64), + msg, + ); + expect(sr25519.verify(msg, jsSigned, getBytes(generatedKey.publicKey))).eq( + true, + ); + + // on-chain verify JS signed message + const onchainVerify = await se.testVerify( + 6, + generatedKey.publicKey, + CONTEXT, + msg, + jsSigned, + ); + expect(onchainVerify).eq(true); + }); it('Secp256r1 (Prehashed SHA256)', async () => { // Try Secp256r1 (alg=7) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ae75bf6..7b95aa61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -130,6 +130,9 @@ importers: hardhat-watcher: specifier: ^2.5.0 version: 2.5.0(hardhat@2.22.12(bufferutil@4.0.8)(ts-node@10.9.2(@types/node@18.19.54)(typescript@4.9.5))(typescript@4.9.5)(utf-8-validate@5.0.10)) + micro-sr25519: + specifier: ^0.1.0 + version: 0.1.0 npm-run-all: specifier: ^4.1.5 version: 4.1.5 @@ -239,7 +242,7 @@ importers: devDependencies: react-scripts: specifier: 5.0.1 - version: 5.0.1(@babel/plugin-syntax-flow@7.25.7(@babel/core@7.25.7))(@babel/plugin-transform-react-jsx@7.25.7(@babel/core@7.25.7))(@types/babel__core@7.20.5)(bufferutil@4.0.8)(eslint@8.57.1)(react@18.3.1)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(type-fest@0.21.3)(typescript@5.6.2)(utf-8-validate@5.0.10)(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0)) + version: 5.0.1(@babel/plugin-syntax-flow@7.25.7(@babel/core@7.25.7))(@babel/plugin-transform-react-jsx@7.25.7(@babel/core@7.25.7))(@types/babel__core@7.20.5)(bufferutil@4.0.8)(eslint@8.57.1)(react@18.3.1)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(type-fest@0.21.3)(typescript@5.6.2)(utf-8-validate@5.0.10)(webpack-cli@5.1.4) webpack-bundle-analyzer: specifier: ^4.10.2 version: 4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) @@ -2314,6 +2317,10 @@ packages: '@noble/curves@1.4.2': resolution: {integrity: sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==} + '@noble/curves@1.7.0': + resolution: {integrity: sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==} + engines: {node: ^14.21.3 || >=16} + '@noble/hashes@1.2.0': resolution: {integrity: sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==} @@ -2329,6 +2336,14 @@ packages: resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} engines: {node: ^14.21.3 || >=16} + '@noble/hashes@1.6.0': + resolution: {integrity: sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==} + engines: {node: ^14.21.3 || >=16} + + '@noble/hashes@1.6.1': + resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} + engines: {node: ^14.21.3 || >=16} + '@noble/secp256k1@1.7.1': resolution: {integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==} @@ -5864,6 +5879,7 @@ packages: ethereumjs-abi@0.6.8: resolution: {integrity: sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA==} + deprecated: This library has been deprecated and usage is discouraged. ethereumjs-util@6.2.1: resolution: {integrity: sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==} @@ -7740,6 +7756,9 @@ packages: micro-ftch@0.3.1: resolution: {integrity: sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==} + micro-sr25519@0.1.0: + resolution: {integrity: sha512-at5zfxiKNhh07v4GPb8Sc6wCW+jd18FMMgPM0ACIQMcgvMfB9a34mfOlXr5B04J4yFZ6imlvJfRaFbOxMA7ytw==} + micromatch@4.0.8: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} @@ -13633,6 +13652,10 @@ snapshots: dependencies: '@noble/hashes': 1.4.0 + '@noble/curves@1.7.0': + dependencies: + '@noble/hashes': 1.6.0 + '@noble/hashes@1.2.0': {} '@noble/hashes@1.3.2': {} @@ -13641,6 +13664,10 @@ snapshots: '@noble/hashes@1.5.0': {} + '@noble/hashes@1.6.0': {} + + '@noble/hashes@1.6.1': {} + '@noble/secp256k1@1.7.1': {} '@nodelib/fs.scandir@2.1.5': @@ -14127,7 +14154,7 @@ snapshots: dependencies: playwright: 1.48.2 - '@pmmmwh/react-refresh-webpack-plugin@0.5.15(react-refresh@0.11.0)(type-fest@0.21.3)(webpack-dev-server@4.15.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + '@pmmmwh/react-refresh-webpack-plugin@0.5.15(react-refresh@0.11.0)(type-fest@0.21.3)(webpack-dev-server@4.15.2)(webpack@5.95.0)': dependencies: ansi-html: 0.0.9 core-js-pure: 3.38.1 @@ -15479,7 +15506,7 @@ snapshots: - utf-8-validate - zod - '@wagmi/connectors@5.1.14(@types/react@18.3.11)(@wagmi/core@2.13.8(@tanstack/query-core@5.0.5)(@types/react@18.3.11)(immer@10.0.2)(react@18.3.1)(typescript@5.6.2)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.24.0)(typescript@5.6.2)(utf-8-validate@5.0.10)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10))': + '@wagmi/connectors@5.1.14(@types/react@18.3.11)(@wagmi/core@2.13.8(@tanstack/query-core@5.0.5)(@types/react@18.3.11)(react@18.3.1)(typescript@5.6.2)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.24.0)(typescript@5.6.2)(utf-8-validate@5.0.10)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10))': dependencies: '@coinbase/wallet-sdk': 4.0.4 '@metamask/sdk': 0.28.4(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.24.0)(utf-8-validate@5.0.10) @@ -16231,17 +16258,17 @@ snapshots: '@webassemblyjs/ast': 1.12.1 '@xtuc/long': 4.2.2 - '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4)(webpack@5.95.0)': dependencies: webpack: 5.95.0(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0) - '@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + '@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.95.0)': dependencies: webpack: 5.95.0(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0) - '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0))(webpack-dev-server@4.15.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4))': + '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack-dev-server@4.15.2)(webpack@5.95.0)': dependencies: webpack: 5.95.0(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0) @@ -16631,7 +16658,7 @@ snapshots: transitivePeerDependencies: - supports-color - babel-loader@8.4.1(@babel/core@7.25.7)(webpack@5.95.0(webpack-cli@5.1.4)): + babel-loader@8.4.1(@babel/core@7.25.7)(webpack@5.95.0): dependencies: '@babel/core': 7.25.7 find-cache-dir: 3.3.2 @@ -17542,7 +17569,7 @@ snapshots: postcss: 8.4.47 postcss-selector-parser: 6.1.2 - css-loader@6.11.0(webpack@5.95.0(webpack-cli@5.1.4)): + css-loader@6.11.0(webpack@5.95.0): dependencies: icss-utils: 5.1.0(postcss@8.4.47) postcss: 8.4.47 @@ -17555,7 +17582,7 @@ snapshots: optionalDependencies: webpack: 5.95.0(webpack-cli@5.1.4) - css-minimizer-webpack-plugin@3.4.1(webpack@5.95.0(webpack-cli@5.1.4)): + css-minimizer-webpack-plugin@3.4.1(webpack@5.95.0): dependencies: cssnano: 5.1.15(postcss@8.4.47) jest-worker: 27.5.1 @@ -18430,7 +18457,7 @@ snapshots: eslint-visitor-keys@3.4.3: {} - eslint-webpack-plugin@3.2.0(eslint@8.57.1)(webpack@5.95.0(webpack-cli@5.1.4)): + eslint-webpack-plugin@3.2.0(eslint@8.57.1)(webpack@5.95.0): dependencies: '@types/eslint': 8.56.12 eslint: 8.57.1 @@ -18885,7 +18912,7 @@ snapshots: dependencies: flat-cache: 3.2.0 - file-loader@6.2.0(webpack@5.95.0(webpack-cli@5.1.4)): + file-loader@6.2.0(webpack@5.95.0): dependencies: loader-utils: 2.0.4 schema-utils: 3.3.0 @@ -18990,7 +19017,7 @@ snapshots: forever-agent@0.6.1: {} - fork-ts-checker-webpack-plugin@6.5.3(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0(webpack-cli@5.1.4)): + fork-ts-checker-webpack-plugin@6.5.3(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0): dependencies: '@babel/code-frame': 7.25.7 '@types/json-schema': 7.0.15 @@ -19669,7 +19696,7 @@ snapshots: relateurl: 0.2.7 terser: 5.34.1 - html-webpack-plugin@5.6.0(webpack@5.95.0(webpack-cli@5.1.4)): + html-webpack-plugin@5.6.0(webpack@5.95.0): dependencies: '@types/html-minifier-terser': 6.1.0 html-minifier-terser: 6.1.0 @@ -21470,6 +21497,11 @@ snapshots: micro-ftch@0.3.1: {} + micro-sr25519@0.1.0: + dependencies: + '@noble/curves': 1.7.0 + '@noble/hashes': 1.6.1 + micromatch@4.0.8: dependencies: braces: 3.0.3 @@ -21506,7 +21538,7 @@ snapshots: dependencies: dom-walk: 0.1.2 - mini-css-extract-plugin@2.9.1(webpack@5.95.0(webpack-cli@5.1.4)): + mini-css-extract-plugin@2.9.1(webpack@5.95.0): dependencies: schema-utils: 4.2.0 tapable: 2.2.1 @@ -22304,7 +22336,7 @@ snapshots: postcss: 8.4.47 ts-node: 10.9.2(@types/node@18.19.54)(typescript@5.6.2) - postcss-loader@6.2.1(postcss@8.4.47)(webpack@5.95.0(webpack-cli@5.1.4)): + postcss-loader@6.2.1(postcss@8.4.47)(webpack@5.95.0): dependencies: cosmiconfig: 7.1.0 klona: 2.0.6 @@ -22797,7 +22829,7 @@ snapshots: regenerator-runtime: 0.13.11 whatwg-fetch: 3.6.20 - react-dev-utils@12.0.1(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0(webpack-cli@5.1.4)): + react-dev-utils@12.0.1(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0): dependencies: '@babel/code-frame': 7.25.7 address: 1.2.2 @@ -22808,7 +22840,7 @@ snapshots: escape-string-regexp: 4.0.0 filesize: 8.0.7 find-up: 5.0.0 - fork-ts-checker-webpack-plugin: 6.5.3(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0(webpack-cli@5.1.4)) + fork-ts-checker-webpack-plugin: 6.5.3(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0) global-modules: 2.0.0 globby: 11.1.0 gzip-size: 6.0.0 @@ -22917,56 +22949,56 @@ snapshots: react-refresh@0.14.2: {} - react-scripts@5.0.1(@babel/plugin-syntax-flow@7.25.7(@babel/core@7.25.7))(@babel/plugin-transform-react-jsx@7.25.7(@babel/core@7.25.7))(@types/babel__core@7.20.5)(bufferutil@4.0.8)(eslint@8.57.1)(react@18.3.1)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(type-fest@0.21.3)(typescript@5.6.2)(utf-8-validate@5.0.10)(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0)): + react-scripts@5.0.1(@babel/plugin-syntax-flow@7.25.7(@babel/core@7.25.7))(@babel/plugin-transform-react-jsx@7.25.7(@babel/core@7.25.7))(@types/babel__core@7.20.5)(bufferutil@4.0.8)(eslint@8.57.1)(react@18.3.1)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(type-fest@0.21.3)(typescript@5.6.2)(utf-8-validate@5.0.10)(webpack-cli@5.1.4): dependencies: '@babel/core': 7.25.7 - '@pmmmwh/react-refresh-webpack-plugin': 0.5.15(react-refresh@0.11.0)(type-fest@0.21.3)(webpack-dev-server@4.15.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) + '@pmmmwh/react-refresh-webpack-plugin': 0.5.15(react-refresh@0.11.0)(type-fest@0.21.3)(webpack-dev-server@4.15.2)(webpack@5.95.0) '@svgr/webpack': 5.5.0 babel-jest: 27.5.1(@babel/core@7.25.7) - babel-loader: 8.4.1(@babel/core@7.25.7)(webpack@5.95.0(webpack-cli@5.1.4)) + babel-loader: 8.4.1(@babel/core@7.25.7)(webpack@5.95.0) babel-plugin-named-asset-import: 0.3.8(@babel/core@7.25.7) babel-preset-react-app: 10.0.1 bfj: 7.1.0 browserslist: 4.24.0 camelcase: 6.3.0 case-sensitive-paths-webpack-plugin: 2.4.0 - css-loader: 6.11.0(webpack@5.95.0(webpack-cli@5.1.4)) - css-minimizer-webpack-plugin: 3.4.1(webpack@5.95.0(webpack-cli@5.1.4)) + css-loader: 6.11.0(webpack@5.95.0) + css-minimizer-webpack-plugin: 3.4.1(webpack@5.95.0) dotenv: 10.0.0 dotenv-expand: 5.1.0 eslint: 8.57.1 eslint-config-react-app: 7.0.1(@babel/plugin-syntax-flow@7.25.7(@babel/core@7.25.7))(@babel/plugin-transform-react-jsx@7.25.7(@babel/core@7.25.7))(eslint@8.57.1)(jest@27.5.1(bufferutil@4.0.8)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(utf-8-validate@5.0.10))(typescript@5.6.2) - eslint-webpack-plugin: 3.2.0(eslint@8.57.1)(webpack@5.95.0(webpack-cli@5.1.4)) - file-loader: 6.2.0(webpack@5.95.0(webpack-cli@5.1.4)) + eslint-webpack-plugin: 3.2.0(eslint@8.57.1)(webpack@5.95.0) + file-loader: 6.2.0(webpack@5.95.0) fs-extra: 10.1.0 - html-webpack-plugin: 5.6.0(webpack@5.95.0(webpack-cli@5.1.4)) + html-webpack-plugin: 5.6.0(webpack@5.95.0) identity-obj-proxy: 3.0.0 jest: 27.5.1(bufferutil@4.0.8)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(utf-8-validate@5.0.10) jest-resolve: 27.5.1 jest-watch-typeahead: 1.1.0(jest@27.5.1(bufferutil@4.0.8)(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2))(utf-8-validate@5.0.10)) - mini-css-extract-plugin: 2.9.1(webpack@5.95.0(webpack-cli@5.1.4)) + mini-css-extract-plugin: 2.9.1(webpack@5.95.0) postcss: 8.4.47 postcss-flexbugs-fixes: 5.0.2(postcss@8.4.47) - postcss-loader: 6.2.1(postcss@8.4.47)(webpack@5.95.0(webpack-cli@5.1.4)) + postcss-loader: 6.2.1(postcss@8.4.47)(webpack@5.95.0) postcss-normalize: 10.0.1(browserslist@4.24.0)(postcss@8.4.47) postcss-preset-env: 7.8.3(postcss@8.4.47) prompts: 2.4.2 react: 18.3.1 react-app-polyfill: 3.0.0 - react-dev-utils: 12.0.1(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0(webpack-cli@5.1.4)) + react-dev-utils: 12.0.1(eslint@8.57.1)(typescript@5.6.2)(webpack@5.95.0) react-refresh: 0.11.0 resolve: 1.22.8 resolve-url-loader: 4.0.0 - sass-loader: 12.6.0(webpack@5.95.0(webpack-cli@5.1.4)) + sass-loader: 12.6.0(webpack@5.95.0) semver: 7.6.3 - source-map-loader: 3.0.2(webpack@5.95.0(webpack-cli@5.1.4)) - style-loader: 3.3.4(webpack@5.95.0(webpack-cli@5.1.4)) + source-map-loader: 3.0.2(webpack@5.95.0) + style-loader: 3.3.4(webpack@5.95.0) tailwindcss: 3.4.13(ts-node@10.9.2(@types/node@18.19.54)(typescript@5.6.2)) - terser-webpack-plugin: 5.3.10(webpack@5.95.0(webpack-cli@5.1.4)) + terser-webpack-plugin: 5.3.10(webpack@5.95.0) webpack: 5.95.0(webpack-cli@5.1.4) webpack-dev-server: 4.15.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)(webpack-cli@5.1.4)(webpack@5.95.0) - webpack-manifest-plugin: 4.1.1(webpack@5.95.0(webpack-cli@5.1.4)) - workbox-webpack-plugin: 6.6.0(@types/babel__core@7.20.5)(webpack@5.95.0(webpack-cli@5.1.4)) + webpack-manifest-plugin: 4.1.1(webpack@5.95.0) + workbox-webpack-plugin: 6.6.0(@types/babel__core@7.20.5)(webpack@5.95.0) optionalDependencies: fsevents: 2.3.3 typescript: 5.6.2 @@ -23317,7 +23349,7 @@ snapshots: sanitize.css@13.0.0: {} - sass-loader@12.6.0(webpack@5.95.0(webpack-cli@5.1.4)): + sass-loader@12.6.0(webpack@5.95.0): dependencies: klona: 2.0.6 neo-async: 2.6.2 @@ -23752,7 +23784,7 @@ snapshots: source-map-js@1.2.1: {} - source-map-loader@3.0.2(webpack@5.95.0(webpack-cli@5.1.4)): + source-map-loader@3.0.2(webpack@5.95.0): dependencies: abab: 2.0.6 iconv-lite: 0.6.3 @@ -24011,7 +24043,7 @@ snapshots: strnum@1.0.5: {} - style-loader@3.3.4(webpack@5.95.0(webpack-cli@5.1.4)): + style-loader@3.3.4(webpack@5.95.0): dependencies: webpack: 5.95.0(webpack-cli@5.1.4) @@ -24192,7 +24224,7 @@ snapshots: ansi-escapes: 4.3.2 supports-hyperlinks: 2.3.0 - terser-webpack-plugin@5.3.10(webpack@5.95.0(webpack-cli@5.1.4)): + terser-webpack-plugin@5.3.10(webpack@5.95.0): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 @@ -24906,7 +24938,7 @@ snapshots: wagmi@2.12.16(@tanstack/query-core@5.0.5)(@tanstack/react-query@5.0.5(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1))(@types/react@18.3.11)(bufferutil@4.0.8)(immer@10.0.2)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.24.0)(typescript@5.6.2)(utf-8-validate@5.0.10)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)): dependencies: '@tanstack/react-query': 5.0.5(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1) - '@wagmi/connectors': 5.1.14(@types/react@18.3.11)(@wagmi/core@2.13.8(@tanstack/query-core@5.0.5)(@types/react@18.3.11)(immer@10.0.2)(react@18.3.1)(typescript@5.6.2)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.24.0)(typescript@5.6.2)(utf-8-validate@5.0.10)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)) + '@wagmi/connectors': 5.1.14(@types/react@18.3.11)(@wagmi/core@2.13.8(@tanstack/query-core@5.0.5)(@types/react@18.3.11)(react@18.3.1)(typescript@5.6.2)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)))(bufferutil@4.0.8)(react-dom@18.3.1(react@18.3.1))(react-native@0.75.4(@babel/core@7.25.7)(@babel/preset-env@7.25.7(@babel/core@7.25.7))(@types/react@18.3.11)(bufferutil@4.0.8)(react@18.3.1)(typescript@5.6.2)(utf-8-validate@5.0.10))(react@18.3.1)(rollup@4.24.0)(typescript@5.6.2)(utf-8-validate@5.0.10)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)) '@wagmi/core': 2.13.8(@tanstack/query-core@5.0.5)(@types/react@18.3.11)(immer@10.0.2)(react@18.3.1)(typescript@5.6.2)(viem@2.9.19(bufferutil@4.0.8)(typescript@5.6.2)(utf-8-validate@5.0.10)) react: 18.3.1 use-sync-external-store: 1.2.0(react@18.3.1) @@ -25398,9 +25430,9 @@ snapshots: webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0): dependencies: '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) - '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) - '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack-bundle-analyzer@4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10))(webpack-dev-server@4.15.2)(webpack@5.95.0))(webpack-dev-server@4.15.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(webpack-cli@5.1.4)) + '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4)(webpack@5.95.0) + '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4)(webpack@5.95.0) + '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4)(webpack-dev-server@4.15.2)(webpack@5.95.0) colorette: 2.0.20 commander: 10.0.1 cross-spawn: 7.0.3 @@ -25415,7 +25447,7 @@ snapshots: webpack-bundle-analyzer: 4.10.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) webpack-dev-server: 4.15.2(bufferutil@4.0.8)(utf-8-validate@5.0.10)(webpack-cli@5.1.4)(webpack@5.95.0) - webpack-dev-middleware@5.3.4(webpack@5.95.0(webpack-cli@5.1.4)): + webpack-dev-middleware@5.3.4(webpack@5.95.0): dependencies: colorette: 2.0.20 memfs: 3.5.3 @@ -25454,7 +25486,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 5.3.4(webpack@5.95.0(webpack-cli@5.1.4)) + webpack-dev-middleware: 5.3.4(webpack@5.95.0) ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) optionalDependencies: webpack: 5.95.0(webpack-cli@5.1.4) @@ -25465,7 +25497,7 @@ snapshots: - supports-color - utf-8-validate - webpack-manifest-plugin@4.1.1(webpack@5.95.0(webpack-cli@5.1.4)): + webpack-manifest-plugin@4.1.1(webpack@5.95.0): dependencies: tapable: 2.2.1 webpack: 5.95.0(webpack-cli@5.1.4) @@ -25511,7 +25543,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(webpack@5.95.0(webpack-cli@5.1.4)) + terser-webpack-plugin: 5.3.10(webpack@5.95.0) watchpack: 2.4.2 webpack-sources: 3.2.3 optionalDependencies: @@ -25741,7 +25773,7 @@ snapshots: workbox-sw@6.6.0: {} - workbox-webpack-plugin@6.6.0(@types/babel__core@7.20.5)(webpack@5.95.0(webpack-cli@5.1.4)): + workbox-webpack-plugin@6.6.0(@types/babel__core@7.20.5)(webpack@5.95.0): dependencies: fast-json-stable-stringify: 2.1.0 pretty-bytes: 5.6.0 diff --git a/runtime/Cargo.lock b/runtime/Cargo.lock index 27c8d4df..24535441 100644 --- a/runtime/Cargo.lock +++ b/runtime/Cargo.lock @@ -1525,15 +1525,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -2149,7 +2140,7 @@ dependencies = [ [[package]] name = "oasis-runtime-sdk" version = "0.10.0" -source = "git+https://github.com/oasisprotocol/oasis-sdk?tag=runtime-sdk/v0.10.0#8444b42637892c14052e53124363362adc297bda" +source = "git+https://github.com/oasisprotocol/oasis-sdk?branch=kostko/feature/sr25519-sign#76219216f38de15f30bd7c831c08254b899ea2b0" dependencies = [ "anyhow", "async-trait", @@ -2190,7 +2181,7 @@ dependencies = [ [[package]] name = "oasis-runtime-sdk-evm" version = "0.6.0" -source = "git+https://github.com/oasisprotocol/oasis-sdk?tag=runtime-sdk/v0.10.0#8444b42637892c14052e53124363362adc297bda" +source = "git+https://github.com/oasisprotocol/oasis-sdk?branch=kostko/feature/sr25519-sign#76219216f38de15f30bd7c831c08254b899ea2b0" dependencies = [ "anyhow", "base64 0.22.1", @@ -2222,7 +2213,7 @@ dependencies = [ [[package]] name = "oasis-runtime-sdk-macros" version = "0.3.0" -source = "git+https://github.com/oasisprotocol/oasis-sdk?tag=runtime-sdk/v0.10.0#8444b42637892c14052e53124363362adc297bda" +source = "git+https://github.com/oasisprotocol/oasis-sdk?branch=kostko/feature/sr25519-sign#76219216f38de15f30bd7c831c08254b899ea2b0" dependencies = [ "darling 0.20.10", "proc-macro2 1.0.89", @@ -2575,7 +2566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools", "proc-macro2 1.0.89", "quote 1.0.37", "syn 2.0.85", @@ -2588,7 +2579,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools", "proc-macro2 1.0.89", "quote 1.0.37", "syn 2.0.85", diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 6d63d110..d19ced25 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -21,8 +21,8 @@ debug = false keymanager = { git = "https://github.com/oasisprotocol/keymanager-paratime", tag = "v0.5.0-testnet" } # SDK. -module-evm = { git = "https://github.com/oasisprotocol/oasis-sdk", tag = "runtime-sdk/v0.10.0", package = "oasis-runtime-sdk-evm" } -oasis-runtime-sdk = { git = "https://github.com/oasisprotocol/oasis-sdk", tag = "runtime-sdk/v0.10.0" } +module-evm = { git = "https://github.com/oasisprotocol/oasis-sdk", branch = "kostko/feature/sr25519-sign", package = "oasis-runtime-sdk-evm" } +oasis-runtime-sdk = { git = "https://github.com/oasisprotocol/oasis-sdk", branch = "kostko/feature/sr25519-sign" } # Third party. once_cell = "1.8.0" diff --git a/runtime/Makefile b/runtime/Makefile index c123de94..bd0998e0 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -10,7 +10,7 @@ pull: docker pull $(SAPPHIRE_DEV_DOCKER) debug: build-debug - docker run --rm -ti -p8545:8545 -p8546:8546 -v $(ROOT_DIR)/target/debug/sapphire-paratime:/runtime.elf $(SAPPHIRE_DEV_DOCKER) -test-mnemonic -n 4 + docker run --rm -ti -p8545:8545 -p8546:8546 -v $(ROOT_DIR)/target/debug/sapphire-paratime:/ronl.elf $(DOCKER_EXTRA_ARGS) $(SAPPHIRE_DEV_DOCKER) -test-mnemonic -n 4 clean: cargo clean