aboutsummaryrefslogtreecommitdiffstats
path: root/common/natspec
diff options
context:
space:
mode:
authorRicardo Catalinas Jiménez <r@untroubled.be>2016-02-22 02:40:27 +0800
committerRicardo Catalinas Jiménez <r@untroubled.be>2016-02-22 06:34:34 +0800
commit436fc8d76a4871d67a61dc86c1a635e20594a0e6 (patch)
tree5fad9f69b068f43ca606e2887f5522188e7f9ddd /common/natspec
parentc20d6e5e4ed8eff6d26cd849f90ca42dd5a7040c (diff)
downloaddexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar
dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.gz
dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.bz2
dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.lz
dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.xz
dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.zst
dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.zip
all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()
As we aren't really using the standarized SHA-3
Diffstat (limited to 'common/natspec')
-rw-r--r--common/natspec/natspec.go4
-rw-r--r--common/natspec/natspec_e2e_test.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/common/natspec/natspec.go b/common/natspec/natspec.go
index 2e4d8d7a4..8197018cf 100644
--- a/common/natspec/natspec.go
+++ b/common/natspec/natspec.go
@@ -115,7 +115,7 @@ func FetchDocsForContract(contractAddress string, xeth *xeth.XEth, client *httpc
err = fmt.Errorf("contract (%v) not found", contractAddress)
return
}
- codehash := common.BytesToHash(crypto.Sha3(codeb))
+ codehash := common.BytesToHash(crypto.Keccak256(codeb))
// set up nameresolver with natspecreg + urlhint contract addresses
reg := registrar.New(xeth)
@@ -197,7 +197,7 @@ type userDoc struct {
func (self *NatSpec) makeAbi2method(abiKey [8]byte) (meth *method) {
for signature, m := range self.userDoc.Methods {
name := strings.Split(signature, "(")[0]
- hash := []byte(common.Bytes2Hex(crypto.Sha3([]byte(signature))))
+ hash := []byte(common.Bytes2Hex(crypto.Keccak256([]byte(signature))))
var key [8]byte
copy(key[:], hash[:8])
if bytes.Equal(key[:], abiKey[:]) {
diff --git a/common/natspec/natspec_e2e_test.go b/common/natspec/natspec_e2e_test.go
index 4a9b92eb6..0730391c7 100644
--- a/common/natspec/natspec_e2e_test.go
+++ b/common/natspec/natspec_e2e_test.go
@@ -238,11 +238,11 @@ func TestNatspecE2E(t *testing.T) {
// create a contractInfo file (mock cloud-deployed contract metadocs)
// incidentally this is the info for the HashReg contract itself
ioutil.WriteFile("/tmp/"+testFileName, []byte(testContractInfo), os.ModePerm)
- dochash := crypto.Sha3Hash([]byte(testContractInfo))
+ dochash := crypto.Keccak256Hash([]byte(testContractInfo))
// take the codehash for the contract we wanna test
codeb := tf.xeth.CodeAtBytes(registrar.HashRegAddr)
- codehash := crypto.Sha3Hash(codeb)
+ codehash := crypto.Keccak256Hash(codeb)
reg := registrar.New(tf.xeth)
_, err := reg.SetHashToHash(addr, codehash, dochash)