diff --git a/api.md b/api.md index 775e142aaacf4c9fafc914dc1369518c4415f91b..b549023c7f4ac7a20b68d348732d7e467cac0213 100644 --- a/api.md +++ b/api.md @@ -457,7 +457,7 @@ Event object: | Name | RPC method name | REST method | REST endpoint | | :--- | :-------------- | :---------: | :------------ | | [Call](#call) | erisdb.call | POST | `/calls` | -| [CallCode](#call-code) | erisdb.callCode | POST | `/calls/code` | +| [CallCode](#call-code) | erisdb.callCode | POST | `/codecalls` | ####Unsafe @@ -1414,7 +1414,7 @@ TODO *** -<a name="BroadcastTx"></a> +<a name="broadcast-tx"></a> ####BroadcastTx Broadcast a given (signed) transaction to the node. It will be added to the tx pool if there are no issues, and if it is accepted by all validators it will eventually be committed to a block. @@ -1500,7 +1500,7 @@ See [The transaction types](#the-transaction-types) for more info on the `Tx` ty *** -<a name="Call"></a> +<a name="call"></a> ####Call Call a given (contract) account to execute its code with the given in-data. @@ -1541,8 +1541,8 @@ Parameters: *** -<a name="CallCode"></a> -####Call +<a name="call-code"></a> +####CallCode Pass contract code and tx data to the node and have it executed in the virtual machine. This is mostly a dev feature. @@ -1550,7 +1550,7 @@ Pass contract code and tx data to the node and have it executed in the virtual m Method: POST -Endpoint: `/calls/code` +Endpoint: `/codecalls` Body: See JSON-RPC parameter. @@ -1590,7 +1590,7 @@ These methods are unsafe because they require that a private key is either trans *** -<a name="SignTx"></a> +<a name="sign-tx"></a> ####SignTx Send an unsigned transaction to the node for signing. @@ -1627,7 +1627,7 @@ See [The transaction types](#the-transaction-types) for more info on the `Tx` ty *** -<a name="Transact"></a> +<a name="transact"></a> ####Transact Convenience method for sending a transaction "old Ethereum dev style". It will do the following things: @@ -1679,7 +1679,7 @@ See [The transaction types](#the-transaction-types) for more info on the `CallTx *** -<a name="GenPrivAccount"></a> +<a name="gen-priv-account"></a> ####GenPrivAccount Convenience method for generating a `PrivAccount` object, which contains a private key and the corresponding public key and address. diff --git a/erisdb/restServer.go b/erisdb/restServer.go index 08819b27c6c5c8ffc8de7584fb8441694bd115b0..2ad00cd7e56bca6900085e91ddee70a83048d412 100644 --- a/erisdb/restServer.go +++ b/erisdb/restServer.go @@ -62,8 +62,8 @@ func (this *RestServer) Start(config *server.ServerConfig, router *gin.Engine) { router.POST("/txpool", this.handleBroadcastTx) router.GET("/txpool", this.handleUnconfirmedTxs) // Code execution - router.POST("/calls/:address", this.handleCall) - router.POST("/calls", this.handleCallCode) + router.POST("/calls", this.handleCall) + router.POST("/codecalls", this.handleCallCode) // Unsafe router.GET("/unsafe/pa_generator", this.handleGenPrivAcc) router.POST("/unsafe/txpool", this.handleTransact) diff --git a/test/mock/mock_web_api_test.go b/test/mock/mock_web_api_test.go index cb8c6be4ec2f4c2b167e2318ca42eb91eddf697a..0f9ddf6ffb5369737750d97f5c2dec9ed860f333 100644 --- a/test/mock/mock_web_api_test.go +++ b/test/mock/mock_web_api_test.go @@ -18,6 +18,7 @@ import ( "testing" "os" "runtime" + "time" ) func init() { @@ -65,6 +66,9 @@ func (this *MockSuite) TearDownSuite() { sec := this.serveProcess.StopEventChannel() this.serveProcess.Stop(0) <-sec + // Tests are done rapidly, this is just to give that extra milliseconds + // to shut down the previous server (may be excessive). + time.Sleep(500*time.Millisecond) } // ********************************************* Consensus ********************************************* @@ -163,7 +167,7 @@ func (this *MockSuite) Test_C2_UnconfirmedTxs() { } func (this *MockSuite) Test_C3_CallCode() { - resp := this.postJson("/calls", this.testData.Input.CallCode) + resp := this.postJson("/codecalls", this.testData.Input.CallCode) ret := &ep.Call{} errD := this.codec.Decode(ret, resp.Body) this.NoError(errD) diff --git a/test/web_api/query_test.go b/test/web_api/query_test.go index 3c4c853477a9ded335b965f6560e807ee2ff00cc..4002579412f528cbfa73b6a52df01b6a875329c7 100644 --- a/test/web_api/query_test.go +++ b/test/web_api/query_test.go @@ -15,6 +15,7 @@ import ( "os" "path" "testing" + "time" ) type QuerySuite struct { @@ -55,6 +56,9 @@ func (this *QuerySuite) TearDownSuite() { sec := this.serveProcess.StopEventChannel() this.serveProcess.Stop(0) <-sec + // Tests are done rapidly, this is just to give that extra milliseconds + // to shut down the previous server (may be excessive). + time.Sleep(500*time.Millisecond) } // ********************************************* Tests ********************************************* diff --git a/test/web_api/web_api_test.go b/test/web_api/web_api_test.go index c607b629f9e5ceaa1e52ebbe965e4a1d4611df81..3aacb3580d501133eacdc0ffd478282dc094d532 100644 --- a/test/web_api/web_api_test.go +++ b/test/web_api/web_api_test.go @@ -18,6 +18,7 @@ import ( "os" "path" "testing" + "time" ) type WebApiSuite struct { @@ -59,6 +60,9 @@ func (this *WebApiSuite) TearDownSuite() { sec := this.serveProcess.StopEventChannel() this.serveProcess.Stop(0) <-sec + // Tests are done rapidly, this is just to give that extra milliseconds + // to shut down the previous server (may be excessive). + time.Sleep(500*time.Millisecond) } // ********************************************* Consensus ********************************************* @@ -157,7 +161,7 @@ func (this *WebApiSuite) Test_C2_UnconfirmedTxs() { } func (this *WebApiSuite) Test_C3_CallCode() { - resp := this.postJson("/calls", this.testData.Input.CallCode) + resp := this.postJson("/codecalls", this.testData.Input.CallCode) ret := &ep.Call{} errD := this.codec.Decode(ret, resp.Body) this.NoError(errD)