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

Improve tx dependency estimation #1380

Closed MujkicA closed 1 month ago

MujkicA commented 2 months ago

Currently, estimate_tx_dependencies initiates a simulation for every dependency it needs to resolve.

@segfault-magnet suggested: To reduce the number of simulations performed, we can add a high number of variable outputs to the tx before simulation and then inspect it afterwards to see how many were used.

Additionally, we'll have to watch the tx size limit. We can only add so many variable outputs until the limit is reached, then if the tx still reverts with missing outputs we have to communicate that there is no way of constructing a valid transaction.