-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Question about transaction cpu limit #4749
Comments
In this case the transaction will be rolled back as nothing has happened. |
So, when the smart contract is running, Is there a mechanism that check the cpu usage and mem usage after every op code? |
Yes. cpu usage will be checked at each op, while mem usage will be checked at the end. |
Thank you very much |
Sorry, I have another question, if mem usage will be checked at the end, so how to sovle the mem exceeding when running smart contract? |
There's a hard memory limit (around 32M) that can be allocated in the smart contract. |
So, in smart contract, for some specific ops which will remove/update/add the mem, it will check the mem usage, but these mem don't be calced to the account mem limit(not reach the hard limit), and in the end of smart contract, the total mem usage delta between the begin of smart contract and the end of smart contract, the delta will be calced to the account mem limit, right? |
This is correct. RAM usage validation is done after contract execution. |
Thank you for your generous reply so many times! |
I am a blockchain developer. I have a question: When a running transaction exceed the cpu or mem limit, how to halt this transaction(e.g. A smart contract having a dead loop). I have read the ref:
#353 and #717, but I still can't understand how to halt the transaction which is running and exceeded the limit.
Thx for your time.
The text was updated successfully, but these errors were encountered: