FuelLabs / fuels-rs

Fuel Network Rust SDK
https://fuellabs.github.io/fuels-rs
Apache License 2.0
44.35k stars 1.33k forks source link

feat!: var output estimation optimization #1393

Closed segfault-magnet closed 1 month ago

segfault-magnet commented 1 month ago

closes: #1380 The number of variable outputs is now determined by filling the dry-run tx with as much variable outputs as the node will allow (consensus_params.tx_params.max_ouputs - whatever other outputs are already present) and counting the number of TransferOut receipts made by the dry run.

I've checked with the core devs, ideally we'd be looking at the tx outputs themselves but since the dry run endpoint doesn't return a tx this is the next best thing since only TRO instructions require a variable output attow.

Breaking changes

Checklist

hal3e commented 1 month ago

Regarding the naming: with_variable_output_policy is good. However, determine_missing_contracts could be misleading because we will determine them and add them to the outputs. So maybe something like fix_missing_contracts or determine_and_update_missing_contracts ...

digorithm commented 1 month ago

Regarding the naming: with_variable_output_policy is good. However, determine_missing_contracts could be misleading because we will determine them and add them to the outputs. So maybe something like fix_missing_contracts or determine_and_update_missing_contracts ...

Yeah, I was (and maybe still am) on the fence about determine_missing_contracts. Maybe just update_missing_contracts? update indicates it will mutate the inner stuff and also does some magic underneath.

segfault-magnet commented 1 month ago

Thing is previously it was called "estimate_tx_dependencies" that also didn't have anything claiming mutability.

I share the concern but have no satisfactory name that isn't a kilometer long.

maybe discover_missing_contract_inputs ?