geniusyield / atlas

Application backend for Plutus smart contracts on Cardano
https://atlas-app.io
Apache License 2.0
67 stars 18 forks source link

Return `GYBalancedTx` (or similar) when raising `BuildTxBodyErrorAutoBalance` to have more information #321

Open TotallyNotChase opened 4 months ago

TotallyNotChase commented 4 months ago

Is your feature request related to a problem? Please describe. Currently, when BuildTxBodyErrorAutoBalance is raised, there is barely any information about what really happened. Especially when a validator error is raised.

Describe the solution you'd like It'd be useful to return our balanced transaction (as selecting inputs and collateral can indeed influence script behavior) with the error.

Describe alternatives you've considered N/A

Additional context The addition is simple. Amend the BuildTxBodyErrorAutoBalance constructor to contain GYBalancedTx and amend attach this data type within makeTransactionBodyAutoBalanceWrapper. It should not prompt any API changes.

TotallyNotChase commented 4 months ago

I might have a better idea actually. I've been looking into the ledger and realized that I might be able to add the ability to retrieve the exact ScriptContext used with every plutus script in a transaction into CLB. Which means we can see it during validation failures in the "emulator log".