-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5316 +/- ##
==========================================
- Coverage 61.87% 61.45% -0.42%
==========================================
Files 342 342
Lines 28063 28062 -1
Branches 3238 3238
==========================================
- Hits 17363 17245 -118
- Misses 9561 9670 +109
- Partials 1139 1147 +8 |
@@ -90,7 +90,7 @@ struct SubState | |||
{ | |||
std::set<Address> suicides; ///< Any accounts that have suicided. | |||
LogEntries logs; ///< Any logs. | |||
u256 refunds; ///< Refund counter for storage changes. | |||
int64_t refunds = 0; ///< Refund counter for storage changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be safer to use signed bigint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but if 63 bits are not enough I'd like to constructs a test for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, you would need 3*10^13 millions gas in a transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. For this counter, geth uses u64
, and parity uses i128
(which is basically signed u64
). If we make every opcode give maximum amount of refund as we currently have, it would still take decades of execution for that to ever overflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarification @sorpaas.
cc @sorpaas.
There are 2 commits: the first one cleans up some code to make the fix in the second commit more obvious.