Skip to content

Commit

Permalink
Merge branch 'main' into feature/zkprogram-value-inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Trivo25 committed Feb 6, 2025
2 parents 5af2f00 + c824001 commit 5cf301f
Show file tree
Hide file tree
Showing 20 changed files with 714 additions and 227 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,24 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [Unreleased](https://github.com/o1-labs/o1js/compare/b857516...HEAD)

### Added

- `setFee` and `setFeePerSnarkCost` for `Transaction` and `PendingTransaction` https://github.com/o1-labs/o1js/pull/1968
- Doc comments for various ZkProgram methods https://github.com/o1-labs/o1js/pull/1974
- `MerkleList.popOption()` for popping the last element and also learning if there was one https://github.com/o1-labs/o1js/pull/1997
- Added custom header support for `Fetch` methods such as `fetchEvents`, `fetchActions` etc. and to `Mina` instance. Also added two new methods `setMinaDefaultHeaders` and `setArchiveDefaultHeaders` https://github.com/o1-labs/o1js/pull/2004

### Changed

- Sort order for actions now includes the transaction sequence number and the exact account id sequence https://github.com/o1-labs/o1js/pull/1917
- Updated typedoc version for generating docs https://github.com/o1-labs/o1js/pull/1973
- Enable to pass normal JS values (e.g., `bigint` instead of `Field`) to ZkProgram provers https://github.com/o1-labs/o1js/pull/1934
- Also improves the supported JS values for a few important types like `Signature` and `UIntX`
- ECDSA `verifySignedHash()` accepts hash `Bytes` directly for easy use with alternative hash functions https://github.com/o1-labs/o1js/pull/2005

### Fixed

- Fix behavior of `initializeBindings()` when called concurrently, to improve error messages in common failure scenarios https://github.com/o1-labs/o1js/pull/1996
- Fix `ZkProgram` public input/output types https://github.com/o1-labs/o1js/pull/1998

## [2.2.0](https://github.com/o1-labs/o1js/compare/e1bac02...b857516) - 2024-12-10

Expand Down Expand Up @@ -377,7 +387,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- `Reducer.reduce()` requires the maximum number of actions per method as an explicit (optional) argument https://github.com/o1-labs/o1js/pull/1450
- The default value is 1 and should work for most existing contracts
- `new UInt64()` and `UInt64.from()` no longer unsafely accept a field element as input. https://github.com/o1-labs/o1js/pull/1438 [@julio4](https://github.com/julio4)
As a replacement, `UInt64.Unsafe.fromField()` was introduced
As a replacement, `UInt64.Unsafe.fromField()` was introduced
- This prevents you from accidentally creating a `UInt64` without proving that it fits in 64 bits
- Equivalent changes were made to `UInt32`
- Fixed vulnerability in `Field.to/fromBits()` outlined in [#1023](https://github.com/o1-labs/o1js/issues/1023) by imposing a limit of 254 bits https://github.com/o1-labs/o1js/pull/1461
Expand Down
2 changes: 1 addition & 1 deletion README-nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Alternatively, try this change in the `src/mina/flake.nix` file:
```
- devShellPackages = with pkgs; [ rosetta-cli wasm-pack nodejs binaryen ];
+ devShellPackages = with pkgs; [ rosetta-cli wasm-pack nodejs binaryen cargo libiconvI];
+ devShellPackages = with pkgs; [ rosetta-cli wasm-pack nodejs binaryen cargo libiconv];
```
### wasm32-unknown-unknown
Expand Down
22 changes: 22 additions & 0 deletions src/examples/crypto/ecdsa/ecdsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
createForeignCurve,
Bool,
Bytes,
Hash,
} from 'o1js';

export { keccakAndEcdsa, ecdsa, Secp256k1, Ecdsa, Bytes32, ecdsaEthers };
Expand Down Expand Up @@ -62,3 +63,24 @@ const ecdsaEthers = ZkProgram({
},
},
});

/**
* We can also use a different hash function with ECDSA, like SHA-256.
*/
const sha256AndEcdsa = ZkProgram({
name: 'ecdsa-sha256',
publicInput: Bytes32,
publicOutput: Bool,

methods: {
verifyEcdsa: {
privateInputs: [Ecdsa, Secp256k1],
async method(message: Bytes32, signature: Ecdsa, publicKey: Secp256k1) {
let messageHash = Hash.SHA2_256.hash(message);
return {
publicOutput: signature.verifySignedHash(messageHash, publicKey),
};
},
},
},
});
Loading

0 comments on commit 5cf301f

Please sign in to comment.