Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
fix: x86_64 & wasm CI error
Browse files Browse the repository at this point in the history
  • Loading branch information
polarbeargo committed Nov 11, 2021
1 parent 86cd714 commit ce3c3c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions consensus/src/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const slots_per_epoch: u32 = 7140;

/// init_checkpoints initializes the checkpoints for the genesis block
/// This function assumes the state hash of `genesis` is already set
fn initCheckpoints(genesis: &mut ProtocolState) {
fn init_checkpoints(genesis: &mut ProtocolState) {
let state_hash = genesis.hash();
genesis
.body
Expand All @@ -29,7 +29,7 @@ fn initCheckpoints(genesis: &mut ProtocolState) {
genesis.body.consensus_state.next_epoch_data.lock_checkpoint = state_hash;
}

fn updateCheckpoints(parent: &ProtocolState, block: &mut ProtocolState) {
fn update_checkpoints(parent: &ProtocolState, block: &mut ProtocolState) {
let parent_hash = parent.hash();
let epoch_slot = block.epoch_slot().unwrap();

Expand All @@ -42,7 +42,7 @@ fn updateCheckpoints(parent: &ProtocolState, block: &mut ProtocolState) {
}
}

fn isShortRange(c0: &ProtocolStateChain, c1: &ProtocolStateChain) -> bool {
fn is_short_range(c0: &ProtocolStateChain, c1: &ProtocolStateChain) -> bool {
c0.consensus_state()
.unwrap()
.staking_epoch_data
Expand All @@ -64,7 +64,7 @@ mod tests {
fn test_init_checkpoints() {
let mut genesis: ProtocolState = Default::default();
let state_hash = genesis.hash();
initCheckpoints(&mut genesis);
init_checkpoints(&mut genesis);
assert_eq!(
genesis
.body
Expand Down Expand Up @@ -98,15 +98,15 @@ mod tests {
fn test_update_checkpoints() {
let mut genesis: ProtocolState = Default::default();
let state_hash = genesis.hash();
initCheckpoints(&mut genesis);
init_checkpoints(&mut genesis);

let mut b1: ProtocolState = Default::default();
b1.body.consensus_state.blockchain_length = Length(0);
b1.body.consensus_state.curr_global_slot = GlobalSlot {
slot_number: GlobalSlotNumber(0),
slots_per_epoch: Length(1000),
};
updateCheckpoints(&genesis, &mut b1);
update_checkpoints(&genesis, &mut b1);
assert_eq!(
b1.body.consensus_state.next_epoch_data.start_checkpoint,
state_hash
Expand All @@ -122,7 +122,7 @@ mod tests {
slot_number: GlobalSlotNumber(1),
slots_per_epoch: Length(1000),
};
updateCheckpoints(&genesis, &mut b1);
update_checkpoints(&genesis, &mut b1);
assert_eq!(
b1.body.consensus_state.next_epoch_data.start_checkpoint,
StateHash::default()
Expand All @@ -137,7 +137,7 @@ mod tests {
slot_number: GlobalSlotNumber(667),
slots_per_epoch: Length(1000),
};
updateCheckpoints(&genesis, &mut b1);
update_checkpoints(&genesis, &mut b1);
assert_eq!(
b1.body.consensus_state.next_epoch_data.start_checkpoint,
StateHash::default()
Expand Down
1 change: 0 additions & 1 deletion consensus/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ mod tests {
assert_eq!(c.top(), Some(&expected));
}

#[test]
fn test_protocol_state_chain_epoch_slot() {
let mut c: ProtocolStateChain = ProtocolStateChain(vec![]);

Expand Down

0 comments on commit ce3c3c3

Please sign in to comment.