diff --git a/.vscode/settings.json b/.vscode/settings.json index cefe785..91b8f60 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,7 @@ "source.fixAll.eslint": "explicit" }, "eslint.format.enable": true, - "eslint.workingDirectories": [{ "pattern": "./*" }] + "eslint.workingDirectories": [{ "pattern": "./*" }], + "rust-analyzer.procMacro.enable": true } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b64df9..01cf765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.4.8 - 2024-09-12 + +- Expose `commitToScalars` in public API. #[60](https://github.com/ethereumjs/verkle-cryptography-wasm/pull/60) + ## 0.4.7 - 2024-09-10 - Add better API for `createProof`/`verifyProof` and expanded tests #[57](https://github.com/ethereumjs/verkle-cryptography-wasm/pull/57) diff --git a/package-lock.json b/package-lock.json index fc2ff8b..550a4e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "verkle-cryptography-wasm", - "version": "0.4.7", + "version": "0.4.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "verkle-cryptography-wasm", - "version": "0.4.7", + "version": "0.4.8", "license": "MIT/Apache", "dependencies": { "@scure/base": "^1.1.5" diff --git a/package.json b/package.json index 315e4ff..5c60b8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "verkle-cryptography-wasm", - "version": "0.4.7", + "version": "0.4.8", "description": "Verkle Trie Crytography WASM/TypeScript Bindings", "keywords": [ "ethereum", diff --git a/src.ts/index.ts b/src.ts/index.ts index 55f17fd..92ac8bf 100644 --- a/src.ts/index.ts +++ b/src.ts/index.ts @@ -7,6 +7,7 @@ import { verifyExecutionWitnessPreState as verifyExecutionWitnessPreStateBase, createProof as createProofBase, verifyProof as verifyProofBase, + commitToScalars as commitToScalarsBase, type ProverInput as ProverInputBase, type VerifierInput as VerifierInputBase, } from './verkleFFIBindings/index.js' @@ -43,7 +44,9 @@ export const loadVerkleCrypto = async () => { const createProof = (proverInputs: ProverInput[]) => createProofBase(verkleFFI, proverInputs) const verifyProof = (proof: Uint8Array, verifierInputs: VerifierInput[]) => verifyProofBase(verkleFFI, proof, verifierInputs) + const commitToScalars = (vector: Uint8Array[]) => commitToScalarsBase(verkleFFI, vector) return { + commitToScalars, getTreeKey, getTreeKeyHash, updateCommitment, diff --git a/src.ts/verkleFFIBindings/index.ts b/src.ts/verkleFFIBindings/index.ts index 549b18a..8e41b03 100644 --- a/src.ts/verkleFFIBindings/index.ts +++ b/src.ts/verkleFFIBindings/index.ts @@ -5,6 +5,7 @@ import { } from '../wasm/rust_verkle_wasm.js' import { + commitToScalars, getTreeKey, getTreeKeyHash, updateCommitment, @@ -15,6 +16,7 @@ import { } from './verkleFFI.js' export { + commitToScalars, initVerkleWasm, getTreeKey, getTreeKeyHash, diff --git a/src.ts/verkleFFIBindings/verkleFFI.ts b/src.ts/verkleFFIBindings/verkleFFI.ts index 41048b3..daf6431 100644 --- a/src.ts/verkleFFIBindings/verkleFFI.ts +++ b/src.ts/verkleFFIBindings/verkleFFI.ts @@ -178,3 +178,13 @@ function serializeVerifierInputs(proof: Uint8Array, verifierInputs: VerifierInpu return concatBytes(...serializedVerifierInputs) } + +/** + * + * @param verkleFFI The interface to the WASM verkle crypto object + * @param vector an array of Uint8Arrays to be committed to (must be 32 bytes each) + * @returns a 64 byte {@link Uint8Array} uncompressed commitment to the {@link vector} of values + */ +export const commitToScalars = (verkleFFI: VerkleFFI, vector: Uint8Array[]) => { + return verkleFFI.commitToScalars(vector) +} \ No newline at end of file