Fee off by 1
theeldermillenial opened this issue · 3 comments
I'm running into a case where building a transaction with a script input is resulting in an incorrect fee calculation, which is off by 1.
Doing some debugging on pycardano.utils.fee, it looks like everything is rounded down with a cast to int. Would it make sense to add all raw values and round? In some cases, the values sum to a value with 0.5 ADA getting rounded down, and if we just rounded up this would resolve the issue.
Upon further investigation, we may need to sum raw values and use math.ceil for final fee when scripts are involved. I've gotten one example of off by two.
This is occurring when trying to submit through Blockfrost.
Makes sense to round up (using math.cell) in fee calculations.
@theeldermillenial It would be great if you could provide a failing example so I can find where the root cause is and add it to test.