// Create a 'GovernanceProto' with 'num_neurons' neurons and a
// following graph such that all neurons will vote according to the
// vote of neuron 0.
//
// If linear_following:
// - Neuron i+3 follows neurons i, i+1, and i+2.
// - Neuron 2 follows 0, 1
// - Neuron 1 follows 0
// - So, when neuron 0 votes, it should cascade to accept.
//
// Otherwise:
// - Each neuron i follows "previous power of two".
// - So, when neuron 0 votes, it should cascade to accept in log steps.
Create a 'GovernanceProto' with 'num_neurons' neurons and a
following graph such that all neurons will vote according to the
vote of neuron 0.



Each neuron i follows "previous power of two".
So, when neuron 0 votes, it should cascade to accept in log steps.
Create a ' GovernanceProto ' with ' num_neurons ' neurons and a following graph such that all neurons will vote according to the vote of neuron 0 . Each neuron i follows " previous power of two " . So when neuron 0 votes it should cascade to accept in log steps .
fn fixture_for_scale(num_neurons: u32, linear_following: bool) -> GovernanceProto {
    let mut gov = GovernanceProto {
        economics: Some(NetworkEconomics::with_default_values()),
        ..Default::default()
    };
    for i in 0..(num_neurons as u64) {
        let mut followees = Vec::new();
        if linear_following {
            match i {
                0 => (),
                1 => followees.push(NeuronId { id: 0 }),
                2 => {
                    followees.push(NeuronId { id: 0 });
                    followees.push(NeuronId { id: 1 });
                }
                _ => {
                    followees.push(NeuronId { id: i - 1 });
                    followees.push(NeuronId { id: i - 2 });
                    followees.push(NeuronId { id: i - 3 })
                }
            }
        } else {
            let prev_pow = i.next_power_of_two() / 2;
            if prev_pow < i {
                followees.push(NeuronId { id: prev_pow });
            }
        }
        // Use i as neuron ID.
        let n = Neuron {
            id: Some(NeuronId { id: i }),
            // 10 + i ICP
            cached_neuron_stake_e8s: (10 + i) * 100_000_000,
            // One year
            dissolve_state: Some(neuron::DissolveState::DissolveDelaySeconds(31557600)),
            //
            controller: Some(
                PrincipalId::try_from(format!("SID{}", i).as_bytes().to_vec()).unwrap(),
            ),
            //
            followees: [(Topic::Unspecified as i32, neuron::Followees { followees })]
                .to_vec()
                .into_iter()
                .collect(),
            ..Default::default()
        };
        gov.neurons.insert(i, n);
    }
    gov
}
fn fixture_for_scale ( num_neurons : u32 , linear_following : bool ) -> GovernanceProto { let mut gov = GovernanceProto { economics : Some ( NetworkEconomics :: with_default_values ( ) ) , .. Default :: default ( ) } ; for i in 0 .. ( num_neurons as u64 ) { let mut followees = Vec :: new ( ) ; if linear_following { match i { 0 => ( ) , 1 => followees . push ( NeuronId { id : 0 } ) , 2 => { followees . push ( NeuronId { id : 0 } ) ; followees . push ( NeuronId { id : 1 } ) ; } _ => { followees . push ( NeuronId { id : i - 1 } ) ; followees . push ( NeuronId { id : i - 2 } ) ; followees . push ( NeuronId { id : i - 3 } ) } } } else { let prev_pow = i . next_power_of_two ( ) / 2 ; if prev_pow < i { followees . push ( NeuronId { id : prev_pow } ) ; } } // Use i as neuron ID. let n = Neuron { id : Some ( NeuronId { id : i } ) , // 10 + i ICP cached_neuron_stake_e8s : ( 10 + i ) * 100_000_000 , // One year dissolve_state : Some ( neuron :: DissolveState :: DissolveDelaySeconds ( 31557600 ) ) , // controller : Some ( PrincipalId :: try_from ( format ! ( " " i ) . as_bytes ( ) . to_vec ( ) ) . unwrap ( ) , ) , // followees : [ ( Topic :: Unspecified as i32 , neuron :: Followees { followees } ) ] . to_vec ( ) . into_iter ( ) . collect ( ) , .. Default :: default ( ) } ; gov . neurons . insert ( i , n ) ; } gov }
Create a 'GovernanceProto' with 'num_neurons' neurons and a
following graph such that all neurons will vote according to the
vote of neuron 0.
Create a ' GovernanceProto ' with ' num_neurons ' neurons and a following graph such that all neurons will vote according to the vote of neuron 0 .
num_neurons
u32
linear_following
bool