|
@@ -42,7 +42,11 @@ use super::level_up::LEVEL_INVITATIONS;
|
|
|
#[cfg(feature = "bridgeauth")]
|
|
|
use super::level_up::MAX_LEVEL;
|
|
|
pub use crate::lox_creds::{Lox, Migration};
|
|
|
+#[cfg(feature = "bridgeauth")]
|
|
|
+use crate::migration_table::MigrationType;
|
|
|
use cmz::*;
|
|
|
+#[cfg(feature = "bridgeauth")]
|
|
|
+use ff::PrimeField;
|
|
|
use group::Group;
|
|
|
use rand::{CryptoRng, RngCore};
|
|
|
use sha2::Sha512;
|
|
@@ -51,7 +55,7 @@ const SESSION_ID: &[u8] = b"blockage_migration";
|
|
|
|
|
|
muCMZProtocol! { blockage_migration,
|
|
|
[ L: Lox { id: R, bucket: H, trust_level: R, level_since: H, invites_remaining: H, blockages: H },
|
|
|
- M: Migration { lox_id: R, from_bucket: H, to_bucket: H } ],
|
|
|
+ M: Migration { lox_id: R, from_bucket: H, to_bucket: H, migration_type: I } ],
|
|
|
N: Lox {id: J, bucket: H, trust_level: I, level_since: S, invites_remaining: I, blockages: H },
|
|
|
L.id = M.lox_id,
|
|
|
L.bucket = M.from_bucket,
|
|
@@ -141,6 +145,7 @@ impl BridgeAuth {
|
|
|
L.set_privkey(&self.lox_priv);
|
|
|
M.set_privkey(&self.migration_priv);
|
|
|
N.set_privkey(&self.lox_priv);
|
|
|
+ M.migration_type = Some(Scalar::from_u128(MigrationType::Blockage.into()));
|
|
|
N.trust_level = Some((level - 2).into());
|
|
|
N.level_since = Some(today.into());
|
|
|
N.invites_remaining = Some(LEVEL_INVITATIONS[(level - 3) as usize].into());
|
|
@@ -188,8 +193,6 @@ mod tests {
|
|
|
let lox_cred_3 = th.level_up(rng, lox_cred_2.clone());
|
|
|
th.block_bridges(lox_cred_3.clone());
|
|
|
mig_cred = th.check_blockage(rng, lox_cred_3.clone());
|
|
|
- th.verify_migration(&mig_cred.clone());
|
|
|
- th.verify_lox(&lox_cred_3.clone());
|
|
|
lox_cred = th.blockage_migration(rng, lox_cred_3.clone(), mig_cred.clone());
|
|
|
th.verify_lox(&lox_cred);
|
|
|
}
|