Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update go, hedera-sdk, go-ethereum versions #911

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/go-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
name: Setup GO Env
with:
go-version: '1.18'
go-version: '1.20'
- name: Cache Go modules
uses: actions/cache@v2
with:
Expand All @@ -19,7 +19,7 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Build hedera-eth-bridge-validator
run: go build -i -o validator cmd/*
run: go build -o validator cmd/*
- name: Upload Binary as artifact
uses: actions/upload-artifact@master
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/go-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
name: Setup GO Env
with:
go-version: '1.18'
go-version: '1.20'
- name: Cache Go Test modules
uses: actions/cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mainnet-deploy-to-vms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
deploy_mainnet_dave:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mainnet-release-gcr-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: |
! contains(github.event.release.tag_name, '-rc-')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/outdated-dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
go-mod-outdated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
name: Setup GO Env
with:
go-version: '1.18'
go-version: '1.20'
- name: Run go-mod-outdated
run: go list -u -m -json all | docker run --rm -i psampaz/go-mod-outdated -update -direct -ci
6 changes: 3 additions & 3 deletions .github/workflows/run-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
name: Setup GO Env
with:
go-version: '1.18'
go-version: '1.20'
- name: Cache Go E2E Test modules
uses: actions/cache@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/staticcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: WillAbides/setup-go-faster@v1.8.0
- uses: WillAbides/setup-go-faster@v1.9.1
with:
go-version: "1.18.x"
go-version: "1.20"
- uses: dominikh/staticcheck-action@v1.3.0
with:
checks: "all,-ST*,-S1002,-S1005,-S1008,-S1023,-S1039,-U1000"
version: "2022.1.3"
install-go: false
install-go: true
8 changes: 4 additions & 4 deletions .github/workflows/testnet-deploy-to-vms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
deploy_testnet_alice:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
deploy_testnet_bob:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
deploy_testnet_carol:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
deploy_testnet_dave:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testnet-release-gcr-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: |
contains(github.event.release.tag_name, '-rc-')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup GCloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
Expand Down
20 changes: 10 additions & 10 deletions app/clients/hedera/mirror-node/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -242,7 +242,7 @@
}

if httpResponse.StatusCode != http.StatusOK {
return transaction.NftTransactionsResponse{}, fmt.Errorf("Mirror Node API [%s] ended with Status Code [%d]. Body bytes: [%s]", query, httpResponse.StatusCode, bodyBytes)
return transaction.NftTransactionsResponse{}, fmt.Errorf("mirror Node API [%s] ended with Status Code [%d]. Body bytes: [%s]", query, httpResponse.StatusCode, bodyBytes)

Check warning on line 245 in app/clients/hedera/mirror-node/client.go

View check run for this annotation

Codecov / codecov/patch

app/clients/hedera/mirror-node/client.go#L245

Added line #L245 was not covered by tests
}

var response *transaction.NftTransactionsResponse
Expand Down Expand Up @@ -291,7 +291,7 @@
return nil, e
}
if httpResponse.StatusCode >= 400 {
return nil, fmt.Errorf(`Failed to execute query: [%s]. Error: [%s]`, query, query)
return nil, fmt.Errorf(`failed to execute query: [%s]. Error: [%s]`, query, query)
}

bodyBytes, e := readResponseBody(httpResponse)
Expand All @@ -318,7 +318,7 @@
}

if response.StatusCode != http.StatusOK {
return nil, fmt.Errorf("State Proof HTTP GET for TransactionID [%s] ended with Status Code [%d].", transactionID, response.StatusCode)
return nil, fmt.Errorf("state Proof HTTP GET for TransactionID [%s] ended with Status Code [%d]", transactionID, response.StatusCode)
}

return readResponseBody(response)
Expand All @@ -333,7 +333,7 @@
return nil, e
}
if httpResponse.StatusCode >= 400 {
return nil, fmt.Errorf(`Failed to execute query: [%s]. Error: [%s]`, query, query)
return nil, fmt.Errorf(`failed to execute query: [%s]. Error: [%s]`, query, query)

Check warning on line 336 in app/clients/hedera/mirror-node/client.go

View check run for this annotation

Codecov / codecov/patch

app/clients/hedera/mirror-node/client.go#L336

Added line #L336 was not covered by tests
}

bodyBytes, e := readResponseBody(httpResponse)
Expand Down Expand Up @@ -372,7 +372,7 @@
return nil, e
}
if httpResponse.StatusCode >= 400 {
return nil, fmt.Errorf(`Failed to execute query: [%s]. Error: [%s]`, query, query)
return nil, fmt.Errorf(`failed to execute query: [%s]. Error: [%s]`, query, query)
}

bodyBytes, e := readResponseBody(httpResponse)
Expand Down Expand Up @@ -400,7 +400,7 @@
return nil, e
}
if httpResponse.StatusCode >= 400 {
return nil, fmt.Errorf(`Failed to execute query: [%s]. Error: [%s]`, query, query)
return nil, fmt.Errorf(`failed to execute query: [%s]. Error: [%s]`, query, query)
}

bodyBytes, e := readResponseBody(httpResponse)
Expand Down Expand Up @@ -429,7 +429,7 @@
return nil, e
}
if httpResponse.StatusCode >= 400 {
return nil, fmt.Errorf(`Failed to execute query: [%s]. Error: [%s]`, query, query)
return nil, fmt.Errorf(`failed to execute query: [%s]. Error: [%s]`, query, query)
}

bodyBytes, e := readResponseBody(httpResponse)
Expand Down Expand Up @@ -594,7 +594,7 @@
return nil, fmt.Errorf("failed to unmarshal response body: [%s]. Error: [%s]", string(bodyBytes), e.Error())
}
if httpResponse.StatusCode >= 400 {
return response, fmt.Errorf(`Failed to execute query: [%s]. Error: [%s]`, query, response.Status.String())
return response, fmt.Errorf(`failed to execute query: [%s]. Error: [%s]`, query, response.Status.String())

Check warning on line 597 in app/clients/hedera/mirror-node/client.go

View check run for this annotation

Codecov / codecov/patch

app/clients/hedera/mirror-node/client.go#L597

Added line #L597 was not covered by tests
}

return response, nil
Expand Down Expand Up @@ -622,5 +622,5 @@
func readResponseBody(response *http.Response) ([]byte, error) {
defer response.Body.Close()

return ioutil.ReadAll(response.Body)
return io.ReadAll(response.Body)
}
20 changes: 4 additions & 16 deletions app/clients/hedera/mirror-node/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"strings"
"testing"
Expand Down Expand Up @@ -63,18 +63,6 @@ var (
Topic: 2,
}

scheduleId = hedera.ScheduleID{
Shard: 0,
Realm: 0,
Schedule: 3,
}

tokenId = hedera.TokenID{
Shard: 0,
Realm: 0,
Token: 4,
}

c *Client
)

Expand Down Expand Up @@ -128,7 +116,7 @@ func Test_GetSchedule_Fails(t *testing.T) {
func Test_AccountExists_Status400(t *testing.T) {
setup()
stringReader := strings.NewReader("error")
stringReadCloser := ioutil.NopCloser(stringReader)
stringReadCloser := io.NopCloser(stringReader)
response := &http.Response{
StatusCode: 400,
Body: stringReadCloser,
Expand Down Expand Up @@ -179,7 +167,7 @@ func Test_GetToken_Fails(t *testing.T) {
func Test_TopicExists_Status400(t *testing.T) {
setup()
stringReader := strings.NewReader("error")
stringReadCloser := ioutil.NopCloser(stringReader)
stringReadCloser := io.NopCloser(stringReader)
response := &http.Response{
StatusCode: 400,
Body: stringReadCloser,
Expand Down Expand Up @@ -687,7 +675,7 @@ func Test_GetAccountByPublicKey_Err(t *testing.T) {
mocks.MHTTPClient.On("Get", mock.Anything).Return(&http.Response{StatusCode: 400, Body: encodedContent}, nil)
response, err := c.GetAccountByPublicKey("1234")
assert.Nil(t, response)
assert.Contains(t, err.Error(), "Failed to execute query")
assert.Contains(t, err.Error(), "failed to execute query")
}

func Test_GetToken_HttpErr(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions app/helper/http/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
)

func EncodeBodyContent(content interface{}) (io.ReadCloser, error) {
Expand All @@ -30,7 +29,7 @@ func EncodeBodyContent(content interface{}) (io.ReadCloser, error) {
return nil, encodeErr
}
encodedResponseReader := bytes.NewReader(encodedResponseBuffer.Bytes())
encodedResponseReaderCloser := ioutil.NopCloser(encodedResponseReader)
encodedResponseReaderCloser := io.NopCloser(encodedResponseReader)

return encodedResponseReaderCloser, nil
}
6 changes: 3 additions & 3 deletions app/router/transfer-reset/transfer-reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
Expand Down Expand Up @@ -51,7 +51,7 @@ func Test_GetTransferSuccess(t *testing.T) {
handler(w, req)
res := w.Result()
defer res.Body.Close()
data, _ := ioutil.ReadAll(res.Body)
data, _ := io.ReadAll(res.Body)

assert.Equal(t, http.StatusOK, res.StatusCode)
assert.Equal(t, "OK", string(data))
Expand Down Expand Up @@ -146,7 +146,7 @@ func Test_GetTransferSuccess_FailsWithEmptyPassword(t *testing.T) {
"SourceChainId": 1,
"TargetChainId": 2,
"SourceToken": "token",
"Password": "",
"Password": "",
}

reqBody, _ := json.Marshal(body)
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as build
FROM golang:1.20 as build
WORKDIR /tmp/src/hedera-eth-bridge-validator
COPY . .
RUN go build -o main ./cmd
Expand Down
3 changes: 1 addition & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package config

import (
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -64,7 +63,7 @@ func GetConfig(config interface{}, path string) error {
log.Fatal(err)
}

yamlFile, err := ioutil.ReadFile(filename)
yamlFile, err := os.ReadFile(filename)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion config/loggcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ func (f *GCEFormatter) Format(entry *logrus.Entry) ([]byte, error) {
return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
}
return append(serialized, '\n'), nil
}
}
4 changes: 2 additions & 2 deletions e2e/clients/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package clients
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"time"
)
Expand Down Expand Up @@ -68,5 +68,5 @@ func (v *Validator) get(url string) ([]byte, error) {
return nil, fmt.Errorf("GET resolved with status [%d].", response.StatusCode)
}

return ioutil.ReadAll(response.Body)
return io.ReadAll(response.Body)
}
Loading
Loading