Validation Error (Insufficient Fee Amount) during predicate call

@fuel We’re pretty sure this is a regression with fuels-rs v0.47.0. We’re working on confirming and solving the issue.

In the meantime, you can implement a workaround.

The issue is with our estimation mechanisms when using predicates – in order to circumvent it we have to have some gas present in inputs before we run call() on the ScriptCallHandler

A simple workaround for your case would be:

  1. Change init_wallets so that each wallet gets more than 1 coin. Set it to at least 2:
pub async fn init_wallets() -> Vec<WalletUnlocked> {
    let config = WalletsConfig::new(Some(5), Some(2), Some(1_000_000_000));
    launch_custom_provider_and_get_wallets(config, None, None).await
}
  1. Add enough base asset to inputs and add the change output:
// in `fulfill_order`
        let base_asset = wallet
            .get_asset_inputs_for_amount(BASE_ASSET_ID, 10)
            .await?;
        inputs.extend(base_asset);

        let change = Output::change(wallet.address().into(), 0, BASE_ASSET_ID);
        outputs.push(change);

        let script_call = ScriptCallHandler::new(
            vec![],
            UnresolvedBytes::default(),
            wallet.clone(),
            provider.clone(),
            Default::default(),
        )
        .with_inputs(inputs)
        .with_outputs(outputs)

Your test should now pass. We’ll work on a fix asap.

1 Like