Skip to content

Commit

Permalink
Create new Pythagoras era
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed May 26, 2023
1 parent c271d62 commit 9673acc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 12 additions & 1 deletion mithril-aggregator/tests/certificate_chain.rs
Expand Up @@ -2,7 +2,10 @@ mod test_extensions;

use mithril_aggregator::{Configuration, VerificationKeyStorer};
use mithril_common::{
chain_observer::ChainObserver, entities::ProtocolParameters, test_utils::MithrilFixtureBuilder,
chain_observer::ChainObserver,
entities::{Epoch, ProtocolParameters},
era::{EraMarker, SupportedEra},
test_utils::MithrilFixtureBuilder,
};
use test_extensions::{utilities::get_test_dir, RuntimeTester, SignedEntityTypeDiscriminants};

Expand All @@ -21,6 +24,14 @@ async fn certificate_chain() {
let mut tester = RuntimeTester::build(configuration).await;
let observer = tester.observer.clone();

comment!("use Pythagoras era");
tester
.set_era_markers(vec![EraMarker::new(
&SupportedEra::Pythagoras.to_string(),
Some(Epoch(0)),
)])
.await;

comment!("Create signers & declare stake distribution");
let fixture = MithrilFixtureBuilder::default()
.with_signers(5)
Expand Down
11 changes: 10 additions & 1 deletion mithril-aggregator/tests/create_certificate.rs
Expand Up @@ -4,7 +4,8 @@ use std::collections::BTreeSet;

use mithril_aggregator::Configuration;
use mithril_common::{
entities::{ProtocolMessagePartKey, ProtocolParameters},
entities::{Epoch, ProtocolMessagePartKey, ProtocolParameters},
era::{EraMarker, SupportedEra},
test_utils::MithrilFixtureBuilder,
};
use test_extensions::{utilities::get_test_dir, RuntimeTester, SignedEntityTypeDiscriminants};
Expand All @@ -24,6 +25,14 @@ async fn create_certificate() {
let mut tester = RuntimeTester::build(configuration).await;
let observer = tester.observer.clone();

comment!("use Pythagoras era");
tester
.set_era_markers(vec![EraMarker::new(
&SupportedEra::Pythagoras.to_string(),
Some(Epoch(0)),
)])
.await;

comment!("create signers & declare stake distribution");
let fixture = MithrilFixtureBuilder::default()
.with_signers(10)
Expand Down
3 changes: 3 additions & 0 deletions mithril-common/src/era/supported_era.rs
Expand Up @@ -28,6 +28,9 @@ impl UnsupportedEraError {
pub enum SupportedEra {
/// Thales era
Thales,

/// Pythagoras era
Pythagoras,
}

impl SupportedEra {
Expand Down

0 comments on commit 9673acc

Please sign in to comment.