diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-04-02 11:17:15 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2015-04-02 12:22:32 +0800 |
commit | c26c8d3a44cdd45994b6d99777d620565bab8f9c (patch) | |
tree | 6ab5a74981e9fb9f869f1ef884a375163b898113 /core/state_transition.go | |
parent | 516ec28544e0f9c76e18d82742d3ae58cfb59cc1 (diff) | |
download | dexon-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.gz dexon-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.zst dexon-c26c8d3a44cdd45994b6d99777d620565bab8f9c.zip |
Read most protocol params from common/params.json
* Add params package with exported variables generated from
github.com/ethereum/common/blob/master/params.json
* Use params package variables in applicable places
* Add check for minimum gas limit in validation of block's gas limit
* Remove common/params.json from go-ethereum to avoid
outdated version of it
Diffstat (limited to 'core/state_transition.go')
-rw-r--r-- | core/state_transition.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/state_transition.go b/core/state_transition.go index 7616686db..1994cabf6 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" ) const tryJit = false @@ -178,7 +179,7 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er ) // Transaction gas - if err = self.UseGas(vm.GasTx); err != nil { + if err = self.UseGas(params.TxGas); err != nil { return nil, nil, InvalidTxError(err) } @@ -186,9 +187,9 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er dgas := new(big.Int) for _, byt := range self.data { if byt != 0 { - dgas.Add(dgas, vm.GasTxDataNonzeroByte) + dgas.Add(dgas, params.TxDataNonZeroGas) } else { - dgas.Add(dgas, vm.GasTxDataZeroByte) + dgas.Add(dgas, params.TxDataZeroGas) } } @@ -202,7 +203,7 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er ret, err, ref = vmenv.Create(sender, self.msg.Data(), self.gas, self.gasPrice, self.value) if err == nil { dataGas := big.NewInt(int64(len(ret))) - dataGas.Mul(dataGas, vm.GasCreateByte) + dataGas.Mul(dataGas, params.CreateDataGas) if err := self.UseGas(dataGas); err == nil { ref.SetCode(ret) } else { |