Skip to content

Commit 37d0390

Browse files
authored
Merge pull request #1717 from input-output-hk/ensemble/1697/cardano_transaction_with_chain_point_beacon
Add `chain_point` to `TimePoint` structure
2 parents 635ba54 + ed46948 commit 37d0390

24 files changed

+265
-87
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.

mithril-aggregator/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-aggregator"
3-
version = "0.5.11"
3+
version = "0.5.12"
44
description = "A Mithril Aggregator server"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-aggregator/src/configuration.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ impl Source for DefaultConfiguration {
459459

460460
#[cfg(test)]
461461
mod test {
462+
use mithril_common::entities::ChainPoint;
462463
use mithril_common::test_utils::fake_data;
463464

464465
use super::*;
@@ -610,7 +611,8 @@ mod test {
610611
#[test]
611612
fn test_list_allowed_signed_entity_types_with_specific_configuration() {
612613
let beacon = fake_data::beacon();
613-
let time_point = TimePoint::new(*beacon.epoch, beacon.immutable_file_number);
614+
let chain_point = ChainPoint::dummy();
615+
let time_point = TimePoint::new(*beacon.epoch, beacon.immutable_file_number, chain_point);
614616

615617
let config = Configuration {
616618
network: beacon.network.clone(),

mithril-aggregator/src/runtime/runner.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ pub mod tests {
486486
};
487487
use async_trait::async_trait;
488488
use chrono::{DateTime, Utc};
489+
use mithril_common::entities::ChainPoint;
489490
use mithril_common::{
490491
chain_observer::FakeObserver,
491492
digesters::DumbImmutableFileObserver,
@@ -607,7 +608,7 @@ pub mod tests {
607608

608609
#[tokio::test]
609610
async fn test_get_time_point_from_chain() {
610-
let expected = TimePoint::new(2, 17);
611+
let expected = TimePoint::new(2, 17, ChainPoint::dummy());
611612
let mut dependencies = initialize_dependencies().await;
612613
let immutable_file_observer = Arc::new(DumbImmutableFileObserver::default());
613614
immutable_file_observer

mithril-aggregator/src/tools/certificates_hash_migrator.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ impl CertificatesHashMigrator {
191191
#[cfg(test)]
192192
mod test {
193193
use mithril_common::entities::{
194-
ImmutableFileNumber, SignedEntityType, SignedEntityTypeDiscriminants as Type, TimePoint,
194+
ChainPoint, ImmutableFileNumber, SignedEntityType, SignedEntityTypeDiscriminants as Type,
195+
TimePoint,
195196
};
196197
use mithril_common::test_utils::fake_data;
197198
use mithril_persistence::sqlite::{ConnectionBuilder, ConnectionOptions, SqliteConnection};
@@ -217,8 +218,10 @@ mod test {
217218
.unwrap()
218219
}
219220

221+
/// Note: If we want to create CardanoTransaction test certificate then another method
222+
/// that take a ChainPoint as parameter should be created.
220223
fn time_at(epoch: u64, immutable_file_number: ImmutableFileNumber) -> TimePoint {
221-
TimePoint::new(epoch, immutable_file_number)
224+
TimePoint::new(epoch, immutable_file_number, ChainPoint::dummy())
222225
}
223226

224227
fn dummy_genesis(certificate_hash: &str, time_point: TimePoint) -> Certificate {

mithril-aggregator/tests/certificate_chain.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod test_extensions;
33
use mithril_aggregator::Configuration;
44
use mithril_common::{
55
entities::{
6-
CardanoDbBeacon, Epoch, ProtocolParameters, SignedEntityType,
6+
CardanoDbBeacon, ChainPoint, Epoch, ProtocolParameters, SignedEntityType,
77
SignedEntityTypeDiscriminants, StakeDistribution, StakeDistributionParty, TimePoint,
88
},
99
test_utils::MithrilFixtureBuilder,
@@ -22,7 +22,11 @@ async fn certificate_chain() {
2222
data_stores_directory: get_test_dir("certificate_chain"),
2323
..Configuration::new_sample()
2424
};
25-
let mut tester = RuntimeTester::build(TimePoint::new(1, 1), configuration).await;
25+
let mut tester = RuntimeTester::build(
26+
TimePoint::new(1, 1, ChainPoint::new(10, 1, "block_hash-1")),
27+
configuration,
28+
)
29+
.await;
2630
let observer = tester.observer.clone();
2731

2832
comment!("Create signers & declare stake distribution");

mithril-aggregator/tests/create_certificate.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod test_extensions;
33
use mithril_aggregator::Configuration;
44
use mithril_common::{
55
entities::{
6-
CardanoDbBeacon, Epoch, ProtocolParameters, SignedEntityType,
6+
CardanoDbBeacon, ChainPoint, Epoch, ProtocolParameters, SignedEntityType,
77
SignedEntityTypeDiscriminants, StakeDistributionParty, TimePoint,
88
},
99
test_utils::MithrilFixtureBuilder,
@@ -22,7 +22,11 @@ async fn create_certificate() {
2222
data_stores_directory: get_test_dir("create_certificate"),
2323
..Configuration::new_sample()
2424
};
25-
let mut tester = RuntimeTester::build(TimePoint::new(1, 1), configuration).await;
25+
let mut tester = RuntimeTester::build(
26+
TimePoint::new(1, 1, ChainPoint::new(10, 1, "block_hash-1")),
27+
configuration,
28+
)
29+
.await;
2630

2731
comment!("create signers & declare stake distribution");
2832
let fixture = MithrilFixtureBuilder::default()

mithril-aggregator/tests/era_checker.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod test_extensions;
22
use mithril_aggregator::{Configuration, RuntimeError};
33
use mithril_common::{
4-
entities::{Epoch, ProtocolParameters, TimePoint},
4+
entities::{ChainPoint, Epoch, ProtocolParameters, TimePoint},
55
era::{EraMarker, SupportedEra},
66
test_utils::MithrilFixtureBuilder,
77
};
@@ -23,7 +23,11 @@ async fn testing_eras() {
2323
data_stores_directory: get_test_dir("testing_eras"),
2424
..Configuration::new_sample()
2525
};
26-
let mut tester = RuntimeTester::build(TimePoint::new(1, 1), configuration).await;
26+
let mut tester = RuntimeTester::build(
27+
TimePoint::new(1, 1, ChainPoint::new(10, 1, "block_hash-1")),
28+
configuration,
29+
)
30+
.await;
2731
tester.era_reader_adapter.set_markers(vec![
2832
EraMarker::new("unsupported", Some(Epoch(0))),
2933
EraMarker::new(&SupportedEra::dummy().to_string(), Some(Epoch(12))),

mithril-aggregator/tests/genesis_to_signing.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod test_extensions;
22

33
use mithril_aggregator::Configuration;
44
use mithril_common::{
5-
entities::{CardanoDbBeacon, ProtocolParameters, TimePoint},
5+
entities::{CardanoDbBeacon, ChainPoint, ProtocolParameters, TimePoint},
66
test_utils::MithrilFixtureBuilder,
77
};
88
use test_extensions::{utilities::get_test_dir, ExpectedCertificate, RuntimeTester};
@@ -19,7 +19,11 @@ async fn genesis_to_signing() {
1919
data_stores_directory: get_test_dir("genesis_to_signing"),
2020
..Configuration::new_sample()
2121
};
22-
let mut tester = RuntimeTester::build(TimePoint::new(1, 1), configuration).await;
22+
let mut tester = RuntimeTester::build(
23+
TimePoint::new(1, 1, ChainPoint::new(10, 1, "block_hash-1")),
24+
configuration,
25+
)
26+
.await;
2327

2428
comment!("Create signers & declare stake distribution");
2529
let fixture = MithrilFixtureBuilder::default()

mithril-aggregator/tests/open_message_expiration.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::time::Duration;
55
use mithril_aggregator::Configuration;
66
use mithril_common::{
77
entities::{
8-
CardanoDbBeacon, ProtocolParameters, SignedEntityType, SignedEntityTypeDiscriminants,
9-
TimePoint,
8+
CardanoDbBeacon, ChainPoint, ProtocolParameters, SignedEntityType,
9+
SignedEntityTypeDiscriminants, TimePoint,
1010
},
1111
test_utils::MithrilFixtureBuilder,
1212
};
@@ -24,7 +24,11 @@ async fn open_message_expiration() {
2424
data_stores_directory: get_test_dir("open_message_expiration"),
2525
..Configuration::new_sample()
2626
};
27-
let mut tester = RuntimeTester::build(TimePoint::new(1, 1), configuration).await;
27+
let mut tester = RuntimeTester::build(
28+
TimePoint::new(1, 1, ChainPoint::new(10, 1, "block_hash-1")),
29+
configuration,
30+
)
31+
.await;
2832

2933
comment!("create signers & declare stake distribution");
3034
let fixture = MithrilFixtureBuilder::default()

0 commit comments

Comments
 (0)