1

What is the equivalent of gas in preventing DoS attacks? What happens if an attacker writes a recursion that never stops in Plutus? Someone asked the question before.

2 Answers 2

1

One of the features of Plutus contracts is that fees of all valid Plutus contracts must be able to be determined at compile time. That means that anything for which this cannot be determined is not a valid Plutus contract. Therefore, contracts containing infinite loops are not valid.

1

The execution costs of a contract need to be covered by the included transaction fees. Additionally, a collateral needs to be included. The value of the collateral determines the script execution budget. As soon as execution costs exceed the collateral:

  • script execution is aborted,
  • the transaction is not accepted (i.e. does not make it to the blockchain),
  • the collateral is collected by the validating node.

Because it is impossible to determine in advance if a program/script will succeed or not (halting problem), the script needs to be executed to find out. Because script execution is deterministic on Cardano, the constructor of the transaction can, however, make sure that transaction fees and collateral have the correct values. Execution failure and collateral collection are therefore only to protect against ill intentioned actors, and do not impact well behaving actors.

In this blogpost you can find more about the collateral mechanism on Cardano: link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.