-
Notifications
You must be signed in to change notification settings - Fork 11
Description
At the moment, if a TxSkel in a MockChain run causes a Phase 2 failure, its submitted version will be logged in the MockChainLog, but not its adjusted version. This is inconvenient, because this would the most relevant piece of information to assess why said failure occurred.
This is, however, not a bug. The reason why this happens is tied to the transaction generation process and the balancing mechanism of cooked. When cooked attempts to balance skeletons, it sets a fee following a certain logic and then balances the skeleton around this fee. Then, it generates the associated cardano transaction body, and asks cardano-api the minimal fee required for this body to compare it to the original fee as it was set. To generate the cardano transaction body, execution units need to be provided. As they cannot be estimated, the scripts need to be run to know exactly how much resources they will take. In the process of running those script, phase 2 validation errors can occur.
These validation errors occur during the balancing process, and thus before the actual validation of the transaction, and before the balanced skeleton is fixed and given back to cooked' validation procedure, hence why it is not traced. The validation process simply does not reach the point where it can be traced in those situation.
However, this is not hopeless. There might be ways to recover from those validation error to print out the last skeleton that was attempted. This needs to be investigated.
This issue is connected to issue #494 because they both might require, in their implementation, to keep in memory the current balanced skeleton. They should be handled in a single work.