diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2015-04-07 17:50:17 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-04-20 03:57:49 +0800 |
commit | b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6 (patch) | |
tree | 81d44673f4510e13f85f9aa9d5e0009b6638eacd /common/natspec/natspec.go | |
parent | 94489b2269133c545aa3e9580737b2bd93f3ead0 (diff) | |
download | go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.gz go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.bz2 go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.lz go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.xz go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.tar.zst go-tangerine-b635cad9fe127e6b0ca6d993ce9a3b6c61ce79c6.zip |
NatSpec passing end to end test
Diffstat (limited to 'common/natspec/natspec.go')
-rw-r--r-- | common/natspec/natspec.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/natspec/natspec.go b/common/natspec/natspec.go index b047f19d6..0253ebd81 100644 --- a/common/natspec/natspec.go +++ b/common/natspec/natspec.go @@ -45,18 +45,19 @@ func New(xeth *xeth.XEth, tx string, http *docserver.DocServer) (self *NatSpec, err = fmt.Errorf("NatSpec error: contract not found") return } - codeHash := xeth.CodeAt(contractAddress) + codehex := xeth.CodeAt(contractAddress) + codeHash := common.BytesToHash(crypto.Sha3(common.Hex2Bytes(codehex))) // parse out host/domain // set up nameresolver with natspecreg + urlhint contract addresses res := resolver.New( xeth, - resolver.NameRegContractAddress, resolver.URLHintContractAddress, + resolver.HashRegContractAddress, ) - // resolve host via nameReg/UrlHint Resolver - uri, hash, err := res.NameToUrl(codeHash) + // resolve host via HashReg/UrlHint Resolver + uri, hash, err := res.KeyToUrl(codeHash) if err != nil { return } @@ -165,6 +166,7 @@ func (self *NatSpec) Notice() (notice string, err error) { } copy(abiKey[:], self.data[2:10]) meth := self.makeAbi2method(abiKey) + if meth == nil { err = fmt.Errorf("abi key %x does not match any method %v") return @@ -174,6 +176,7 @@ func (self *NatSpec) Notice() (notice string, err error) { } func (self *NatSpec) noticeForMethod(tx string, name, expression string) (notice string, err error) { + if _, err = self.jsvm.Run("var transaction = " + tx + ";"); err != nil { return "", fmt.Errorf("natspec.js error setting transaction: %v", err) } |