-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Reduced gas cost for call to self #1380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9a5ac7b to
00aa665
Compare
|
I'm puzzled. Not sure what the requirements are on the filename, because
But travis fails with: |
|
I would prefer a more comprehensive solution that also reduces the costs for e.g. repeated calls to the same library. |
| them through `JUMP` requires a bigger effort from the compiler as opposed to being able to use `CALL`s. | ||
|
|
||
| Using call-to-self provides the guarentee that when making an internal call the function can rely on a clear reset state of memory or context, benefiting both | ||
| contract writers and contract consumers against potentially undetetected edge cases were memory could poison the context of the internal function. |
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.
typo in undetected
|
@chriseth The simple version of which would probably be keeping a list of addresses touched in the current transaction and searching the list each time there's a call, lowering the gas cost if there's a hit. That would also mean the client would have to keep all touched contracts loaded, which would probably mean an increase to the base cost of a Though I also have no idea how clients currently handle un-loading of contracts after execution so maybe they already keep it cached. |
As discussed offline, that would really be similar to how "net sstore gas metering" is working: the VM should maintain the list of loaded contracts by a given contract and only charge once for loading it. Therefore it doesn't make sense to extend this EIP with that, but would warrant its own EIP. |
|
Note that such an extended version would also reduce the cost of contract calls because the actual |
|
|
||
| ## Specification | ||
| If `block.number >= FORK_BLKNUM`, then decrease the cost of `CALL`, `DELEGATECALL`, `CALLCODE` and `STATICCALL` from 700 to 40, | ||
| if and only if, the destination address of the call equals to the address of the caller. |
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.
Perhaps this could be combined with a reduction for calling precompiles, as an alternative to EIP-1109?
|
Since this was merged as a draft, please take all the discussion to https://ethereum-magicians.org/t/eip-1380-reduced-gas-cost-for-call-to-self/1242 |
No description provided.