diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0a61af..5f991125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ -## Unreleased +## v4.0.0 ### Changes - Updated cosmos/cosmos-sdk to `v0.45.8` - ([\#74](https://github.com/forbole/juno/pull/74)) Added database block count to prometheus to improve alert monitoring - ([\#75](https://github.com/forbole/juno/pull/75)) Allow modules to handle MsgExec inner messages - ([\#76](https://github.com/forbole/juno/pull/76)) Return 0 as height for `GetLastBlockHeight()` method if there are no blocks saved in database -- ([\#77](https://github.com/forbole/juno/pull/77)) Add wait group to handle messages concurrently - ([\#79](https://github.com/forbole/juno/pull/79)) Use `sqlx` instead of `sql` while dealing with a PostgreSQL database - ([\#83](https://github.com/forbole/juno/pull/83)) Bump `github.com/tendermint/tendermint` to `v0.34.22` - ([\#84](https://github.com/forbole/juno/pull/84)) Replace database configuration params with URI +- ([\#86](https://github.com/forbole/juno/pull/86)) Revert concurrent handling of transactions and messages ## v3.4.0 ### Changes diff --git a/Makefile b/Makefile index 126e1d29..2a2e12a7 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,8 @@ all: lint test-unit install ### Build flags ### ############################################################################### -LD_FLAGS = -X github.com/forbole/juno/v3/cmd.Version=$(VERSION) \ - -X github.com/forbole/juno/v3/cmd.Commit=$(COMMIT) +LD_FLAGS = -X github.com/forbole/juno/v4/cmd.Version=$(VERSION) \ + -X github.com/forbole/juno/v4/cmd.Commit=$(COMMIT) BUILD_FLAGS := -ldflags '$(LD_FLAGS)' diff --git a/cmd/config.go b/cmd/config.go index a9128434..6916b21c 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -1,8 +1,8 @@ package cmd import ( - initcmd "github.com/forbole/juno/v3/cmd/init" - parsecmd "github.com/forbole/juno/v3/cmd/parse/types" + initcmd "github.com/forbole/juno/v4/cmd/init" + parsecmd "github.com/forbole/juno/v4/cmd/parse/types" ) // Config represents the general configuration for the commands diff --git a/cmd/executor.go b/cmd/executor.go index e0376037..aa138fcc 100644 --- a/cmd/executor.go +++ b/cmd/executor.go @@ -5,14 +5,14 @@ import ( "os" "path" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" - initcmd "github.com/forbole/juno/v3/cmd/init" - migratecmd "github.com/forbole/juno/v3/cmd/migrate" - parsecmd "github.com/forbole/juno/v3/cmd/parse" - startcmd "github.com/forbole/juno/v3/cmd/start" + initcmd "github.com/forbole/juno/v4/cmd/init" + migratecmd "github.com/forbole/juno/v4/cmd/migrate" + parsecmd "github.com/forbole/juno/v4/cmd/parse" + startcmd "github.com/forbole/juno/v4/cmd/start" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" "github.com/spf13/cobra" "github.com/tendermint/tendermint/libs/cli" diff --git a/cmd/init/cmd.go b/cmd/init/cmd.go index d051cfb4..a7ffcd91 100644 --- a/cmd/init/cmd.go +++ b/cmd/init/cmd.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "os" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" "github.com/spf13/cobra" ) diff --git a/cmd/init/types.go b/cmd/init/types.go index 46b76456..5473edf3 100644 --- a/cmd/init/types.go +++ b/cmd/init/types.go @@ -3,7 +3,7 @@ package init import ( "github.com/spf13/cobra" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" ) // WritableConfig represents a configuration that can be written to a file diff --git a/cmd/juno/main.go b/cmd/juno/main.go index 1ef88911..5c9e2007 100644 --- a/cmd/juno/main.go +++ b/cmd/juno/main.go @@ -3,12 +3,12 @@ package main import ( "os" - "github.com/forbole/juno/v3/cmd/parse/types" + "github.com/forbole/juno/v4/cmd/parse/types" - "github.com/forbole/juno/v3/modules/messages" - "github.com/forbole/juno/v3/modules/registrar" + "github.com/forbole/juno/v4/modules/messages" + "github.com/forbole/juno/v4/modules/registrar" - "github.com/forbole/juno/v3/cmd" + "github.com/forbole/juno/v4/cmd" ) func main() { diff --git a/cmd/migrate/cmd.go b/cmd/migrate/cmd.go index bd48b6ad..010afd75 100644 --- a/cmd/migrate/cmd.go +++ b/cmd/migrate/cmd.go @@ -4,11 +4,11 @@ import ( "fmt" "os" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" "github.com/spf13/cobra" - v4 "github.com/forbole/juno/v3/cmd/migrate/v4" + v4 "github.com/forbole/juno/v4/cmd/migrate/v4" ) type Migrator func(parseCfg *parsecmdtypes.Config) error diff --git a/cmd/migrate/v3/types.go b/cmd/migrate/v3/types.go index 77815707..d018a3cd 100644 --- a/cmd/migrate/v3/types.go +++ b/cmd/migrate/v3/types.go @@ -1,13 +1,13 @@ package v3 import ( - loggingconfig "github.com/forbole/juno/v3/logging/config" - "github.com/forbole/juno/v3/modules/pruning" - "github.com/forbole/juno/v3/modules/telemetry" - nodeconfig "github.com/forbole/juno/v3/node/config" - parserconfig "github.com/forbole/juno/v3/parser/config" - pricefeedconfig "github.com/forbole/juno/v3/pricefeed" - "github.com/forbole/juno/v3/types/config" + loggingconfig "github.com/forbole/juno/v4/logging/config" + "github.com/forbole/juno/v4/modules/pruning" + "github.com/forbole/juno/v4/modules/telemetry" + nodeconfig "github.com/forbole/juno/v4/node/config" + parserconfig "github.com/forbole/juno/v4/parser/config" + pricefeedconfig "github.com/forbole/juno/v4/pricefeed" + "github.com/forbole/juno/v4/types/config" ) type Config struct { diff --git a/cmd/migrate/v3/utils.go b/cmd/migrate/v3/utils.go index 02eec01b..a2d32bde 100644 --- a/cmd/migrate/v3/utils.go +++ b/cmd/migrate/v3/utils.go @@ -8,7 +8,7 @@ import ( "gopkg.in/yaml.v3" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" ) // GetConfig returns the configuration reading it from the config.yaml file present inside the home directory diff --git a/cmd/migrate/v4/migrate.go b/cmd/migrate/v4/migrate.go index cc72027e..4df0ff7a 100644 --- a/cmd/migrate/v4/migrate.go +++ b/cmd/migrate/v4/migrate.go @@ -4,13 +4,13 @@ import ( "fmt" "io/ioutil" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" "gopkg.in/yaml.v3" - v3 "github.com/forbole/juno/v3/cmd/migrate/v3" - databaseconfig "github.com/forbole/juno/v3/database/config" - "github.com/forbole/juno/v3/types/config" + v3 "github.com/forbole/juno/v4/cmd/migrate/v3" + databaseconfig "github.com/forbole/juno/v4/database/config" + "github.com/forbole/juno/v4/types/config" ) // RunMigration runs the migrations from v3 to v4 diff --git a/cmd/migrate/v4/types.go b/cmd/migrate/v4/types.go index 5d14fe0b..ca62ec49 100644 --- a/cmd/migrate/v4/types.go +++ b/cmd/migrate/v4/types.go @@ -1,14 +1,14 @@ package v4 import ( - databaseconfig "github.com/forbole/juno/v3/database/config" - loggingconfig "github.com/forbole/juno/v3/logging/config" - "github.com/forbole/juno/v3/modules/pruning" - "github.com/forbole/juno/v3/modules/telemetry" - nodeconfig "github.com/forbole/juno/v3/node/config" - parserconfig "github.com/forbole/juno/v3/parser/config" - pricefeedconfig "github.com/forbole/juno/v3/pricefeed" - "github.com/forbole/juno/v3/types/config" + databaseconfig "github.com/forbole/juno/v4/database/config" + loggingconfig "github.com/forbole/juno/v4/logging/config" + "github.com/forbole/juno/v4/modules/pruning" + "github.com/forbole/juno/v4/modules/telemetry" + nodeconfig "github.com/forbole/juno/v4/node/config" + parserconfig "github.com/forbole/juno/v4/parser/config" + pricefeedconfig "github.com/forbole/juno/v4/pricefeed" + "github.com/forbole/juno/v4/types/config" ) // Config defines all necessary juno configuration parameters. diff --git a/cmd/parse/blocks/blocks.go b/cmd/parse/blocks/blocks.go index 884147ba..ea8e4c7a 100644 --- a/cmd/parse/blocks/blocks.go +++ b/cmd/parse/blocks/blocks.go @@ -3,15 +3,15 @@ package blocks import ( "fmt" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" - "github.com/forbole/juno/v3/types/utils" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" + "github.com/forbole/juno/v4/types/utils" "github.com/rs/zerolog/log" "github.com/spf13/cobra" - "github.com/forbole/juno/v3/parser" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/parser" + "github.com/forbole/juno/v4/types/config" ) const ( diff --git a/cmd/parse/blocks/cmd.go b/cmd/parse/blocks/cmd.go index 9bc4c3bc..e2789d58 100644 --- a/cmd/parse/blocks/cmd.go +++ b/cmd/parse/blocks/cmd.go @@ -3,7 +3,7 @@ package blocks import ( "github.com/spf13/cobra" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" ) // NewBlocksCmd returns the Cobra command that allows to fix all the things related to blocks diff --git a/cmd/parse/cmd.go b/cmd/parse/cmd.go index 6cdb84b2..de596b76 100644 --- a/cmd/parse/cmd.go +++ b/cmd/parse/cmd.go @@ -3,11 +3,11 @@ package parse import ( "github.com/spf13/cobra" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" - parseblocks "github.com/forbole/juno/v3/cmd/parse/blocks" - parsegenesis "github.com/forbole/juno/v3/cmd/parse/genesis" - parsetransactions "github.com/forbole/juno/v3/cmd/parse/transactions" + parseblocks "github.com/forbole/juno/v4/cmd/parse/blocks" + parsegenesis "github.com/forbole/juno/v4/cmd/parse/genesis" + parsetransactions "github.com/forbole/juno/v4/cmd/parse/transactions" ) // NewParseCmd returns the Cobra command allowing to parse some chain data without having to re-sync the whole database diff --git a/cmd/parse/genesis/cmd.go b/cmd/parse/genesis/cmd.go index 976a7d24..d9cd299a 100644 --- a/cmd/parse/genesis/cmd.go +++ b/cmd/parse/genesis/cmd.go @@ -3,11 +3,11 @@ package genesis import ( "github.com/spf13/cobra" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" - "github.com/forbole/juno/v3/modules" - nodeconfig "github.com/forbole/juno/v3/node/config" - "github.com/forbole/juno/v3/types/utils" + "github.com/forbole/juno/v4/modules" + nodeconfig "github.com/forbole/juno/v4/node/config" + "github.com/forbole/juno/v4/types/utils" ) const ( diff --git a/cmd/parse/transactions/cmd.go b/cmd/parse/transactions/cmd.go index 1e7e6b00..d74b9644 100644 --- a/cmd/parse/transactions/cmd.go +++ b/cmd/parse/transactions/cmd.go @@ -3,7 +3,7 @@ package transactions import ( "github.com/spf13/cobra" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" ) // NewTransactionsCmd returns the Cobra command that allows to fix missing or incomplete transactions diff --git a/cmd/parse/transactions/transactions.go b/cmd/parse/transactions/transactions.go index 479e9bea..cc8c7be1 100644 --- a/cmd/parse/transactions/transactions.go +++ b/cmd/parse/transactions/transactions.go @@ -3,14 +3,14 @@ package transactions import ( "fmt" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" "github.com/rs/zerolog/log" "github.com/spf13/cobra" - "github.com/forbole/juno/v3/parser" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/parser" + "github.com/forbole/juno/v4/types/config" ) const ( diff --git a/cmd/parse/types/config.go b/cmd/parse/types/config.go index 8cec94bc..1d829491 100644 --- a/cmd/parse/types/config.go +++ b/cmd/parse/types/config.go @@ -4,11 +4,11 @@ import ( "fmt" "os" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" "github.com/spf13/cobra" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" ) // ReadConfigPreRunE represents a Cobra cmd function allowing to read the config before executing the command itself diff --git a/cmd/parse/types/sdk.go b/cmd/parse/types/sdk.go index 159dcb09..929d89ba 100644 --- a/cmd/parse/types/sdk.go +++ b/cmd/parse/types/sdk.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" ) // SdkConfigSetup represents a method that allows to customize the given sdk.Config. diff --git a/cmd/parse/types/setup.go b/cmd/parse/types/setup.go index 07f515cf..e757f4cd 100644 --- a/cmd/parse/types/setup.go +++ b/cmd/parse/types/setup.go @@ -4,16 +4,16 @@ import ( "fmt" "reflect" - "github.com/forbole/juno/v3/parser" + "github.com/forbole/juno/v4/parser" - nodebuilder "github.com/forbole/juno/v3/node/builder" - "github.com/forbole/juno/v3/types/config" + nodebuilder "github.com/forbole/juno/v4/node/builder" + "github.com/forbole/juno/v4/types/config" - "github.com/forbole/juno/v3/database" + "github.com/forbole/juno/v4/database" sdk "github.com/cosmos/cosmos-sdk/types" - modsregistrar "github.com/forbole/juno/v3/modules/registrar" + modsregistrar "github.com/forbole/juno/v4/modules/registrar" ) // GetParserContext setups all the things that can be used to later parse the chain state diff --git a/cmd/parse/types/types.go b/cmd/parse/types/types.go index 98dbe4fd..598485db 100644 --- a/cmd/parse/types/types.go +++ b/cmd/parse/types/types.go @@ -3,12 +3,12 @@ package types import ( "github.com/cosmos/cosmos-sdk/simapp" - "github.com/forbole/juno/v3/logging" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/logging" + "github.com/forbole/juno/v4/types/config" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/database/builder" - "github.com/forbole/juno/v3/modules/registrar" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/database/builder" + "github.com/forbole/juno/v4/modules/registrar" ) // Config contains all the configuration for the "parse" command diff --git a/cmd/start/cmd.go b/cmd/start/cmd.go index 66bfecd5..c016747c 100644 --- a/cmd/start/cmd.go +++ b/cmd/start/cmd.go @@ -7,18 +7,18 @@ import ( "syscall" "time" - parsecmdtypes "github.com/forbole/juno/v3/cmd/parse/types" - "github.com/forbole/juno/v3/types/utils" + parsecmdtypes "github.com/forbole/juno/v4/cmd/parse/types" + "github.com/forbole/juno/v4/types/utils" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/logging" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" "github.com/go-co-op/gocron" - "github.com/forbole/juno/v3/modules" - "github.com/forbole/juno/v3/parser" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/modules" + "github.com/forbole/juno/v4/parser" + "github.com/forbole/juno/v4/types" "github.com/spf13/cobra" ) diff --git a/database/builder/builder.go b/database/builder/builder.go index be83b6a9..de59a75f 100644 --- a/database/builder/builder.go +++ b/database/builder/builder.go @@ -1,9 +1,9 @@ package builder import ( - "github.com/forbole/juno/v3/database" + "github.com/forbole/juno/v4/database" - "github.com/forbole/juno/v3/database/postgresql" + "github.com/forbole/juno/v4/database/postgresql" ) // Builder represents a generic Builder implementation that build the proper database diff --git a/database/config/config.go b/database/config/config.go index 0a2ab224..42fd4bc6 100644 --- a/database/config/config.go +++ b/database/config/config.go @@ -10,12 +10,37 @@ type Config struct { PartitionBatchSize int64 `yaml:"partition_batch"` } -func (c *Config) GetUser() string { +func (c *Config) getURL() *url.URL { parsedURL, err := url.Parse(c.URL) if err != nil { panic(err) } - return parsedURL.User.Username() + return parsedURL +} + +func (c *Config) GetUser() string { + return c.getURL().User.Username() +} + +func (c *Config) GetPassword() string { + password, _ := c.getURL().User.Password() + return password +} + +func (c *Config) GetHost() string { + return c.getURL().Host +} + +func (c *Config) GetPort() string { + return c.getURL().Port() +} + +func (c *Config) GetSchema() string { + return c.getURL().Query().Get("search_path") +} + +func (c *Config) GetSSLMode() string { + return c.getURL().Query().Get("sslmode") } func NewDatabaseConfig( diff --git a/database/database.go b/database/database.go index 65583d47..c1d89738 100644 --- a/database/database.go +++ b/database/database.go @@ -3,11 +3,11 @@ package database import ( "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/logging" - databaseconfig "github.com/forbole/juno/v3/database/config" + databaseconfig "github.com/forbole/juno/v4/database/config" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" ) // Database represents an abstract database that can be used to save data inside it diff --git a/database/legacy/v3/migrate.go b/database/legacy/v3/migrate.go index db75f86d..8b1a5df9 100644 --- a/database/legacy/v3/migrate.go +++ b/database/legacy/v3/migrate.go @@ -6,9 +6,9 @@ import ( "github.com/rs/zerolog/log" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" - types "github.com/forbole/juno/v3/database/migrate/utils" + types "github.com/forbole/juno/v4/database/migrate/utils" ) // Migrate implements database.Migrator diff --git a/database/legacy/v3/migrator.go b/database/legacy/v3/migrator.go index 2ca4a0c5..bc03559c 100644 --- a/database/legacy/v3/migrator.go +++ b/database/legacy/v3/migrator.go @@ -3,8 +3,8 @@ package v3 import ( "github.com/jmoiron/sqlx" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/database/postgresql" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/database/postgresql" ) var _ database.Migrator = &Migrator{} diff --git a/database/legacy/v3/prepare.go b/database/legacy/v3/prepare.go index 59e8587e..3845508d 100644 --- a/database/legacy/v3/prepare.go +++ b/database/legacy/v3/prepare.go @@ -3,7 +3,7 @@ package v3 import ( "fmt" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" ) // PrepareMigration prepares the database for the migration by renaming the old tables and creating the new ones diff --git a/database/postgresql/postgresql.go b/database/postgresql/postgresql.go index a8fe1e5d..dc9e1988 100644 --- a/database/postgresql/postgresql.go +++ b/database/postgresql/postgresql.go @@ -8,14 +8,14 @@ import ( "github.com/jmoiron/sqlx" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/logging" "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/lib/pq" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/types" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/types" + "github.com/forbole/juno/v4/types/config" ) // Builder creates a database connection with the given database connection info diff --git a/database/postgresql/postgresql_test.go b/database/postgresql/postgresql_test.go index 07a04766..96e15db3 100644 --- a/database/postgresql/postgresql_test.go +++ b/database/postgresql/postgresql_test.go @@ -11,10 +11,10 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" "github.com/stretchr/testify/suite" - "github.com/forbole/juno/v3/database" - databaseconfig "github.com/forbole/juno/v3/database/config" - postgres "github.com/forbole/juno/v3/database/postgresql" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/database" + databaseconfig "github.com/forbole/juno/v4/database/config" + postgres "github.com/forbole/juno/v4/database/postgresql" + "github.com/forbole/juno/v4/logging" ) func TestDatabaseTestSuite(t *testing.T) { diff --git a/go.mod b/go.mod index d660b44e..13404705 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/forbole/juno/v3 +module github.com/forbole/juno/v4 go 1.18 diff --git a/logging/default.go b/logging/default.go index 9b10be0c..a75d3ea6 100644 --- a/logging/default.go +++ b/logging/default.go @@ -11,8 +11,8 @@ import ( "github.com/rs/zerolog/log" tmctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/forbole/juno/v3/modules" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/modules" + "github.com/forbole/juno/v4/types" ) var ( diff --git a/logging/logger.go b/logging/logger.go index 17d7a404..2e33f6db 100644 --- a/logging/logger.go +++ b/logging/logger.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" tmctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/forbole/juno/v3/modules" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/modules" + "github.com/forbole/juno/v4/types" ) const ( diff --git a/modules/messages/message_handler.go b/modules/messages/message_handler.go index b2ca2d07..784f5b40 100644 --- a/modules/messages/message_handler.go +++ b/modules/messages/message_handler.go @@ -5,8 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/gogo/protobuf/proto" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/types" ) // HandleMsg represents a message handler that stores the given message inside the proper database table diff --git a/modules/messages/module.go b/modules/messages/module.go index 65a6be3d..27df8ac2 100644 --- a/modules/messages/module.go +++ b/modules/messages/module.go @@ -4,9 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/modules" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/modules" + "github.com/forbole/juno/v4/types" ) var _ modules.Module = &Module{} diff --git a/modules/module.go b/modules/module.go index d3678000..39c70ec8 100644 --- a/modules/module.go +++ b/modules/module.go @@ -11,7 +11,7 @@ import ( tmctypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" ) // Module represents a generic module without any particular handling of data diff --git a/modules/pruning/config_test.go b/modules/pruning/config_test.go index 2462d7e2..143041b8 100644 --- a/modules/pruning/config_test.go +++ b/modules/pruning/config_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/forbole/juno/v3/modules/pruning" + "github.com/forbole/juno/v4/modules/pruning" ) func TestParseConfig(t *testing.T) { diff --git a/modules/pruning/handle_block.go b/modules/pruning/handle_block.go index bbd20fac..8baf4268 100644 --- a/modules/pruning/handle_block.go +++ b/modules/pruning/handle_block.go @@ -5,8 +5,8 @@ import ( tmctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/types" ) // HandleBlock implements modules.BlockModule diff --git a/modules/pruning/module.go b/modules/pruning/module.go index ef642922..20abd200 100644 --- a/modules/pruning/module.go +++ b/modules/pruning/module.go @@ -1,12 +1,12 @@ package pruning import ( - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/logging" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/modules" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/modules" ) var ( diff --git a/modules/registrar/registrar.go b/modules/registrar/registrar.go index df88b373..2505cdc7 100644 --- a/modules/registrar/registrar.go +++ b/modules/registrar/registrar.go @@ -4,20 +4,20 @@ import ( "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/forbole/juno/v3/node" + "github.com/forbole/juno/v4/node" - "github.com/forbole/juno/v3/modules/telemetry" + "github.com/forbole/juno/v4/modules/telemetry" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/logging" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/types/config" - "github.com/forbole/juno/v3/modules/pruning" + "github.com/forbole/juno/v4/modules/pruning" - "github.com/forbole/juno/v3/modules" - "github.com/forbole/juno/v3/modules/messages" + "github.com/forbole/juno/v4/modules" + "github.com/forbole/juno/v4/modules/messages" - "github.com/forbole/juno/v3/database" + "github.com/forbole/juno/v4/database" ) // Context represents the context of the modules registrar diff --git a/modules/telemetry/module.go b/modules/telemetry/module.go index a9309446..b53750c9 100644 --- a/modules/telemetry/module.go +++ b/modules/telemetry/module.go @@ -1,8 +1,8 @@ package telemetry import ( - "github.com/forbole/juno/v3/modules" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/modules" + "github.com/forbole/juno/v4/types/config" ) const ( diff --git a/node/builder/builder.go b/node/builder/builder.go index acbdac28..f336c16b 100644 --- a/node/builder/builder.go +++ b/node/builder/builder.go @@ -5,10 +5,10 @@ import ( "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/forbole/juno/v3/node" - nodeconfig "github.com/forbole/juno/v3/node/config" - "github.com/forbole/juno/v3/node/local" - "github.com/forbole/juno/v3/node/remote" + "github.com/forbole/juno/v4/node" + nodeconfig "github.com/forbole/juno/v4/node/config" + "github.com/forbole/juno/v4/node/local" + "github.com/forbole/juno/v4/node/remote" ) func BuildNode(cfg nodeconfig.Config, encodingConfig *params.EncodingConfig) (node.Node, error) { diff --git a/node/config/config.go b/node/config/config.go index 5b17ebb0..cd6f06f9 100644 --- a/node/config/config.go +++ b/node/config/config.go @@ -3,8 +3,8 @@ package config import ( "gopkg.in/yaml.v3" - "github.com/forbole/juno/v3/node/local" - "github.com/forbole/juno/v3/node/remote" + "github.com/forbole/juno/v4/node/local" + "github.com/forbole/juno/v4/node/remote" ) const ( diff --git a/node/config/config_test.go b/node/config/config_test.go index 07ef24d0..94170c07 100644 --- a/node/config/config_test.go +++ b/node/config/config_test.go @@ -7,9 +7,9 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" - nodeconfig "github.com/forbole/juno/v3/node/config" - "github.com/forbole/juno/v3/node/local" - "github.com/forbole/juno/v3/node/remote" + nodeconfig "github.com/forbole/juno/v4/node/config" + "github.com/forbole/juno/v4/node/local" + "github.com/forbole/juno/v4/node/remote" ) func TestConfig_UnmarshalYAML(t *testing.T) { diff --git a/node/local/node.go b/node/local/node.go index f4b15be2..9f2a3654 100644 --- a/node/local/node.go +++ b/node/local/node.go @@ -31,8 +31,8 @@ import ( "github.com/tendermint/tendermint/store" tmtypes "github.com/tendermint/tendermint/types" - "github.com/forbole/juno/v3/node" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/node" + "github.com/forbole/juno/v4/types" "path" "time" diff --git a/node/local/source.go b/node/local/source.go index 4fbc4701..b129900e 100644 --- a/node/local/source.go +++ b/node/local/source.go @@ -20,7 +20,7 @@ import ( tmstore "github.com/tendermint/tendermint/store" db "github.com/tendermint/tm-db" - "github.com/forbole/juno/v3/node" + "github.com/forbole/juno/v4/node" ) var ( diff --git a/node/node.go b/node/node.go index 5ee4aa7f..2b7606fb 100644 --- a/node/node.go +++ b/node/node.go @@ -6,7 +6,7 @@ import ( constypes "github.com/tendermint/tendermint/consensus/types" tmctypes "github.com/tendermint/tendermint/rpc/core/types" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" ) type Node interface { diff --git a/node/remote/node.go b/node/remote/node.go index d5a1feab..10d9df4b 100644 --- a/node/remote/node.go +++ b/node/remote/node.go @@ -17,11 +17,11 @@ import ( constypes "github.com/tendermint/tendermint/consensus/types" tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/forbole/juno/v3/node" + "github.com/forbole/juno/v4/node" "github.com/cosmos/cosmos-sdk/types/tx" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" httpclient "github.com/tendermint/tendermint/rpc/client/http" tmctypes "github.com/tendermint/tendermint/rpc/core/types" diff --git a/node/remote/source.go b/node/remote/source.go index db0405fd..f7c6cf67 100644 --- a/node/remote/source.go +++ b/node/remote/source.go @@ -5,7 +5,7 @@ import ( "google.golang.org/grpc" - "github.com/forbole/juno/v3/node" + "github.com/forbole/juno/v4/node" ) var ( diff --git a/parser/context.go b/parser/context.go index c1d5e30e..2538cbcf 100644 --- a/parser/context.go +++ b/parser/context.go @@ -3,11 +3,11 @@ package parser import ( "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/forbole/juno/v3/logging" - "github.com/forbole/juno/v3/node" + "github.com/forbole/juno/v4/logging" + "github.com/forbole/juno/v4/node" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/modules" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/modules" ) // Context represents the context that is shared among different workers diff --git a/parser/utils.go b/parser/utils.go index 2713040d..52351afa 100644 --- a/parser/utils.go +++ b/parser/utils.go @@ -5,7 +5,7 @@ import ( tmctypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/forbole/juno/v3/types" + "github.com/forbole/juno/v4/types" ) // findValidatorByAddr finds a validator by a consensus address given a set of diff --git a/parser/worker.go b/parser/worker.go index f361e8a4..a0b485b2 100644 --- a/parser/worker.go +++ b/parser/worker.go @@ -3,27 +3,26 @@ package parser import ( "encoding/json" "fmt" - "sync" "time" "github.com/cosmos/cosmos-sdk/x/authz" - "github.com/forbole/juno/v3/logging" + "github.com/forbole/juno/v4/logging" "github.com/cosmos/cosmos-sdk/codec" - "github.com/forbole/juno/v3/database" - "github.com/forbole/juno/v3/types/config" + "github.com/forbole/juno/v4/database" + "github.com/forbole/juno/v4/types/config" - "github.com/forbole/juno/v3/modules" + "github.com/forbole/juno/v4/modules" sdk "github.com/cosmos/cosmos-sdk/types" tmctypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" - "github.com/forbole/juno/v3/node" - "github.com/forbole/juno/v3/types" - "github.com/forbole/juno/v3/types/utils" + "github.com/forbole/juno/v4/node" + "github.com/forbole/juno/v4/types" + "github.com/forbole/juno/v4/types/utils" ) // Worker defines a job consumer that is responsible for getting and @@ -328,23 +327,18 @@ func (w Worker) handleMessage(index int, msg sdk.Msg, tx *types.Tx) { // ExportTxs accepts a slice of transactions and persists then inside the database. // An error is returned if the write fails. func (w Worker) ExportTxs(txs []*types.Tx) error { - var wg sync.WaitGroup - + // handle all transactions inside the block for _, tx := range txs { - // Save the transaction + // save the transaction err := w.saveTx(tx) if err != nil { return fmt.Errorf("error while storing txs: %s", err) } - // Handle the transaction concurrently - wg.Add(1) - go func(tx *types.Tx) { - defer wg.Done() - w.handleTx(tx) - }(tx) + // call the tx handlers + w.handleTx(tx) - // Parse all the messages contained inside the transaction + // handle all messages contained inside the transaction sdkMsgs := make([]sdk.Msg, len(tx.Body.Messages)) for i, msg := range tx.Body.Messages { var stdMsg sdk.Msg @@ -355,19 +349,12 @@ func (w Worker) ExportTxs(txs []*types.Tx) error { sdkMsgs[i] = stdMsg } - // Handle all the messages concurrently + // call the msg handlers for i, sdkMsg := range sdkMsgs { - wg.Add(1) - go func(i int, sdkMsg sdk.Msg) { - defer wg.Done() - w.handleMessage(i, sdkMsg, tx) - }(i, sdkMsg) + w.handleMessage(i, sdkMsg, tx) } } - // Wait all transactions and messages to be parsed - wg.Wait() - totalBlocks := w.db.GetTotalBlocks() logging.DbBlockCount.WithLabelValues("total_blocks_in_db").Set(float64(totalBlocks)) diff --git a/types/config/config.go b/types/config/config.go index aa2d2d8e..68240479 100644 --- a/types/config/config.go +++ b/types/config/config.go @@ -3,10 +3,10 @@ package config import ( "strings" - databaseconfig "github.com/forbole/juno/v3/database/config" - loggingconfig "github.com/forbole/juno/v3/logging/config" - nodeconfig "github.com/forbole/juno/v3/node/config" - parserconfig "github.com/forbole/juno/v3/parser/config" + databaseconfig "github.com/forbole/juno/v4/database/config" + loggingconfig "github.com/forbole/juno/v4/logging/config" + nodeconfig "github.com/forbole/juno/v4/node/config" + parserconfig "github.com/forbole/juno/v4/parser/config" ) var ( diff --git a/types/utils/genesis.go b/types/utils/genesis.go index a4a492ed..51b28dda 100644 --- a/types/utils/genesis.go +++ b/types/utils/genesis.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/forbole/juno/v3/node" + "github.com/forbole/juno/v4/node" tmjson "github.com/tendermint/tendermint/libs/json" tmos "github.com/tendermint/tendermint/libs/os"