forked from cerc-io/plugeth
Added missing requires on SSTORE SLOAD
This commit is contained in:
parent
7849b7e978
commit
48125a25eb
23
vm/common.go
23
vm/common.go
@ -19,17 +19,18 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
GasStep = big.NewInt(1)
|
GasStep = big.NewInt(1)
|
||||||
GasSha = big.NewInt(20)
|
GasSha = big.NewInt(20)
|
||||||
GasSLoad = big.NewInt(20)
|
GasSLoad = big.NewInt(20)
|
||||||
GasSStore = big.NewInt(100)
|
GasSStore = big.NewInt(100)
|
||||||
GasBalance = big.NewInt(20)
|
GasSStoreRefund = big.NewInt(100)
|
||||||
GasCreate = big.NewInt(100)
|
GasBalance = big.NewInt(20)
|
||||||
GasCall = big.NewInt(20)
|
GasCreate = big.NewInt(100)
|
||||||
GasMemory = big.NewInt(1)
|
GasCall = big.NewInt(20)
|
||||||
GasData = big.NewInt(5)
|
GasMemory = big.NewInt(1)
|
||||||
GasTx = big.NewInt(500)
|
GasData = big.NewInt(5)
|
||||||
GasLog = big.NewInt(32)
|
GasTx = big.NewInt(500)
|
||||||
|
GasLog = big.NewInt(32)
|
||||||
|
|
||||||
Pow256 = ethutil.BigPow(2, 256)
|
Pow256 = ethutil.BigPow(2, 256)
|
||||||
|
|
||||||
|
@ -169,9 +169,13 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
|
|||||||
|
|
||||||
gas.Set(ethutil.Big0)
|
gas.Set(ethutil.Big0)
|
||||||
case SLOAD:
|
case SLOAD:
|
||||||
|
require(1)
|
||||||
|
|
||||||
gas.Set(GasSLoad)
|
gas.Set(GasSLoad)
|
||||||
// Memory resize & Gas
|
// Memory resize & Gas
|
||||||
case SSTORE:
|
case SSTORE:
|
||||||
|
require(2)
|
||||||
|
|
||||||
var mult *big.Int
|
var mult *big.Int
|
||||||
y, x := stack.Peekn()
|
y, x := stack.Peekn()
|
||||||
val := closure.GetStorage(x)
|
val := closure.GetStorage(x)
|
||||||
@ -179,7 +183,7 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
|
|||||||
// 0 => non 0
|
// 0 => non 0
|
||||||
mult = ethutil.Big3
|
mult = ethutil.Big3
|
||||||
} else if val.BigInt().Cmp(ethutil.Big0) != 0 && len(y.Bytes()) == 0 {
|
} else if val.BigInt().Cmp(ethutil.Big0) != 0 && len(y.Bytes()) == 0 {
|
||||||
state.Refund(closure.caller.Address(), big.NewInt(100), closure.Price)
|
state.Refund(closure.caller.Address(), GasSStoreRefund, closure.Price)
|
||||||
|
|
||||||
mult = ethutil.Big0
|
mult = ethutil.Big0
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user