Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/pr-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Run integration tests with Elasticsearch `v7.17.8`
run: make integration-tests ES_VERSION=7.17.8
test-2:
name: Elasticsearch v8.6.0
name: Elasticsearch v8.16.0
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
Expand All @@ -59,8 +59,8 @@ jobs:
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Run integration tests with Elasticsearch `v8.6.0`
run: make integration-tests ES_VERSION=8.6.0
- name: Run integration tests with Elasticsearch `v8.16.0`
run: make integration-tests ES_VERSION=8.16.0
test-3:
name: OpenSearch v1.3.7
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion client/elasticClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (ec *elasticClient) createPolicy(policyName string, policy *bytes.Buffer) e

// CreateIndexTemplate creates an elasticsearch index template
func (ec *elasticClient) createIndexTemplate(templateName string, template io.Reader) error {
res, err := ec.client.Indices.PutTemplate(templateName, template, ec.client.Indices.PutTemplate.WithContext(context.Background()))
res, err := ec.client.Indices.PutIndexTemplate(templateName, template)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions client/elasticClientCommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func loadResponseBody(body io.ReadCloser, dest interface{}) error {
return nil
}
if dest == nil {
_, err := io.Copy(ioutil.Discard, body)
_, err := io.Copy(io.Discard, body)
return err
}

Expand All @@ -56,7 +56,7 @@ func loadResponseBody(body io.ReadCloser, dest interface{}) error {

func elasticDefaultErrorResponseHandler(res *esapi.Response) error {
responseBody := map[string]interface{}{}
bodyBytes, err := ioutil.ReadAll(res.Body)
bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("%w cannot read elastic response body bytes", err)
}
Expand Down
7 changes: 2 additions & 5 deletions client/elasticClientScroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"io/ioutil"
"io"
"net/http"
"strconv"
"time"
Expand All @@ -23,9 +23,6 @@ func (ec *elasticClient) DoCountRequest(ctx context.Context, index string, body
if err != nil {
return 0, err
}
if err != nil {
return 0, err
}

bodyBytes, err := getBytesFromResponse(res)
if err != nil {
Expand Down Expand Up @@ -139,7 +136,7 @@ func getBytesFromResponse(res *esapi.Response) ([]byte, error) {
}
defer closeBody(res)

bodyBytes, err := ioutil.ReadAll(res.Body)
bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions client/elasticClientScroll_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package client

import (
"context"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"os"
Expand All @@ -24,7 +24,7 @@ func TestElasticClient_DoCountRequest(t *testing.T) {
jsonFile, err := os.Open("./testsData/response-count-request.json")
require.Nil(t, err)

byteValue, _ := ioutil.ReadAll(jsonFile)
byteValue, _ := io.ReadAll(jsonFile)
_, _ = w.Write(byteValue)
}

Expand Down
5 changes: 2 additions & 3 deletions client/logging/customLogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package logging

import (
"io"
"io/ioutil"
"net/http"
"time"

Expand All @@ -28,10 +27,10 @@ func (cl *CustomLogger) LogRoundTrip(
)

if req != nil && req.Body != nil && req.Body != http.NoBody {
reqSize, _ = io.Copy(ioutil.Discard, req.Body)
reqSize, _ = io.Copy(io.Discard, req.Body)
}
if res != nil && res.Body != nil && res.Body != http.NoBody {
resSize, _ = io.Copy(ioutil.Discard, res.Body)
resSize, _ = io.Copy(io.Discard, res.Body)
}

if err != nil {
Expand Down
1 change: 1 addition & 0 deletions data/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// to be saved for a block. It has all the default fields
// plus some extra information for ease of search and filter
type Block struct {
UUID string `json:"uuid"`
Nonce uint64 `json:"nonce"`
Round uint64 `json:"round"`
Epoch uint32 `json:"epoch"`
Expand Down
1 change: 1 addition & 0 deletions data/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "time"

// LogEvent is the dto for the log event structure
type LogEvent struct {
UUID string `json:"uuid"`
ID string `json:"-"`
TxHash string `json:"txHash"`
OriginalTxHash string `json:"originalTxHash,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions data/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

// Logs holds all the fields needed for a logs structure
type Logs struct {
UUID string `json:"uuid"`
ID string `json:"-"`
OriginalTxHash string `json:"originalTxHash,omitempty"`
Address string `json:"address"`
Expand Down
2 changes: 2 additions & 0 deletions data/scresult.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "time"

// ScResult is a structure containing all the fields that need to be saved for a smart contract result
type ScResult struct {
UUID string `json:"uuid"`
Hash string `json:"-"`
MBHash string `json:"miniBlockHash,omitempty"`
Nonce uint64 `json:"nonce"`
Expand Down Expand Up @@ -39,6 +40,7 @@ type ScResult struct {
CanBeIgnored bool `json:"canBeIgnored,omitempty"`
OriginalSender string `json:"originalSender,omitempty"`
HasLogs bool `json:"hasLogs,omitempty"`
Epoch uint32 `json:"epoch"`
ExecutionOrder int `json:"-"`
SenderAddressBytes []byte `json:"-"`
InitialTxGasUsed uint64 `json:"-"`
Expand Down
2 changes: 2 additions & 0 deletions data/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
// to be saved for a transaction. It has all the default fields
// plus some extra information for ease of search and filter
type Transaction struct {
UUID string `json:"uuid"`
MBHash string `json:"miniBlockHash"`
Nonce uint64 `json:"nonce"`
Round uint64 `json:"round"`
Expand Down Expand Up @@ -51,6 +52,7 @@ type Transaction struct {
RelayedAddr string `json:"relayer,omitempty"`
RelayedSignature string `json:"relayerSignature,omitempty"`
HadRefund bool `json:"hadRefund,omitempty"`
Epoch uint32 `json:"epoch"`
ExecutionOrder int `json:"-"`
SmartContractResults []*ScResult `json:"-"`
Hash string `json:"-"`
Expand Down
51 changes: 26 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,59 @@ go 1.20
require (
github.com/elastic/go-elasticsearch/v7 v7.12.0
github.com/gin-contrib/cors v1.4.0
github.com/gin-gonic/gin v1.9.1
github.com/multiversx/mx-chain-communication-go v1.1.0
github.com/gin-gonic/gin v1.10.0
github.com/google/uuid v1.6.0
github.com/multiversx/mx-chain-communication-go v1.1.1
github.com/multiversx/mx-chain-core-go v1.2.24
github.com/multiversx/mx-chain-logger-go v1.0.15
github.com/multiversx/mx-chain-vm-common-go v1.5.13
github.com/multiversx/mx-chain-vm-common-go v1.5.16
github.com/prometheus/client_model v0.4.0
github.com/prometheus/common v0.37.0
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.14.0
github.com/urfave/cli v1.22.10
google.golang.org/protobuf v1.30.0
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
github.com/urfave/cli v1.22.16
google.golang.org/protobuf v1.36.3
)

require (
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/bytedance/sonic v1.11.6 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading