Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main into v2 #1873

Merged
merged 109 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 108 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
c1e8d6e
add missing exports
mitschabaude Sep 23, 2024
c142de6
first pass
45930 Sep 24, 2024
89f774a
progress
45930 Sep 25, 2024
45a0fca
error in transfer function
45930 Sep 25, 2024
b106b5d
sloppy version working
45930 Sep 25, 2024
d37fcc0
Update mina version
volhovm Sep 30, 2024
6c4ec79
Regenerate bindings
volhovm Sep 30, 2024
d0eeee2
rm log lines, add multi-instance test
45930 Oct 1, 2024
a445be2
better names and descriptions
45930 Oct 1, 2024
1feb7b4
small cleanups
45930 Oct 1, 2024
a6ad3a5
Merge branch 'main' into 2024-09-refactor-offchain-state
45930 Oct 1, 2024
4674be6
point to bindings
Trivo25 Oct 1, 2024
b062cc5
Merge pull request #1835 from o1-labs/volhovm/arkworks024-regression-…
volhovm Oct 1, 2024
bf0e09e
demo the cleaner API
45930 Oct 1, 2024
dfce473
split out feature flags and proof into their own files
mitschabaude Oct 2, 2024
e5f0bf4
Merge branch 'feature/type-exports' into feature/provable-proofs
mitschabaude Oct 2, 2024
6017d63
prune imports
mitschabaude Oct 2, 2024
e255dcb
Merge pull request #1846 from o1-labs/feature/provable-proofs
mitschabaude Oct 2, 2024
4884e10
attach .provable to proof
mitschabaude Oct 2, 2024
1d2111f
add unit test
mitschabaude Oct 2, 2024
2c54719
minor unit test change
mitschabaude Oct 2, 2024
a10e6dc
remove special-casing between proofs and other types
mitschabaude Oct 2, 2024
8a4038d
store proofs and others in a single list
mitschabaude Oct 2, 2024
3e17207
adapt method interface in unit test
mitschabaude Oct 3, 2024
c6ba3c3
fix getting prev proofs
mitschabaude Oct 3, 2024
b63cb7b
improve error feedback in zkapp test runner for proving errors
mitschabaude Oct 3, 2024
5277324
Merge pull request #1847 from o1-labs/feature/provable-proofs-2
mitschabaude Oct 3, 2024
af307e1
simplification 1: don't store proofs in separate list
mitschabaude Oct 3, 2024
8037bb0
simplification 2: remove isProof flag
mitschabaude Oct 3, 2024
29e1448
unit tests
mitschabaude Oct 3, 2024
c978754
Added method to retrieve dummy VerificationKey
rpanic Oct 3, 2024
c661f69
we can filter proofs from values, without types
mitschabaude Oct 3, 2024
05e4c26
recursively extract proofs
mitschabaude Oct 3, 2024
6007f63
add changelog
Trivo25 Oct 4, 2024
8ceca5e
initialize bindings
Trivo25 Oct 4, 2024
ca9bb88
replace occurrence of old dummy vk
Trivo25 Oct 4, 2024
0f9525f
extract nested proof inputs in pickles rule
mitschabaude Oct 4, 2024
9d4a17e
unit test for nested proof extraction
mitschabaude Oct 4, 2024
27b07d5
test recursive proving (negative + positive)
mitschabaude Oct 4, 2024
cb09374
achieve proper intellisense
mitschabaude Oct 4, 2024
0df8bcd
negative test for > max proofs
mitschabaude Oct 4, 2024
0cd022d
Merge pull request #1852 from rpanic/rpanic/expose-dummy-vk
Trivo25 Oct 4, 2024
055aab3
expose extremely useful utility method
mitschabaude Oct 4, 2024
8bfbaab
remove some mini-abstractions that are only used once
mitschabaude Oct 4, 2024
480cfc2
unrelated: enable detecting struct at runtime
mitschabaude Oct 4, 2024
3616cc8
changelog
mitschabaude Oct 4, 2024
a140dfa
Merge branch 'main' into feature/provable-proofs-3
mitschabaude Oct 4, 2024
ea19655
remove unused method
mitschabaude Oct 4, 2024
59a6c58
Merge pull request #1851 from o1-labs/feature/provable-proofs-3
mitschabaude Oct 5, 2024
7e1cdd3
Fixed fetch() behaviour in regards to custom token contracts
rpanic Oct 7, 2024
4df6e36
Update bindings for safe lagrange basis
mrmr1993 Oct 8, 2024
67b3e38
Fix typechecking of main
mrmr1993 Oct 8, 2024
66f9c64
add unit test of fix
45930 Oct 9, 2024
fdcb8b6
export a few utility types
mitschabaude Oct 10, 2024
80fcc08
expose arrayGet
mitschabaude Oct 10, 2024
d75cf6c
Update CHANGELOG.md
Trivo25 Oct 10, 2024
2635545
expose bytes base class
mitschabaude Oct 10, 2024
0f8ff81
Merge pull request #1853 from rpanic/fix/state-fetch-token
Trivo25 Oct 10, 2024
a27a6ca
improve packed
mitschabaude Oct 10, 2024
6bcbdf7
mapValue
mitschabaude Oct 10, 2024
9e539b5
nice value type for packed
mitschabaude Oct 10, 2024
90a8822
fixup
mitschabaude Oct 11, 2024
7b62ad1
expose sha2 padding and fix input mutation in compression
mitschabaude Oct 11, 2024
0384736
export tupleN
mitschabaude Oct 11, 2024
8e3ac5e
uint32 to./from bytes
mitschabaude Oct 11, 2024
ecc4b03
remove duplication
mitschabaude Oct 11, 2024
ee52796
handle out of bounds
mitschabaude Oct 11, 2024
46e7a8c
update mina and bindings
45930 Oct 14, 2024
d057138
revert type changes
45930 Oct 14, 2024
3bbb4f9
updated changelog
45930 Oct 14, 2024
d5994ba
1.8.1
actions-user Oct 15, 2024
b4d22e7
Update CHANGELOG for new version v1.8.1
actions-user Oct 15, 2024
f15293a
Merge pull request #1857 from o1-labs/feature/fix-compilation-of-main
45930 Oct 15, 2024
ceaa80f
Merge branch 'main' into release/v1.8.1
Trivo25 Oct 15, 2024
85a650f
fix version
Trivo25 Oct 15, 2024
aa37fd9
bump playwright
Trivo25 Oct 15, 2024
dd5e6a1
Merge pull request #1866 from o1-labs/fix-ci-playwright
Trivo25 Oct 15, 2024
39be181
Merge branch 'main' into release/v1.8.1
Trivo25 Oct 15, 2024
a0900ae
Merge pull request #1865 from o1-labs/release/v1.8.1
Trivo25 Oct 15, 2024
a40b888
create changelog workflow
Trivo25 Oct 16, 2024
70b22cd
Merge pull request #1867 from o1-labs/force-changelog-entry
Trivo25 Oct 16, 2024
97e5130
Merge pull request #1860 from zksecurity/feature/provable-proofs-4
Trivo25 Oct 16, 2024
57642f2
Merge branch 'main' into 2024-09-refactor-offchain-state
45930 Oct 16, 2024
78a23d7
PR comments
45930 Oct 16, 2024
1219a26
undelete changelog!
45930 Oct 16, 2024
ef3f7f8
refactor test file into directory
45930 Oct 16, 2024
f5a3f1d
Merge pull request #1834 from o1-labs/2024-09-refactor-offchain-state
45930 Oct 17, 2024
6f50045
include the type OffchainStateInstance in the internal API
Oct 17, 2024
b4847d2
rm nonsense
Oct 17, 2024
fc16ce3
Merge pull request #1871 from o1-labs/2024-10-fix-offchain-state-typing
45930 Oct 17, 2024
17c658f
Merge branch 'main' into merge-main-v2-1
Trivo25 Oct 18, 2024
5eb9bcb
fix test
Trivo25 Oct 18, 2024
33b7c6a
update changelog; remove deprecated functions; replace with new ones;…
Trivo25 Oct 18, 2024
8e8cf88
fix getUnconstrained
Trivo25 Oct 18, 2024
da665b0
dump vk
Trivo25 Oct 18, 2024
95d1b1b
build fix for lagrange basis performance
Oct 18, 2024
fa3e1ef
adding a unit test
Oct 19, 2024
7958bda
updating changelog and adding comment to unit test
Oct 21, 2024
44eb218
Merge pull request #1874 from o1-labs/2024-10-bugfix-lb-performance
45930 Oct 21, 2024
7e93948
update package json
45930 Oct 21, 2024
c56ba60
release 1.9.1
45930 Oct 21, 2024
3f26345
Merge branch 'main' into merge-main-v2-1
Trivo25 Oct 21, 2024
9145722
changelog
Trivo25 Oct 21, 2024
ad774e1
Merge pull request #1880 from o1-labs/release/v1.9.1
45930 Oct 21, 2024
50c52b5
bindngs
Trivo25 Oct 21, 2024
212f778
fix test
Trivo25 Oct 21, 2024
26442a9
Merge branch 'main' into merge-main-v2-1
Trivo25 Oct 21, 2024
fde3f0c
merge changelog
Trivo25 Oct 21, 2024
cd20ace
typo
Trivo25 Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/changelog-entry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check Changelog for changes
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
jobs:
Check-Changelog:
name: Check Changelog Action
runs-on: ubuntu-20.04
steps:
- uses: tarides/changelog-check-action@v2
with:
changelog: CHANGELOG.md
41 changes: 0 additions & 41 deletions CHANGELOG-v2.md

This file was deleted.

57 changes: 54 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,70 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
_Security_ in case of vulnerabilities.
-->

## [Unreleased](https://github.com/o1-labs/o1js/compare/450943...HEAD)
## [Unreleased](https://github.com/o1-labs/o1js/compare/7e9394...HEAD)

## [2.0.0](https://github.com/o1-labs/o1js/compare/f15293a69...HEAD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NIT]

I think this compare should use 7e9394 as the base, rather than f15293a69 which comes from v1.9.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Still need to shuffle commits around, I'll pick the final commit in a separate release PR


### Breaking Changes
Trivo25 marked this conversation as resolved.
Show resolved Hide resolved

- The `divMod32()` gadget was modified to accept `nBits` instead of `quotientBits`, and assert it is in the range [0, 2\*\*255) to address an issue previously where the bound on `quotientBits` was too low https://github.com/o1-labs/o1js/pull/1763.
- `Provable.equal()` now turns both types into canonical form before comparing them https://github.com/o1-labs/o1js/pull/1759
- Removed implicit version `Provable.equal(x, y)` where you didn't have to pass in the type
- The return signature of a zkProgram has changed. https://github.com/o1-labs/o1js/pull/1809
- A zkProgram method must now explicitly define the return type of the method when the method has a public or auxiliary output defined.
- The return type of a proven method has changed as a result of this.
- Various breaking constraint changes in internal methods or circuits because of audit fix.
- Removal of various deprecated methods and functions.
- Promotion of various methods and functions to stable as part of change.
- A slightly modified encryption and decryption algorithm. https://github.com/o1-labs/o1js/pull/1729
- Promotion of `TokenContractV2` to `TokenContract` with a correct amount of maximum account updates.

### Added

- `zkProgram` methods now support `auxiliaryOutput`. https://github.com/o1-labs/o1js/pull/1809
Trivo25 marked this conversation as resolved.
Show resolved Hide resolved
- Each program method now accepts an optional property `auxiliaryOutput`
- Auxiliary output is additional output that the zkProgram method returns
- New method `toCanonical()` in the `Provable<T>` interface to protect against incompleteness of certain operations on malicious witness inputs https://github.com/o1-labs/o1js/pull/1759
- `divMod64()` division modulo 2^64 that returns the remainder and quotient of the operation
- `addMod64()` addition modulo 2^64
- Bitwise OR via `{UInt32, UInt64}.or()`
- **BLAKE2B hash function** gadget [#1285](https://github.com/o1-labs/o1js/pull/1285)

## [1.9.1](https://github.com/o1-labs/o1js/compare/f15293a69...7e9394) - 2024-10-15

### Fixes

- Performance regression when compiling recursive circuits is fixed https://github.com/o1-labs/o1js/pull/1874
- Decouple offchain state instances from their definitions https://github.com/o1-labs/o1js/pull/1834

## [1.9.0](https://github.com/o1-labs/o1js/compare/450943...f15293a69) - 2024-10-15
Trivo25 marked this conversation as resolved.
Show resolved Hide resolved

### Added

- Added `VerificationKey.dummy()` method to get the dummy value of a verification key https://github.com/o1-labs/o1js/pull/1852 [@rpanic](https://github.com/rpanic)

### Changed

- Make `Proof` a normal provable type, that can be witnessed and composed into Structs https://github.com/o1-labs/o1js/pull/1847, https://github.com/o1-labs/o1js/pull/1851
- ZkProgram and SmartContract now also support private inputs that are not proofs themselves, but contain proofs nested within a Struct or array
- Only `SelfProof` can still not be nested because it needs special treatment

### Fixes

- Fix verification of serialized proofs done before compiling any circuits https://github.com/o1-labs/o1js/pull/1857

## [1.8.0](https://github.com/o1-labs/o1js/compare/5006e4f...450943) - 2024-09-18

### Added

- Added `verifyEthers` method to verify Ethereum signatures using the EIP-191 message hashing standard https://github.com/o1-labs/o1js/pull/1815
- Added `verifyEthers` method to verify Ethereum signatures using the EIP-191 message hashing standard. https://github.com/o1-labs/o1js/pull/1815
- Added `fromEthers` method for parsing and converting Ethereum public keys into `ForeignCurve` points, supporting both compressed and uncompressed formats.
- Added `fromHex` method for converting hexadecimal strings into `ForeignCurve` points.

### Fixes

- Fix incorrect behavior of optional proving for zkPrograms where `myProgram.setProofsEnabled(false)` wouldn't work when called before `myProgram.compile()` https://github.com/o1-labs/o1js/pull/1827
- Fix incorrect behavior of optional proving for zkPrograms where `myProgram.setProofsEnabled(false)` wouldn't work when called before `myProgram.compile()`. https://github.com/o1-labs/o1js/pull/1827
- Fix incorrect behavior of `state.fetch()` for custom token contracts. [@rpanic](https://github.com/rpanic) https://github.com/o1-labs/o1js/pull/1853

## [1.7.0](https://github.com/o1-labs/o1js/compare/d6abf1d97...5006e4f) - 2024-09-04

Expand Down
48 changes: 31 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "o1js",
"description": "TypeScript framework for zk-SNARKs and zkApps",
"version": "1.8.0",
"version": "1.9.1",
"license": "Apache-2.0",
"homepage": "https://github.com/o1-labs/o1js/",
"repository": {
Expand Down Expand Up @@ -74,7 +74,7 @@
"devDependencies": {
"@influxdata/influxdb-client": "^1.33.2",
"@noble/hashes": "^1.3.2",
"@playwright/test": "^1.25.2",
"@playwright/test": "^1.48.0",
"@types/isomorphic-fetch": "^0.0.36",
"@types/jest": "^27.0.0",
"@types/node": "^18.14.2",
Expand Down
100 changes: 21 additions & 79 deletions src/examples/encryption.ts
Original file line number Diff line number Diff line change
@@ -1,90 +1,32 @@
import assert from 'assert';
import {
Encryption,
Encoding,
Bytes,
PrivateKey,
Provable,
initializeBindings,
Encryption,
Encoding,
} from 'o1js';

await initializeBindings();

// generate keys
let privateKey = PrivateKey.random();
let publicKey = privateKey.toPublicKey();

// message
let message = 'This is a secret.';
let messageFields = Encoding.stringToFields(message);

// encrypt
let cipherText = Encryption.encrypt(messageFields, publicKey);

// decrypt
let decryptedFields = Encryption.decrypt(cipherText, privateKey);
let decryptedMessage = Encoding.stringFromFields(decryptedFields);

if (decryptedMessage !== message) throw Error('decryption failed');
console.log(`Original message: "${message}"`);
console.log(`Recovered message: "${decryptedMessage}"`);

// the same but in a checked computation

await Provable.runAndCheck(() => {
// encrypt
let cipherText = Encryption.encrypt(messageFields, publicKey);

// decrypt
let decryptedFields = Encryption.decrypt(cipherText, privateKey);

messageFields.forEach((m, i) => {
m.assertEquals(decryptedFields[i]);
});
});

// With a longer message
message = JSON.stringify({
coinbase: {
btc: 40000.0,
eth: 3000.0,
usdc: 1.0,
ada: 1.02,
avax: 70.43,
mina: 2.13,
},
binance: {
btc: 39999.0,
eth: 3001.0,
usdc: 1.01,
ada: 0.99,
avax: 70.21,
mina: 2.07,
},
});
messageFields = Encoding.stringToFields(message);

// encrypt
cipherText = Encryption.encrypt(messageFields, publicKey);

// decrypt
decryptedFields = Encryption.decrypt(cipherText, privateKey);
decryptedMessage = Encoding.stringFromFields(decryptedFields);

if (decryptedMessage !== message) throw Error('decryption failed');
console.log(`Original message: "${message}"`);
console.log(`Recovered message: "${decryptedMessage}"`);

// the same but in a checked computation
class Bytes256 extends Bytes(256) {}
const priv = PrivateKey.random();
const pub = priv.toPublicKey();

await Provable.runAndCheck(() => {
// encrypt
let cipherText = Encryption.encrypt(messageFields, publicKey);
const plainMsg = 'The quick brown fox jumped over the angry dog.';

// decrypt
let decryptedFields = Encryption.decrypt(cipherText, privateKey);
console.log('en/decryption of field elements');
const cipher2 = Encryption.encrypt(Encoding.stringToFields(plainMsg), pub);
const plainText2 = Encryption.decrypt(cipher2, priv);

messageFields.forEach((m, i) => {
m.assertEquals(decryptedFields[i]);
});
});
assert(
Encoding.stringFromFields(plainText2) === plainMsg,
'Plain message and decrypted message are the same'
);

console.log('everything works!');
console.log('en/decryption of bytes');
const message = Bytes256.fromString(plainMsg);
console.log('plain message', plainMsg);
const cipher = Encryption.encryptBytes(message, pub);
const plainText = Encryption.decryptBytes(cipher, priv);
console.log('decrypted message', Buffer.from(plainText.toBytes()).toString());
Loading
Loading