Skip to content

Commit 916af56

Browse files
Merge d5b9d22 into 49fbaef
2 parents 49fbaef + d5b9d22 commit 916af56

File tree

243 files changed

+4647
-2420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+4647
-2420
lines changed

.github/workflows/build_and_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
runs-on: ${{ matrix.runs-on }}
1616
name: Build
1717
steps:
18-
- name: Set up Go 1.20.5
18+
- name: Set up Go 1.20.7
1919
uses: actions/setup-go@v3
2020
with:
21-
go-version: 1.20.5
21+
go-version: 1.20.7
2222
id: go
2323

2424
- name: Check out code into the Go module directory

.github/workflows/check-cli-md.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
runs-on: ${{ matrix.runs-on }}
1616
name: Check CLI.md
1717
steps:
18-
- name: Set up Go 1.20.5
18+
- name: Set up Go 1.20.7
1919
uses: actions/setup-go@v3
2020
with:
21-
go-version: 1.20.5
21+
go-version: 1.20.7
2222
id: go
2323

2424
- name: Check out code into the Go module directory

.github/workflows/code-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
runs-on: ${{ matrix.runs-on }}
1818
name: Build
1919
steps:
20-
- name: Set up Go 1.20.5
20+
- name: Set up Go 1.20.7
2121
uses: actions/setup-go@v3
2222
with:
23-
go-version: 1.20.5
23+
go-version: 1.20.7
2424
id: go
2525

2626
- name: Check out code into the Go module directory

.github/workflows/create_release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
runs-on: ${{ matrix.runs-on }}
2020
name: Build
2121
steps:
22-
- name: Set up Go 1.20.5
22+
- name: Set up Go 1.20.7
2323
uses: actions/setup-go@v3
2424
with:
25-
go-version: 1.20.5
25+
go-version: 1.20.7
2626
id: go
2727

2828
- name: Check out code into the Go module directory
@@ -59,10 +59,10 @@ jobs:
5959
- name: Build
6060
run: |
6161
mkdir -p ${BUILD_DIR}
62-
cd ${GITHUB_WORKSPACE}/cmd/node && go build -o "${BUILD_DIR}/node" -a -i -ldflags="-X main.appVersion=${APP_VER}"
63-
cd ${GITHUB_WORKSPACE}/cmd/keygenerator && go build -o "${BUILD_DIR}/keygenerator" -a -i -ldflags="-X main.appVersion=${APP_VER}"
64-
cd ${GITHUB_WORKSPACE}/cmd/logviewer && go build -o "${BUILD_DIR}/logviewer" -a -i -ldflags="-X main.appVersion=${APP_VER}"
65-
cd ${GITHUB_WORKSPACE}/cmd/termui && go build -o "${BUILD_DIR}/termui" -a -i -ldflags="-X main.appVersion=${APP_VER}"
62+
cd ${GITHUB_WORKSPACE}/cmd/node && go build -o "${BUILD_DIR}/node" -a -ldflags="-X main.appVersion=${APP_VER}"
63+
cd ${GITHUB_WORKSPACE}/cmd/keygenerator && go build -o "${BUILD_DIR}/keygenerator" -a -ldflags="-X main.appVersion=${APP_VER}"
64+
cd ${GITHUB_WORKSPACE}/cmd/logviewer && go build -o "${BUILD_DIR}/logviewer" -a -ldflags="-X main.appVersion=${APP_VER}"
65+
cd ${GITHUB_WORKSPACE}/cmd/termui && go build -o "${BUILD_DIR}/termui" -a -ldflags="-X main.appVersion=${APP_VER}"
6666
6767
- name: Package
6868
run: |

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/setup-go@v3
1818
with:
19-
go-version: 1.20.5
19+
go-version: 1.20.7
2020
- uses: actions/checkout@v3
2121
- name: golangci-lint
2222
uses: golangci/golangci-lint-action@v3

api/groups/networkGroup_test.go

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"io"
8-
"io/ioutil"
98
"math/big"
109
"net/http"
1110
"net/http/httptest"
@@ -96,8 +95,8 @@ func TestNetworkConfigMetrics_ShouldWork(t *testing.T) {
9695

9796
statusMetricsProvider := statusHandler.NewStatusMetrics()
9897
key := common.MetricMinGasLimit
99-
value := uint64(37)
100-
statusMetricsProvider.SetUInt64Value(key, value)
98+
val := uint64(37)
99+
statusMetricsProvider.SetUInt64Value(key, val)
101100

102101
facade := mock.FacadeStub{}
103102
facade.StatusMetricsHandler = func() external.StatusMetricsHandler {
@@ -113,17 +112,15 @@ func TestNetworkConfigMetrics_ShouldWork(t *testing.T) {
113112
resp := httptest.NewRecorder()
114113
ws.ServeHTTP(resp, req)
115114

116-
respBytes, _ := ioutil.ReadAll(resp.Body)
115+
respBytes, _ := io.ReadAll(resp.Body)
117116
respStr := string(respBytes)
118117
assert.Equal(t, resp.Code, http.StatusOK)
119118

120-
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, fmt.Sprintf("%d", value))
119+
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, fmt.Sprintf("%d", val))
121120
assert.True(t, keyAndValueFoundInResponse)
122121
}
123122

124123
func TestGetNetworkConfig_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
125-
expectedErr := errors.New("i am an error")
126-
127124
facade := mock.FacadeStub{
128125
StatusMetricsHandler: func() external.StatusMetricsHandler {
129126
return &testscommon.StatusMetricsStub{
@@ -152,8 +149,6 @@ func TestGetNetworkConfig_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
152149
}
153150

154151
func TestGetNetworkStatus_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
155-
expectedErr := errors.New("i am an error")
156-
157152
facade := mock.FacadeStub{
158153
StatusMetricsHandler: func() external.StatusMetricsHandler {
159154
return &testscommon.StatusMetricsStub{
@@ -186,8 +181,8 @@ func TestNetworkConfigMetrics_GasLimitGuardedTxShouldWork(t *testing.T) {
186181

187182
statusMetricsProvider := statusHandler.NewStatusMetrics()
188183
key := common.MetricExtraGasLimitGuardedTx
189-
value := uint64(37)
190-
statusMetricsProvider.SetUInt64Value(key, value)
184+
val := uint64(37)
185+
statusMetricsProvider.SetUInt64Value(key, val)
191186

192187
facade := mock.FacadeStub{}
193188
facade.StatusMetricsHandler = func() external.StatusMetricsHandler {
@@ -203,11 +198,11 @@ func TestNetworkConfigMetrics_GasLimitGuardedTxShouldWork(t *testing.T) {
203198
resp := httptest.NewRecorder()
204199
ws.ServeHTTP(resp, req)
205200

206-
respBytes, _ := ioutil.ReadAll(resp.Body)
201+
respBytes, _ := io.ReadAll(resp.Body)
207202
respStr := string(respBytes)
208203
assert.Equal(t, resp.Code, http.StatusOK)
209204

210-
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, fmt.Sprintf("%d", value))
205+
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, fmt.Sprintf("%d", val))
211206
assert.True(t, keyAndValueFoundInResponse)
212207
}
213208

@@ -216,8 +211,8 @@ func TestNetworkStatusMetrics_ShouldWork(t *testing.T) {
216211

217212
statusMetricsProvider := statusHandler.NewStatusMetrics()
218213
key := common.MetricEpochNumber
219-
value := uint64(37)
220-
statusMetricsProvider.SetUInt64Value(key, value)
214+
val := uint64(37)
215+
statusMetricsProvider.SetUInt64Value(key, val)
221216

222217
facade := mock.FacadeStub{}
223218
facade.StatusMetricsHandler = func() external.StatusMetricsHandler {
@@ -233,19 +228,19 @@ func TestNetworkStatusMetrics_ShouldWork(t *testing.T) {
233228
resp := httptest.NewRecorder()
234229
ws.ServeHTTP(resp, req)
235230

236-
respBytes, _ := ioutil.ReadAll(resp.Body)
231+
respBytes, _ := io.ReadAll(resp.Body)
237232
respStr := string(respBytes)
238233
assert.Equal(t, resp.Code, http.StatusOK)
239234

240-
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, fmt.Sprintf("%d", value))
235+
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, fmt.Sprintf("%d", val))
241236
assert.True(t, keyAndValueFoundInResponse)
242237
}
243238

244239
func TestEconomicsMetrics_ShouldWork(t *testing.T) {
245240
statusMetricsProvider := statusHandler.NewStatusMetrics()
246241
key := common.MetricTotalSupply
247-
value := "12345"
248-
statusMetricsProvider.SetStringValue(key, value)
242+
val := "12345"
243+
statusMetricsProvider.SetStringValue(key, val)
249244

250245
facade := mock.FacadeStub{
251246
GetTotalStakedValueHandler: func() (*api.StakeValues, error) {
@@ -268,17 +263,15 @@ func TestEconomicsMetrics_ShouldWork(t *testing.T) {
268263
resp := httptest.NewRecorder()
269264
ws.ServeHTTP(resp, req)
270265

271-
respBytes, _ := ioutil.ReadAll(resp.Body)
266+
respBytes, _ := io.ReadAll(resp.Body)
272267
respStr := string(respBytes)
273268
assert.Equal(t, resp.Code, http.StatusOK)
274269

275-
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, value)
270+
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, val)
276271
assert.True(t, keyAndValueFoundInResponse)
277272
}
278273

279274
func TestGetEconomicValues_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
280-
expectedErr := errors.New("i am an error")
281-
282275
facade := mock.FacadeStub{
283276
StatusMetricsHandler: func() external.StatusMetricsHandler {
284277
return &testscommon.StatusMetricsStub{
@@ -312,8 +305,8 @@ func TestGetEconomicValues_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
312305
func TestEconomicsMetrics_CannotGetStakeValues(t *testing.T) {
313306
statusMetricsProvider := statusHandler.NewStatusMetrics()
314307
key := common.MetricTotalSupply
315-
value := "12345"
316-
statusMetricsProvider.SetStringValue(key, value)
308+
val := "12345"
309+
statusMetricsProvider.SetStringValue(key, val)
317310

318311
localErr := fmt.Errorf("%s", "local error")
319312
facade := mock.FacadeStub{
@@ -410,7 +403,7 @@ func TestDirectStakedInfo_ShouldWork(t *testing.T) {
410403
resp := httptest.NewRecorder()
411404
ws.ServeHTTP(resp, req)
412405

413-
respBytes, _ := ioutil.ReadAll(resp.Body)
406+
respBytes, _ := io.ReadAll(resp.Body)
414407
respStr := string(respBytes)
415408
assert.Equal(t, resp.Code, http.StatusOK)
416409

@@ -440,7 +433,7 @@ func TestDirectStakedInfo_CannotGetDirectStakedList(t *testing.T) {
440433
resp := httptest.NewRecorder()
441434
ws.ServeHTTP(resp, req)
442435

443-
respBytes, _ := ioutil.ReadAll(resp.Body)
436+
respBytes, _ := io.ReadAll(resp.Body)
444437
respStr := string(respBytes)
445438

446439
assert.Equal(t, resp.Code, http.StatusInternalServerError)
@@ -495,7 +488,7 @@ func TestDelegatedInfo_ShouldWork(t *testing.T) {
495488
resp := httptest.NewRecorder()
496489
ws.ServeHTTP(resp, req)
497490

498-
respBytes, _ := ioutil.ReadAll(resp.Body)
491+
respBytes, _ := io.ReadAll(resp.Body)
499492
respStr := string(respBytes)
500493
assert.Equal(t, resp.Code, http.StatusOK)
501494

@@ -534,16 +527,14 @@ func TestDelegatedInfo_CannotGetDelegatedList(t *testing.T) {
534527
resp := httptest.NewRecorder()
535528
ws.ServeHTTP(resp, req)
536529

537-
respBytes, _ := ioutil.ReadAll(resp.Body)
530+
respBytes, _ := io.ReadAll(resp.Body)
538531
respStr := string(respBytes)
539532

540533
assert.Equal(t, resp.Code, http.StatusInternalServerError)
541534
assert.True(t, strings.Contains(respStr, expectedError.Error()))
542535
}
543536

544537
func TestGetEnableEpochs_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
545-
expectedErr := errors.New("i am an error")
546-
547538
facade := mock.FacadeStub{
548539
StatusMetricsHandler: func() external.StatusMetricsHandler {
549540
return &testscommon.StatusMetricsStub{
@@ -576,8 +567,8 @@ func TestGetEnableEpochs_ShouldWork(t *testing.T) {
576567

577568
statusMetrics := statusHandler.NewStatusMetrics()
578569
key := common.MetricScDeployEnableEpoch
579-
value := uint64(4)
580-
statusMetrics.SetUInt64Value(key, value)
570+
val := uint64(4)
571+
statusMetrics.SetUInt64Value(key, val)
581572

582573
facade := mock.FacadeStub{}
583574
facade.StatusMetricsHandler = func() external.StatusMetricsHandler {
@@ -593,18 +584,17 @@ func TestGetEnableEpochs_ShouldWork(t *testing.T) {
593584
resp := httptest.NewRecorder()
594585
ws.ServeHTTP(resp, req)
595586

596-
respBytes, _ := ioutil.ReadAll(resp.Body)
587+
respBytes, _ := io.ReadAll(resp.Body)
597588
respStr := string(respBytes)
598589
assert.Equal(t, resp.Code, http.StatusOK)
599590

600-
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, strconv.FormatUint(value, 10))
591+
keyAndValueFoundInResponse := strings.Contains(respStr, key) && strings.Contains(respStr, strconv.FormatUint(val, 10))
601592
assert.True(t, keyAndValueFoundInResponse)
602593
}
603594

604595
func TestGetESDTTotalSupply_InternalError(t *testing.T) {
605596
t.Parallel()
606597

607-
expectedErr := errors.New("expected error")
608598
facade := mock.FacadeStub{
609599
GetTokenSupplyCalled: func(token string) (*api.ESDTSupply, error) {
610600
return nil, expectedErr
@@ -620,7 +610,7 @@ func TestGetESDTTotalSupply_InternalError(t *testing.T) {
620610
resp := httptest.NewRecorder()
621611
ws.ServeHTTP(resp, req)
622612

623-
respBytes, _ := ioutil.ReadAll(resp.Body)
613+
respBytes, _ := io.ReadAll(resp.Body)
624614
respStr := string(respBytes)
625615
assert.Equal(t, resp.Code, http.StatusInternalServerError)
626616

@@ -629,8 +619,6 @@ func TestGetESDTTotalSupply_InternalError(t *testing.T) {
629619
}
630620

631621
func TestGetNetworkRatings_ShouldReturnErrorIfFacadeReturnsError(t *testing.T) {
632-
expectedErr := errors.New("i am an error")
633-
634622
facade := mock.FacadeStub{
635623
StatusMetricsHandler: func() external.StatusMetricsHandler {
636624
return &testscommon.StatusMetricsStub{
@@ -716,7 +704,7 @@ func TestGetESDTTotalSupply(t *testing.T) {
716704
resp := httptest.NewRecorder()
717705
ws.ServeHTTP(resp, req)
718706

719-
respBytes, _ := ioutil.ReadAll(resp.Body)
707+
respBytes, _ := io.ReadAll(resp.Body)
720708
assert.Equal(t, resp.Code, http.StatusOK)
721709

722710
respSupply := &supplyResponse{}
@@ -964,7 +952,6 @@ func TestNetworkGroup_UpdateFacade(t *testing.T) {
964952
loadResponse(resp.Body, &response)
965953
assert.Equal(t, builtInCost, response.Data.Configs.BuiltInCost)
966954

967-
expectedErr := errors.New("expected error")
968955
newFacade := mock.FacadeStub{
969956
GetGasConfigsCalled: func() (map[string]map[string]uint64, error) {
970957
return nil, expectedErr

0 commit comments

Comments
 (0)