From 0738cfc59395419930a5c03a35d8b1e2b7b31b90 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 14:51:18 +0100 Subject: [PATCH 1/2] Add IssuanceBlockHeaderResponse::latest_parent_block_issuing_time (#1752) * Add IssuanceBlockHeaderResponse::latest_parent_block_issuing_time * Add TODO --- sdk/src/client/api/block_builder/mod.rs | 1 + sdk/src/types/api/core.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/sdk/src/client/api/block_builder/mod.rs b/sdk/src/client/api/block_builder/mod.rs index 9222463327..45bb293a2d 100644 --- a/sdk/src/client/api/block_builder/mod.rs +++ b/sdk/src/client/api/block_builder/mod.rs @@ -19,6 +19,7 @@ impl ClientInner { pub async fn build_basic_block(&self, issuer_id: AccountId, payload: Option) -> Result { let issuance = self.get_issuance().await?; + // TODO https://github.com/iotaledger/iota-sdk/issues/1753 let issuing_time = { #[cfg(feature = "std")] let issuing_time = std::time::SystemTime::now() diff --git a/sdk/src/types/api/core.rs b/sdk/src/types/api/core.rs index c4f1dce37f..34b6472ad8 100644 --- a/sdk/src/types/api/core.rs +++ b/sdk/src/types/api/core.rs @@ -277,6 +277,9 @@ pub struct IssuanceBlockHeaderResponse { /// Blocks that are directly referenced to adjust opinion. #[serde(default, skip_serializing_if = "BTreeSet::is_empty")] pub shallow_like_parents: BTreeSet, + // Latest issuing time of the returned parents. + #[serde(with = "string")] + pub latest_parent_block_issuing_time: u64, /// The slot index of the latest finalized slot. pub latest_finalized_slot: SlotIndex, /// The latest slot commitment. From 2b192618878ea9ac8e04bf89313f75036b540398 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 15:19:34 +0100 Subject: [PATCH 2/2] Add ProtocolParameters::chain_switching_threshold (#1754) * Add ProtocolParameters::chain_switching_threshold * Update sdk/src/types/block/protocol/mod.rs Co-authored-by: /alex/ --------- Co-authored-by: /alex/ --- sdk/src/types/block/protocol/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/src/types/block/protocol/mod.rs b/sdk/src/types/block/protocol/mod.rs index e4e2adaeb0..2c200bc596 100644 --- a/sdk/src/types/block/protocol/mod.rs +++ b/sdk/src/types/block/protocol/mod.rs @@ -91,6 +91,8 @@ pub struct ProtocolParameters { /// Defines the target size of the committee. If there's fewer candidates the actual committee size could be /// smaller in a given epoch. pub(crate) target_committee_size: u8, + /// Defines the number of heavier slots that a chain needs to be ahead of the current chain to be considered for switching. + pub(crate) chain_switching_threshold: u8, } // This implementation is required to make [`ProtocolParameters`] a [`Packable`] visitor. @@ -128,6 +130,7 @@ impl Default for ProtocolParameters { version_signaling_parameters: Default::default(), rewards_parameters: Default::default(), target_committee_size: 32, + chain_switching_threshold: 3, } } }