Skip to content
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

core/vm,params/vars: "correctly" implement EIP2200 SLOAD gas cost change #144

Merged
merged 1 commit into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/vm/eips.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func enableSelfBalance(jt *JumpTable) {
// - Define SELFBALANCE, with cost GasFastStep (5)
func enable1884(jt *JumpTable) {
// Gas cost changes
jt[SLOAD].constantGas = vars.SloadGasEIP1884
jt[BALANCE].constantGas = vars.BalanceGasEIP1884
jt[EXTCODEHASH].constantGas = vars.ExtcodeHashGasEIP1884
jt[SLOAD].constantGas = vars.SloadGasEIP1884

// New opcode
enableSelfBalance(jt)
Expand Down Expand Up @@ -92,5 +92,6 @@ func opChainID(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memo

// enable2200 applies EIP-2200 (Rebalance net-metered SSTORE)
func enable2200(jt *JumpTable) {
jt[SLOAD].constantGas = vars.SloadGasEIP2200
jt[SSTORE].dynamicGas = gasSStoreEIP2200
}
1 change: 1 addition & 0 deletions params/vars/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var (
SloadGasFrontier uint64 = 50
SloadGasEIP150 uint64 = 200
SloadGasEIP1884 uint64 = 800 // Cost of SLOAD after EIP 1884 (part of Istanbul)
SloadGasEIP2200 uint64 = 800 // Cost of SLOAD after EIP 2200 (part of Istanbul)
ExtcodeHashGasConstantinople uint64 = 400 // Cost of EXTCODEHASH (introduced in Constantinople)
ExtcodeHashGasEIP1884 uint64 = 700 // Cost of EXTCODEHASH after EIP 1884 (part in Istanbul)
SelfdestructGasEIP150 uint64 = 5000 // Cost of SELFDESTRUCT post EIP 150 (Tangerine)
Expand Down