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

feat: better reduce api #1486

Merged
merged 5 commits into from
Sep 6, 2024
Merged

Conversation

tamirhemo
Copy link
Contributor

No description provided.

@@ -0,0 +1,23 @@
use serde::{de::DeserializeOwned, Deserialize, Serialize};

Copy link
Member

Choose a reason for hiding this comment

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

nit: remove empty line

use sp1_stark::{baby_bear_poseidon2::BabyBearPoseidon2, ShardProof, StarkVerifyingKey};
use sp1_stark::{baby_bear_poseidon2::BabyBearPoseidon2, StarkVerifyingKey};

use crate::SP1ReduceProof;

Copy link
Member

Choose a reason for hiding this comment

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

nit: remove empty line

@@ -3,9 +3,11 @@
use std::sync::atomic::AtomicBool;

Copy link
Member

Choose a reason for hiding this comment

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

nit: remove emtpy line

Comment on lines 17 to 34
pub fn sp1_vkey_digest_babybear(proof: &SP1ReduceProof<BabyBearPoseidon2Outer>) -> [BabyBear; 8] {
let proof = &proof.proof;
let pv: &RecursionPublicValues<BabyBear> = proof.public_values.as_slice().borrow();
pv.sp1_vk_digest
}

pub fn sp1_vkey_digest_bn254(proof: &SP1ReduceProof<BabyBearPoseidon2Outer>) -> Bn254Fr {
babybears_to_bn254(&sp1_vkey_digest_babybear(proof))
}

pub fn sp1_commited_values_digest_bn254(proof: &SP1ReduceProof<BabyBearPoseidon2Outer>) -> Bn254Fr {
let proof = &proof.proof;
let pv: &RecursionPublicValues<BabyBear> = proof.public_values.as_slice().borrow();
let committed_values_digest_bytes: [BabyBear; 32] =
words_to_bytes(&pv.committed_value_digest).try_into().unwrap();
babybear_bytes_to_bn254(&committed_values_digest_bytes)
}

Copy link
Member

Choose a reason for hiding this comment

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

Add doc comments for these functions.

Copy link
Member

@ratankaliani ratankaliani left a comment

Choose a reason for hiding this comment

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

Some small nits and missing docs for some functions, otherwise LGTM.

Copy link

github-actions bot commented Sep 6, 2024

SP1 Performance Test Results

Branch: tamir/better-reduce-api
Commit: 00bbf60
Author: tamirhemo

program cycles execute (mHz) core (kHZ) compress (KHz) time success
fibonacci 11291 0.19 6.14 0.80 16s
ssz-withdrawals 2757356 16.73 58.12 109.19 1m13s
tendermint 12593597 6.66 152.85 266.83 2m11s

@tamirhemo tamirhemo merged commit ec57ab1 into tamir/v1.3.0-rc2 Sep 6, 2024
8 of 9 checks passed
@tamirhemo tamirhemo deleted the tamir/better-reduce-api branch September 6, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants