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 inx-app to 646f949dc816 #187

Merged
merged 3 commits into from
Mar 21, 2024
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
90 changes: 62 additions & 28 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,149 @@
run:
tests: true
skip-files:
- ".*_test.go$"

linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/iotaledger
golint:
min-confidence: 0.9
gocyclo:
min-complexity: 15
govet:
check-shadowing: false
disable:
- shadow
misspell:
locale: US
nlreturn:
# Size of the block (including return statement that is still "OK")
# so no return split required.
# Default: 1
block-size: 2
staticcheck:
checks: ["all"]
nlreturn:
block-size: 2
stylecheck:
initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
depguard:
rules:
main:
deny:
- pkg: "errors"
desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package
- pkg: "golang.org/x/xerrors"
desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package
- pkg: "github.com/pkg/errors"
desc: Should be replaced with "github.com/iotaledger/hive.go/ierrors" package

linters:
# Disable all linters.
disable-all: true
# Enable specific linter
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- varcheck
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
#- containedctx
#- contextcheck # this linter is buggy and renders all nolint rules useless
- copyloopvar
#- cyclop
- decorder
#- depguard
- depguard
- dogsled
- dupl
- dupword
- durationcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
#- exhaustive
#- exhaustruct
- exportloopref
#- forbidigo
- forcetypeassert
#- funlen
#- gci
- ginkgolinter
- gocheckcompilerdirectives
#- gochecknoglobals
#- gochecknoinits
#- gochecksumtype
#- gocognit
- goconst
- gocritic
#- gocyclo
- godot
#- godox
#- goerr113
- godox
- goerr113
- gofmt
#- gofumpt
- goheader
- goimports
- golint
#- gomnd
#- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- grouper
- ifshort
- importas
- interfacer
- inamedparam
#- interfacebloat
- intrange
#- ireturn
#- lll
- loggercheck
#- maintidx
- makezero
#- maligned
- mirror
- misspell
- musttag
- nakedret
#- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosnakecase
- nosprintfhostport
- paralleltest
#- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- revive
- rowserrcheck
- scopelint
- sloglint
- spancheck
- sqlclosecheck
- structcheck
- stylecheck
#- tagalign
- tagliatelle
- tenv
- testableexamples
- testifylint
- testpackage
#- thelper
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
#- varnamelen
- wastedassign
- whitespace
#- wrapcheck
#- wsl
- zerologlint

issues:
exclude-files:
- ".*_test.go$"
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
Expand Down Expand Up @@ -136,4 +171,3 @@ issues:
# - "blank-imports" # revive
# - "var-naming: don't use leading k in Go names;" #revive
# - 'shadow: declaration of "err"' # govet

11 changes: 4 additions & 7 deletions components/indexer/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ var (
)

func provide(c *dig.Container) error {

if err := c.Provide(func() (*indexer.Indexer, error) {
Component.LogInfo("Setting up database ...")

Expand Down Expand Up @@ -97,7 +96,6 @@ func provide(c *dig.Container) error {
}

func run() error {

indexerInitWait := make(chan struct{})

// create a background worker that handles the indexer events
Expand Down Expand Up @@ -260,7 +258,7 @@ func checkIndexerStatus(ctx context.Context) (*indexer.Status, error) {
status, err = deps.Indexer.Status()
if err != nil {
if !ierrors.Is(err, indexer.ErrStatusNotFound) {
return nil, fmt.Errorf("reading committedSlot from Indexer failed! Error: %w", err)
return nil, ierrors.Errorf("reading committedSlot from Indexer failed! Error: %w", err)
}
Component.LogInfo("Indexer is empty, so import initial ledger...")
needsToFillIndexer = true
Expand All @@ -284,7 +282,7 @@ func checkIndexerStatus(ctx context.Context) (*indexer.Status, error) {
if needsToClearIndexer {
Component.LogInfo("Re-import initial ledger...")
if err := deps.Indexer.Clear(); err != nil {
return nil, fmt.Errorf("clearing Indexer failed! Error: %w", err)
return nil, ierrors.Errorf("clearing Indexer failed! Error: %w", err)
}
needsToFillIndexer = true
}
Expand All @@ -294,13 +292,13 @@ func checkIndexerStatus(ctx context.Context) (*indexer.Status, error) {
timeStart := time.Now()
var count int
if count, err = fillIndexer(ctx, deps.Indexer); err != nil {
return nil, fmt.Errorf("filling Indexer failed! Error: %w", err)
return nil, ierrors.Errorf("filling Indexer failed! Error: %w", err)
}
duration := time.Since(timeStart)
// Read new committedSlot after filling up the indexer
status, err = deps.Indexer.Status()
if err != nil {
return nil, fmt.Errorf("reading committedSlot from Indexer failed! Error: %w", err)
return nil, ierrors.Errorf("reading committedSlot from Indexer failed! Error: %w", err)
}
Component.LogInfo("Re-creating indexes")
// Run auto migrate to make sure all required tables and indexes are there
Expand Down Expand Up @@ -328,7 +326,6 @@ func checkIndexerStatus(ctx context.Context) (*indexer.Status, error) {
}

func fillIndexer(ctx context.Context, indexer *indexer.Indexer) (int, error) {

// Drop indexes to speed up data insertion
if err := deps.Indexer.DropIndexes(); err != nil {
return 0, err
Expand Down
3 changes: 0 additions & 3 deletions components/prometheus/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ var (
)

func provide(c *dig.Container) error {

type depsOut struct {
dig.Out
PrometheusEcho *echo.Echo `name:"prometheusEcho"`
Expand All @@ -63,11 +62,9 @@ func provide(c *dig.Container) error {
}

func configure() error {

registry := registerMetrics()

deps.PrometheusEcho.GET("/metrics", func(c echo.Context) error {

handler := promhttp.HandlerFor(
registry,
promhttp.HandlerOpts{
Expand Down
38 changes: 19 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ go 1.22.0
require (
github.com/ethereum/go-ethereum v1.13.14
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/iotaledger/hive.go/app v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/crypto v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/app v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/crypto v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/db v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/hive.go/ds v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/ierrors v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/lo v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/log v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/runtime v0.0.0-20240305162344-4b8be588e1cf
github.com/iotaledger/hive.go/ds v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/ierrors v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/lo v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/log v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/runtime v0.0.0-20240320122938-13a946cf3c7a
github.com/iotaledger/hive.go/sql v0.0.0-20240223142044-12ffcb37c413
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240307101848-db58eb9353ec
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240307100839-48553e1d2022
github.com/iotaledger/iota.go/v4 v4.0.0-20240307091827-db3c503615a6
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240320125204-646f949dc816
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240320124425-aef029f6d349
github.com/iotaledger/iota.go/v4 v4.0.0-20240320124121-0b5258b05dbc
github.com/labstack/echo-contrib v0.15.0
github.com/labstack/echo/v4 v4.11.4
github.com/prometheus/client_golang v1.19.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
go.uber.org/dig v1.17.1
golang.org/x/text v0.14.0
gorm.io/gorm v1.25.7
Expand All @@ -37,22 +37,22 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.3 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/felixge/fgprof v0.9.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect
github.com/google/pprof v0.0.0-20240319011627-a57c5dfe54fd // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/iotaledger/hive.go/constraints v0.0.0-20240305162344-4b8be588e1cf // indirect
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240305162344-4b8be588e1cf // indirect
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240305162344-4b8be588e1cf // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20240305162344-4b8be588e1cf // indirect
github.com/iotaledger/hive.go/constraints v0.0.0-20240320122938-13a946cf3c7a // indirect
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20240320122938-13a946cf3c7a // indirect
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20240320122938-13a946cf3c7a // indirect
github.com/iotaledger/hive.go/stringify v0.0.0-20240320122938-13a946cf3c7a // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgx/v5 v5.5.3 // indirect
Expand All @@ -70,7 +70,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
Expand All @@ -86,7 +86,7 @@ require (
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading
Loading