diff options
author | zelig <viktor.tron@gmail.com> | 2015-04-20 02:24:46 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-04-20 04:09:30 +0800 |
commit | 093a9106b093310acf4c3911baa61916cff52ab8 (patch) | |
tree | 7d5d5db476ff116e6fd0ba969750c7e4e64d1b03 /common/natspec | |
parent | 71c974f3eb080ffcdcf4812f3dd082e668627c8b (diff) | |
download | dexon-093a9106b093310acf4c3911baa61916cff52ab8.tar dexon-093a9106b093310acf4c3911baa61916cff52ab8.tar.gz dexon-093a9106b093310acf4c3911baa61916cff52ab8.tar.bz2 dexon-093a9106b093310acf4c3911baa61916cff52ab8.tar.lz dexon-093a9106b093310acf4c3911baa61916cff52ab8.tar.xz dexon-093a9106b093310acf4c3911baa61916cff52ab8.tar.zst dexon-093a9106b093310acf4c3911baa61916cff52ab8.zip |
contract addresses include hex prefix
- simplify resolver and tests
- added missing test for KeyToUrl
- fix notice error message and its test with !%x(MISSING)
- natspec test: insertTx modified - does not prepend 0x to contract address
- disable networking in e2e test
Diffstat (limited to 'common/natspec')
-rw-r--r-- | common/natspec/natspec.go | 2 | ||||
-rw-r--r-- | common/natspec/natspec_e2e_test.go | 21 |
2 files changed, 10 insertions, 13 deletions
diff --git a/common/natspec/natspec.go b/common/natspec/natspec.go index fb98d6ad9..38e7c1a9d 100644 --- a/common/natspec/natspec.go +++ b/common/natspec/natspec.go @@ -195,7 +195,7 @@ func (self *NatSpec) Notice() (notice string, err error) { meth := self.makeAbi2method(abiKey) if meth == nil { - err = fmt.Errorf("abi key %x does not match any method %v") + err = fmt.Errorf("abi key does not match any method") return } notice, err = self.noticeForMethod(self.tx, meth.name, meth.Notice) diff --git a/common/natspec/natspec_e2e_test.go b/common/natspec/natspec_e2e_test.go index 30e6e87dc..147abe162 100644 --- a/common/natspec/natspec_e2e_test.go +++ b/common/natspec/natspec_e2e_test.go @@ -1,7 +1,6 @@ package natspec import ( - "fmt" "io/ioutil" "math/big" "os" @@ -40,7 +39,7 @@ const testFileName = "long_file_name_for_testing_registration_of_URLs_longer_tha const testNotice = "Register key `utils.toHex(_key)` <- content `utils.toHex(_content)`" const testExpNotice = "Register key 0xadd1a7d961cff0242089674ec2ef6fca671ab15e1fe80e38859fc815b98d88ab <- content 0xc00d5bcc872e17813df6ec5c646bb281a6e2d3b454c2c400c78192adf3344af9" -const testExpNotice2 = `About to submit transaction (NatSpec notice error "abi key %!x(MISSING) does not match any method %!v(MISSING)"): {"id":6,"jsonrpc":"2.0","method":"eth_transact","params":[{"from":"0xe273f01c99144c438695e10f24926dc1f9fbf62d","to":"0xb737b91f8e95cf756766fc7c62c9a8ff58470381","value":"100000000000","gas":"100000","gasPrice":"100000","data":"0x31e12c20"}]}` +const testExpNotice2 = `About to submit transaction (NatSpec notice error "abi key does not match any method"): {"id":6,"jsonrpc":"2.0","method":"eth_transact","params":[{"from":"0xe273f01c99144c438695e10f24926dc1f9fbf62d","to":"0xb737b91f8e95cf756766fc7c62c9a8ff58470381","value":"100000000000","gas":"100000","gasPrice":"100000","data":"0x31e12c20"}]}` const testExpNotice3 = `About to submit transaction (no NatSpec info found for contract): {"id":6,"jsonrpc":"2.0","method":"eth_transact","params":[{"from":"0xe273f01c99144c438695e10f24926dc1f9fbf62d","to":"0x8b839ad85686967a4f418eccc81962eaee314ac3","value":"100000000000","gas":"100000","gasPrice":"100000","data":"0x300a3bbfc00d5bcc872e17813df6ec5c646bb281a6e2d3b454c2c400c78192adf3344af900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000"}]}` const testUserDoc = ` @@ -106,27 +105,25 @@ func (f *testFrontend) ConfirmTransaction(tx string) bool { var port = 30300 func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { - os.RemoveAll("/tmp/eth/") - err = os.MkdirAll("/tmp/eth/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/", os.ModePerm) + os.RemoveAll("/tmp/eth-natspec/") + err = os.MkdirAll("/tmp/eth-natspec/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/", os.ModePerm) if err != nil { t.Errorf("%v", err) return } - err = os.MkdirAll("/tmp/eth/data", os.ModePerm) + err = os.MkdirAll("/tmp/eth-natspec/data", os.ModePerm) if err != nil { t.Errorf("%v", err) return } - ks := crypto.NewKeyStorePlain("/tmp/eth/keys") - ioutil.WriteFile("/tmp/eth/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/e273f01c99144c438695e10f24926dc1f9fbf62d", + ks := crypto.NewKeyStorePlain("/tmp/eth-natspec/keys") + ioutil.WriteFile("/tmp/eth-natspec/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/e273f01c99144c438695e10f24926dc1f9fbf62d", []byte(`{"Id":"RhRXD+fNRKS4jx+7ZfEsNA==","Address":"4nPwHJkUTEOGleEPJJJtwfn79i0=","PrivateKey":"h4ACVpe74uIvi5Cg/2tX/Yrm2xdr3J7QoMbMtNX2CNc="}`), os.ModePerm) port++ ethereum, err = eth.New(ð.Config{ - DataDir: "/tmp/eth", + DataDir: "/tmp/eth-natspec", AccountManager: accounts.NewManager(ks), - Port: fmt.Sprintf("%d", port), - MaxPeers: 10, Name: "test", }) @@ -146,7 +143,7 @@ func testInit(t *testing.T) (self *testFrontend) { ethereum, err := testEth(t) if err != nil { - t.Errorf("error creating jsre, got %v", err) + t.Errorf("error creating ethereum: %v", err) return } err = ethereum.Start() @@ -193,7 +190,7 @@ func (self *testFrontend) insertTx(addr, contract, fnsig string, args []string) jsontx := ` [{ "from": "` + addr + `", - "to": "0x` + contract + `", + "to": "` + contract + `", "value": "100000000000", "gas": "100000", "gasPrice": "100000", |