@@ -37,22 +37,21 @@ import (
3737 "github.com/ethereum/go-ethereum/eth"
3838 "github.com/ethereum/go-ethereum/ethdb"
3939 "github.com/ethereum/go-ethereum/node"
40- "github.com/ethereum/go-ethereum/cmd/utils"
4140)
4241
4342const (
4443 testSolcPath = ""
45- solcVersion = "0.9.23"
44+ solcVersion = "0.9.23"
4645
47- testKey = "e6fab74a43941f82d89cb7faa408e227cdad3153c4720e540e855c19b15e6674"
46+ testKey = "e6fab74a43941f82d89cb7faa408e227cdad3153c4720e540e855c19b15e6674"
4847 testAddress = "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
4948 testBalance = "10000000000000000000"
50- // of empty string
49+ // of empty string
5150 testHash = "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
5251)
5352
5453var (
55- versionRE = regexp .MustCompile (strconv .Quote (`"compilerVersion":"` + solcVersion + `"` ))
54+ versionRE = regexp .MustCompile (strconv .Quote (`"compilerVersion":"` + solcVersion + `"` ))
5655 testNodeKey = crypto .ToECDSA (common .Hex2Bytes ("4b50fa71f5c3eeb8fdc452224b2395af2fcc3d125e06c32c82e048c0559db03f" ))
5756 testGenesis = `{"` + testAddress [2 :] + `": {"balance": "` + testBalance + `"}}`
5857)
@@ -141,8 +140,10 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
141140 stack .Service (& ethereum )
142141
143142 assetPath := filepath .Join (os .Getenv ("GOPATH" ), "src" , "github.com" , "ethereum" , "go-ethereum" , "cmd" , "mist" , "assets" , "ext" )
144- //client := comms.NewInProcClient(codec.JSON)
145- client := utils .NewInProcRPCClient (stack )
143+ client , err := stack .Attach ()
144+ if err != nil {
145+ t .Fatalf ("failed to attach to node: %v" , err )
146+ }
146147 tf := & testjethre {client : ethereum .HTTPClient ()}
147148 repl := newJSRE (stack , assetPath , "" , client , false )
148149 tf .jsre = repl
@@ -152,9 +153,6 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
152153func TestNodeInfo (t * testing.T ) {
153154 t .Skip ("broken after p2p update" )
154155 tmp , repl , ethereum := testJEthRE (t )
155- if err := ethereum .Start (); err != nil {
156- t .Fatalf ("error starting ethereum: %v" , err )
157- }
158156 defer ethereum .Stop ()
159157 defer os .RemoveAll (tmp )
160158
@@ -167,8 +165,8 @@ func TestAccounts(t *testing.T) {
167165 defer node .Stop ()
168166 defer os .RemoveAll (tmp )
169167
170- checkEvalJSON (t , repl , `eth.accounts` , `["` + testAddress + `"]` )
171- checkEvalJSON (t , repl , `eth.coinbase` , `"` + testAddress + `"` )
168+ checkEvalJSON (t , repl , `eth.accounts` , `["` + testAddress + `"]` )
169+ checkEvalJSON (t , repl , `eth.coinbase` , `"` + testAddress + `"` )
172170 val , err := repl .re .Run (`jeth.newAccount("password")` )
173171 if err != nil {
174172 t .Errorf ("expected no error, got %v" , err )
@@ -178,7 +176,7 @@ func TestAccounts(t *testing.T) {
178176 t .Errorf ("address not hex: %q" , addr )
179177 }
180178
181- checkEvalJSON (t , repl , `eth.accounts` , `["` + testAddress + `","` + addr + `"]` )
179+ checkEvalJSON (t , repl , `eth.accounts` , `["` + testAddress + `","` + addr + `"]` )
182180
183181}
184182
@@ -206,13 +204,13 @@ func TestBlockChain(t *testing.T) {
206204 node .Service (& ethereum )
207205 ethereum .BlockChain ().Reset ()
208206
209- checkEvalJSON (t , repl , `admin.exportChain(` + tmpfileq + `)` , `true` )
207+ checkEvalJSON (t , repl , `admin.exportChain(` + tmpfileq + `)` , `true` )
210208 if _ , err := os .Stat (tmpfile ); err != nil {
211209 t .Fatal (err )
212210 }
213211
214212 // check import, verify that dumpBlock gives the same result.
215- checkEvalJSON (t , repl , `admin.importChain(` + tmpfileq + `)` , `true` )
213+ checkEvalJSON (t , repl , `admin.importChain(` + tmpfileq + `)` , `true` )
216214 checkEvalJSON (t , repl , `debug.dumpBlock(eth.blockNumber)` , beforeExport )
217215}
218216
@@ -240,7 +238,7 @@ func TestCheckTestAccountBalance(t *testing.T) {
240238 defer os .RemoveAll (tmp )
241239
242240 repl .re .Run (`primary = "` + testAddress + `"` )
243- checkEvalJSON (t , repl , `eth.getBalance(primary)` , `"` + testBalance + `"` )
241+ checkEvalJSON (t , repl , `eth.getBalance(primary)` , `"` + testBalance + `"` )
244242}
245243
246244func TestSignature (t * testing.T ) {
@@ -301,11 +299,11 @@ func TestContract(t *testing.T) {
301299 */
302300
303301 source := `contract test {\n` +
304- " /// @notice Will multiply `a` by 7." + `\n` +
305- ` function multiply(uint a) returns(uint d) {\n` +
306- ` return a * 7;\n` +
307- ` }\n` +
308- `}\n`
302+ " /// @notice Will multiply `a` by 7." + `\n` +
303+ ` function multiply(uint a) returns(uint d) {\n` +
304+ ` return a * 7;\n` +
305+ ` }\n` +
306+ `}\n`
309307
310308 if checkEvalJSON (t , repl , `admin.stopNatSpec()` , `true` ) != nil {
311309 return
@@ -315,10 +313,10 @@ func TestContract(t *testing.T) {
315313 if err != nil {
316314 t .Fatalf ("%v" , err )
317315 }
318- if checkEvalJSON (t , repl , `primary = eth.accounts[0]` , `"` + testAddress + `"` ) != nil {
316+ if checkEvalJSON (t , repl , `primary = eth.accounts[0]` , `"` + testAddress + `"` ) != nil {
319317 return
320318 }
321- if checkEvalJSON (t , repl , `source = "` + source + `"` , `"` + source + `"` ) != nil {
319+ if checkEvalJSON (t , repl , `source = "` + source + `"` , `"` + source + `"` ) != nil {
322320 return
323321 }
324322
@@ -396,7 +394,7 @@ multiply7 = Multiply7.at(contractaddress);
396394
397395 var contentHash = `"0x86d2b7cf1e72e9a7a3f8d96601f0151742a2f780f1526414304fbe413dc7f9bd"`
398396 if sol != nil && solcVersion != sol .Version () {
399- modContractInfo := versionRE .ReplaceAll (contractInfo , []byte (`"compilerVersion":"` + sol .Version () + `"` ))
397+ modContractInfo := versionRE .ReplaceAll (contractInfo , []byte (`"compilerVersion":"` + sol .Version ()+ `"` ))
400398 fmt .Printf ("modified contractinfo:\n %s\n " , modContractInfo )
401399 contentHash = `"` + common .ToHex (crypto .Sha3 ([]byte (modContractInfo ))) + `"`
402400 }
@@ -481,7 +479,7 @@ func processTxs(repl *testjethre, t *testing.T, expTxc int) bool {
481479 repl .wait <- height
482480 select {
483481 case <- timer .C :
484- // if times out make sure the xeth loop does not block
482+ // if times out make sure the xeth loop does not block
485483 go func () {
486484 select {
487485 case repl .wait <- nil :
0 commit comments