Skip to content

Commit

Permalink
Rename burned_mana to max_burned_mana (#1375)
Browse files Browse the repository at this point in the history
* Rename burned_mana

* missed fn

* fn again
  • Loading branch information
DaughterOfMars authored Oct 3, 2023
1 parent 655b7f8 commit 9b39040
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bindings/nodejs/lib/types/block/core/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ export class BasicBlock extends Block {
* The amount of mana the Account identified by IssuerID is at most
* willing to burn for this block.
*/
readonly burnedMana!: u64;
readonly maxBurnedMana!: u64;
}
4 changes: 2 additions & 2 deletions bindings/python/iota_sdk/types/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class Block:
strong_parents: Blocks that are strongly directly approved.
weak_parents: Blocks that are weakly directly approved.
shallow_like_parents: Blocks that are directly referenced to adjust opinion.
burned_mana: The amount of Mana the Account identified by the IssuerId is at most willing to burn for this block.
max_burned_mana: The amount of Mana the Account identified by the IssuerId is at most willing to burn for this block.
payload: The optional payload of this block.
"""

protocol_version: int
strong_parents: List[HexStr]
weak_parents: List[HexStr]
shallow_like_parents: List[HexStr]
burned_mana: str
max_burned_mana: str
payload: Optional[Union[TaggedDataPayload,
TransactionPayload]] = None

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/client/api/block_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl ClientInner {
issuance.commitment.id(),
issuance.latest_finalized_slot,
issuer_id,
// TODO correct value for burned_mana
// TODO correct value for max_burned_mana
Block::build_basic(strong_parents, 0)
.with_weak_parents(issuance.weak_parents()?)
.with_shallow_like_parents(issuance.shallow_like_parents()?)
Expand Down
34 changes: 17 additions & 17 deletions sdk/src/types/block/core/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ pub struct BasicBlockBuilder {
weak_parents: WeakParents,
shallow_like_parents: ShallowLikeParents,
payload: OptionalPayload,
burned_mana: u64,
max_burned_mana: u64,
}

impl BasicBlockBuilder {
/// Creates a new [`BasicBlockBuilder`].
#[inline(always)]
pub fn new(strong_parents: StrongParents, burned_mana: u64) -> Self {
pub fn new(strong_parents: StrongParents, max_burned_mana: u64) -> Self {
Self {
strong_parents,
weak_parents: WeakParents::default(),
shallow_like_parents: ShallowLikeParents::default(),
payload: OptionalPayload::default(),
burned_mana,
max_burned_mana,
}
}

Expand Down Expand Up @@ -69,10 +69,10 @@ impl BasicBlockBuilder {
self
}

/// Adds burned mana to a [`BasicBlockBuilder`].
/// Adds max burned mana to a [`BasicBlockBuilder`].
#[inline(always)]
pub fn with_burned_mana(mut self, burned_mana: u64) -> Self {
self.burned_mana = burned_mana;
pub fn with_max_burned_mana(mut self, max_burned_mana: u64) -> Self {
self.max_burned_mana = max_burned_mana;
self
}

Expand All @@ -85,7 +85,7 @@ impl BasicBlockBuilder {
weak_parents: self.weak_parents,
shallow_like_parents: self.shallow_like_parents,
payload: self.payload,
burned_mana: self.burned_mana,
max_burned_mana: self.max_burned_mana,
})
}

Expand All @@ -107,7 +107,7 @@ pub struct BasicBlock {
payload: OptionalPayload,
/// The amount of Mana the Account identified by [`IssuerId`](super::IssuerId) is at most willing to burn for this
/// block.
burned_mana: u64,
max_burned_mana: u64,
}

impl BasicBlock {
Expand Down Expand Up @@ -137,10 +137,10 @@ impl BasicBlock {
self.payload.as_ref()
}

/// Returns the burned mana of a [`BasicBlock`].
/// Returns the max burned mana of a [`BasicBlock`].
#[inline(always)]
pub fn burned_mana(&self) -> u64 {
self.burned_mana
pub fn max_burned_mana(&self) -> u64 {
self.max_burned_mana
}
}

Expand All @@ -153,7 +153,7 @@ impl Packable for BasicBlock {
self.weak_parents.pack(packer)?;
self.shallow_like_parents.pack(packer)?;
self.payload.pack(packer)?;
self.burned_mana.pack(packer)?;
self.max_burned_mana.pack(packer)?;

Ok(())
}
Expand All @@ -173,14 +173,14 @@ impl Packable for BasicBlock {

let payload = OptionalPayload::unpack::<_, VERIFY>(unpacker, visitor)?;

let burned_mana = u64::unpack::<_, VERIFY>(unpacker, &()).coerce()?;
let max_burned_mana = u64::unpack::<_, VERIFY>(unpacker, &()).coerce()?;

Ok(Self {
strong_parents,
weak_parents,
shallow_like_parents,
payload,
burned_mana,
max_burned_mana,
})
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ pub(crate) mod dto {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub payload: Option<PayloadDto>,
#[serde(with = "crate::utils::serde::string")]
pub burned_mana: u64,
pub max_burned_mana: u64,
}

impl From<&BasicBlock> for BasicBlockDto {
Expand All @@ -219,7 +219,7 @@ pub(crate) mod dto {
weak_parents: value.weak_parents.to_set(),
shallow_like_parents: value.shallow_like_parents.to_set(),
payload: value.payload.as_ref().map(Into::into),
burned_mana: value.burned_mana,
max_burned_mana: value.max_burned_mana,
}
}
}
Expand All @@ -229,7 +229,7 @@ pub(crate) mod dto {
type Error = Error;

fn try_from_dto_with_params_inner(dto: Self::Dto, params: ValidationParams<'_>) -> Result<Self, Self::Error> {
BasicBlockBuilder::new(StrongParents::from_set(dto.strong_parents)?, dto.burned_mana)
BasicBlockBuilder::new(StrongParents::from_set(dto.strong_parents)?, dto.max_burned_mana)
.with_weak_parents(WeakParents::from_set(dto.weak_parents)?)
.with_shallow_like_parents(ShallowLikeParents::from_set(dto.shallow_like_parents)?)
.with_payload(
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/types/block/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ impl Block {

/// Creates a new [`BasicBlockBuilder`].
#[inline(always)]
pub fn build_basic(strong_parents: self::basic::StrongParents, burned_mana: u64) -> BasicBlockBuilder {
BasicBlockBuilder::new(strong_parents, burned_mana)
pub fn build_basic(strong_parents: self::basic::StrongParents, max_burned_mana: u64) -> BasicBlockBuilder {
BasicBlockBuilder::new(strong_parents, max_burned_mana)
}

/// Creates a new [`ValidationBlockBuilder`].
Expand Down
4 changes: 2 additions & 2 deletions sdk/tests/types/block_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn basic_block_id_tagged_data_payload() {
"tag": "0x68656c6c6f20776f726c64",
"data": "0x01020304"
},
"burnedMana": "180500"
"maxBurnedMana": "180500"
},
"signature": {
"type": 0,
Expand Down Expand Up @@ -214,7 +214,7 @@ fn basic_block_id_transaction_payload() {
}
]
},
"burnedMana": "180500"
"maxBurnedMana": "180500"
},
"signature": {
"type": 0,
Expand Down

0 comments on commit 9b39040

Please sign in to comment.