Skip to content

Commit

Permalink
Add missing #[serde(with = "string")], clippy (#2088)
Browse files Browse the repository at this point in the history
Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
Thoralf-M and thibault-martinez authored Feb 28, 2024
1 parent 59a68ab commit c43c804
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sdk/src/client/api/block_builder/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn verify_semantic(
protocol_parameters,
);

Ok(context.validate()?)
context.validate()
}

/// Verifies that the signed transaction payload doesn't exceed the block size limit with 8 parents.
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/types/block/core/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl Packable for Block {
};

if let Some(protocol_params) = protocol_params {
verify_block_slot(&block.header, &block.body, &protocol_params).map_err(UnpackError::Packable)?;
verify_block_slot(&block.header, &block.body, protocol_params).map_err(UnpackError::Packable)?;

let block_len = if let (Some(start), Some(end)) = (start_opt, unpacker.read_bytes()) {
end - start
Expand Down
4 changes: 1 addition & 3 deletions sdk/src/types/block/semantic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,7 @@ impl<'a> SemanticValidationContext<'a> {
return Err(TransactionFailureReason::SemanticValidationFailed);
}

if let Err(conflict) = self.output_unlock(consumed_output, output_id, &unlocks[index]) {
return Err(conflict);
}
self.output_unlock(consumed_output, output_id, &unlocks[index])?
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{
address::{AccountAddress, Bech32Address},
output::{unlock_condition::AddressUnlockCondition, DelegationId, DelegationOutputBuilder},
},
utils::serde::string,
wallet::{operations::transaction::TransactionOptions, types::TransactionWithMetadata, Wallet},
};

Expand All @@ -21,6 +22,7 @@ pub struct CreateDelegationParams {
// TODO: https://github.com/iotaledger/iota-sdk/issues/1888
pub address: Option<Bech32Address>,
/// The amount to delegate.
#[serde(with = "string")]
pub delegated_amount: u64,
/// The Account Address of the validator to which this output will delegate.
pub validator_address: AccountAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::{
output::{feature::StakingFeature, AccountId, AccountOutputBuilder},
slot::EpochIndex,
},
utils::serde::string,
wallet::{types::TransactionWithMetadata, TransactionOptions, Wallet},
};

Expand All @@ -19,8 +20,10 @@ pub struct BeginStakingParams {
/// The account id which will begin staking.
pub account_id: AccountId,
/// The amount of tokens to stake.
#[serde(with = "string")]
pub staked_amount: u64,
/// The fixed cost of the validator, which it receives as part of its Mana rewards.
#[serde(with = "string")]
pub fixed_cost: u64,
/// The staking period (in epochs). Will default to the staking unbonding period.
pub staking_period: Option<u32>,
Expand Down

0 comments on commit c43c804

Please sign in to comment.