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