Timeline for How require() and assert() work in solidity?
Current License: CC BY-SA 4.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 11 at 2:09 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
May 8 at 6:01 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Jan 8 at 10:02 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Sep 2, 2023 at 15:00 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
May 1, 2023 at 20:42 | comment | added | immaxkent | what kind of values have you tried storing in the contract on the testnet? | |
May 1, 2023 at 20:04 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Dec 31, 2022 at 15:06 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Aug 23, 2022 at 17:04 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Apr 11, 2022 at 23:06 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Mar 10, 2022 at 13:53 | answer | added | Shravan kp | timeline score: 0 | |
May 12, 2019 at 10:03 | comment | added | goodvibration |
Well, if the revert takes place as a result of call then there's no require hence no message.
|
|
May 12, 2019 at 10:00 | comment | added | snehal |
@goodvibration Thanks. I can see the REVERT opcode while debugging the contract but I don't understand why the transaction is not giving the message that I have put in the require .
|
|
May 12, 2019 at 9:43 | comment | added | goodvibration |
Also, correct me if I'm wrong - you are trying to prevent reentrant attacks using an additional (i.e., unrelated) state variable. First, please note that you are essentially blocking all but one credit holder from withdrawing. Are you sure that this feature complies with the rest of your goals? Second, in order to prevent reentrant attack, I believe that you can simply perform the subtraction before the funds-transfer (i.e., do credit[msg.sender]-=amount first, and msg.sender.call.value(amount)("") last).
|
|
May 12, 2019 at 9:38 | history | edited | snehal | CC BY-SA 4.0 |
added 1413 characters in body
|
May 12, 2019 at 9:38 | comment | added | goodvibration |
When the condition (flag ) is true in the first time, it will not necessarily be false in the second time. If the function reverts at msg.sender.call.value(amount)("") , then the operation flag = false will be reverted along with the rest of the operations in the function, thus leaving flag == true .
|
|
May 12, 2019 at 9:36 | comment | added | snehal | Thanks. I have edited the post and added the example. I hope now you can understand my question better and provide any comments on the behavior of require. | |
May 12, 2019 at 9:33 | history | edited | snehal | CC BY-SA 4.0 |
added 1413 characters in body
|
May 12, 2019 at 9:04 | comment | added | goodvibration |
"this is happening" because of how you implemented the contract (most likely, you have placed the require statement to be executed only under certain conditions, which means that your description above is not even correct). Obviously, no one here will be able to guess any further than that, since you haven't shared this contract!
|
|
May 12, 2019 at 8:58 | comment | added | user19510 |
We'd need to see your code to help debug, and perhaps you'll need to explain what you mean by "the first time" and "the second time". If your code says require(x) and x is false , then the transaction will be reverted.
|
|
May 12, 2019 at 8:33 | history | asked | snehal | CC BY-SA 4.0 |