mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 19:50:37 +00:00
Shift around some types in ActiveState, RecentProp
This commit is contained in:
parent
c79db16ffb
commit
a6d0a0f85e
@ -10,7 +10,7 @@ pub struct ActiveState {
|
||||
pub height: u64,
|
||||
pub randao: Sha256Digest,
|
||||
pub ffg_voter_bitfield: Bitfield,
|
||||
pub recent_attesters: Vec<u32>, // TODO: should be u24
|
||||
pub recent_attesters: Vec<usize>, // TODO: should be u24
|
||||
pub partial_crosslinks: Vec<PartialCrosslinkRecord>,
|
||||
pub total_skip_count: u64,
|
||||
pub recent_proposers: Vec<RecentPropserRecord>
|
||||
|
@ -3,15 +3,15 @@ use super::utils::types::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RecentPropserRecord {
|
||||
pub index: u32, // TODO: make u24
|
||||
pub index: usize, // TODO: make u24
|
||||
pub randao_commitment: Sha256Digest,
|
||||
pub balance_delta: u32, // TODO: make u24
|
||||
pub balance_delta: i64, // TODO: make u24
|
||||
}
|
||||
|
||||
impl RecentPropserRecord {
|
||||
pub fn new(index: u32,
|
||||
pub fn new(index: usize,
|
||||
randao_commitment: Sha256Digest,
|
||||
balance_delta: u32) -> RecentPropserRecord {
|
||||
balance_delta: i64) -> RecentPropserRecord {
|
||||
RecentPropserRecord {
|
||||
index: index,
|
||||
randao_commitment: randao_commitment,
|
||||
@ -27,7 +27,8 @@ impl Encodable for RecentPropserRecord {
|
||||
fn rlp_append(&self, s: &mut RlpStream) {
|
||||
s.append(&self.index);
|
||||
s.append(&self.randao_commitment);
|
||||
s.append(&self.balance_delta);
|
||||
// TODO: serialize this if needed.
|
||||
// s.append(&self.balance_delta);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,10 +45,12 @@ mod tests {
|
||||
let balance_delta = 99;
|
||||
let r = RecentPropserRecord::new(index, randao_commitment, balance_delta);
|
||||
let e = rlp::encode(&r);
|
||||
assert_eq!(e.len(), 35);
|
||||
assert_eq!(e.len(), 34);
|
||||
assert_eq!(e[0], 1);
|
||||
assert_eq!(e[1], 160);
|
||||
assert_eq!(e[2..34], [0; 32]);
|
||||
/*
|
||||
assert_eq!(e[34], 99);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ mod tests {
|
||||
vote_count += 2;
|
||||
}
|
||||
assert_eq!(pc.voter_bitfield.num_true_bits(), vote_count,
|
||||
"shard_id {} failed.", id);
|
||||
"shard_id {} failed.", id);
|
||||
assert_eq!(pc.shard_block_hash, shard_hashes[id as usize]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user