aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/evm/runner.go4
-rw-r--r--common/types.go10
-rw-r--r--core/vm/runtime/runtime.go4
-rw-r--r--eth/filters/api_test.go4
4 files changed, 10 insertions, 12 deletions
diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go
index c13e9fb33..2d9d31fb0 100644
--- a/cmd/evm/runner.go
+++ b/cmd/evm/runner.go
@@ -84,8 +84,8 @@ func runCmd(ctx *cli.Context) error {
debugLogger *vm.StructLogger
statedb *state.StateDB
chainConfig *params.ChainConfig
- sender = common.StringToAddress("sender")
- receiver = common.StringToAddress("receiver")
+ sender = common.BytesToAddress([]byte("sender"))
+ receiver = common.BytesToAddress([]byte("receiver"))
)
if ctx.GlobalBool(MachineFlag.Name) {
tracer = NewJSONLogger(logconfig, os.Stdout)
diff --git a/common/types.go b/common/types.go
index fdc67480c..4ea2d56a6 100644
--- a/common/types.go
+++ b/common/types.go
@@ -45,9 +45,8 @@ func BytesToHash(b []byte) Hash {
h.SetBytes(b)
return h
}
-func StringToHash(s string) Hash { return BytesToHash([]byte(s)) }
-func BigToHash(b *big.Int) Hash { return BytesToHash(b.Bytes()) }
-func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) }
+func BigToHash(b *big.Int) Hash { return BytesToHash(b.Bytes()) }
+func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) }
// Get the string representation of the underlying hash
func (h Hash) Str() string { return string(h[:]) }
@@ -143,9 +142,8 @@ func BytesToAddress(b []byte) Address {
a.SetBytes(b)
return a
}
-func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
-func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
-func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
+func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
+func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
// IsHexAddress verifies whether a string can represent a valid hex-encoded
// Ethereum address or not.
diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go
index 1e9ed7ae2..5ac546406 100644
--- a/core/vm/runtime/runtime.go
+++ b/core/vm/runtime/runtime.go
@@ -103,7 +103,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
cfg.State, _ = state.New(common.Hash{}, state.NewDatabase(db))
}
var (
- address = common.StringToAddress("contract")
+ address = common.BytesToAddress([]byte("contract"))
vmenv = NewEnv(cfg)
sender = vm.AccountRef(cfg.Origin)
)
@@ -113,7 +113,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
// Call the code with the given configuration.
ret, _, err := vmenv.Call(
sender,
- common.StringToAddress("contract"),
+ common.BytesToAddress([]byte("contract")),
input,
cfg.GasLimit,
cfg.Value,
diff --git a/eth/filters/api_test.go b/eth/filters/api_test.go
index 4ae37f977..02229a754 100644
--- a/eth/filters/api_test.go
+++ b/eth/filters/api_test.go
@@ -29,8 +29,8 @@ func TestUnmarshalJSONNewFilterArgs(t *testing.T) {
var (
fromBlock rpc.BlockNumber = 0x123435
toBlock rpc.BlockNumber = 0xabcdef
- address0 = common.StringToAddress("70c87d191324e6712a591f304b4eedef6ad9bb9d")
- address1 = common.StringToAddress("9b2055d370f73ec7d8a03e965129118dc8f5bf83")
+ address0 = common.HexToAddress("70c87d191324e6712a591f304b4eedef6ad9bb9d")
+ address1 = common.HexToAddress("9b2055d370f73ec7d8a03e965129118dc8f5bf83")
topic0 = common.HexToHash("3ac225168df54212a25c1c01fd35bebfea408fdac2e31ddd6f80a4bbf9a5f1ca")
topic1 = common.HexToHash("9084a792d2f8b16a62b882fd56f7860c07bf5fa91dd8a2ae7e809e5180fef0b3")
topic2 = common.HexToHash("6ccae1c4af4152f460ff510e573399795dfab5dcf1fa60d1f33ac8fdc1e480ce")