diff --git a/bindings/core/src/response.rs b/bindings/core/src/response.rs index 8c9205134e..365b629b09 100644 --- a/bindings/core/src/response.rs +++ b/bindings/core/src/response.rs @@ -180,7 +180,6 @@ pub enum Response { FoundryId(FoundryId), /// Response for: /// - [`TransactionSigningHash`](crate::method::UtilsMethod::TransactionSigningHash) - /// - [`ComputeInputsCommitment`](crate::method::UtilsMethod::ComputeInputsCommitment) Hash(String), /// Response for [`GetNodeInfo`](crate::method::ClientMethod::GetNodeInfo) NodeInfoWrapper(NodeInfoWrapper), diff --git a/bindings/nodejs/lib/types/block/slot/commitment.ts b/bindings/nodejs/lib/types/block/slot/commitment.ts index 25e105b9e6..232703f319 100644 --- a/bindings/nodejs/lib/types/block/slot/commitment.ts +++ b/bindings/nodejs/lib/types/block/slot/commitment.ts @@ -33,37 +33,48 @@ type RootsId = string; * It is linked to the commitment of the previous slot, which forms a commitment chain. */ class SlotCommitment { + /** + * The version of the protocol running. + */ + readonly protocolVersion: number; /** * The slot index of this commitment. * It is calculated based on genesis timestamp and the duration of a slot. */ - readonly index: SlotIndex; + readonly slot: SlotIndex; /** * The commitment ID of the previous slot. */ - readonly prevId: SlotCommitmentId; + readonly previousCommitmentId: SlotCommitmentId; /** * A BLAKE2b-256 hash of concatenating multiple sparse merkle tree roots of a slot. */ readonly rootsId: RootsId; - /** * The sum of previous slot commitment cumulative weight and weight of issuers of accepted blocks within this * slot. It is just an indication of "committed into" this slot, and can not strictly be used for evaluating * the switching of a chain. */ readonly cumulativeWeight: u64; + /** + * Reference Mana Cost (RMC) to be used in the slot with index at `index + Max Committable Age`. + */ + readonly referenceManaCost: u64; constructor( - index: SlotIndex, - previousSlotCommitmentId: SlotCommitmentId, + protocolVersion: number, + slot: SlotIndex, + previousCommitmentId: SlotCommitmentId, rootsId: RootsId, cumulativeWeight: u64, + referenceManaCost: u64, ) { - this.index = index; - this.prevId = previousSlotCommitmentId; + this.protocolVersion = protocolVersion; + this.slot = slot; + this.previousCommitmentId = previousCommitmentId; this.rootsId = rootsId; this.cumulativeWeight = cumulativeWeight; + this.referenceManaCost = referenceManaCost; } } diff --git a/bindings/nodejs/lib/types/utils/bridge/utils.ts b/bindings/nodejs/lib/types/utils/bridge/utils.ts index 79c1931f74..906ddfbb83 100644 --- a/bindings/nodejs/lib/types/utils/bridge/utils.ts +++ b/bindings/nodejs/lib/types/utils/bridge/utils.ts @@ -194,11 +194,12 @@ export interface __OutputHexBytes__ { }; } +// TODO we don't do this anywhere else, but it seems necessary, need to reevaluate later. // Modified `SlotCommitment` with bigint types converted to strings. type SlotCommitmentConverted = Omit< SlotCommitment, - 'index' | 'cumulativeWeight' -> & { index: string; cumulativeWeight: string }; + 'cumulativeWeight' | 'referenceManaCost' +> & { cumulativeWeight: string; referenceManaCost: string }; export interface __ComputeSlotCommitmentId__ { name: 'computeSlotCommitmentId'; data: { diff --git a/bindings/nodejs/lib/utils/utils.ts b/bindings/nodejs/lib/utils/utils.ts index 7824171c58..c4b23ad3ab 100644 --- a/bindings/nodejs/lib/utils/utils.ts +++ b/bindings/nodejs/lib/utils/utils.ts @@ -394,11 +394,14 @@ export class Utils { name: 'computeSlotCommitmentId', data: { slotCommitment: { - index: slotCommitment.index.toString(10), - prevId: slotCommitment.prevId, + protocolVersion: slotCommitment.protocolVersion, + slot: slotCommitment.slot, + previousCommitmentId: slotCommitment.previousCommitmentId, rootsId: slotCommitment.rootsId, cumulativeWeight: slotCommitment.cumulativeWeight.toString(10), + referenceManaCost: + slotCommitment.referenceManaCost.toString(10), }, }, }); diff --git a/bindings/python/iota_sdk/utils.py b/bindings/python/iota_sdk/utils.py index 687a507d9c..e5a9203633 100644 --- a/bindings/python/iota_sdk/utils.py +++ b/bindings/python/iota_sdk/utils.py @@ -122,14 +122,6 @@ def compute_foundry_id(account_id: HexStr, serial_number: int, 'tokenSchemeType': token_scheme_type }) - @staticmethod - def compute_inputs_commitment(inputs: List[Output]) -> HexStr: - """Compute the input commitment from the output objects that are used as inputs to fund the transaction. - """ - return _call_method('computeInputsCommitment', { - 'inputs': [i.to_dict() for i in inputs] - }) - @staticmethod def compute_storage_deposit(output, rent) -> HexStr: """Compute the required storage deposit of an output. diff --git a/sdk/src/types/block/slot/commitment.rs b/sdk/src/types/block/slot/commitment.rs index 26cef21804..f61960c741 100644 --- a/sdk/src/types/block/slot/commitment.rs +++ b/sdk/src/types/block/slot/commitment.rs @@ -23,10 +23,9 @@ pub struct SlotCommitment { protocol_version: u8, /// The slot index of this commitment. /// It is calculated based on genesis timestamp and the duration of a slot. - index: SlotIndex, + slot: SlotIndex, /// The commitment ID of the previous slot. - #[cfg_attr(feature = "serde", serde(rename = "previousCommitmentId"))] - previous_slot_commitment_id: SlotCommitmentId, + previous_commitment_id: SlotCommitmentId, /// The digest of multiple sparse merkle tree roots of this slot. roots_id: RootsId, /// The sum of previous slot commitment cumulative weight and weight of issuers of accepted blocks within this @@ -43,16 +42,16 @@ impl SlotCommitment { /// Creates a new [`SlotCommitment`]. pub fn new( protocol_version: u8, - index: SlotIndex, - previous_slot_commitment_id: SlotCommitmentId, + slot: SlotIndex, + previous_commitment_id: SlotCommitmentId, roots_id: RootsId, cumulative_weight: u64, reference_mana_cost: u64, ) -> Self { Self { protocol_version, - index, - previous_slot_commitment_id, + slot, + previous_commitment_id, roots_id, cumulative_weight, reference_mana_cost, @@ -64,14 +63,14 @@ impl SlotCommitment { self.protocol_version } - /// Returns the index of the [`SlotCommitment`]. - pub fn index(&self) -> SlotIndex { - self.index + /// Returns the slot index of the [`SlotCommitment`]. + pub fn slot(&self) -> SlotIndex { + self.slot } /// Returns the previous slot commitment ID of the [`SlotCommitment`]. - pub fn previous_slot_commitment_id(&self) -> &SlotCommitmentId { - &self.previous_slot_commitment_id + pub fn previous_commitment_id(&self) -> &SlotCommitmentId { + &self.previous_commitment_id } /// Returns the roots ID of the [`SlotCommitment`]. @@ -91,6 +90,6 @@ impl SlotCommitment { /// Computes the [`SlotCommitmentId`] of the [`SlotCommitment`]. pub fn id(&self) -> SlotCommitmentId { - SlotCommitmentHash::new(Blake2b256::digest(self.pack_to_vec()).into()).into_slot_commitment_id(self.index) + SlotCommitmentHash::new(Blake2b256::digest(self.pack_to_vec()).into()).into_slot_commitment_id(self.slot) } }