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

feat/altered accounts #163

Merged
merged 119 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
5aab174
adapt indexer for new core altered accounts
bogdan-rosianu Feb 1, 2022
fafd4b1
update core dep
bogdan-rosianu Feb 1, 2022
f69cc21
Merge branch 'master' into elastic-indexer-with-core-altered-accounts
bogdan-rosianu Feb 7, 2022
82657e8
fixes after merge master
bogdan-rosianu Feb 7, 2022
ffccec7
new core reference
bogdan-rosianu Feb 9, 2022
2a53c6b
fixes after review
bogdan-rosianu Feb 9, 2022
87a6eaa
small fix
bogdan-rosianu Feb 9, 2022
f118324
Merge branch 'master' into elastic-indexer-with-core-altered-accounts
bogdan-rosianu Mar 16, 2022
ab71fb4
fixes after merge
bogdan-rosianu Mar 18, 2022
c0a9263
Merge branch 'master' into elastic-indexer-with-core-altered-accounts
bogdan-rosianu Apr 6, 2022
251f84d
added unit tests
bogdan-rosianu May 3, 2022
f282161
fixes after review
bogdan-rosianu May 3, 2022
9054cf9
Merge branch 'master' into elastic-indexer-with-core-altered-accounts
bogdan-rosianu May 18, 2022
dbbe35b
fixes after merge
bogdan-rosianu May 18, 2022
b4cbee6
adapt integration tests
bogdan-rosianu May 18, 2022
dead560
further fixes for int tests
bogdan-rosianu May 18, 2022
0cd528e
revert some changes
bogdan-rosianu May 18, 2022
815db67
final int tests fixes (hopefully)
bogdan-rosianu May 18, 2022
435b8e9
Merge branch 'master' into elastic-indexer-with-core-altered-accounts
bogdan-rosianu May 30, 2022
d36c936
fixed integration tests
bogdan-rosianu May 30, 2022
37f50aa
fixes after review
bogdan-rosianu Jun 3, 2022
73a5dcd
Merge branch 'development' into elastic-indexer-with-core-altered-acc…
bogdan-rosianu Jun 3, 2022
96f27c7
Merge branch 'development' into elastic-indexer-with-core-altered-acc…
bogdan-rosianu Jul 6, 2022
dd5be1f
fix integration tests
bogdan-rosianu Jul 7, 2022
7cd2eb4
Merge pull request #103 from ElrondNetwork/elastic-indexer-with-core-…
miiu96 Jul 27, 2022
ba6de83
preparations remove TransactionFeeHandler
miiu96 Jul 27, 2022
816878f
fix import
miiu96 Jul 27, 2022
0acb630
fixes
miiu96 Jul 28, 2022
f6dd4fb
integrated new elrond-go-core (changed name of a package)
miiu96 Jul 29, 2022
c28c768
latest elrond go core
miiu96 Aug 11, 2022
784a094
remove transactions fee handler
miiu96 Aug 12, 2022
20344a8
Merge branch 'feat/altered-accounts' into prepare-remove-tx-fee-handler
miiu96 Aug 12, 2022
0675d22
make tests compile
miiu96 Aug 12, 2022
b35bc12
fix imports
miiu96 Aug 12, 2022
5bc6d19
fix integration tests
miiu96 Aug 16, 2022
aea0d3f
Merge branch 'development' into merge-dev-in-feat
miiu96 Aug 29, 2022
7ad4d9d
Merge pull request #167 from ElrondNetwork/merge-dev-in-feat
miiu96 Aug 29, 2022
7a177bf
Merge branch 'feat/altered-accounts' into prepare-remove-tx-fee-handler
miiu96 Aug 29, 2022
846d81e
fix integration tests
miiu96 Aug 29, 2022
9fa91c5
fix unit tests
miiu96 Aug 29, 2022
b1a2f2f
fixes after review
miiu96 Aug 29, 2022
d984a80
Merge pull request #164 from ElrondNetwork/prepare-remove-tx-fee-handler
miiu96 Aug 29, 2022
1e04687
indexer binary
miiu96 Sep 1, 2022
e5faae5
remove shard coordinator from dataIndexer.go
miiu96 Sep 1, 2022
7356166
change folder structure
miiu96 Sep 1, 2022
8d2adcc
fix build
miiu96 Sep 1, 2022
a1f1dc9
ws client and indexer
miiu96 Sep 2, 2022
a192b52
move factory
miiu96 Sep 2, 2022
0672c96
small fix
miiu96 Sep 2, 2022
02a08b1
remove is in import db flag
miiu96 Sep 14, 2022
fc9a3d4
refactoring and fix unit tests
miiu96 Sep 15, 2022
7d9abbd
fix integration tests
miiu96 Sep 15, 2022
15ebfe7
remove shard coordinator
miiu96 Sep 19, 2022
ee5ab58
update vm common and fixes
miiu96 Sep 21, 2022
3f2f38b
fix unit tests
miiu96 Sep 21, 2022
e112162
fix integration tests 1
miiu96 Sep 21, 2022
2b74722
fix integration tests 2
miiu96 Sep 21, 2022
4b904e1
move factory
miiu96 Sep 22, 2022
3ab9c0d
create ws client and indexer
miiu96 Sep 22, 2022
961c00b
go mod tidy
miiu96 Sep 22, 2022
f965585
refactor client in order to retry to connect
miiu96 Sep 22, 2022
ec81d2a
unmarshall data
miiu96 Sep 27, 2022
20f3e23
latest elrond go core
miiu96 Sep 27, 2022
bab1d99
fix unmarshal
miiu96 Sep 28, 2022
a435a28
remove comment code and extra checks
miiu96 Sep 28, 2022
7cebfc3
change log
miiu96 Sep 28, 2022
2d410cf
change log
miiu96 Sep 28, 2022
b5d8871
ignore peer blocks
miiu96 Sep 28, 2022
6de5af7
fixes after review 1
miiu96 Sep 30, 2022
9b52471
implement close
miiu96 Sep 30, 2022
f0b4137
fix linter issues
miiu96 Sep 30, 2022
d8a3f18
latest elrond go logger
miiu96 Oct 3, 2022
14ddedc
fixes after re review
miiu96 Oct 3, 2022
cd568fa
fixes
miiu96 Oct 6, 2022
d9de7ca
available indices and disabled
miiu96 Oct 6, 2022
7d83c40
latest elrond-go core
miiu96 Oct 6, 2022
fd94fbb
small fix
miiu96 Oct 6, 2022
104ae39
change action
miiu96 Oct 6, 2022
a09a9b9
Merge pull request #168 from ElrondNetwork/indexer-binary
miiu96 Oct 6, 2022
c50663b
Merge branch 'rc/v1.4.0' into merge-rc-in-feat
miiu96 Oct 6, 2022
e1b2413
fixes after merge
miiu96 Oct 6, 2022
a7c3dec
Merge pull request #177 from ElrondNetwork/merge-rc-in-feat
miiu96 Oct 6, 2022
91059d1
push
miiu96 Oct 6, 2022
a1edbfa
extra checks and prints
miiu96 Oct 6, 2022
63e3991
small fix
miiu96 Oct 6, 2022
88fea1f
remove altered accounts part
miiu96 Oct 25, 2022
2108634
fix integration tests
miiu96 Oct 25, 2022
88ffeeb
refactor python scrips
miiu96 Oct 26, 2022
8346462
small fix
miiu96 Oct 26, 2022
b3997bd
fix unmarshall
miiu96 Oct 26, 2022
6574353
fix log processor
miiu96 Oct 26, 2022
5b1c19f
refactor
miiu96 Oct 27, 2022
2cd634f
fixes after review
miiu96 Oct 27, 2022
c1d9520
fixes
miiu96 Oct 27, 2022
833d50a
refactor
miiu96 Oct 27, 2022
3fed07b
update elrond go core
miiu96 Oct 27, 2022
b57115b
remove Path cast
miiu96 Oct 27, 2022
0359f0c
fix integration tests
miiu96 Oct 27, 2022
dc2a42c
Merge pull request #178 from ElrondNetwork/script-start-observers
miiu96 Oct 27, 2022
ed60ee5
latest elrond-go-core
miiu96 Oct 28, 2022
85d86bb
fix integration tests
miiu96 Oct 28, 2022
60da603
fix
miiu96 Oct 28, 2022
6f62eb4
fixes
miiu96 Oct 31, 2022
d82347b
extra log
miiu96 Oct 31, 2022
8d8cfb7
modify
miiu96 Oct 31, 2022
fb3604a
Merge pull request #180 from ElrondNetwork/latest-elrond-go-cre
miiu96 Oct 31, 2022
89c23d9
Merge branch 'rc/v1.4.0' into merge-rc-in-feat-altered
miiu96 Nov 7, 2022
2aef309
remove unused stub
miiu96 Nov 7, 2022
d2b8325
Merge pull request #181 from ElrondNetwork/merge-rc-in-feat-altered
miiu96 Nov 7, 2022
8e12c05
update core
miiu96 Nov 8, 2022
9213466
fixes
miiu96 Nov 8, 2022
69b6483
fix integration tests
miiu96 Nov 8, 2022
fba1d46
fix integration
miiu96 Nov 8, 2022
840d495
Merge pull request #182 from ElrondNetwork/update-core
miiu96 Nov 8, 2022
4f66684
fixed smart contract results processor
miiu96 Nov 9, 2022
de67b59
fix com
miiu96 Nov 9, 2022
9b1b148
Merge pull request #183 from ElrondNetwork/fix-scrs-proc
miiu96 Nov 9, 2022
264cd0d
proper tags
miiu96 Nov 11, 2022
3f7d0f3
Merge pull request #184 from ElrondNetwork/proper-tags
miiu96 Nov 11, 2022
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
36 changes: 36 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: golangci-lint
on:
push:
branches: [ master ]
pull_request:
branches: [ master, development, feat/*, rc/* ]

permissions:
contents: read

jobs:
golangci:
name: golangci linter
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.17.6
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.45.2

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --timeout 10m0s --max-issues-per-linter 0 --max-same-issues 0 --print-issued-lines

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go
# skip-go-installation: true
4 changes: 3 additions & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ jobs:
dep ensure
fi
- name: Build
run: go build
run: |
cd cmd/elasticindexer
go build
2 changes: 1 addition & 1 deletion client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type BulkRequestResponse struct {
} `json:"items"`
}

// Item defines the structure of a item from a bulk response
// Item defines the structure of an item from a bulk response
type Item struct {
Index string `json:"_index"`
ID string `json:"_id"`
Expand Down
10 changes: 5 additions & 5 deletions client/elasticClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http"
"strings"

"github.com/ElrondNetwork/elastic-indexer-go"
"github.com/ElrondNetwork/elastic-indexer-go/data"
"github.com/ElrondNetwork/elastic-indexer-go/process/dataindexer"
logger "github.com/ElrondNetwork/elrond-go-logger"
"github.com/elastic/go-elasticsearch/v7"
"github.com/elastic/go-elasticsearch/v7/esapi"
Expand Down Expand Up @@ -41,7 +41,7 @@ type elasticClient struct {
// NewElasticClient will create a new instance of elasticClient
func NewElasticClient(cfg elasticsearch.Config) (*elasticClient, error) {
if len(cfg.Addresses) == 0 {
return nil, indexer.ErrNoElasticUrlProvided
return nil, dataindexer.ErrNoElasticUrlProvided
}

es, err := elasticsearch.NewClient(cfg)
Expand Down Expand Up @@ -125,7 +125,7 @@ func (ec *elasticClient) DoBulkRequest(buff *bytes.Buffer, index string) error {
return elasticBulkRequestResponseHandler(res)
}

// DoMultiGet wil do a multi get request to elaticsearch server
// DoMultiGet wil do a multi get request to Elasticsearch server
func (ec *elasticClient) DoMultiGet(ids []string, index string, withSource bool, resBody interface{}) error {
obj := getDocumentsByIDsQuery(ids, withSource)
body, err := encode(obj)
Expand Down Expand Up @@ -302,15 +302,15 @@ func (ec *elasticClient) createPolicy(policyName string, policy *bytes.Buffer) e

errStr := fmt.Sprintf("%v", existsRes.Error)
if existsRes.Status == http.StatusConflict && !strings.Contains(errStr, errPolicyAlreadyExists) {
return indexer.ErrCouldNotCreatePolicy
return dataindexer.ErrCouldNotCreatePolicy
}

return nil
}

// CreateIndexTemplate creates an elasticsearch index template
func (ec *elasticClient) createIndexTemplate(templateName string, template io.Reader) error {
res, err := ec.client.Indices.PutTemplate(templateName, template)
res, err := ec.client.Indices.PutTemplate(templateName, template, ec.client.Indices.PutTemplate.WithContext(context.Background()))
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions client/elasticClientCommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"net/url"
"strings"

"github.com/ElrondNetwork/elastic-indexer-go"
"github.com/ElrondNetwork/elastic-indexer-go/data"
"github.com/ElrondNetwork/elastic-indexer-go/process/dataindexer"
"github.com/elastic/go-elasticsearch/v7/esapi"
)

Expand Down Expand Up @@ -67,7 +67,7 @@ func elasticDefaultErrorResponseHandler(res *esapi.Response) error {
isBackOffError := strings.Contains(string(bodyBytes), fmt.Sprintf("%d", http.StatusForbidden)) ||
strings.Contains(string(bodyBytes), fmt.Sprintf("%d", http.StatusTooManyRequests))
if isBackOffError {
errToReturn = indexer.ErrBackOff
errToReturn = dataindexer.ErrBackOff
}

return fmt.Errorf("%w, cannot unmarshal elastic response body to map[string]interface{}, "+
Expand Down Expand Up @@ -213,7 +213,7 @@ func kibanaResponseErrorHandler(res *esapi.Response) error {
log.Warn("elasticClient.parseResponse",
"error returned by elastic API", errorRes.Error,
"code", res.StatusCode)
return indexer.ErrBackOff
return dataindexer.ErrBackOff
}

func newRequest(method, path string, body *bytes.Buffer) *http.Request {
Expand Down Expand Up @@ -263,7 +263,7 @@ func parseResponse(res *esapi.Response, dest interface{}, errorHandler responseE
if err != nil {
log.Warn("elasticClient.parseResponse",
"could not load response body:", err.Error())
return indexer.ErrBackOff
return dataindexer.ErrBackOff
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions client/elasticClientCommon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

"github.com/ElrondNetwork/elastic-indexer-go"
"github.com/ElrondNetwork/elastic-indexer-go/mock"
"github.com/ElrondNetwork/elastic-indexer-go/process/dataindexer"
"github.com/elastic/go-elasticsearch/v7/esapi"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -55,7 +55,7 @@ func TestElasticDefaultErrorResponseHandler_UnmarshalFailsWithHttpForbiddenError
resp := createMockEsapiResponseWithText(httpErrString)
err := elasticDefaultErrorResponseHandler(resp)

assert.True(t, errorsGo.Is(err, indexer.ErrBackOff))
assert.True(t, errorsGo.Is(err, dataindexer.ErrBackOff))
}

func TestElasticDefaultErrorResponseHandler_UnmarshalFailsWithHttpTooManyRequestsErrorShouldSignalBackOffErr(t *testing.T) {
Expand All @@ -65,7 +65,7 @@ func TestElasticDefaultErrorResponseHandler_UnmarshalFailsWithHttpTooManyRequest
resp := createMockEsapiResponseWithText(httpErrString)
err := elasticDefaultErrorResponseHandler(resp)

assert.True(t, errorsGo.Is(err, indexer.ErrBackOff))
assert.True(t, errorsGo.Is(err, dataindexer.ErrBackOff))
}

func TestElasticDefaultErrorResponseHandler_UnmarshalFailsWithGenericError(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion client/elasticClient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"testing"

indexer "github.com/ElrondNetwork/elastic-indexer-go"
"github.com/ElrondNetwork/elastic-indexer-go/client/logging"
"github.com/ElrondNetwork/elastic-indexer-go/data"
indexer "github.com/ElrondNetwork/elastic-indexer-go/process/dataindexer"
"github.com/elastic/go-elasticsearch/v7"
"github.com/stretchr/testify/require"
)
Expand Down
23 changes: 23 additions & 0 deletions cmd/elasticindexer/config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[config]
available-indices = [
"rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory",
"receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags",
"logs", "delegators", "operations", "collections"
]
[config.address-converter]
length = 32
type = "bech32"
[config.validator-keys-converter]
length = 96
type = "hex"
[config.hasher]
type = "blake2b"
[config.marshaller]
type = "gogo protobuf"
[config.economics]
denomination = 18
[config.logs]
log-file-life-span-in-mb = 1024 # 1GB
log-file-life-span-in-sec = 432000 # 5 days
log-file-prefix = "elastic-indexer"
logs-path = "logs"
12 changes: 12 additions & 0 deletions cmd/elasticindexer/config/prefs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[config]
disabled-indices = []
[config.web-socket]
server-url = "localhost:22111"
data-marshaller-type = "json"

[config.elastic-cluster]
use-kibana = false
url = "http://localhost:9200"
username = ""
password = ""
bulk-request-max-size-in-bytes = 4194304 # 4MB
38 changes: 38 additions & 0 deletions cmd/elasticindexer/flags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
logger "github.com/ElrondNetwork/elrond-go-logger"
"github.com/urfave/cli"
)

var (
configurationFile = cli.StringFlag{
Name: "config",
Usage: "The main configuration file to load",
Value: "./config/config.toml",
}
// configurationPreferencesFile defines a flag for the path to the preferences toml configuration file
configurationPreferencesFile = cli.StringFlag{
Name: "config-preferences",
Usage: "The [path] for the preferences configuration file. This TOML file contains " +
"preferences configurations, such as the node display name or the shard to start in when starting as observer",
Value: "./config/prefs.toml",
}
logLevel = cli.StringFlag{
Name: "log-level",
Usage: "This flag specifies the logger `level(s)`. It can contain multiple comma-separated value. For example" +
", if set to *:INFO the logs for all packages will have the INFO level. However, if set to *:INFO,api:DEBUG" +
" the logs for all packages will have the INFO level, excepting the api package which will receive a DEBUG" +
" log level.",
Value: "*:" + logger.LogInfo.String(),
}
logSaveFile = cli.BoolFlag{
Name: "log-save",
Usage: "Boolean option for enabling log saving. If set, it will automatically save all the logs into a file.",
}
// disableAnsiColor defines if the logger subsystem should prevent displaying ANSI colors
disableAnsiColor = cli.BoolFlag{
Name: "disable-ansi-color",
Usage: "Boolean option for disabling ANSI colors in the logging system.",
}
)
Loading