mirror of
https://github.com/logos-co/nomos-pocs.git
synced 2025-01-26 09:09:33 +00:00
Last update
This commit is contained in:
parent
0635a277d7
commit
5c7ff0fad5
@ -258,7 +258,7 @@
|
||||
|
||||
"coeffs" : ["329725079","667313404","2083859876","1645693780"],
|
||||
|
||||
"inner_commitment_0" : "19048435553851756854966583714228494720706220237110109487981675465058006706934",
|
||||
"inner_commitment_0" : "45555755014923146766476222823122654194153582923386372098787021809602091298670",
|
||||
|
||||
"inner_decommitment_0" :
|
||||
["5462985033728555575703006689913665598917262836577853690370070265073174719979",
|
||||
@ -280,7 +280,7 @@
|
||||
["3310770","2003547458","1663490902","2105455978"],
|
||||
["824310523","1757518542","231582441","427507918"]],
|
||||
|
||||
"inner_commitment_1" : "18169576490546341141767046171814645645044172101340402424909425947818564934087",
|
||||
"inner_commitment_1" : "36809196688918736785151875655523363274066842107451407514854169291514772437712",
|
||||
|
||||
"inner_decommitment_1" :
|
||||
["45836684762941279488847688946861562185184567552524644394596887832754938056979",
|
||||
@ -299,7 +299,7 @@
|
||||
["1550507975","1444313548","117070947","1740854590"],
|
||||
["342709844","601149328","1436490544","1384381104"]],
|
||||
|
||||
"inner_commitment_2" : "29215190960441505077529177935027039424488733477246157993605964254003539615792",
|
||||
"inner_commitment_2" : "881819876414071785116043072319901261019430342891967010427739931379717752179",
|
||||
|
||||
"inner_decommitment_2" :
|
||||
["3578061893060038632121836895066391994380789049478144565795630968916166958170",
|
||||
@ -315,7 +315,7 @@
|
||||
["716686867","138132852","2024080584","392488646"],
|
||||
["606958913","308986056","258114411","2075401741"]],
|
||||
|
||||
"inner_commitment_3" : "33865913108527976063513611264849688092773721821534885464172308921150897546371",
|
||||
"inner_commitment_3" : "12027868599227153144742193285247060272784688895537159385948117930165143367635",
|
||||
|
||||
"inner_decommitment_3" :
|
||||
["46510393127320994984678433868779353751380750916123221099220042551249644407575",
|
||||
@ -328,7 +328,7 @@
|
||||
["2038210709","1600238918","655676259","1542271403"],
|
||||
["1014579052","1384080403","862591487","1941843578"]],
|
||||
|
||||
"inner_commitment_4" : "233063347401903348432987619086774265933828676513621676247992038308030708388",
|
||||
"inner_commitment_4" : "14412699124489796400221638504502701429059474709940645969751865021865037702257",
|
||||
|
||||
"inner_decommitment_4" :
|
||||
["19324767949149751902195880760061491860991545124249052461044586503970003688610"],
|
||||
@ -338,7 +338,7 @@
|
||||
["2101847208","689925082","1602280602","1942656531"],
|
||||
["1952987285","1995490213","2082219584","1620868519"]],
|
||||
|
||||
"inner_commitment_5" : "693572572477915449222328871061568563307509948116711167874020917953971074657",
|
||||
"inner_commitment_5" : "7898658461322497542615494384418597990320440781916208640366283709415937814000",
|
||||
|
||||
"inner_decommitment_5" :
|
||||
[],
|
||||
|
@ -3,7 +3,6 @@ use std::collections::BTreeMap;
|
||||
use std::fmt::Debug;
|
||||
use std::iter::zip;
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
use itertools::Itertools;
|
||||
use num_traits::Zero;
|
||||
use thiserror::Error;
|
||||
|
@ -116,10 +116,10 @@ pub fn fri_answers(
|
||||
multiunzip(tuples);
|
||||
fri_answers_for_log_size(
|
||||
log_size,
|
||||
&samples,
|
||||
&samples, // Here it's the points and sampled values (in the proof)
|
||||
random_coeff,
|
||||
&query_domain_per_log_size[&log_size],
|
||||
&queried_valued_per_column,
|
||||
&queried_valued_per_column, // Here it's queried values (in the proof)
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
@ -141,7 +141,7 @@ pub fn fri_answers_for_log_size(
|
||||
));
|
||||
}
|
||||
}
|
||||
let mut queried_values_per_column = queried_values_per_column
|
||||
let mut queried_values_per_column = queried_values_per_column
|
||||
.iter()
|
||||
.map(|q| q.iter())
|
||||
.collect_vec();
|
||||
|
@ -58,6 +58,7 @@ impl<MC: MerkleChannel> CommitmentSchemeVerifier<MC> {
|
||||
proof: CommitmentSchemeProof<MC::H>,
|
||||
channel: &mut MC::C,
|
||||
) -> Result<(), VerificationError> {
|
||||
|
||||
channel.mix_felts(&proof.sampled_values.clone().flatten_cols());
|
||||
let random_coeff = channel.draw_felt();
|
||||
|
||||
@ -105,9 +106,10 @@ impl<MC: MerkleChannel> CommitmentSchemeVerifier<MC> {
|
||||
.0
|
||||
.into_iter()
|
||||
.collect::<Result<_, _>>()?;
|
||||
println!("DONE");
|
||||
|
||||
// Answer FRI queries.
|
||||
let samples = sampled_points
|
||||
let samples = sampled_points // Sample point is always the same and the value is the one provided in the proof
|
||||
.zip_cols(proof.sampled_values)
|
||||
.map_cols(|(sampled_points, sampled_values)| {
|
||||
zip(sampled_points, sampled_values)
|
||||
|
@ -118,7 +118,7 @@ pub fn verify<MC: MerkleChannel>(
|
||||
let composition_oods_eval = extract_composition_eval(sampled_oods_values).map_err(|_| {
|
||||
VerificationError::InvalidStructure("Unexpected sampled_values structure".to_string())
|
||||
})?;
|
||||
println!("composition_oods_eval = {:?}",composition_oods_eval);
|
||||
|
||||
if composition_oods_eval
|
||||
// Compute
|
||||
!= components.eval_composition_polynomial_at_point(
|
||||
|
@ -1,6 +1,5 @@
|
||||
use std::cmp::Reverse;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use itertools::Itertools;
|
||||
use thiserror::Error;
|
||||
|
||||
@ -152,10 +151,8 @@ impl<H: MerkleHasher> MerkleVerifier<H> {
|
||||
if node_values.len() != n_columns_in_layer {
|
||||
return Err(MerkleVerificationError::WitnessTooShort);
|
||||
}
|
||||
|
||||
layer_total_queries.push((node_index, H::hash_node(node_hashes, &node_values)));
|
||||
}
|
||||
|
||||
if !layer_queried_values.iter().all(|(_, c)| c.is_empty()) {
|
||||
return Err(MerkleVerificationError::ColumnValuesTooLong);
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ pub fn pretty_save_poseidon_bls_proof(proof: &StarkProof<PoseidonBLSMerkleHasher
|
||||
file.write_all(b"\t\"inner_commitment_")?;
|
||||
file.write_all(&i.to_string().into_bytes())?;
|
||||
file.write_all(b"\" : \"")?;
|
||||
file.write_all(&proof.commitment_scheme_proof.fri_proof.inner_layers[i].commitment.0.to_string().into_bytes())?;
|
||||
file.write_all(&proof.commitment_scheme_proof.fri_proof.inner_layers[i].commitment.to_string().into_bytes())?;
|
||||
file.write_all(b"\",\n\n")?;
|
||||
|
||||
//decommitment
|
||||
@ -331,7 +331,7 @@ pub fn compressed_save_poseidon_bls_proof(proof: &StarkProof<PoseidonBLSMerkleHa
|
||||
file.write_all(b"\"inner_commitment_")?;
|
||||
file.write_all(&i.to_string().into_bytes())?;
|
||||
file.write_all(b"\":\"")?;
|
||||
file.write_all(&proof.commitment_scheme_proof.fri_proof.inner_layers[i].commitment.0.to_string().into_bytes())?;
|
||||
file.write_all(&proof.commitment_scheme_proof.fri_proof.inner_layers[i].commitment.to_string().into_bytes())?;
|
||||
file.write_all(b"\",")?;
|
||||
|
||||
//decommitment
|
||||
@ -400,7 +400,6 @@ mod tests {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::core::vcs::poseidon_bls_merkle::PoseidonBLSMerkleChannel;
|
||||
use crate::core::ColumnVec;
|
||||
use crate::core::fields::qm31::QM31;
|
||||
use crate::examples::wide_fibonacci::{generate_trace, FibInput, WideFibonacciComponent};
|
||||
|
||||
const FIB_SEQUENCE_LENGTH: usize = 100;
|
||||
@ -605,7 +604,6 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
_ = pretty_save_poseidon_bls_proof(&proof);
|
||||
println!(" 0 1 0 0 = {:?}",QM31::from_u32_unchecked(0,1,0,0));
|
||||
|
||||
// Verify.
|
||||
let verifier_channel = &mut PoseidonBLSChannel::default();
|
||||
|
@ -174,7 +174,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 128,
|
||||
"execution_count": 3,
|
||||
"id": "67a09953",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@ -322,7 +322,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 312,
|
||||
"execution_count": 9,
|
||||
"id": "d9371b02",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@ -481,7 +481,11 @@
|
||||
"assert(nodes[\"level_8_node_0\"] == F(proof[\"commitments\"][1]))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Check querries answer\n"
|
||||
"# Check querries answer we have 104 samples each equal to x = oods_point and f(x) = sampled_value_i\n",
|
||||
"# For each column:\n",
|
||||
"for i in range(2):\n",
|
||||
" evaluations = []\n",
|
||||
" queried_values_per_column = proof[\"queried_values_\"+str(i)]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -502,11 +506,47 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"id": "e486cb3a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[['316772341',\n",
|
||||
" '1526280133',\n",
|
||||
" '663010112',\n",
|
||||
" '224983897',\n",
|
||||
" '510598760',\n",
|
||||
" '1109503351'],\n",
|
||||
" ['754832207',\n",
|
||||
" '435790299',\n",
|
||||
" '883623752',\n",
|
||||
" '553207508',\n",
|
||||
" '154784232',\n",
|
||||
" '199176676'],\n",
|
||||
" ['689603315',\n",
|
||||
" '1763523007',\n",
|
||||
" '1720552945',\n",
|
||||
" '1983603154',\n",
|
||||
" '367841669',\n",
|
||||
" '319325418'],\n",
|
||||
" ['1290247052',\n",
|
||||
" '1120744584',\n",
|
||||
" '193500372',\n",
|
||||
" '294491115',\n",
|
||||
" '951360807',\n",
|
||||
" '891034447']]"
|
||||
]
|
||||
},
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"queried_values_per_column"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
|
Loading…
x
Reference in New Issue
Block a user