aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/address.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-02 11:17:15 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-04-02 12:22:32 +0800
commitc26c8d3a44cdd45994b6d99777d620565bab8f9c (patch)
tree6ab5a74981e9fb9f869f1ef884a375163b898113 /core/vm/address.go
parent516ec28544e0f9c76e18d82742d3ae58cfb59cc1 (diff)
downloadgo-tangerine-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar
go-tangerine-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.gz
go-tangerine-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.bz2
go-tangerine-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.lz
go-tangerine-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.xz
go-tangerine-c26c8d3a44cdd45994b6d99777d620565bab8f9c.tar.zst
go-tangerine-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/vm/address.go')
-rw-r--r--core/vm/address.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/vm/address.go b/core/vm/address.go
index 0b3a95dd0..df801863f 100644
--- a/core/vm/address.go
+++ b/core/vm/address.go
@@ -5,6 +5,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/params"
)
type Address interface {
@@ -27,28 +28,28 @@ func PrecompiledContracts() map[string]*PrecompiledAccount {
return map[string]*PrecompiledAccount{
// ECRECOVER
string(common.LeftPadBytes([]byte{1}, 20)): &PrecompiledAccount{func(l int) *big.Int {
- return GasEcrecover
+ return params.EcrecoverGas
}, ecrecoverFunc},
// SHA256
string(common.LeftPadBytes([]byte{2}, 20)): &PrecompiledAccount{func(l int) *big.Int {
n := big.NewInt(int64(l+31) / 32)
- n.Mul(n, GasSha256Word)
- return n.Add(n, GasSha256Base)
+ n.Mul(n, params.Sha256WordGas)
+ return n.Add(n, params.Sha256Gas)
}, sha256Func},
// RIPEMD160
string(common.LeftPadBytes([]byte{3}, 20)): &PrecompiledAccount{func(l int) *big.Int {
n := big.NewInt(int64(l+31) / 32)
- n.Mul(n, GasRipemdWord)
- return n.Add(n, GasRipemdBase)
+ n.Mul(n, params.Ripemd160WordGas)
+ return n.Add(n, params.Ripemd160Gas)
}, ripemd160Func},
string(common.LeftPadBytes([]byte{4}, 20)): &PrecompiledAccount{func(l int) *big.Int {
n := big.NewInt(int64(l+31) / 32)
- n.Mul(n, GasIdentityWord)
+ n.Mul(n, params.IdentityWordGas)
- return n.Add(n, GasIdentityBase)
+ return n.Add(n, params.IdentityGas)
}, memCpy},
}
}