Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MujkicA committed Jan 13, 2025
1 parent ff388e4 commit 1f9bc79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions e2e/tests/predicates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ async fn predicate_adjust_fee_persists_message_w_data() -> Result<()> {
TxPolicies::default().with_tip(1),
);
predicate.adjust_for_fee(&mut tb, 1000).await?;

let tx = tb.build(&provider).await?;

assert_eq!(tx.inputs().len(), 2);
Expand Down
13 changes: 8 additions & 5 deletions packages/fuels-core/src/types/transaction_builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ macro_rules! impl_tx_builder_trait {
.witnesses_mut()
.extend(repeat(witness).take(self.unresolved_signers.len()));

// Temporarily enable burning to avoid errors when calculating the fee.
let fee_estimation_tb = fee_estimation_tb.enable_burn(true);

let mut tx = $crate::types::transaction_builders::BuildableTransaction::build(
fee_estimation_tb,
&provider,
Expand Down Expand Up @@ -1605,19 +1608,19 @@ mod tests {
}
}

fn given_a_coin(tx_id: [u8; 32]) -> Coin {
fn given_a_coin(tx_id: [u8; 32], owner: [u8; 32], amount: u64) -> Coin {
Coin {
utxo_id: UtxoId::new(tx_id.into(), 0),
amount: 0,
asset_id: AssetId::zeroed(),
owner: Bech32Address::new("fuel", owner),
amount,
..Default::default()
}
}

fn given_inputs(num_inputs: u8) -> Vec<Input> {
(0..num_inputs)
.map(|i| {
let coin = given_a_coin([i; 32]);
let coin = given_a_coin([i; 32], [num_inputs + i; 32], 1000);
Input::resource_signed(CoinType::Coin(coin))
})
.collect()
Expand Down Expand Up @@ -1768,7 +1771,7 @@ mod tests {
#[tokio::test]
async fn build_w_enable_burn_predicates() -> Result<()> {
let predicate = Input::resource_predicate(
CoinType::Coin(given_a_coin([1; 32])),
CoinType::Coin(given_a_coin([1; 32], [2; 32], 1000)),
op::ret(1).to_bytes().to_vec(),
vec![],
);
Expand Down

0 comments on commit 1f9bc79

Please sign in to comment.