Hi @mpoplavkov you are correct in that if there is there is an error in executing the dry run of the transaction, that error will be thrown and thus the cost will not be returned. At the moment I see this as correct behaviour.
As a wallet, we’re performing a simulation of transactions but we still want to give users an opportunity to send the transaction even if the simulation has failed. And for that we want to show the expected fee the user’s gonna pay
I’m curious about what benefit there may be in allowing a user to intentionally submit a transaction that will fail, could you elaborate a bit more on this use case?
In all likelihood, correcting that transaction so that it may be successful may increase/decrease gas costs, and so even if the gas cost was returned in the event of an error, it would not be representative of what’s required to make the transaction succeed.