Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mithril-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-common"
version = "0.6.29"
version = "0.6.30"
description = "Common types, interfaces, and utilities for Mithril nodes."
authors = { workspace = true }
edition = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions mithril-common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ CARGO = cargo
all: test build

build:
${CARGO} build --release --features full
${CARGO} build --release

test:
${CARGO} test --features full
${CARGO} test

check:
${CARGO} check --release --all-features --all-targets
${CARGO} clippy --release --all-features --all-targets
${CARGO} fmt --check

doc:
${CARGO} doc --no-deps --open --features full
${CARGO} doc --no-deps --open

bench:
${CARGO} bench --features full --verbose
${CARGO} bench --verbose
36 changes: 32 additions & 4 deletions mithril-common/src/entities/signed_entity_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ impl SignedEntityType {
/// Return the associated open message timeout
pub fn get_open_message_timeout(&self) -> Option<Duration> {
match self {
Self::MithrilStakeDistribution(_) | Self::CardanoImmutableFilesFull(_) => None,
Self::CardanoStakeDistribution(_) => Some(Duration::from_secs(600)),
Self::CardanoTransactions(_, _) => Some(Duration::from_secs(1800)),
Self::CardanoDatabase(_) => Some(Duration::from_secs(1800)),
Self::MithrilStakeDistribution(_) => Some(Duration::from_secs(3600)),
Self::CardanoImmutableFilesFull(_) => Some(Duration::from_secs(600)),
Self::CardanoStakeDistribution(_) => Some(Duration::from_secs(1800)),
Self::CardanoTransactions(_, _) => Some(Duration::from_secs(600)),
Self::CardanoDatabase(_) => Some(Duration::from_secs(600)),
}
}

Expand Down Expand Up @@ -377,6 +378,33 @@ mod tests {
);
}

#[test]
fn get_open_message_timeout() {
assert_eq!(
SignedEntityType::MithrilStakeDistribution(Epoch(1)).get_open_message_timeout(),
Some(Duration::from_secs(3600))
);
assert_eq!(
SignedEntityType::CardanoImmutableFilesFull(CardanoDbBeacon::new(1, 1))
.get_open_message_timeout(),
Some(Duration::from_secs(600))
);
assert_eq!(
SignedEntityType::CardanoStakeDistribution(Epoch(1)).get_open_message_timeout(),
Some(Duration::from_secs(1800))
);
assert_eq!(
SignedEntityType::CardanoTransactions(Epoch(1), BlockNumber(1))
.get_open_message_timeout(),
Some(Duration::from_secs(600))
);
assert_eq!(
SignedEntityType::CardanoDatabase(CardanoDbBeacon::new(1, 1))
.get_open_message_timeout(),
Some(Duration::from_secs(600))
);
}

#[test]
fn serialize_beacon_to_json() {
let cardano_stake_distribution_json = SignedEntityType::CardanoStakeDistribution(Epoch(25))
Expand Down
Loading