Skip to content

Commit

Permalink
Fixing a test compilation error introduced by my previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SkidanovAlex committed Aug 14, 2019
1 parent 00c562a commit ea785c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion chain/chain/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub enum ShardFullChunkOrOnePart<'a> {
NoChunk,
}

#[derive(Eq, PartialEq)]
#[derive(Eq, PartialEq, Debug)]
pub enum ValidatorSignatureVerificationResult {
Valid,
Invalid,
Expand Down
31 changes: 19 additions & 12 deletions near/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ mod test {

use crate::config::{TESTING_INIT_BALANCE, TESTING_INIT_STAKE};
use crate::{get_store_path, GenesisConfig, NightshadeRuntime};
use near_chain::types::ValidatorSignatureVerificationResult;

fn stake(nonce: Nonce, sender: &BlockProducer, amount: Balance) -> SignedTransaction {
TransactionBody::Stake(StakeTransaction {
Expand Down Expand Up @@ -1124,12 +1125,15 @@ mod test {
let data = [0; 32];
let signer = InMemorySigner::from_seed(&validators[0], &validators[0]);
let signature = signer.sign(&data);
assert!(env.runtime.verify_validator_signature(
&EpochId::default(),
&validators[0],
&data,
&signature
));
assert_eq!(
ValidatorSignatureVerificationResult::Valid,
env.runtime.verify_validator_signature(
&EpochId::default(),
&validators[0],
&data,
&signature
)
);
}

#[test]
Expand All @@ -1139,12 +1143,15 @@ mod test {
let data = [0; 32];
let signer = InMemorySigner::from_seed(&validators[0], &validators[0]);
let signature = signer.sign(&data);
assert!(!env.runtime.verify_validator_signature(
&EpochId::default(),
&validators[1],
&data,
&signature
));
assert_eq!(
ValidatorSignatureVerificationResult::Invalid,
env.runtime.verify_validator_signature(
&EpochId::default(),
&validators[1],
&data,
&signature
)
);
}

#[test]
Expand Down

0 comments on commit ea785c7

Please sign in to comment.