Skip to content

Commit 630d246

Browse files
authored
Merge pull request #120 from filecoin-project/fix/notaries-name-verifier
Fix/notaries-name-verifier
2 parents 1bd37cd + e796a6c commit 630d246

File tree

9 files changed

+60
-79
lines changed

9 files changed

+60
-79
lines changed

fplus-cli/src/main.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ fn cli() -> Command {
1414
Command::new("validate-trigger")
1515
.about("Validates triggering an application")
1616
.arg(arg!(<PR_NUMBER> "Pull Request Number"))
17-
.arg(arg!(<GOV_GITHUB_HANDLE> "Github handle of Gov Team Member"))
17+
.arg(arg!(<VERIFIER_GITHUB_HANDLE> "Github handle of Verifier"))
1818
.arg_required_else_help(true),
1919
)
2020
.subcommand(
2121
Command::new("validate-proposal")
2222
.about("Validates proposing an application")
2323
.arg(arg!(<PR_NUMBER> "Pull Request Number"))
24-
.arg(arg!(<Notary_GITHUB_HANDLE> "Github handle of Notary"))
24+
.arg(arg!(<VERIFIER_GITHUB_HANDLE> "Github handle of Verifier"))
2525
.arg_required_else_help(true),
2626
)
2727
.subcommand(
@@ -41,20 +41,20 @@ async fn main() -> std::io::Result<()> {
4141
let pull_request_number = sub_matches
4242
.get_one::<String>("PR_NUMBER")
4343
.expect("required");
44-
let gov_gh_handle = sub_matches
45-
.get_one::<String>("GOV_GITHUB_HANDLE")
44+
let verifier_gh_handle = sub_matches
45+
.get_one::<String>("VERIFIER_GITHUB_HANDLE")
4646
.expect("required");
47-
validate_trigger(gov_gh_handle.to_string(), pull_request_number.to_string()).await;
47+
validate_trigger(verifier_gh_handle.to_string(), pull_request_number.to_string()).await;
4848
}
4949
Some(("validate-proposal", sub_matches)) => {
5050
let pull_request_number = sub_matches
5151
.get_one::<String>("PR_NUMBER")
5252
.expect("required");
53-
let notary_gh_handle = sub_matches
54-
.get_one::<String>("NOTARY_GITHUB_HANDLE")
53+
let verifier_gh_handle = sub_matches
54+
.get_one::<String>("VERIFIER_GITHUB_HANDLE")
5555
.expect("required");
5656
validate_proposal(
57-
notary_gh_handle.to_string(),
57+
verifier_gh_handle.to_string(),
5858
pull_request_number.to_string(),
5959
)
6060
.await;
@@ -63,11 +63,11 @@ async fn main() -> std::io::Result<()> {
6363
let pull_request_number = sub_matches
6464
.get_one::<String>("PR_NUMBER")
6565
.expect("required");
66-
let notary_gh_handle = sub_matches
67-
.get_one::<String>("NOTARY_GITHUB_HANDLE")
66+
let verifier_gh_handle = sub_matches
67+
.get_one::<String>("VERIFIER_GITHUB_HANDLE")
6868
.expect("required");
6969
validate_approval(
70-
notary_gh_handle.to_string(),
70+
verifier_gh_handle.to_string(),
7171
pull_request_number.to_string(),
7272
)
7373
.await;

fplus-cli/src/validators.rs

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub async fn validate_trigger(github_handle: String, pull_request_number: String) -> bool {
22
true
3-
// if validate_gov_team_member(&github_handle).await {
3+
// if validate_verifier(&github_handle).await {
44
// println!(
55
// "Validated Root Key Holder {} for application {}",
66
// &github_handle, pull_request_number
@@ -37,38 +37,20 @@ pub async fn validate_approval(github_handle: String, pull_request_number: Strin
3737
// }
3838
}
3939

40-
async fn validate_gov_team_member(github_handle: &str) -> bool {
40+
async fn validate_verifier(github_handle: &str) -> bool {
4141
true
4242
// let db_connection: web::Data<Mutex<mongodb::Client>> = web::Data::new(Mutex::new(
4343
// fplus_database::core::setup::setup().await.unwrap(),
4444
// ));
45-
// let gov_team_members = fplus_database::core::collections::govteam::find(db_connection)
45+
// let verifiers_list = fplus_database::core::collections::verifier::find(db_connection)
4646
// .await
4747
// .unwrap();
48-
// let gov_team_members: Option<fplus_database::core::collections::govteam::GovTeamMember> = gov_team_members
48+
// let verifiers_list: Option<fplus_database::core::collections::verifier::Verifier> = verifiers
4949
// .into_iter()
5050
// .find(|gov| &gov.github_handle == github_handle);
51-
// if gov_team_members.is_none() {
51+
// if verifiers_list.is_none() {
5252
// false
5353
// } else {
5454
// true
5555
// }
56-
}
57-
58-
async fn validate_notary(github_handle: &str) -> bool {
59-
true
60-
// let db_connection: web::Data<Mutex<mongodb::Client>> = web::Data::new(Mutex::new(
61-
// fplus_database::core::setup::setup().await.unwrap(),
62-
// ));
63-
// let notary = fplus_database::core::collections::notary::find(db_connection)
64-
// .await
65-
// .unwrap();
66-
// let notary: Option<fplus_database::core::collections::notary::Notary> = notary
67-
// .into_iter()
68-
// .find(|n| &n.github_handle == github_handle);
69-
// if notary.is_none() {
70-
// false
71-
// } else {
72-
// true
73-
// }
74-
}
56+
}

fplus-http-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async fn main() -> std::io::Result<()> {
4242
.service(router::application::validate_application_approval)
4343
.service(router::blockchain::address_allowance)
4444
.service(router::blockchain::verified_clients)
45-
.service(router::govteam::gov_team_members)
45+
.service(router::verifier::verifiers)
4646
.service(router::allocator::allocators)
4747
.service(router::allocator::create_or_update)
4848
.service(router::allocator::allocator)

fplus-http-server/src/router/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use actix_web::{get, HttpResponse, Responder};
22

33
pub mod application;
44
pub mod blockchain;
5-
pub mod govteam;
5+
pub mod verifier;
66
pub mod allocator;
77

88
/// Return server health status

fplus-http-server/src/router/govteam.rs renamed to fplus-http-server/src/router/verifier.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use actix_web::{get, web, HttpResponse, Responder};
22
use fplus_lib::core::{LDNApplication, GithubQueryParams};
33

4-
#[get("/gov-team-members")]
5-
pub async fn gov_team_members(query: web::Query<GithubQueryParams>) -> actix_web::Result<impl Responder> {
4+
#[get("/verifiers")]
5+
pub async fn verifiers(query: web::Query<GithubQueryParams>) -> actix_web::Result<impl Responder> {
66
let GithubQueryParams { owner, repo } = query.into_inner();
77

88
match LDNApplication::fetch_verifiers(owner, repo).await {

fplus-lib/src/core/application/allocation.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
use chrono::Utc;
22

33
use super::file::{
4-
Allocation, AllocationRequest, AllocationRequestType, Allocations, Notaries, Notary,
4+
Allocation, AllocationRequest, AllocationRequestType, Allocations, Verifiers, Verifier,
55
};
66

7-
impl Default for Notaries {
7+
impl Default for Verifiers {
88
fn default() -> Self {
99
Self(vec![])
1010
}
1111
}
1212

13-
impl Notaries {
14-
pub fn add(&self, signer: Notary) -> Self {
13+
impl Verifiers {
14+
pub fn add(&self, signer: Verifier) -> Self {
1515
let mut res = self.0.clone();
1616
res.push(signer);
1717
Self(res)
@@ -44,7 +44,7 @@ impl Allocation {
4444
updated_at: Utc::now().to_string(),
4545
is_active: true,
4646
amount: request_information.allocation_amount,
47-
signers: Notaries::default(),
47+
signers: Verifiers::default(),
4848
}
4949
}
5050
}
@@ -100,7 +100,7 @@ impl Allocations {
100100
is_active
101101
}
102102

103-
pub fn add_signer(&self, request_id: String, signer: Notary) -> Self {
103+
pub fn add_signer(&self, request_id: String, signer: Verifier) -> Self {
104104
let mut res: Vec<Allocation> = self.0.clone();
105105
for allocation in res.iter_mut() {
106106
if allocation.id == request_id && allocation.is_active {
@@ -111,7 +111,7 @@ impl Allocations {
111111
Self(res)
112112
}
113113

114-
pub fn add_signer_and_complete(&self, request_id: String, signer: Notary) -> Self {
114+
pub fn add_signer_and_complete(&self, request_id: String, signer: Verifier) -> Self {
115115
let mut res: Vec<Allocation> = self.0.clone();
116116
for allocation in res.iter_mut() {
117117
if allocation.id == request_id && allocation.is_active {

fplus-lib/src/core/application/file.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,11 @@ pub struct Allocation {
299299
#[serde(rename = "Allocation Amount")]
300300
pub amount: String,
301301
#[serde(rename = "Signers")]
302-
pub signers: Notaries,
302+
pub signers: Verifiers,
303303
}
304304

305305
#[derive(Serialize, Deserialize, Debug, Clone)]
306-
pub struct Notaries(pub Vec<Notary>);
306+
pub struct Verifiers(pub Vec<Verifier>);
307307

308308
#[derive(Serialize, Deserialize, Debug, Clone)]
309309
pub struct VerifierInput {
@@ -313,7 +313,7 @@ pub struct VerifierInput {
313313
pub message_cid: String,
314314
}
315315

316-
impl From<VerifierInput> for Notary {
316+
impl From<VerifierInput> for Verifier {
317317
fn from(input: VerifierInput) -> Self {
318318
Self {
319319
github_username: input.github_username,
@@ -325,7 +325,7 @@ impl From<VerifierInput> for Notary {
325325
}
326326

327327
#[derive(Serialize, Deserialize, Debug, Clone)]
328-
pub struct Notary {
328+
pub struct Verifier {
329329
#[serde(rename = "Github Username")]
330330
pub github_username: String,
331331
#[serde(rename = "Signing Address")]
@@ -347,17 +347,16 @@ pub struct AllocationRequest {
347347

348348
#[derive(Serialize, Deserialize, Debug, Clone)]
349349
pub struct ValidVerifierList {
350-
pub gov_team: Vec<String>,
350+
pub verifiers: Vec<String>,
351351
}
352352

353353
impl ValidVerifierList {
354354
pub fn is_valid(&self, member: &str) -> bool {
355-
self.gov_team.contains(&member.to_string())
355+
self.verifiers.contains(&member.to_string())
356356
}
357357
}
358358

359359
#[derive(Serialize)]
360360
pub struct LDNActorsResponse {
361-
pub governance_gh_handles: Vec<String>,
362-
pub notary_gh_handles: Vec<String>,
361+
pub verifier_gh_handles: Vec<String>,
363362
}

fplus-lib/src/core/application/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use self::file::{AllocationRequest, Allocations, LifeCycle, Notary};
1+
use self::file::{AllocationRequest, Allocations, LifeCycle, Verifier};
22

33
pub mod allocation;
44
pub mod client;
@@ -77,7 +77,7 @@ impl file::ApplicationFile {
7777

7878
pub fn add_signer_to_allocation(
7979
&self,
80-
signer: Notary,
80+
signer: Verifier,
8181
request_id: String,
8282
app_lifecycle: LifeCycle,
8383
) -> Self {
@@ -91,7 +91,7 @@ impl file::ApplicationFile {
9191

9292
pub fn add_signer_to_allocation_and_complete(
9393
&self,
94-
signer: Notary,
94+
signer: Verifier,
9595
request_id: String,
9696
app_lifecycle: LifeCycle,
9797
) -> Self {

0 commit comments

Comments
 (0)