Skip to content

Commit 5748d63

Browse files
authored
Merge pull request #159 from input-output-hk/feature/create-snapshot-lib
Create new crate snapshot-lib
2 parents 94b413f + edabcc5 commit 5748d63

File tree

25 files changed

+153
-106
lines changed

25 files changed

+153
-106
lines changed

Cargo.lock

Lines changed: 27 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
22
members = [
33
"catalyst-toolbox",
4-
"voting-hir"
4+
"snapshot-lib"
55
]

catalyst-toolbox/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ graphql_client = { version = "0.10" }
6262
gag = "1"
6363
vit-servicing-station-lib = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
6464
env_logger = "0.9"
65-
voting-hir = { path = "../voting-hir", features = ["serde"] }
65+
snapshot-lib = { path = "../snapshot-lib" }
6666
fraction = "0.10"
6767

6868
[dev-dependencies]
@@ -74,7 +74,7 @@ chain-vote = { git = "https://github.com/input-output-hk/chain-libs.git", branch
7474
proptest = { git = "https://github.com/input-output-hk/proptest", branch = "master" }
7575
test-strategy = "0.2"
7676
serde_test = "1"
77-
voting-hir = { path = "../voting-hir", features = ["serde", "proptest"] }
77+
snapshot-lib = { path = "../snapshot-lib", features = ["proptest"] }
7878
vit-servicing-station-tests = { git = "https://github.com/input-output-hk/vit-servicing-station.git", branch = "master" }
7979

8080
[build-dependencies]

catalyst-toolbox/src/bin/cli/advisor_reviews/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ mod test {
8585

8686
#[test]
8787
fn test_output_csv() {
88-
let resource_input = "./resources/testing/valid_assessments.csv";
88+
let resource_input = "../resources/testing/valid_assessments.csv";
8989
let tmp_file = assert_fs::NamedTempFile::new("outfile.csv").unwrap();
9090

9191
let export = Export {

catalyst-toolbox/src/bin/cli/rewards/voters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use catalyst_toolbox::rewards::voters::{calc_voter_rewards, Rewards, Threshold, VoteCount};
2-
use catalyst_toolbox::snapshot::{registration::MainnetRewardAddress, SnapshotInfo};
32
use catalyst_toolbox::utils::assert_are_close;
43
use jormungandr_lib::{
54
crypto::{account::Identifier, hash::Hash},
65
interfaces::AccountVotes,
76
};
7+
use snapshot_lib::{registration::MainnetRewardAddress, SnapshotInfo};
88
use vit_servicing_station_lib::db::models::proposals::FullProposalInfo;
99

1010
use color_eyre::{eyre::eyre, Report};

catalyst-toolbox/src/bin/cli/snapshot/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use catalyst_toolbox::snapshot::{voting_group::RepsVotersAssigner, RawSnapshot, Snapshot};
21
use color_eyre::Report;
32
use fraction::Fraction;
43
use jcli_lib::utils::{output_file::OutputFile, output_format::OutputFormat};
54
use jormungandr_lib::interfaces::Value;
5+
use snapshot_lib::{voting_group::RepsVotersAssigner, RawSnapshot, Snapshot};
66
use std::fs::File;
77
use std::io::Write;
88
use std::path::PathBuf;

catalyst-toolbox/src/community_advisors/models/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ mod tests {
145145

146146
#[test]
147147
fn test_deserialize() {
148-
let file_path = PathBuf::from("./resources/testing/valid_assessments.csv");
148+
let file_path = PathBuf::from("../resources/testing/valid_assessments.csv");
149149
let data: Vec<AdvisorReviewRow> =
150150
csv_utils::load_data_from_csv::<_, b','>(&file_path).unwrap();
151151
assert_eq!(data.len(), 1);

catalyst-toolbox/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pub mod logs;
66
pub mod notifications;
77
pub mod recovery;
88
pub mod rewards;
9-
pub mod snapshot;
109
pub mod stats;
1110
pub mod utils;
1211
pub mod vca_reviews;

catalyst-toolbox/src/rewards/voters.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::snapshot::{registration::MainnetRewardAddress, SnapshotInfo};
21
use jormungandr_lib::crypto::{account::Identifier, hash::Hash};
32
use rust_decimal::Decimal;
3+
use snapshot_lib::{registration::MainnetRewardAddress, SnapshotInfo};
44
use std::collections::{BTreeMap, HashMap, HashSet};
55
use thiserror::Error;
66
use vit_servicing_station_lib::db::models::proposals::FullProposalInfo;
@@ -167,11 +167,11 @@ pub fn calc_voter_rewards(
167167
#[cfg(test)]
168168
mod tests {
169169
use super::*;
170-
use crate::snapshot::registration::*;
171-
use crate::snapshot::*;
172170
use crate::utils::assert_are_close;
173171
use fraction::Fraction;
174172
use jormungandr_lib::crypto::account::Identifier;
173+
use snapshot_lib::registration::{Delegations, VotingRegistration};
174+
use snapshot_lib::Snapshot;
175175
use test_strategy::proptest;
176176

177177
#[proptest]

catalyst-toolbox/src/vote_check/explorer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use graphql_client::GraphQLQuery;
22

33
#[derive(GraphQLQuery)]
44
#[graphql(
5-
query_path = "resources/explorer/transaction_by_id.graphql",
6-
schema_path = "resources/explorer/schema.graphql",
5+
query_path = "../resources/explorer/transaction_by_id.graphql",
6+
schema_path = "../resources/explorer/schema.graphql",
77
response_derives = "Debug"
88
)]
99
pub struct TransactionById;

0 commit comments

Comments
 (0)