Skip to content

Commit

Permalink
Index incoming tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
axenteoctavian committed Jan 23, 2025
1 parent b6038d1 commit a62d85b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
11 changes: 11 additions & 0 deletions cmd/node/config/external.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
# ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations", "esdts"]
EnabledIndexes = ["rating", "transactions", "blocks", "validators", "miniblocks", "rounds", "accounts", "accountshistory", "receipts", "scresults", "accountsesdt", "accountsesdthistory", "epochinfo", "scdeploys", "tokens", "tags", "logs", "delegators", "operations", "esdts"]

# MainChainElasticSearchConnector defines settings related to ElasticSearch such as login information or URL
[MainChainElasticSearchConnector]
## We do not recommend to activate this indexer on a validator node since
#the node might lose rating (even facing penalties) due to the fact that
#the indexer is called synchronously and might block due to external causes.
#Strongly suggested to activate this on a regular observer node.
Enabled = true
URL = "https://testnet-index.multiversx.com"
Username = ""
Password = ""

# EventNotifierConnector defines settings needed to configure and launch the event notifier component
# HTTP event notifier connector integration will be DEPRECATED in the following iterations
[EventNotifierConnector]
Expand Down
2 changes: 1 addition & 1 deletion cmd/sovereignnode/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ require (
github.com/multiversx/concurrent-map v0.1.4 // indirect
github.com/multiversx/mx-chain-communication-go v1.1.1 // indirect
github.com/multiversx/mx-chain-crypto-go v1.2.12 // indirect
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20241211094055-23de51462ca4 // indirect
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20250123162626-57b1927831ff // indirect
github.com/multiversx/mx-chain-scenario-go v1.4.4 // indirect
github.com/multiversx/mx-chain-storage-go v1.0.16 // indirect
github.com/multiversx/mx-chain-vm-common-go v1.5.17-0.20241119132002-2fa80c5ec516 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/sovereignnode/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ github.com/multiversx/mx-chain-core-go v1.2.24-0.20241209142414-762196f8dd06 h1:
github.com/multiversx/mx-chain-core-go v1.2.24-0.20241209142414-762196f8dd06/go.mod h1:P/YBoFnt25XUaCQ7Q/SD15vhnc9yV5JDhHxyFO9P8Z0=
github.com/multiversx/mx-chain-crypto-go v1.2.12 h1:zWip7rpUS4CGthJxfKn5MZfMfYPjVjIiCID6uX5BSOk=
github.com/multiversx/mx-chain-crypto-go v1.2.12/go.mod h1:HzcPpCm1zanNct/6h2rIh+MFrlXbjA5C8+uMyXj3LI4=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20241211094055-23de51462ca4 h1:IfjK6IQy65eMWr/FEv3CMUz13ZqH9sWLnKv85/AoayM=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20241211094055-23de51462ca4/go.mod h1:i5xoCUsrHteffxx3yfR8bj9tmpP/DtastZGOc/KRAoY=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20250123162626-57b1927831ff h1:BP9qS2lrZ2oXUWFHihtCyx0whMt7OxQLcO4yx67w4Z8=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20250123162626-57b1927831ff/go.mod h1:i5xoCUsrHteffxx3yfR8bj9tmpP/DtastZGOc/KRAoY=
github.com/multiversx/mx-chain-logger-go v1.0.15 h1:HlNdK8etyJyL9NQ+6mIXyKPEBo+wRqOwi3n+m2QIHXc=
github.com/multiversx/mx-chain-logger-go v1.0.15/go.mod h1:t3PRKaWB1M+i6gUfD27KXgzLJJC+mAQiN+FLlL1yoGQ=
github.com/multiversx/mx-chain-scenario-go v1.4.4 h1:DVE2V+FPeyD/yWoC+KEfPK3jsFzHeruelESfpTlf460=
Expand Down
15 changes: 12 additions & 3 deletions config/externalConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package config

// ExternalConfig will hold the configurations for external tools, such as Explorer or Elasticsearch
type ExternalConfig struct {
ElasticSearchConnector ElasticSearchConfig
EventNotifierConnector EventNotifierConfig
HostDriversConfig []HostDriversConfig
ElasticSearchConnector ElasticSearchConfig
MainChainElasticSearchConnector MainChainElasticSearchConfig
EventNotifierConnector EventNotifierConfig
HostDriversConfig []HostDriversConfig
}

// ElasticSearchConfig will hold the configuration for the elastic search
Expand All @@ -19,6 +20,14 @@ type ElasticSearchConfig struct {
EnabledIndexes []string
}

// MainChainElasticSearchConfig will hold the configuration for the main chain elastic search
type MainChainElasticSearchConfig struct {
Enabled bool
URL string
Username string
Password string
}

// EventNotifierConfig will hold the configuration for the events notifier driver
type EventNotifierConfig struct {
Enabled bool
Expand Down
10 changes: 10 additions & 0 deletions factory/status/statusComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
factoryMarshalizer "github.com/multiversx/mx-chain-core-go/marshal/factory"
esFactory "github.com/multiversx/mx-chain-es-indexer-go/process/elasticproc/factory"
indexerFactory "github.com/multiversx/mx-chain-es-indexer-go/process/factory"
logger "github.com/multiversx/mx-chain-logger-go"

Expand Down Expand Up @@ -218,6 +219,14 @@ func (scf *statusComponentsFactory) createOutportDriver() (outport.OutportHandle

func (scf *statusComponentsFactory) makeElasticIndexerArgs() indexerFactory.ArgsIndexerFactory {
elasticSearchConfig := scf.externalConfig.ElasticSearchConnector
mainChainElastic := esFactory.MainChainElastic{
Enabled: scf.externalConfig.MainChainElasticSearchConnector.Enabled,
Url: scf.externalConfig.MainChainElasticSearchConnector.URL,
UserName: scf.externalConfig.MainChainElasticSearchConnector.Username,
Password: scf.externalConfig.MainChainElasticSearchConnector.Password,
}
log.Error("mc es", "url", scf.externalConfig.MainChainElasticSearchConnector.URL)

return indexerFactory.ArgsIndexerFactory{
Enabled: elasticSearchConfig.Enabled,
BulkRequestMaxSize: elasticSearchConfig.BulkRequestMaxSizeInBytes,
Expand All @@ -234,6 +243,7 @@ func (scf *statusComponentsFactory) makeElasticIndexerArgs() indexerFactory.Args
ImportDB: scf.isInImportMode,
HeaderMarshaller: scf.coreComponents.InternalMarshalizer(),
Sovereign: scf.isSovereign,
MainChainElastic: mainChainElastic,
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/multiversx/mx-chain-communication-go v1.1.1
github.com/multiversx/mx-chain-core-go v1.2.24-0.20241209142414-762196f8dd06
github.com/multiversx/mx-chain-crypto-go v1.2.12
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20241211094055-23de51462ca4
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20250123162626-57b1927831ff
github.com/multiversx/mx-chain-logger-go v1.0.15
github.com/multiversx/mx-chain-scenario-go v1.4.4
github.com/multiversx/mx-chain-storage-go v1.0.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ github.com/multiversx/mx-chain-core-go v1.2.24-0.20241209142414-762196f8dd06 h1:
github.com/multiversx/mx-chain-core-go v1.2.24-0.20241209142414-762196f8dd06/go.mod h1:P/YBoFnt25XUaCQ7Q/SD15vhnc9yV5JDhHxyFO9P8Z0=
github.com/multiversx/mx-chain-crypto-go v1.2.12 h1:zWip7rpUS4CGthJxfKn5MZfMfYPjVjIiCID6uX5BSOk=
github.com/multiversx/mx-chain-crypto-go v1.2.12/go.mod h1:HzcPpCm1zanNct/6h2rIh+MFrlXbjA5C8+uMyXj3LI4=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20241211094055-23de51462ca4 h1:IfjK6IQy65eMWr/FEv3CMUz13ZqH9sWLnKv85/AoayM=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20241211094055-23de51462ca4/go.mod h1:i5xoCUsrHteffxx3yfR8bj9tmpP/DtastZGOc/KRAoY=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20250123162626-57b1927831ff h1:BP9qS2lrZ2oXUWFHihtCyx0whMt7OxQLcO4yx67w4Z8=
github.com/multiversx/mx-chain-es-indexer-go v1.7.11-0.20250123162626-57b1927831ff/go.mod h1:i5xoCUsrHteffxx3yfR8bj9tmpP/DtastZGOc/KRAoY=
github.com/multiversx/mx-chain-logger-go v1.0.15 h1:HlNdK8etyJyL9NQ+6mIXyKPEBo+wRqOwi3n+m2QIHXc=
github.com/multiversx/mx-chain-logger-go v1.0.15/go.mod h1:t3PRKaWB1M+i6gUfD27KXgzLJJC+mAQiN+FLlL1yoGQ=
github.com/multiversx/mx-chain-scenario-go v1.4.4 h1:DVE2V+FPeyD/yWoC+KEfPK3jsFzHeruelESfpTlf460=
Expand Down

0 comments on commit a62d85b

Please sign in to comment.