-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add EIP: GAS2ETH opcode #8980
base: master
Are you sure you want to change the base?
Add EIP: GAS2ETH opcode #8980
Conversation
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Amend `GAS2ETH` Proposal
File
|
Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com>
Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com>
Co-authored-by: Andrew B Coathup <28278242+abcoathup@users.noreply.github.com>
The commit 3a58567 (as a parent of 95e214f) contains errors. |
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.
Some questions/remarks.
EIPS/eip-7791.md
Outdated
|
||
- Pops two values from the stack: `addr` then `gas_amount`. If there are fewer than two values on the stack, the calling context should fail with stack underflow. | ||
- Deducts `gas_amount` from the current calling context. | ||
- Computes `wei_val` by multiplying `gas_amount` by the current transaction context's `gas_price`. |
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.
What is the gas price? Is this the base fee? Or is this the tip? Or is it both?
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.
interesting question, i think it should be the tx gas price which is used to calculate the tx cost in ETH, a la https://github.com/ethereum/execution-specs/blob/98d6ddaaa709a2b7d0cd642f4cfcdadc8c0808e1/src/ethereum/berlin/fork.py#L680.
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.
whatever it is, could you clarify for the purposes of editing the EIP and may be include the reasoning in rational
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.
- If the gas cost of this opcode + `gas_amount` is greater than the available gas in the current calling context, the calling context should fail with "out-of-gas" and any state changes reverted. | ||
- Pushes `wei_val` onto the stack. | ||
|
||
Note that the transfer of `wei_val` to the given account cannot fail. In particular, the destination account code (if any) is not executed, or, if the account does not exist, the balance is still added to the given address `addr`. |
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.
There is extra gas cost in CALL if the call sends value and a new address is created in the trie. I think this should be added here as well.
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.
that is included in the line explaining the account access costs -- https://github.com/ethereum/EIPs/pull/8980/files#diff-945c598617f3a1437a229375d8089476b61a7537d0891e4be08b6cc6e261dd15R53
EIPS/eip-7791.md
Outdated
|
||
The proposed cost of this opcode is similar to the recently proposed `PAY` opcode, but changing the base cost from `9000` to `2400`. That is: | ||
|
||
- The base cost of this opcode is `2400`. This is priced so that invoking `GAS2ETH` on a cold account costs the same as a cold `SSTORE`. |
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.
SSTORE
cold on a storage slot which is currently nonzero changing to another nonzero value costs 5000 gas (if its warm: 2900 gas). I'm not sure how to get 2400.
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.
if the account is cold, COLD_ACCOUNT_ACCESS_COST
(2600) is added to the 2400 base cost.
GAS_CALL_VALUE seems too expensive as the base cost, but maybe that should rather be part of an EIP which updates pricing for all the value transfer opcodes
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.
i copied the gas costs from eip-5920. see abfa48c
EIPS/eip-7791.md
Outdated
The proposed cost of this opcode is similar to the recently proposed `PAY` opcode, but changing the base cost from `9000` to `2400`. That is: | ||
|
||
- The base cost of this opcode is `2400`. This is priced so that invoking `GAS2ETH` on a cold account costs the same as a cold `SSTORE`. | ||
- If `addr` is not the zero address, the [EIP-2929](./eip-2929.md) account access costs for `addr` (but NOT the current account) are also incurred: 100 gas for a warm account, 2600 gas for a cold account, and 25000 gas for a new account. |
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.
What does the zero address have to do with this? Does this change some behavior of this opcode?
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.
that must be a mistake that slipped in over the course of revisions, will fix
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.
This seems like a great idea, but I'm nervous about people abusing this. Why would I, as a protocol developer, ever us |
EIPS/eip-7791.md
Outdated
|
||
## Test Cases | ||
|
||
TBD |
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.
TBD should be in html tags so that bot can remind to fill them before moving to revew
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.
add <-- TODO --> tags for EIP bots to notify you to fill them up post draft stage
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.
added - 90cca4b
EIPS/eip-7791.md
Outdated
|
||
## Test Cases | ||
|
||
TBD |
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.
TBD should be in html tags so that bot can remind to fill them before moving to review
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.
sorry, what html tags?
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.
add <-- TODO --> tags for EIP bots to notify you to fill them up post draft stage
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.
added - 90cca4b
i don't think it's a trick -- it's just an alternative way to get compensation. getting compensation via
|
Co-authored-by: g11tech <develop@g11tech.io>
ATTENTION: ERC-RELATED PULL REQUESTS NOW OCCUR IN ETHEREUM/ERCS
--
When opening a pull request to submit a new EIP, please use the suggested template: https://github.com/ethereum/EIPs/blob/master/eip-template.md
We have a GitHub bot that automatically merges some PRs. It will merge yours immediately if certain criteria are met: