What Is a “Gas Limit” and Why Is It Important for Contract Execution?
The gas limit is the maximum amount of gas a user is willing to spend on a transaction. It is a safety mechanism to prevent infinite loops or excessively complex smart contract execution from draining a user's funds.
If the transaction requires more gas than the specified limit, the transaction fails, but the user still pays for the computational work done up to that point.