mirror of
https://github.com/chancehudson/circom-stark.git
synced 2026-01-08 21:38:05 -05:00
refactor: switch to goldilocks curve
This commit is contained in:
@@ -29,8 +29,10 @@ jobs:
|
||||
name: Fetch rstark wasm
|
||||
command: |
|
||||
cd ..
|
||||
wget https://github.com/vimwitch/rstark/releases/download/alpha-1/rstark.tar.gz
|
||||
wget https://github.com/vimwitch/rstark/releases/download/alpha-1-goldilocks/rstark.tar.gz
|
||||
tar -xzf rstark.tar.gz
|
||||
mkdir rstark
|
||||
mv pkg rstark
|
||||
- run:
|
||||
name: Install Packages
|
||||
command: npm i
|
||||
|
||||
@@ -3,9 +3,14 @@ import { MultiPolynomial } from 'starkstark/src/MultiPolynomial.mjs'
|
||||
import { Polynomial } from 'starkstark/src/Polynomial.mjs'
|
||||
import { ScalarField } from 'starkstark/src/ScalarField.mjs'
|
||||
|
||||
// export const field = new ScalarField(
|
||||
// 1n + 407n * (1n << 119n), // 0xCB800000000000000000000000000001
|
||||
// 85408008396924667383611388730472331217n
|
||||
// )
|
||||
|
||||
export const field = new ScalarField(
|
||||
1n + 407n * (1n << 119n), // 0xCB800000000000000000000000000001
|
||||
85408008396924667383611388730472331217n
|
||||
18446744069414584321n,
|
||||
2717n
|
||||
)
|
||||
|
||||
// compile an assembly file to a set of STARK constraints
|
||||
|
||||
BIN
test/epochKeyLite_main.r1cs
Normal file
BIN
test/epochKeyLite_main.r1cs
Normal file
Binary file not shown.
Binary file not shown.
@@ -13,6 +13,26 @@ function serializeBigint(v) {
|
||||
return out
|
||||
}
|
||||
|
||||
test.skip('should compile and prove unirep epoch key r1cs', async t => {
|
||||
const input = Array(7).fill(2n)
|
||||
const asm = await compileR1cs('test/epochKeyLite_main.r1cs', input)
|
||||
const compiled = compile(asm)
|
||||
const trace = buildTrace(compiled.program)
|
||||
const proof = wasm.prove({
|
||||
transition_constraints: compiled.constraints.map(v => v.serialize()),
|
||||
boundary: compiled.boundary.map(v => [v[0], v[1], serializeBigint(v[2])]),
|
||||
trace: trace.map(t => t.map(v => serializeBigint(v))),
|
||||
})
|
||||
wasm.verify(proof, {
|
||||
trace_len: trace.length,
|
||||
register_count: compiled.program.registerCount,
|
||||
transition_constraints: compiled.constraints.map(v => v.serialize()),
|
||||
boundary: compiled.boundary.map(v => [v[0], v[1], serializeBigint(v[2])]),
|
||||
})
|
||||
|
||||
t.pass()
|
||||
})
|
||||
|
||||
test('should compile and prove r1cs', async t => {
|
||||
const input = [
|
||||
12n,
|
||||
|
||||
Reference in New Issue
Block a user