diff --git a/Cargo.lock b/Cargo.lock index f28604c31c8..77ff426a489 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4204,7 +4204,7 @@ dependencies = [ [[package]] name = "mithril-dmq" -version = "0.1.2" +version = "0.1.3" dependencies = [ "anyhow", "async-trait", @@ -4992,7 +4992,7 @@ dependencies = [ [[package]] name = "pallas-codec" version = "1.0.0-alpha.2" -source = "git+https://github.com/txpipe/pallas.git?branch=main#a97bd93cdc55fa2b061a6ad5fd572f5528a912b8" +source = "git+https://github.com/txpipe/pallas.git?branch=main#a9a299e18f34c90b9ab4a139aff8410832acf43b" dependencies = [ "hex", "minicbor 0.26.5", @@ -5018,7 +5018,7 @@ dependencies = [ [[package]] name = "pallas-crypto" version = "1.0.0-alpha.2" -source = "git+https://github.com/txpipe/pallas.git?branch=main#a97bd93cdc55fa2b061a6ad5fd572f5528a912b8" +source = "git+https://github.com/txpipe/pallas.git?branch=main#a9a299e18f34c90b9ab4a139aff8410832acf43b" dependencies = [ "cryptoxide", "hex", @@ -5049,7 +5049,7 @@ dependencies = [ [[package]] name = "pallas-network" version = "1.0.0-alpha.2" -source = "git+https://github.com/txpipe/pallas.git?branch=main#a97bd93cdc55fa2b061a6ad5fd572f5528a912b8" +source = "git+https://github.com/txpipe/pallas.git?branch=main#a9a299e18f34c90b9ab4a139aff8410832acf43b" dependencies = [ "byteorder", "hex", diff --git a/internal/mithril-dmq/Cargo.toml b/internal/mithril-dmq/Cargo.toml index 7a3d2f62dc2..69bca553129 100644 --- a/internal/mithril-dmq/Cargo.toml +++ b/internal/mithril-dmq/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mithril-dmq" description = "Mechanisms to publish and consume messages of a 'Decentralized Message Queue network' through a DMQ node" -version = "0.1.2" +version = "0.1.3" authors.workspace = true documentation.workspace = true edition.workspace = true diff --git a/internal/mithril-dmq/src/consumer/pallas.rs b/internal/mithril-dmq/src/consumer/pallas.rs index 57898909caf..7c4b591a6b1 100644 --- a/internal/mithril-dmq/src/consumer/pallas.rs +++ b/internal/mithril-dmq/src/consumer/pallas.rs @@ -177,6 +177,7 @@ mod tests { 32, 32, 253, 186, 201, 177, 11, 117, 135, 187, 167, 181, 188, 22, 59, 206, 105, 231, 150, 215, 30, 78, 212, 76, 16, 252, 180, 72, 134, 137, 247, 161, 68, ], + kes_period: 10, }, DmqMsg { msg_id: vec![1, 2], @@ -195,6 +196,7 @@ mod tests { 240, 103, 245, 159, 147, 177, 110, 58, 248, 115, 58, 152, 138, 220, 35, 65, 245, 200, ], + kes_period: 11, }, ] } diff --git a/internal/mithril-dmq/src/message.rs b/internal/mithril-dmq/src/message.rs index 2826330bcfa..e0c8021e259 100644 --- a/internal/mithril-dmq/src/message.rs +++ b/internal/mithril-dmq/src/message.rs @@ -46,6 +46,7 @@ impl DmqMessageBuilder { hasher.update(dmq_message.ttl.to_be_bytes()); hasher.update(&dmq_message.kes_signature); hasher.update(&dmq_message.operational_certificate); + hasher.update(dmq_message.kes_period.to_be_bytes()); hasher.finalize().to_vec() } @@ -66,6 +67,12 @@ impl DmqMessageBuilder { .kes_signer .sign(message_bytes, block_number) .with_context(|| "Failed to KES sign message while building DMQ message")?; + let kes_period = self + .chain_observer + .get_current_kes_period(&operational_certificate) + .await + .with_context(|| "Failed to get KES period while building DMQ message")? + .unwrap_or_default(); let mut dmq_message = DmqMsg { msg_id: vec![], msg_body: message_bytes.to_vec(), @@ -73,6 +80,7 @@ impl DmqMessageBuilder { ttl: self.ttl_blocks, kes_signature: kes_signature.to_bytes_vec()?, operational_certificate: operational_certificate.to_bytes_vec()?, + kes_period, }; dmq_message.msg_id = compute_msg_id(&dmq_message); @@ -134,6 +142,7 @@ mod tests { ttl: 100, kes_signature: kes_signature.to_bytes_vec().unwrap(), operational_certificate: operational_certificate.to_bytes_vec().unwrap(), + kes_period: 0, }, DmqMsg { msg_id: vec![],