Skip to content

Commit

Permalink
🚧 initializing proving pipeline scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdelStark committed Jan 17, 2025
1 parent a132941 commit 6a948b8
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ Cargo.lock

.ai

**/.DS_Store
**/.DS_Store

outputs
13 changes: 13 additions & 0 deletions packages/aggsig_checker/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ edition = "2024_07"
[dependencies]
alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git" }

[lib]
casm = true

[cairo]
enable-gas = true
sierra-replace-ids = true

[dev-dependencies]
cairo_test = "2.9.2"

[profile.proving]
inherits = "release"

[profile.proving.cairo]
enable-gas = false
sierra-replace-ids = true
57 changes: 57 additions & 0 deletions scripts/aggsig_checker_prove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

################################################################################
# Congiguration
################################################################################
readonly LAYOUT=starknet
readonly PROFILE=proving
readonly PROGRAM_DIR="packages/aggsig_checker/target/proving"
readonly PROGRAM_NAME=aggsig_checker
readonly CFG_AND_PARAMS_DIR=config_and_params
readonly TRACE_OUTPUT_DIR=outputs/$PROGRAM_NAME/trace
readonly PIE_OUTPUT_DIR=outputs/$PROGRAM_NAME/pie
readonly PROOF_OUTPUT_DIR=outputs/$PROGRAM_NAME/proof
readonly CAIRO_RUN_BIN="cairo1-run"
readonly STWO_PROVER_BIN="adapted_stwo"

readonly PROGRAM_ARGS="[251912467096364154057891175458070492549 260939768651009451376603063044198637691 77051329489827983386539320026376488593 143855497612595372087158556956488272703 188623336253429538540807746188656707437 287350745678731217637630315430431928781 223834982005398908649898595952193718522 280017917956868261785908066628339915890]"

mkdir -p $PROOF_OUTPUT_DIR
mkdir -p $PIE_OUTPUT_DIR
mkdir -p $TRACE_OUTPUT_DIR


################################################################################
# Build the Cairoprogram
################################################################################
cd packages/aggsig_checker
scarb --profile $PROFILE build
cd ../..

################################################################################
# Generate the Cairo-Pie
################################################################################
#echo "Generating Cairo-Pie"
CMD="$CAIRO_RUN_BIN $PROGRAM_DIR/$PROGRAM_NAME.sierra.json \
--layout=$LAYOUT \
--args \"$PROGRAM_ARGS\"
--cairo_pie_output=$PIE_OUTPUT_DIR/cairo-pie.zip"
echo $CMD
eval $CMD

################################################################################
#echo "Generating Trace"
#$CAIRO_RUN_BIN $PROGRAM_DIR/$PROGRAM_NAME.sierra.json \
# --args "$PROGRAM_ARGS" \
# --layout=$LAYOUT \
# --air_public_input=$TRACE_OUTPUT_DIR/public-input.json \
# --air_private_input=$TRACE_OUTPUT_DIR/private-input.json \
# --trace_file=$TRACE_OUTPUT_DIR/trace.bin \
# --memory_file=$TRACE_OUTPUT_DIR/memory.bin \
# --proof_mode

################################################################################
# Generate the Proof
################################################################################
#echo "Generating Proof"
#$STWO_PROVER_BIN --pub_json $TRACE_OUTPUT_DIR/public-input.json --priv_json $TRACE_OUTPUT_DIR/private-input.json --proof_path stwo-proof.json --verify
7 changes: 7 additions & 0 deletions scripts/sample_aggsig_checker_scarb_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cd packages/aggsig_checker

scarb cairo-run '[[176683710998859414156510166937075682067, 55187569459576321201976262906450820100, 103018626115879340940156672162587808532, 283354871996071695367827140893070637678, 323217734837204111194663387748061068920, 227025623678857638419828685269652196105, 248550569182882525011147985680794684321, 185543153997424577621662074306385317717, 321683181709118817039983274483047669288, 42267025566013959189042772957622143536, 282186115298669849357680718271515504871, 74174979888019477146628241660990578076, 59647002998893167551541406592639228912, 2006891320325329638218477292538078621, 248154017807703263357493592649212850954, 138381720657927309985284544519345575170, 148744588917840615261243811741857149882, 141057244195168382099210133920701844279, 291637480240667569555617862015067958764, 172212438602713169846304280867936812536, 88429217285425834469386952984750135301, 90052632381617690862779709172506843696, 233392539768451385485249988684194332743, 101804211845475116355471365414992813389, 92983453126315756573839316488494459457, 304029299067133961475684666102307849076, 115084866868023324550197233398671227093, 197423518168374585955573128099435834144, 194841870855722186227759052141720851681, 73577160656722067792100540469977161511, 2088651611370386202002342597673718576, 284983010337460821007801615210775795912, 73084152721846261111523505766542303558, 302929169992816324987631466772485047158, 163740857613635257857843842454099133654, 230602618326603246476548111457076398961, 330772702377428670323154472141838142230, 14678431222878906837115936589921444183, 49781217625623672968224497405635330381, 322537656097823987191993233738681635250, 151310156318545578016728589367446683544, 70476916596863831898524842113557855620, 201250895240336970866539305310609928036, 179228454669919827490109329616350333969, 48182982213257889923285056432722851796, 145055406951144615028388819558450611288, 317397708672856206902605444996773346595, 235070250494603010185293028303066833835, 156626351406083014087155295048858249473, 194135234188444802015657376368707850664, 14618163030964347062724469490814573817, 260250062083395098846423086586986987459, 83379332393104322399885644580430438870, 108748044103738873209707679419720982353, 28123546126348923084577046862350787689, 45322461631575825062745449440415915633, 272808406049168894359289587857342757946, 200215864395889144396989066965555611141, 28025254197471244353835872492685275633, 158647387444647495036779217787554847392, 101142118930602222165033063086114221502, 317329501206013545764574548054029599868, 324228049811937954352138425464639346016, 325980195984253045469140785504501301934, 46168404813516151502387599086788265824, 47510472652967433254792195482765073385, 207749091307363032751985061586513009913, 295472677552297121268755157613551039728, 201658199759824870878721787571043829542, 158199959246644099136717980403747113287, 163601168516338991014873144090873564374, 100361580049423788988240629845819539119, 281895563799455251887779182869662140884, 107315608079932796946067580753363820390, 237294227831679206904235037008295761021, 21448701622860211280096664177695857508, 210006471634380156694855553190513986199, 194346227992696867026405517996421438796, 153302712486214439850652939848040274081, 249226732206589138701277795792159629154]]'

cd ../..
4 changes: 3 additions & 1 deletion scripts/verify_nostr_event_batch_signatures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Generate Nostr event data
cd apps/aggsig_checker_cli
echo "Generating Nostr event data"
npm run start
cd ../..

Expand Down Expand Up @@ -47,7 +48,8 @@ CMD_ARGS="'[[${EVENTS_ARRAY}]]'"
CMD="${CMD_PREFIX} ${CMD_ARGS}"

cd packages/aggsig_checker
echo "Running command: ${CMD}"
#echo "Running command: ${CMD}"
echo "Running Cairo program"
# Run the command
eval ${CMD}
cd ../..

0 comments on commit 6a948b8

Please sign in to comment.