aboutsummaryrefslogtreecommitdiffstats
path: root/vm/address.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 18:27:38 +0800
commitb5234413611ce5984292f85a01de1f56c045b490 (patch)
treee6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /vm/address.go
parent0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff)
downloadgo-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.gz
go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.zst
go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.zip
Moved ethutil => common
Diffstat (limited to 'vm/address.go')
-rw-r--r--vm/address.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/vm/address.go b/vm/address.go
index b1345da8f..215f4bc8f 100644
--- a/vm/address.go
+++ b/vm/address.go
@@ -4,7 +4,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/ethereum/go-ethereum/common"
)
type Address interface {
@@ -26,25 +26,25 @@ var Precompiled = PrecompiledContracts()
func PrecompiledContracts() map[string]*PrecompiledAccount {
return map[string]*PrecompiledAccount{
// ECRECOVER
- string(ethutil.LeftPadBytes([]byte{1}, 20)): &PrecompiledAccount{func(l int) *big.Int {
+ string(common.LeftPadBytes([]byte{1}, 20)): &PrecompiledAccount{func(l int) *big.Int {
return GasEcrecover
}, ecrecoverFunc},
// SHA256
- string(ethutil.LeftPadBytes([]byte{2}, 20)): &PrecompiledAccount{func(l int) *big.Int {
+ 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)
}, sha256Func},
// RIPEMD160
- string(ethutil.LeftPadBytes([]byte{3}, 20)): &PrecompiledAccount{func(l int) *big.Int {
+ 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)
}, ripemd160Func},
- string(ethutil.LeftPadBytes([]byte{4}, 20)): &PrecompiledAccount{func(l int) *big.Int {
+ string(common.LeftPadBytes([]byte{4}, 20)): &PrecompiledAccount{func(l int) *big.Int {
n := big.NewInt(int64(l+31) / 32)
n.Mul(n, GasIdentityWord)
@@ -58,7 +58,7 @@ func sha256Func(in []byte) []byte {
}
func ripemd160Func(in []byte) []byte {
- return ethutil.LeftPadBytes(crypto.Ripemd160(in), 32)
+ return common.LeftPadBytes(crypto.Ripemd160(in), 32)
}
func ecrecoverFunc(in []byte) []byte {
@@ -66,10 +66,10 @@ func ecrecoverFunc(in []byte) []byte {
defer func() { recover() }()
hash := in[:32]
- v := ethutil.BigD(in[32:64]).Bytes()[0] - 27
+ v := common.BigD(in[32:64]).Bytes()[0] - 27
sig := append(in[64:], v)
- return ethutil.LeftPadBytes(crypto.Sha3(crypto.Ecrecover(append(hash, sig...))[1:])[12:], 32)
+ return common.LeftPadBytes(crypto.Sha3(crypto.Ecrecover(append(hash, sig...))[1:])[12:], 32)
}
func memCpy(in []byte) []byte {