On efficiency, even in failure: When executing logic through smart contracts, the amount of code run is directly proportional to the cost of execution. This means that, when chasing an arbitrage opportunity, if the competition lands their transaction ahead of yours in the block, your transaction might end up costing as much in failure as it would have in success. To mitigate this, it is advisable to add checks throughout the logic to prevent execution from going on longer than necessary.
← Back to thoughts
Thoughts · Added
Efficiency Even in Failure
By Bo Osinupebi, Toronto-based Senior Software Engineer.