The `determine_missing_contracts` function is failing to figure out the nested contract calls

I am using determine_missing_contracts in places of my application where I do not have access to the contract ids used for the nested calls within my contract.

If I isolate this code which is causing this issue and do the only call which is executed from within the call flow, it is successful and then, when trying to perform the function call (which calls the previous function from within) right after, it yields an error.

The transaction logs can be seen here

CallResponse { value: true, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: f9323d8fc4b5df20687efc24ae81e4037408758eb2db57f0f6cb9da7bb3c41c4, amount: 0, asset_id: f8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07, gas: 77392, param1: 10480, param2: 10494, pc: 11920, is: 11920 }, ReturnData { id: f9323d8fc4b5df20687efc24ae81e4037408758eb2db57f0f6cb9da7bb3c41c4, ptr: 67091165, len: 1, digest: 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a, pc: 16468, is: 11920, data: Some(01) }, Return { id: 0000000000000000000000000000000000000000000000000000000000000000, val: 1, pc: 10388, is: 10368 }, ScriptResult { result: Success, gas_used: 82912 }], gas_used: 82912, log_decoder: LogDecoder { log_formatters: {LogId(f9323d8fc4b5df20687efc24ae81e4037408758eb2db57f0f6cb9da7bb3c41c4, "12857203263801679462"): LogFormatter { type_id: TypeId { t: (1069581086878444301, 2153821500543228854) } }}, decoder_config: DecoderConfig { max_depth: 45, max_tokens: 10000 } }, tx_id: Some(fbbfd50bf61852458e3c3cb03bf283fb9c9aead5c973c726edb22877c22dd288) }

`Err` value: Transaction(Reverted { reason: "failed to decode log from require revert: codec: missing log formatter for log_id: `LogId(f9323d8fc4b5df20687efc24ae81e4037408758eb2db57f0f6cb9da7bb3c41c4, \"12857203263801679462\")`, data: `[0, 0, 0, 0, 0, 0, 0, 1]`. Consider adding external contracts using `with_contracts()`", revert_id: 18446744073709486080

As we can see, the Log ID of the first successful call and the second one which fails is matching, even though I am using determine_missing_contracts(Some(30)) for the second call, which should successfully figure out the internal calls.

On a side note, the contract within the failing function call is dynamic, I’ve tried to use different contracts and it seems to work, and doesn’t work for a specific contract (even though the contract works fine and does not revert during the call).

The latest fuels SDK and Fuel Toolchain versions are used.

1 Like

Thanks for your feedback.

There are two things at play here:

  1. For some reason the second call is failing on some require statement and it impossible to help you out here without seeing the actual code and debugging the logic.
  2. Without providing the contract abi we are not able to decode the require log. The determine_missing_contracts method will only set the required inputs and outputs which means that the decoding will fail.

For debugging purposes you could manually add the right contract_instance (generated with the abi) and start from there. The log decoding would work in this case. Here are the relevant docs:
https://rust.fuel.network/v0.66.9/calling-contracts/other-contracts.html?highlight=determine%20missing%20cont#calling-other-contracts

1 Like

Turns our this was the case, the without the actual ABI added but .with_contracts I was getting a revert which was coming from another contract in the call chain.

Calling with the contract abi and with determine contract inputs allowed to see the actual error and debug it

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.