Skip to content

Commit d6dba71

Browse files
authored
Merge pull request #2261 from input-output-hk/dlachaume/renaming-fake-aggregator
Refactor: improve variable and function names in fake aggregator
2 parents a9886c5 + 90d451b commit d6dba71

File tree

14 files changed

+325
-224
lines changed

14 files changed

+325
-224
lines changed

Cargo.lock

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

examples/client-wasm-nodejs/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/client-wasm-web/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/mithril-build-script/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-build-script"
3-
version = "0.2.16"
3+
version = "0.2.17"
44
description = "A toolbox for Mithril crates build scripts"
55
authors = { workspace = true }
66
edition = { workspace = true }

internal/mithril-build-script/src/fake_aggregator.rs

Lines changed: 107 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ pub struct FakeAggregatorData {
2222
snapshots_list: FileContent,
2323
individual_snapshots: BTreeMap<ArtifactId, FileContent>,
2424

25-
msds_list: FileContent,
26-
individual_msds: BTreeMap<ArtifactId, FileContent>,
25+
mithril_stake_distributions_list: FileContent,
26+
individual_mithril_stake_distributions: BTreeMap<ArtifactId, FileContent>,
2727

28-
ctx_snapshots_list: FileContent,
29-
individual_ctx_snapshots: BTreeMap<ArtifactId, FileContent>,
30-
ctx_proofs: BTreeMap<ArtifactId, FileContent>,
28+
cardano_transaction_snapshots_list: FileContent,
29+
individual_cardano_transaction_snapshots: BTreeMap<ArtifactId, FileContent>,
30+
cardano_transaction_proofs: BTreeMap<ArtifactId, FileContent>,
3131

32-
csds_list: FileContent,
33-
individual_csds: BTreeMap<ArtifactId, FileContent>,
32+
cardano_stake_distributions_list: FileContent,
33+
individual_cardano_stake_distributions: BTreeMap<ArtifactId, FileContent>,
3434

35-
cdbs_list: FileContent,
36-
individual_cdbs: BTreeMap<ArtifactId, FileContent>,
35+
cardano_database_snapshots_list: FileContent,
36+
individual_cardano_database_snapshots: BTreeMap<ArtifactId, FileContent>,
3737
}
3838

3939
impl FakeAggregatorData {
@@ -54,43 +54,47 @@ impl FakeAggregatorData {
5454
data.epoch_settings = file_content;
5555
}
5656
"mithril-stake-distributions-list.json" => {
57-
data.msds_list = file_content;
57+
data.mithril_stake_distributions_list = file_content;
5858
}
5959
"snapshots-list.json" => {
6060
data.snapshots_list = file_content;
6161
}
6262
"cardano-stake-distributions-list.json" => {
63-
data.csds_list = file_content;
63+
data.cardano_stake_distributions_list = file_content;
6464
}
6565
"cardano-databases-list.json" => {
66-
data.cdbs_list = file_content;
66+
data.cardano_database_snapshots_list = file_content;
6767
}
6868
"certificates-list.json" => {
6969
data.certificates_list = file_content;
7070
}
7171
"ctx-snapshots-list.json" => {
72-
data.ctx_snapshots_list = file_content;
72+
data.cardano_transaction_snapshots_list = file_content;
7373
}
7474
"mithril-stake-distributions.json" => {
75-
data.individual_msds = Self::read_artifacts_json_file(&entry.path());
75+
data.individual_mithril_stake_distributions =
76+
Self::read_artifacts_json_file(&entry.path());
7677
}
7778
"snapshots.json" => {
7879
data.individual_snapshots = Self::read_artifacts_json_file(&entry.path());
7980
}
8081
"cardano-stake-distributions.json" => {
81-
data.individual_csds = Self::read_artifacts_json_file(&entry.path());
82+
data.individual_cardano_stake_distributions =
83+
Self::read_artifacts_json_file(&entry.path());
8284
}
8385
"cardano-databases.json" => {
84-
data.individual_cdbs = Self::read_artifacts_json_file(&entry.path());
86+
data.individual_cardano_database_snapshots =
87+
Self::read_artifacts_json_file(&entry.path());
8588
}
8689
"certificates.json" => {
8790
data.individual_certificates = Self::read_artifacts_json_file(&entry.path());
8891
}
8992
"ctx-snapshots.json" => {
90-
data.individual_ctx_snapshots = Self::read_artifacts_json_file(&entry.path());
93+
data.individual_cardano_transaction_snapshots =
94+
Self::read_artifacts_json_file(&entry.path());
9195
}
9296
"ctx-proofs.json" => {
93-
data.ctx_proofs = Self::read_artifacts_json_file(&entry.path());
97+
data.cardano_transaction_proofs = Self::read_artifacts_json_file(&entry.path());
9498
}
9599
// unknown file
96100
_ => {}
@@ -108,32 +112,42 @@ impl FakeAggregatorData {
108112
BTreeSet::from_iter(self.individual_snapshots.keys().cloned()),
109113
),
110114
generate_ids_array(
111-
"msd_hashes",
112-
BTreeSet::from_iter(self.individual_msds.keys().cloned()),
115+
"mithril_stake_distribution_hashes",
116+
BTreeSet::from_iter(
117+
self.individual_mithril_stake_distributions.keys().cloned(),
118+
),
113119
),
114120
generate_ids_array(
115-
"csd_hashes",
116-
BTreeSet::from_iter(self.individual_csds.keys().cloned()),
121+
"cardano_stake_distribution_hashes",
122+
BTreeSet::from_iter(
123+
self.individual_cardano_stake_distributions.keys().cloned(),
124+
),
117125
),
118126
generate_ids_array(
119-
"csd_epochs",
120-
BTreeSet::from_iter(extract_csd_epochs(&self.individual_csds)),
127+
"cardano_stake_distribution_epochs",
128+
BTreeSet::from_iter(extract_cardano_stake_distribution_epochs(
129+
&self.individual_cardano_stake_distributions,
130+
)),
121131
),
122132
generate_ids_array(
123-
"cdb_hashes",
124-
BTreeSet::from_iter(self.individual_cdbs.keys().cloned()),
133+
"cardano_database_snapshot_hashes",
134+
BTreeSet::from_iter(self.individual_cardano_database_snapshots.keys().cloned()),
125135
),
126136
generate_ids_array(
127137
"certificate_hashes",
128138
BTreeSet::from_iter(self.individual_certificates.keys().cloned()),
129139
),
130140
generate_ids_array(
131-
"ctx_snapshot_hashes",
132-
BTreeSet::from_iter(self.individual_ctx_snapshots.keys().cloned()),
141+
"cardano_transaction_snapshot_hashes",
142+
BTreeSet::from_iter(
143+
self.individual_cardano_transaction_snapshots
144+
.keys()
145+
.cloned(),
146+
),
133147
),
134148
generate_ids_array(
135149
"proof_transaction_hashes",
136-
BTreeSet::from_iter(self.ctx_proofs.keys().cloned()),
150+
BTreeSet::from_iter(self.cardano_transaction_proofs.keys().cloned()),
137151
),
138152
],
139153
false,
@@ -151,44 +165,81 @@ impl FakeAggregatorData {
151165
generate_artifact_getter("snapshots", self.individual_snapshots),
152166
generate_list_getter("snapshot_list", self.snapshots_list),
153167
generate_ids_array(
154-
"msd_hashes",
155-
BTreeSet::from_iter(self.individual_msds.keys().cloned()),
168+
"mithril_stake_distribution_hashes",
169+
BTreeSet::from_iter(
170+
self.individual_mithril_stake_distributions.keys().cloned(),
171+
),
172+
),
173+
generate_artifact_getter(
174+
"mithril_stake_distributions",
175+
self.individual_mithril_stake_distributions,
176+
),
177+
generate_list_getter(
178+
"mithril_stake_distribution_list",
179+
self.mithril_stake_distributions_list,
156180
),
157-
generate_artifact_getter("msds", self.individual_msds),
158-
generate_list_getter("msd_list", self.msds_list),
159181
generate_ids_array(
160-
"csd_hashes",
161-
BTreeSet::from_iter(self.individual_csds.keys().cloned()),
182+
"cardano_stake_distribution_hashes",
183+
BTreeSet::from_iter(
184+
self.individual_cardano_stake_distributions.keys().cloned(),
185+
),
162186
),
163187
generate_ids_array(
164-
"csd_epochs",
165-
BTreeSet::from_iter(extract_csd_epochs(&self.individual_csds)),
188+
"cardano_stake_distribution_epochs",
189+
BTreeSet::from_iter(extract_cardano_stake_distribution_epochs(
190+
&self.individual_cardano_stake_distributions,
191+
)),
192+
),
193+
generate_artifact_getter(
194+
"cardano_stake_distributions",
195+
self.individual_cardano_stake_distributions,
196+
),
197+
generate_list_getter(
198+
"cardano_stake_distribution_list",
199+
self.cardano_stake_distributions_list,
166200
),
167-
generate_artifact_getter("csds", self.individual_csds),
168-
generate_list_getter("csd_list", self.csds_list),
169201
generate_ids_array(
170202
"certificate_hashes",
171203
BTreeSet::from_iter(self.individual_certificates.keys().cloned()),
172204
),
173205
generate_ids_array(
174-
"cdb_hashes",
175-
BTreeSet::from_iter(self.individual_cdbs.keys().cloned()),
206+
"cardano_database_snapshot_hashes",
207+
BTreeSet::from_iter(self.individual_cardano_database_snapshots.keys().cloned()),
208+
),
209+
generate_artifact_getter(
210+
"cardano_database_snapshots",
211+
self.individual_cardano_database_snapshots,
212+
),
213+
generate_list_getter(
214+
"cardano_database_snapshot_list",
215+
self.cardano_database_snapshots_list,
176216
),
177-
generate_artifact_getter("cdbs", self.individual_cdbs),
178-
generate_list_getter("cdb_list", self.cdbs_list),
179217
generate_artifact_getter("certificates", self.individual_certificates),
180218
generate_list_getter("certificate_list", self.certificates_list),
181219
generate_ids_array(
182-
"ctx_snapshot_hashes",
183-
BTreeSet::from_iter(self.individual_ctx_snapshots.keys().cloned()),
220+
"cardano_transaction_snapshot_hashes",
221+
BTreeSet::from_iter(
222+
self.individual_cardano_transaction_snapshots
223+
.keys()
224+
.cloned(),
225+
),
226+
),
227+
generate_artifact_getter(
228+
"cardano_transaction_snapshots",
229+
self.individual_cardano_transaction_snapshots,
230+
),
231+
generate_list_getter(
232+
"cardano_transaction_snapshots_list",
233+
self.cardano_transaction_snapshots_list,
184234
),
185-
generate_artifact_getter("ctx_snapshots", self.individual_ctx_snapshots),
186-
generate_list_getter("ctx_snapshots_list", self.ctx_snapshots_list),
187235
generate_ids_array(
188236
"proof_transaction_hashes",
189-
BTreeSet::from_iter(self.ctx_proofs.keys().cloned()),
237+
BTreeSet::from_iter(self.cardano_transaction_proofs.keys().cloned()),
238+
),
239+
generate_artifact_getter(
240+
"cardano_transaction_proofs",
241+
self.cardano_transaction_proofs,
190242
),
191-
generate_artifact_getter("ctx_proofs", self.ctx_proofs),
192243
],
193244
true,
194245
)
@@ -227,7 +278,9 @@ impl FakeAggregatorData {
227278
}
228279
}
229280

230-
pub fn extract_csd_epochs(individual_csds: &BTreeMap<ArtifactId, FileContent>) -> Vec<String> {
281+
pub fn extract_cardano_stake_distribution_epochs(
282+
individual_csds: &BTreeMap<ArtifactId, FileContent>,
283+
) -> Vec<String> {
231284
individual_csds
232285
.values()
233286
.map(|content| {
@@ -439,7 +492,7 @@ fn b() {}
439492
r#"{"hash": "csd-456", "epoch": 456}"#.to_string(),
440493
);
441494

442-
let epochs = extract_csd_epochs(&csds);
495+
let epochs = extract_cardano_stake_distribution_epochs(&csds);
443496

444497
assert_eq!(epochs, vec![123.to_string(), 456.to_string()]);
445498
}
@@ -453,7 +506,7 @@ fn b() {}
453506
r#""hash": "csd-123", "epoch": "123"#.to_string(),
454507
);
455508

456-
extract_csd_epochs(&csds);
509+
extract_cardano_stake_distribution_epochs(&csds);
457510
}
458511

459512
#[test]
@@ -462,14 +515,14 @@ fn b() {}
462515
let mut csds = BTreeMap::new();
463516
csds.insert("csd-123".to_string(), r#"{"hash": "csd-123"}"#.to_string());
464517

465-
extract_csd_epochs(&csds);
518+
extract_cardano_stake_distribution_epochs(&csds);
466519
}
467520

468521
#[test]
469522
fn test_extract_csd_epochs_with_empty_map() {
470523
let csds = BTreeMap::new();
471524

472-
let epochs = extract_csd_epochs(&csds);
525+
let epochs = extract_cardano_stake_distribution_epochs(&csds);
473526

474527
assert!(epochs.is_empty());
475528
}

mithril-client-wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-client-wasm"
3-
version = "0.7.6"
3+
version = "0.7.7"
44
description = "Mithril client WASM"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-client-wasm/ci-test/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mithril-client-wasm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mithril-dev/mithril-client-wasm",
3-
"version": "0.7.6",
3+
"version": "0.7.7",
44
"description": "Mithril client WASM",
55
"license": "Apache-2.0",
66
"collaborators": [

0 commit comments

Comments
 (0)