Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit eb20122

Browse files
authored
Merge pull request #832 from iotaledger/fix/committee-api
Fix wrong public route of committee endpoint in core API
2 parents b0a260d + c0a9e6b commit eb20122

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

components/restapi/params.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var ParamsRestAPI = &ParametersRestAPI{
4747
"/api/core/v3/accounts*",
4848
"/api/core/v3/validators*",
4949
"/api/core/v3/rewards*",
50-
"/api/core/v3/committee",
50+
"/api/core/v3/committee*",
5151
"/api/debug/v2/*",
5252
"/api/indexer/v2/*",
5353
"/api/mqtt/v2",

config_defaults.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"/api/core/v3/accounts*",
5454
"/api/core/v3/validators*",
5555
"/api/core/v3/rewards*",
56-
"/api/core/v3/committee",
56+
"/api/core/v3/committee*",
5757
"/api/debug/v2/*",
5858
"/api/indexer/v2/*",
5959
"/api/mqtt/v2",

documentation/configuration.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,17 @@ Example:
166166

167167
## <a id="restapi"></a> 5. RestAPI
168168

169-
| Name | Description | Type | Default value |
170-
| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
171-
| bindAddress | The bind address on which the REST API listens on | string | "0.0.0.0:14265" |
172-
| publicRoutes | The HTTP REST routes which can be called without authorization. Wildcards using \* are allowed | array | /health<br/>/api/routes<br/>/api/core/v3/info<br/>/api/core/v3/network\*<br/>/api/core/v3/blocks\*<br/>/api/core/v3/transactions\*<br/>/api/core/v3/commitments\*<br/>/api/core/v3/outputs\*<br/>/api/core/v3/accounts\*<br/>/api/core/v3/validators\*<br/>/api/core/v3/rewards\*<br/>/api/core/v3/committee<br/>/api/debug/v2/\*<br/>/api/indexer/v2/\*<br/>/api/mqtt/v2<br/>/api/blockissuer/v1/\* |
173-
| protectedRoutes | The HTTP REST routes which need to be called with authorization. Wildcards using \* are allowed | array | /api/\* |
174-
| debugRequestLoggerEnabled | Whether the debug logging for requests should be enabled | boolean | false |
175-
| maxPageSize | The maximum number of results per page | uint | 100 |
176-
| requestsMemoryCacheGranularity | Defines per how many slots a cache is created for big API requests | uint | 10 |
177-
| maxRequestedSlotAge | The maximum age of a request that will be processed | uint | 10 |
178-
| [jwtAuth](#restapi_jwtauth) | Configuration for jwtAuth | object | |
179-
| [limits](#restapi_limits) | Configuration for limits | object | |
169+
| Name | Description | Type | Default value |
170+
| ------------------------------ | ---------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
171+
| bindAddress | The bind address on which the REST API listens on | string | "0.0.0.0:14265" |
172+
| publicRoutes | The HTTP REST routes which can be called without authorization. Wildcards using \* are allowed | array | /health<br/>/api/routes<br/>/api/core/v3/info<br/>/api/core/v3/network\*<br/>/api/core/v3/blocks\*<br/>/api/core/v3/transactions\*<br/>/api/core/v3/commitments\*<br/>/api/core/v3/outputs\*<br/>/api/core/v3/accounts\*<br/>/api/core/v3/validators\*<br/>/api/core/v3/rewards\*<br/>/api/core/v3/committee\*<br/>/api/debug/v2/\*<br/>/api/indexer/v2/\*<br/>/api/mqtt/v2<br/>/api/blockissuer/v1/\* |
173+
| protectedRoutes | The HTTP REST routes which need to be called with authorization. Wildcards using \* are allowed | array | /api/\* |
174+
| debugRequestLoggerEnabled | Whether the debug logging for requests should be enabled | boolean | false |
175+
| maxPageSize | The maximum number of results per page | uint | 100 |
176+
| requestsMemoryCacheGranularity | Defines per how many slots a cache is created for big API requests | uint | 10 |
177+
| maxRequestedSlotAge | The maximum age of a request that will be processed | uint | 10 |
178+
| [jwtAuth](#restapi_jwtauth) | Configuration for jwtAuth | object | |
179+
| [limits](#restapi_limits) | Configuration for limits | object | |
180180

181181
### <a id="restapi_jwtauth"></a> JwtAuth
182182

@@ -209,7 +209,7 @@ Example:
209209
"/api/core/v3/accounts*",
210210
"/api/core/v3/validators*",
211211
"/api/core/v3/rewards*",
212-
"/api/core/v3/committee",
212+
"/api/core/v3/committee*",
213213
"/api/debug/v2/*",
214214
"/api/indexer/v2/*",
215215
"/api/mqtt/v2",

tools/docker-network/tests/coreapi_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,15 @@ func Test_CoreAPI(t *testing.T) {
328328
require.EqualValues(t, 4, len(resp.Committee))
329329
},
330330
},
331+
{
332+
name: "Test_CommitteeWithEpoch",
333+
testFunc: func(t *testing.T, nodeAlias string) {
334+
resp, err := d.wallet.Clients[nodeAlias].Committee(context.Background(), 0)
335+
require.NoError(t, err)
336+
require.Equal(t, iotago.EpochIndex(0), resp.Epoch)
337+
require.Equal(t, 4, len(resp.Committee))
338+
},
339+
},
331340
}
332341

333342
for _, test := range tests {
@@ -534,6 +543,15 @@ func Test_CoreAPI_BadRequests(t *testing.T) {
534543
require.Nil(t, resp)
535544
},
536545
},
546+
{
547+
name: "Test_Committee_Failure",
548+
testFunc: func(t *testing.T, nodeAlias string) {
549+
resp, err := d.wallet.Clients[nodeAlias].Committee(context.Background(), 4)
550+
require.Error(t, err)
551+
require.True(t, isStatusCode(err, http.StatusBadRequest))
552+
require.Nil(t, resp)
553+
},
554+
},
537555
{
538556
name: "Test_Rewards_Failure",
539557
testFunc: func(t *testing.T, nodeAlias string) {

0 commit comments

Comments
 (0)