-
Notifications
You must be signed in to change notification settings - Fork 109
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
Blocking SnarkyJS CI tests #997
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5444bc6
type import changes for no ts build
mitschabaude fc747ca
run examples without requiring ts build
mitschabaude 07743b8
port inductive proofs example
mitschabaude f854fe5
add script to run minimal snarkyjs tests
mitschabaude 3455bb4
minor
mitschabaude 95aa588
use smaller example in test
mitschabaude 34af4ca
add a script to copy files
mitschabaude 7062619
simplify
mitschabaude b9cd382
delete pointless file
mitschabaude 5177ecd
clean up some build logic
mitschabaude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ tests/report/ | |
tests/test-artifacts/ | ||
profiling.md | ||
snarkyjs-reference | ||
*.tmp.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
./run src/tests/inductive-proofs-small.ts --bundle |
Submodule bindings
updated
from e70968 to 020284
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// copy compiled jsoo/wasm artifacts from a folder in the source tree to the folder where they are imported from | ||
// (these are not the same folders so that we don't automatically pollute the source tree when rebuilding artifacts) | ||
import { copyFromTo } from './utils.js'; | ||
|
||
await copyFromTo( | ||
['src/bindings/compiled/node_bindings/'], | ||
'node_bindings', | ||
'_node_bindings' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// copy some files from /src to /dist/node that tsc doesn't copy because we have .d.ts files for them | ||
import { copyFromTo } from './utils.js'; | ||
|
||
await copyFromTo( | ||
['src/snarky.d.ts', 'src/bindings/compiled/_node_bindings'], | ||
'src/', | ||
'dist/node/' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import fse from 'fs-extra'; | ||
|
||
export { copyFromTo }; | ||
|
||
function copyFromTo(files, srcDir = undefined, targetDir = undefined) { | ||
return Promise.all( | ||
files.map((source) => { | ||
let target = source.replace(srcDir, targetDir); | ||
return fse.copy(source, target, { | ||
recursive: true, | ||
overwrite: true, | ||
dereference: true, | ||
}); | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { | ||
SelfProof, | ||
Field, | ||
Experimental, | ||
isReady, | ||
shutdown, | ||
Proof, | ||
} from '../index.js'; | ||
import { tic, toc } from '../examples/zkapps/tictoc.js'; | ||
|
||
await isReady; | ||
|
||
let MaxProofsVerifiedOne = Experimental.ZkProgram({ | ||
publicInput: Field, | ||
|
||
methods: { | ||
baseCase: { | ||
privateInputs: [], | ||
|
||
method(publicInput: Field) { | ||
publicInput.assertEquals(Field(0)); | ||
}, | ||
}, | ||
|
||
mergeOne: { | ||
privateInputs: [SelfProof], | ||
|
||
method(publicInput: Field, earlierProof: SelfProof<Field, undefined>) { | ||
earlierProof.verify(); | ||
earlierProof.publicInput.add(1).assertEquals(publicInput); | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
tic('compiling program'); | ||
await MaxProofsVerifiedOne.compile(); | ||
toc(); | ||
|
||
await testRecursion(MaxProofsVerifiedOne, 1); | ||
|
||
async function testRecursion( | ||
Program: typeof MaxProofsVerifiedOne, | ||
maxProofsVerified: number | ||
) { | ||
console.log(`testing maxProofsVerified = ${maxProofsVerified}`); | ||
|
||
let ProofClass = Experimental.ZkProgram.Proof(Program); | ||
|
||
tic('executing base case'); | ||
let initialProof = await Program.baseCase(Field(0)); | ||
toc(); | ||
initialProof = testJsonRoundtrip(ProofClass, initialProof); | ||
initialProof.verify(); | ||
initialProof.publicInput.assertEquals(Field(0)); | ||
|
||
if (initialProof.maxProofsVerified != maxProofsVerified) { | ||
throw Error( | ||
`Expected initialProof to have maxProofsVerified = ${maxProofsVerified} but has ${initialProof.maxProofsVerified}` | ||
); | ||
} | ||
|
||
let p1; | ||
if (initialProof.maxProofsVerified === 0) return; | ||
|
||
tic('executing mergeOne'); | ||
p1 = await Program.mergeOne(Field(1), initialProof); | ||
toc(); | ||
p1 = testJsonRoundtrip(ProofClass, p1); | ||
p1.verify(); | ||
p1.publicInput.assertEquals(Field(1)); | ||
if (p1.maxProofsVerified != maxProofsVerified) { | ||
throw Error( | ||
`Expected p1 to have maxProofsVerified = ${maxProofsVerified} but has ${p1.maxProofsVerified}` | ||
); | ||
} | ||
} | ||
|
||
function testJsonRoundtrip(ProofClass: any, proof: Proof<Field, void>) { | ||
let jsonProof = proof.toJSON(); | ||
console.log( | ||
'json roundtrip', | ||
JSON.stringify({ ...jsonProof, proof: jsonProof.proof.slice(0, 10) + '..' }) | ||
); | ||
return ProofClass.fromJSON(jsonProof); | ||
} | ||
|
||
shutdown(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should this be explicit? I think we want to have to change things if the backend changes, right?