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

Commit

Permalink
fix: rebase master
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroqn committed Jul 24, 2020
1 parent 2ef5fb7 commit 2eac67d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion core/consensus/src/tests/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ fn init_crypto() -> OverlordCrypto {

fn mock_node_info() -> NodeInfo {
NodeInfo {
self_pub_key: mock_pub_key().decode(),
chain_id: mock_hash(),
self_address: mock_address(),
}
Expand Down Expand Up @@ -216,6 +217,10 @@ impl CommonConsensusAdapter for MockConsensusAdapter {
) {
}

fn tag_consensus(&self, _ctx: Context, _peer_ids: Vec<Bytes>) -> ProtocolResult<()> {
Ok(())
}

fn verify_proof_signature(
&self,
_ctx: Context,
Expand All @@ -227,7 +232,7 @@ impl CommonConsensusAdapter for MockConsensusAdapter {
Ok(())
}

fn verity_proof_weight(
fn verify_proof_weight(
&self,
_ctx: Context,
_block_height: u64,
Expand Down
11 changes: 9 additions & 2 deletions core/consensus/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod synchronization;

use rand::random;

use protocol::types::{Address, Block, BlockHeader, Hash, MerkleRoot, Proof, Validator};
use protocol::types::{Address, Block, BlockHeader, Hash, Hex, MerkleRoot, Proof, Validator};
use protocol::Bytes;

use crate::status::CurrentConsensusStatus;
Expand Down Expand Up @@ -90,13 +90,20 @@ fn get_random_bytes(len: usize) -> Bytes {
Bytes::from(vec)
}

fn mock_pub_key() -> Hex {
Hex::from_string(
"0x026c184a9016f6f71a234c86b141621f38b68c78602ab06768db4d83682c616004".to_owned(),
)
.unwrap()
}

fn mock_validators(len: usize) -> Vec<Validator> {
(0..len).map(|_| mock_validator()).collect::<Vec<_>>()
}

fn mock_validator() -> Validator {
Validator {
address: mock_address(),
pub_key: mock_pub_key().decode(),
propose_weight: random::<u32>(),
vote_weight: random::<u32>(),
}
Expand Down

0 comments on commit 2eac67d

Please sign in to comment.