3

They say assert is mostly for the use of code analyzers to detect logical bugs in our contracts, but why it consumes the remaining gas too?

Couldn't we use a new keyword, that does the same( just like require ), but doesn't consume the remaining gas?

Isn't it better to spend less gas as possible? Shouldn't Solidity make some changes to it's functions?

I just don't get the purpose(as every answer was just specifying that assert is for checking things that are meant to be true forever, and require is for checking inputs of user; but it's not my answer).

Behnia FB
  • 53
  • 4
  • Does this answer your question? [Difference between assert and require](https://stackoverflow.com/questions/71502322/difference-between-assert-and-require) – Yilmaz Mar 28 '23 at 23:35
  • @Yilmaz Unfortunately no; Because I want to know why assert is not like require (in case of returning the unused gas), and it wasn't answered there. – Behnia FB Mar 29 '23 at 18:17

0 Answers0