Skip to content

Commit 40a29a2

Browse files
committed
removed notaries and govteam
1 parent 9c75884 commit 40a29a2

File tree

9 files changed

+56
-75
lines changed

9 files changed

+56
-75
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)
4848
.service(router::allocator::update)

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 {

fplus-lib/src/core/mod.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct CreateApplicationInfo {
3636
}
3737

3838
#[derive(Deserialize, Serialize, Debug)]
39-
pub struct NotaryList(pub Vec<String>);
39+
pub struct VerifierList(pub Vec<String>);
4040

4141
#[derive(Deserialize, Serialize, Debug)]
4242
pub struct CompleteNewApplicationProposalInfo {
@@ -611,22 +611,22 @@ impl LDNApplication {
611611
pub async fn fetch_verifiers(owner: String, repo: String) -> Result<ValidVerifierList, LDNError> {
612612
let allocator = database::get_allocator(&owner, &repo).await.map_err(|e| LDNError::Load(format!("Failed to retrieve allocators /// {}", e)))?;
613613

614-
let mut gov_team_handles = Vec::new();
614+
let mut verifiers_handles = Vec::new();
615615

616616
let allocator = match allocator {
617617
Some(a) => a,
618618
None => return Err(LDNError::Load("No allocator found".into())),
619619
};
620620

621621
if let Some(handles) = allocator.verifiers_gh_handles {
622-
gov_team_handles.extend(handles.split(',').map(String::from));
622+
verifiers_handles.extend(handles.split(',').map(String::from));
623623
}
624624

625-
if gov_team_handles.is_empty() {
625+
if verifiers_handles.is_empty() {
626626
return Err(LDNError::Load("No governance team found".into()));
627627
}
628628

629-
Ok(ValidVerifierList { gov_team: gov_team_handles })
629+
Ok(ValidVerifierList { verifiers: verifiers_handles })
630630
}
631631

632632
async fn single_merged(application_id: String, owner: String, repo: String) -> Result<(Content, ApplicationFile), LDNError> {
@@ -876,7 +876,7 @@ impl LDNApplication {
876876
let validated_at = application_file.lifecycle.validated_at.clone();
877877
let app_state = application_file.lifecycle.get_state();
878878
let active_request_id = application_file.lifecycle.active_request.clone();
879-
let valid_gov_team = Self::fetch_verifiers(owner.clone(), repo.clone()).await?;
879+
let valid_verifier_list = Self::fetch_verifiers(owner.clone(), repo.clone()).await?;
880880
let bot_user = get_env_var_or_default("BOT_USER", "filplus-allocators-staging-bot[bot]");
881881

882882
let res: bool = match app_state {
@@ -910,8 +910,8 @@ impl LDNApplication {
910910
} else if actor != bot_user {
911911
log::warn!("- Not ready to sign - actor is not the bot user");
912912
false
913-
} else if !valid_gov_team.is_valid(&validated_by) {
914-
log::warn!("- Not ready to sign - valid_gov_team is not valid");
913+
} else if !valid_verifier_list.is_valid(&validated_by) {
914+
log::warn!("- Not ready to sign - valid_verifier_list is not valid");
915915
false
916916
} else {
917917
log::info!("- Validated!");
@@ -939,7 +939,7 @@ impl LDNApplication {
939939
AppState::StartSignDatacap => {
940940
if !validated_at.is_empty()
941941
&& !validated_by.is_empty()
942-
&& valid_gov_team.is_valid(&validated_by)
942+
&& valid_verifier_list.is_valid(&validated_by)
943943
{
944944
log::info!("- Validated!");
945945
true
@@ -950,16 +950,16 @@ impl LDNApplication {
950950
if validated_by.is_empty() {
951951
log::warn!("- AppState: StartSignDatacap, validation failed: validated_by is empty");
952952
}
953-
if !valid_gov_team.is_valid(&validated_by) {
954-
log::warn!("- AppState: StartSignDatacap, validation failed: valid_gov_team is not valid");
953+
if !valid_verifier_list.is_valid(&validated_by) {
954+
log::warn!("- AppState: StartSignDatacap, validation failed: valid_verifier_list is not valid");
955955
}
956956
false
957957
}
958958
}
959959
AppState::Granted => {
960960
if !validated_at.is_empty()
961961
&& !validated_by.is_empty()
962-
&& valid_gov_team.is_valid(&validated_by)
962+
&& valid_verifier_list.is_valid(&validated_by)
963963
{
964964
log::info!("- Application is granted");
965965
true
@@ -974,9 +974,9 @@ impl LDNApplication {
974974
"- AppState: Granted, validation failed: validated_by is empty"
975975
);
976976
}
977-
if !valid_gov_team.is_valid(&validated_by) {
977+
if !valid_verifier_list.is_valid(&validated_by) {
978978
log::warn!(
979-
"- AppState: Granted, validation failed: valid_gov_team is not valid"
979+
"- AppState: Granted, validation failed: valid_verifier_list is not valid"
980980
);
981981
}
982982
false
@@ -1053,7 +1053,7 @@ impl LDNApplication {
10531053
return Ok(false);
10541054
}
10551055
};
1056-
let signers: application::file::Notaries = active_request.signers.clone();
1056+
let signers: application::file::Verifiers = active_request.signers.clone();
10571057
if signers.0.len() != 2 {
10581058
log::warn!("- Not enough signers");
10591059
return Ok(false);
@@ -1296,9 +1296,9 @@ impl LDNApplication {
12961296
datacap_allocation_requested = allocation.amount.clone();
12971297
id = allocation.id.clone();
12981298

1299-
if let Some(first_notary) = allocation.signers.0.get(0) {
1300-
signing_address = first_notary.signing_address.clone();
1301-
message_cid = first_notary.message_cid.clone();
1299+
if let Some(first_verifier) = allocation.signers.0.get(0) {
1300+
signing_address = first_verifier.signing_address.clone();
1301+
message_cid = first_verifier.message_cid.clone();
13021302
}
13031303
}
13041304

0 commit comments

Comments
 (0)