Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shaorongqiang committed Dec 22, 2023
1 parent 35f6cf5 commit 96dbcab
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/components/abciapp/src/abci/staking/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn gen_transfer_tx(

for output in outputs {
trans_builder
.add_output(&output, None, None, None)
.add_output(&output, None, None, None, None)
.c(d!())?;
}

Expand All @@ -159,5 +159,5 @@ fn gen_transfer_tx(
.c(d!())?;

tx_builder.add_operation(op);
Ok(tx_builder.take_transaction())
Ok(tx_builder.take_transaction().into())
}
2 changes: 1 addition & 1 deletion src/components/finutils/src/bins/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ fn run() -> Result<()> {
} else {
common::transfer_asset_batch(
f.as_deref(),
&t.iter().map(|v| (v.clone(), None)).collect::<Vec<_>>(),
&t.iter().map(|v| (*v, None)).collect::<Vec<_>>(),
None,
am.unwrap(),
m.is_present("confidential-amount"),
Expand Down
7 changes: 4 additions & 3 deletions src/components/finutils/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,10 @@ impl From<BuildTransactionBody> for TransactionBody {
impl BuildTransactionBody {
#[inline(always)]
fn from_token(no_replay_token: NoReplayToken) -> Self {
let mut result = Self::default();
result.no_replay_token = no_replay_token;
result
BuildTransactionBody {
no_replay_token,
..Default::default()
}
}
}

Expand Down
34 changes: 17 additions & 17 deletions src/components/finutils/src/txn_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ mod tests {
20,
)
.c(d!())?
.add_output(&output_template, None, None, None)
.add_output(&output_template, None, None, None, None)
.c(d!())?
.balance(None);

Expand All @@ -1276,15 +1276,15 @@ mod tests {
20,
)
.c(d!())?
.add_output(&output_template, None, None, None)
.add_output(&output_template, None, None, None, None)
.c(d!())?
.balance(None)
.c(d!())?
.create(TransferType::Standard)
.c(d!())?
.sign(&alice)
.c(d!())?
.add_output(&output_template, None, None, None);
.add_output(&output_template, None, None, None, None);
assert!(res.is_err());

// Not all signatures present
Expand All @@ -1304,7 +1304,7 @@ mod tests {
20,
)
.c(d!())?
.add_output(&output_template, None, None, None)
.add_output(&output_template, None, None, None, None)
.c(d!())?
.balance(None)
.c(d!())?
Expand Down Expand Up @@ -1368,17 +1368,17 @@ mod tests {
20,
)
.c(d!())?
.add_output(&output_bob5_code1_template, None, None, None)
.add_output(&output_bob5_code1_template, None, None, None, None)
.c(d!())?
.add_output(&output_charlie13_code1_template, None, None, None)
.add_output(&output_charlie13_code1_template, None, None, None, None)
.c(d!())?
.add_output(&output_ben2_code1_template, None, None, None)
.add_output(&output_ben2_code1_template, None, None, None, None)
.c(d!())?
.add_output(&output_bob5_code2_template, None, None, None)
.add_output(&output_bob5_code2_template, None, None, None, None)
.c(d!())?
.add_output(&output_charlie13_code2_template, None, None, None)
.add_output(&output_charlie13_code2_template, None, None, None, None)
.c(d!())?
.add_output(&output_ben2_code2_template, None, None, None)
.add_output(&output_ben2_code2_template, None, None, None, None)
.c(d!())?
.balance(None)
.c(d!())?
Expand Down Expand Up @@ -1438,7 +1438,7 @@ mod tests {
100 * TX_FEE_MIN,
)
.unwrap()
.add_output(&output_bob_fra_template, None, None, None)
.add_output(&output_bob_fra_template, None, None, None, None)
.unwrap()
.balance(None)
.unwrap()
Expand All @@ -1453,11 +1453,11 @@ mod tests {

let mut tx2 = TransactionBuilder::from_seq_id(1);
tx2.add_operation(transfer_to_bob!(txo_sid, bob_kp.get_pk()))
.add_fee_relative_auto(&fra_owner_kp)
.add_fee_relative_auto(&fra_owner_kp, None)
.unwrap();
assert!(tx2.check_fee());

let effect = TxnEffect::compute_effect(tx2.into_transaction()).unwrap();
let effect = TxnEffect::compute_effect(tx2.into_transaction().into()).unwrap();
let mut block = ledger.start_block().unwrap();
let tmp_sid = ledger.apply_transaction(&mut block, effect).unwrap();
// txo_sid[0]: fra_owner to bob
Expand All @@ -1483,10 +1483,10 @@ mod tests {
let mut tx3 = TransactionBuilder::from_seq_id(2);
pnk!(tx3
.add_operation(transfer_to_bob!(txo_sid[2], bob_kp.get_pk()))
.add_fee(fi));
.add_fee(fi, None));
assert!(tx3.check_fee());

let effect = TxnEffect::compute_effect(tx3.into_transaction()).unwrap();
let effect = TxnEffect::compute_effect(tx3.into_transaction().into()).unwrap();
let mut block = ledger.start_block().unwrap();
let tmp_sid = ledger.apply_transaction(&mut block, effect).unwrap();
// txo_sid[0]: fra_owner to bob
Expand All @@ -1512,11 +1512,11 @@ mod tests {
);
let mut tx4 = TransactionBuilder::from_seq_id(3);
tx4.add_operation(transfer_to_bob!(txo_sid[1], bob_kp.get_pk()))
.add_fee(fi)
.add_fee(fi, None)
.unwrap();
assert!(tx4.check_fee());

let effect = TxnEffect::compute_effect(tx4.into_transaction()).unwrap();
let effect = TxnEffect::compute_effect(tx4.into_transaction().into()).unwrap();
let mut block = ledger.start_block().unwrap();
ledger.apply_transaction(&mut block, effect).unwrap();
ledger.finish_block(block).unwrap();
Expand Down
7 changes: 4 additions & 3 deletions src/components/wallet_mobile/src/rust/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl TransactionBuilder {
mut self,
kp: XfrKeyPair,
) -> RucResult<TransactionBuilder> {
self.transaction_builder.add_fee_relative_auto(&kp)?;
self.transaction_builder.add_fee_relative_auto(&kp, None)?;
Ok(self)
}

Expand All @@ -155,7 +155,7 @@ impl TransactionBuilder {
/// As the last operation of any transaction,
/// add a static fee to the transaction.
pub fn add_fee(mut self, inputs: FeeInputs) -> RucResult<TransactionBuilder> {
self.transaction_builder.add_fee(inputs.into())?;
self.transaction_builder.add_fee(inputs.into(), None)?;
Ok(self)
}

Expand Down Expand Up @@ -330,7 +330,7 @@ impl TransactionBuilder {
/// Adds a serialized transfer asset operation to a transaction builder instance.
pub fn add_transfer_operation(mut self, op: String) -> Result<TransactionBuilder> {
let op = serde_json::from_str::<Operation>(&op)?;
self.get_builder_mut().add_operation(op);
self.get_builder_mut().add_operation((&op).into());
Ok(self)
}

Expand Down Expand Up @@ -441,6 +441,7 @@ impl TransferOperationBuilder {
tracing_policies.map(|policies| policies.get_policies_ref().clone()),
None,
None,
None,
)?;
Ok(self)
}
Expand Down

0 comments on commit 96dbcab

Please sign in to comment.