Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: future proof is eligible query #16

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ lazy_static::lazy_static! {
}

pub fn verify_proof(public_key: &[u8], proof: &[u8], hash: Hash) -> Result<()> {
let verifed = VRF.verify(public_key, proof, &hash);
let verified = VRF.verify(public_key, proof, &hash);

// If we don't get an error it's always ok
verifed?;
verified?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/msgs/staking/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum QueryMsg {
#[cfg_attr(feature = "cosmwasm", returns(StakerAndSeq))]
GetStakerAndSeq { public_key: String },
#[cfg_attr(feature = "cosmwasm", returns(bool))]
IsExecutorEligible { public_key: String },
IsExecutorEligible { proof: String, dr_id: String },
#[cfg_attr(feature = "cosmwasm", returns(StakingConfig))]
GetStakingConfig {},
}
Expand Down
6 changes: 4 additions & 2 deletions src/msgs/staking/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ fn json_get_staker_and_seq() {
fn json_is_executor_eligible() {
let expected_json = json!({
"is_executor_eligible": {
"public_key": "public_key"
"proof": "public_key",
"dr_id": "dr_id"
}
});
let msg: QueryMsg = StakingQueryMsg::IsExecutorEligible {
public_key: "public_key".to_string(),
proof: "public_key".to_string(),
dr_id: "dr_id".to_string(),
}
.into();
assert_json_ok(msg, expected_json);
Expand Down