Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename burned_mana to max_burned_mana #1375

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 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
28 changes: 14 additions & 14 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 @@ -71,8 +71,8 @@ impl BasicBlockBuilder {

/// Adds 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 @@ -140,7 +140,7 @@ impl BasicBlock {
/// Returns the burned mana of a [`BasicBlock`].
#[inline(always)]
pub fn burned_mana(&self) -> u64 {
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
self.burned_mana
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