What will __gtf::<u8>(index, GTF_OUTPUT_TYPE) return if there is no output at this index?

Hi guys
I want to add hard predicate outputs check to my predicate
What will __gtf::(index, GTF_OUTPUT_TYPE) return if there is no output at this index?

Now that looping is enabled in predicates, you can first check the number of outputs using GTF_SCRIPT_OUTPUTS_COUNT and then iterate over the correct number of outputs. According to the spec, the predicate will fail if the index is out of bounds:

  • The value of $rB results in an out of bounds access for variable-length fields
  • The input or output type does not match (OutputChange and OutputVariable count as OutputCoin)

https://github.com/FuelLabs/fuel-specs/blob/master/src/vm/instruction_set.md#gtf-get-transaction-fields

Got it
Thanks a lot <3

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