fn generate_replicas(
        max_quantity: usize,
    ) -> impl Strategy<Value = Result<(Vec<Sequence>, Arc<Keypair>)>> {
        let xorname = XorName::random();
        let tag = 45_000u64;
        let owner_keypair = Arc::new(Keypair::new_ed25519(&mut OsRng));
        let owner = owner_keypair.public_key();
        (1..max_quantity + 1).prop_map(move |quantity| {
            let mut replicas = Vec::with_capacity(quantity);
            for _ in 0..quantity {
                let actor = Keypair::new_ed25519(&mut OsRng).public_key().to_string();

                let replica = Sequence::new_public(owner, actor, xorname, tag);
                replicas.push(replica);
            }

            // set the same owner in all replicas
            let perms = BTreeMap::default();
            let mut owner_op = replicas[0].create_unsigned_public_policy_op(owner, perms)?;
            let bytes = utils::serialise(&owner_op.crdt_op)?;
            let signature = owner_keypair.sign(&bytes);

            owner_op.signature = Some(signature);
            for r in replicas.iter_mut() {
                r.apply_public_policy_op(owner_op.clone())?;
            }
            Ok((replicas, owner_keypair.clone()))
        })
    }
// Generate a vec of Sequence replicas of some length, with corresponding vec of keypairs for signing, and the overall owner of the sequence
Generate a vec of Sequence replicas of some length, with corresponding vec of keypairs for signing, and the overall owner of the sequence
Generate a vec of Sequence replicas of some length with corresponding vec of keypairs for signing and the overall owner of the sequence
fn generate_replicas(
        max_quantity: usize,
    ) -> impl Strategy<Value = Result<(Vec<Sequence>, Arc<Keypair>)>> {
        let xorname = XorName::random();
        let tag = 45_000u64;
        let owner_keypair = Arc::new(Keypair::new_ed25519(&mut OsRng));
        let owner = owner_keypair.public_key();
        (1..max_quantity + 1).prop_map(move |quantity| {
            let mut replicas = Vec::with_capacity(quantity);
            for _ in 0..quantity {
                let actor = Keypair::new_ed25519(&mut OsRng).public_key().to_string();
                let replica = Sequence::new_public(owner, actor, xorname, tag);
                replicas.push(replica);
            }
            // set the same owner in all replicas
            let perms = BTreeMap::default();
            let mut owner_op = replicas[0].create_unsigned_public_policy_op(owner, perms)?;
            let bytes = utils::serialise(&owner_op.crdt_op)?;
            let signature = owner_keypair.sign(&bytes);
            owner_op.signature = Some(signature);
            for r in replicas.iter_mut() {
                r.apply_public_policy_op(owner_op.clone())?;
            }
            Ok((replicas, owner_keypair.clone()))
        })
    }
fn generate_replicas ( max_quantity : usize , ) -> impl Strategy < Value = Result < ( Vec < Sequence > , Arc < Keypair > ) > > { let xorname = XorName :: random ( ) ; let tag = 45_000u64 ; let owner_keypair = Arc :: new ( Keypair :: new_ed25519 ( & mut OsRng ) ) ; let owner = owner_keypair . public_key ( ) ; ( 1 .. max_quantity + 1 ) . prop_map ( move | quantity | { let mut replicas = Vec :: with_capacity ( quantity ) ; for _ in 0 .. quantity { let actor = Keypair :: new_ed25519 ( & mut OsRng ) . public_key ( ) . to_string ( ) ; let replica = Sequence :: new_public ( owner , actor , xorname , tag ) ; replicas . push ( replica ) ; } // set the same owner in all replicas let perms = BTreeMap :: default ( ) ; let mut owner_op = replicas [ 0 ] . create_unsigned_public_policy_op ( owner , perms ) ? ; let bytes = utils :: serialise ( & owner_op . crdt_op ) ? ; let signature = owner_keypair . sign ( & bytes ) ; owner_op . signature = Some ( signature ) ; for r in replicas . iter_mut ( ) { r . apply_public_policy_op ( owner_op . clone ( ) ) ? ; } Ok ( ( replicas , owner_keypair . clone ( ) ) ) } ) }
Generate a vec of Sequence replicas of some length, with corresponding vec of keypairs for signing, and the overall owner of the sequence
Generate a vec of Sequence replicas of some length with corresponding vec of keypairs for signing and the overall owner of the sequence
max_quantity
usize
max_quantity
usize