Commit 779ddb18 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

core/vm, params: EIP160: EXP reprice

parent 445feaee
...@@ -313,7 +313,8 @@ func calculateGasAndSize(gasTable params.GasTable, env Environment, contract *Co ...@@ -313,7 +313,8 @@ func calculateGasAndSize(gasTable params.GasTable, env Environment, contract *Co
quadMemGas(mem, newMemSize, gas) quadMemGas(mem, newMemSize, gas)
case EXP: case EXP:
gas.Add(gas, new(big.Int).Mul(big.NewInt(int64(len(stack.data[stack.len()-2].Bytes()))), params.ExpByteGas)) expByteLen := int64((stack.data[stack.len()-2].BitLen() + 7) / 8)
gas.Add(gas, new(big.Int).Mul(big.NewInt(expByteLen), gasTable.ExpByte))
case SSTORE: case SSTORE:
err := stack.require(2) err := stack.require(2)
if err != nil { if err != nil {
......
...@@ -26,9 +26,7 @@ type GasTable struct { ...@@ -26,9 +26,7 @@ type GasTable struct {
Calls *big.Int Calls *big.Int
Suicide *big.Int Suicide *big.Int
Exp *big.Int ExpByte *big.Int
ExpOneByte *big.Int
Exp256 *big.Int
// CreateBySuicide occurs when the // CreateBySuicide occurs when the
// refunded account is one that does // refunded account is one that does
...@@ -48,7 +46,7 @@ var ( ...@@ -48,7 +46,7 @@ var (
SLoad: big.NewInt(50), SLoad: big.NewInt(50),
Calls: big.NewInt(40), Calls: big.NewInt(40),
Suicide: big.NewInt(0), Suicide: big.NewInt(0),
Exp: big.NewInt(20), ExpByte: big.NewInt(10),
// explicitly set to nil to indicate // explicitly set to nil to indicate
// this rule does not apply to homestead. // this rule does not apply to homestead.
...@@ -66,7 +64,7 @@ var ( ...@@ -66,7 +64,7 @@ var (
SLoad: big.NewInt(200), SLoad: big.NewInt(200),
Calls: big.NewInt(700), Calls: big.NewInt(700),
Suicide: big.NewInt(5000), Suicide: big.NewInt(5000),
Exp: big.NewInt(20), ExpByte: big.NewInt(10),
CreateBySuicide: big.NewInt(25000), CreateBySuicide: big.NewInt(25000),
} }
...@@ -78,9 +76,7 @@ var ( ...@@ -78,9 +76,7 @@ var (
SLoad: big.NewInt(200), SLoad: big.NewInt(200),
Calls: big.NewInt(700), Calls: big.NewInt(700),
Suicide: big.NewInt(5000), Suicide: big.NewInt(5000),
Exp: big.NewInt(80), ExpByte: big.NewInt(50),
ExpOneByte: big.NewInt(160),
Exp256: big.NewInt(2640),
CreateBySuicide: big.NewInt(25000), CreateBySuicide: big.NewInt(25000),
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment