Comment out level, bucket proofs to help debug

This commit is contained in:
Vecna 2024-01-17 16:59:33 -05:00
parent 9cd9e3fab7
commit 4240fa3377
1 changed files with 22 additions and 6 deletions

View File

@ -45,6 +45,7 @@ pub struct Request {
CBlockages: RistrettoPoint,
CQ: RistrettoPoint,
/*
// Fields for proving which bucket we have
H: RistrettoPoint,
BP: RistrettoPoint,
@ -52,6 +53,7 @@ pub struct Request {
// Fields for proving 3 <= trust_level <= 4
// CG can be computed by verifier
CGsq: RistrettoPoint,
*/
// The combined lox_zkp
piUser: CompactProof,
@ -61,11 +63,11 @@ define_proof! {
requestproof,
"Positive Report Request",
(id, bucket, level, since, invremain, blockages,
zid, zbucket, zlevel, zsince, zinvremain, zblockages, negzQ,
g, zg, wg, yg),
zid, zbucket, zlevel, zsince, zinvremain, zblockages, negzQ),
// g, zg, wg, yg),
(P, CId, CBucket, CLevel, CSince, CInvRemain, CBlockages,
V, Xid, Xbucket, Xlevel, Xsince, Xinvremain, Xblockages,
H, BP, CG, CGsq),
V, Xid, Xbucket, Xlevel, Xsince, Xinvremain, Xblockages),
// H, BP, CG, CGsq),
(A):
// Blind showing of the Lox credential
CId = (id*P + zid*A),
@ -74,13 +76,15 @@ define_proof! {
CSince = (since*P + zsince*A),
CInvRemain = (invremain*P + zinvremain*A),
CBlockages = (blockages*P + zblockages*A),
V = (zid*Xid + zbucket*Xbucket + zlevel*Xlevel + zsince*Xsince + zinvremain*Xinvremain + zblockages*Xblockages + negzQ*A),
V = (zid*Xid + zbucket*Xbucket + zlevel*Xlevel + zsince*Xsince + zinvremain*Xinvremain + zblockages*Xblockages + negzQ*A)
/*
// Prove bucket is same bucket used in BP
BP = (bucket*H),
// Prove CLevel encodes a value of 3 or 4
// First prove g is a bit by proving that g = g^2
CG = (g*P + zg*A), CGsq = (g*CG + wg*A), CGsq = (g*P + yg*A)
// The verifier will compute CG = CLevel - 3P
*/
}
pub fn request(
@ -90,6 +94,7 @@ pub fn request(
let A: &RistrettoPoint = &CMZ_A;
let Atable: &RistrettoBasepointTable = &CMZ_A_TABLE;
/*
// TODO: Where should this go? For efficiency, this should probably be global
let today: u32 = time::OffsetDateTime::now_utc().date()
.to_julian_day()
@ -97,6 +102,7 @@ pub fn request(
.unwrap();
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(format!("PR Generator H for {}",today).as_bytes());
let Htable: RistrettoBasepointTable = RistrettoBasepointTable::create(&H);
*/
// Ensure that the credential can be correctly shown: it must be the case
// that trust_level is 3 or 4
@ -147,6 +153,7 @@ pub fn request(
+ zblockages * lox_pub.X[6]
+ &negzQ * Atable;
/*
// Compute BP for proving knowledge of bucket
let BP = &lox_cred.bucket * &Htable;
@ -170,6 +177,7 @@ pub fn request(
let CG = g * P + &zg * Atable;
let CGsq = g * P + &yg * Atable;
*/
// Construct the proof
let mut transcript = Transcript::new(b"proof of level 3 cred");
@ -191,10 +199,12 @@ pub fn request(
Xsince: &lox_pub.X[4],
Xinvremain: &lox_pub.X[5],
Xblockages: &lox_pub.X[6],
/*
H: &H,
BP: &BP,
CG: &CG,
CGsq: &CGsq,
*/
id: &lox_cred.id,
bucket: &lox_cred.bucket,
level: &lox_cred.trust_level,
@ -208,10 +218,12 @@ pub fn request(
zinvremain: &zinvremain,
zblockages: &zblockages,
negzQ: &negzQ,
/*
g: &g,
zg: &zg,
wg: &wg,
yg: &yg,
*/
},
)
.0;
@ -226,9 +238,11 @@ pub fn request(
CInvRemain,
CBlockages,
CQ,
/*
H,
BP,
CGsq,
*/
piUser,
}
)
@ -256,7 +270,7 @@ impl BridgeAuth {
- req.CQ;
// Recompute CG
let CG = req.CLevel - Scalar::from(3 as u8) * req.P;
// let CG = req.CLevel - Scalar::from(3 as u8) * req.P;
// TODO: Failure happens in verify_compact
// Verify the zkp
@ -280,10 +294,12 @@ impl BridgeAuth {
Xsince: &self.lox_pub.X[4].compress(),
Xinvremain: &self.lox_pub.X[5].compress(),
Xblockages: &self.lox_pub.X[6].compress(),
/*
H: &req.H.compress(),
BP: &req.BP.compress(),
CG: &CG.compress(),
CGsq: &req.CGsq.compress(),
*/
},
)?;