Skip to content

Commit

Permalink
Post-merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojtek committed Nov 3, 2023
1 parent 1bfba30 commit 24954e0
Show file tree
Hide file tree
Showing 56 changed files with 390 additions and 788 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.default → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ COPY . ./
RUN go mod download
ARG arch=x86_64
# we use the same arch in the CI as a workaround since we don't use the wasm in the indexer
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.${arch}.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.3.0/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.${arch}.a
# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp /lib/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.a
RUN make build
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.hasura
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM --platform=$TARGETPLATFORM hasura/graphql-engine:v2.1.1.cli-migrations-v3
FROM --platform=$TARGETPLATFORM hasura/graphql-engine:v2.35.0.cli-migrations-v3
COPY hasura hasura
WORKDIR hasura
16 changes: 4 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@ all: lint build test-unit
###############################################################################

LD_FLAGS = -X github.com/forbole/juno/v5/cmd.Version=$(VERSION) \
-X github.com/forbole/juno/v5/cmd.Commit=$(COMMIT)
BUILD_FLAGS := -ldflags '$(LD_FLAGS)'
-X github.com/forbole/juno/v5/cmd.Commit=$(COMMIT) \
-linkmode=external -extldflags "-Wl,-z,muldefs -static"
BUILD_FLAGS := -tags muslc -ldflags '$(LD_FLAGS)'

ifeq ($(LINK_STATICALLY),true)
LD_FLAGS += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
endif

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

BUILD_FLAGS := -ldflags '$(LD_FLAGS)' -tags "$(build_tags)"

###############################################################################
##############################################################################
### Build ###
###############################################################################

Expand Down
4 changes: 1 addition & 3 deletions cmd/bdjuno/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ import (

"github.com/forbole/bdjuno/v4/types/config"

"cosmossdk.io/simapp"

"github.com/forbole/bdjuno/v4/database"
"github.com/forbole/bdjuno/v4/modules"
"github.com/forbole/bdjuno/v4/modules/assetft"
"github.com/forbole/bdjuno/v4/modules/assetnft"
"github.com/forbole/bdjuno/v4/modules/nft"
"github.com/forbole/bdjuno/v4/modules/wasm"

coreumapp "github.com/CoreumFoundation/coreum/v2/app"
coreumapp "github.com/CoreumFoundation/coreum/v3/app"
)

func main() {
Expand Down
22 changes: 21 additions & 1 deletion cmd/parse/gov/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import (
"fmt"
"strconv"

"github.com/forbole/bdjuno/v4/modules/assetft"
"github.com/forbole/bdjuno/v4/modules/assetnft"
"github.com/forbole/bdjuno/v4/modules/customparams"
"github.com/forbole/bdjuno/v4/modules/feemodel"
"github.com/rs/zerolog/log"

modulestypes "github.com/forbole/bdjuno/v4/modules/types"
Expand Down Expand Up @@ -53,9 +57,25 @@ func proposalCmd(parseConfig *parsecmdtypes.Config) *cobra.Command {
mintModule := mint.NewModule(sources.MintSource, parseCtx.EncodingConfig.Codec, db)
slashingModule := slashing.NewModule(sources.SlashingSource, parseCtx.EncodingConfig.Codec, db)
stakingModule := staking.NewModule(sources.StakingSource, parseCtx.EncodingConfig.Codec, db)
feeModelModule := feemodel.NewModule(sources.FeeModelSource, parseCtx.EncodingConfig.Codec, db)
customParamsModule := customparams.NewModule(sources.CustomParamsSource, parseCtx.EncodingConfig.Codec, db)
assetFTModule := assetft.NewModule(sources.AssetFTSource, parseCtx.EncodingConfig.Codec, db)
assetNFTModule := assetnft.NewModule(sources.AssetNFTSource, parseCtx.EncodingConfig.Codec, db)

// Build the gov module
govModule := gov.NewModule(sources.GovSource, distrModule, mintModule, slashingModule, stakingModule, parseCtx.EncodingConfig.Codec, db)
govModule := gov.NewModule(
sources.GovSource,
distrModule,
mintModule,
slashingModule,
stakingModule,
feeModelModule,
customParamsModule,
assetFTModule,
assetNFTModule,
parseCtx.EncodingConfig.Codec,
db,
)

err = refreshProposalDetails(parseCtx, proposalID, govModule)
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions database/assetft_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"encoding/json"
"fmt"

assetfttypes "github.com/CoreumFoundation/coreum/v2/x/asset/ft/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

assetfttypes "github.com/CoreumFoundation/coreum/v3/x/asset/ft/types"
)

// SaveAssetFTParams allows to store the given params into the database.
Expand All @@ -24,7 +25,7 @@ ON CONFLICT (one_row_id) DO UPDATE
height = excluded.height
WHERE assetft_params.height <= excluded.height`

_, err = db.Sql.Exec(stmt, string(paramsBz), params.Height)
_, err = db.SQL.Exec(stmt, string(paramsBz), params.Height)
if err != nil {
return fmt.Errorf("error while storing assetft params: %s", err)
}
Expand Down
9 changes: 5 additions & 4 deletions database/assetft_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package database_test
import (
"encoding/json"

assetfttypes "github.com/CoreumFoundation/coreum/v2/x/asset/ft/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

assetfttypes "github.com/CoreumFoundation/coreum/v3/x/asset/ft/types"
)

func (suite *DbTestSuite) TestSaveAssetFTParams() {
Expand All @@ -31,7 +32,7 @@ func (suite *DbTestSuite) TestGetAssetFTParams() {
paramsBz, err := json.Marshal(&assetFTParams)
suite.Require().NoError(err)

_, err = suite.database.Sql.Exec(
_, err = suite.database.SQL.Exec(
`INSERT INTO assetft_params (params, height) VALUES ($1, $2)`,
string(paramsBz), 10,
)
Expand Down
9 changes: 5 additions & 4 deletions database/assetnft_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"encoding/json"
"fmt"

assetnfttypes "github.com/CoreumFoundation/coreum/v2/x/asset/nft/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

assetnfttypes "github.com/CoreumFoundation/coreum/v3/x/asset/nft/types"
)

// SaveAssetNFTParams allows to store the given params into the database.
Expand All @@ -24,7 +25,7 @@ ON CONFLICT (one_row_id) DO UPDATE
height = excluded.height
WHERE assetnft_params.height <= excluded.height`

_, err = db.Sql.Exec(stmt, string(paramsBz), params.Height)
_, err = db.SQL.Exec(stmt, string(paramsBz), params.Height)
if err != nil {
return fmt.Errorf("error while storing assetnft params: %s", err)
}
Expand Down
9 changes: 5 additions & 4 deletions database/assetnft_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package database_test
import (
"encoding/json"

assetnfttypes "github.com/CoreumFoundation/coreum/v2/x/asset/nft/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

assetnfttypes "github.com/CoreumFoundation/coreum/v3/x/asset/nft/types"
)

func (suite *DbTestSuite) TestSaveAssetNFTParams() {
Expand All @@ -31,7 +32,7 @@ func (suite *DbTestSuite) TestGetAssetNFTParams() {
paramsBz, err := json.Marshal(&assetNFTParams)
suite.Require().NoError(err)

_, err = suite.database.Sql.Exec(
_, err = suite.database.SQL.Exec(
`INSERT INTO assetnft_params (params, height) VALUES ($1, $2)`,
string(paramsBz), 10,
)
Expand Down
6 changes: 3 additions & 3 deletions database/customparams_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"encoding/json"
"fmt"

"github.com/forbole/bdjuno/v3/types"
"github.com/forbole/bdjuno/v4/types"

dbtypes "github.com/forbole/bdjuno/v3/database/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
)

// SaveCustomParamsParams saves the given x/customparams parameters inside the database
Expand All @@ -23,7 +23,7 @@ ON CONFLICT (one_row_id) DO UPDATE
SET staking_params = excluded.staking_params,
height = excluded.height
WHERE customparams_params.height <= excluded.height`
_, err = db.Sql.Exec(stmt, string(stakingParamsBz), params.Height)
_, err = db.SQL.Exec(stmt, string(stakingParamsBz), params.Height)
if err != nil {
return fmt.Errorf("error while storing customparams params: %s", err)
}
Expand Down
9 changes: 5 additions & 4 deletions database/customparams_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package database_test
import (
"encoding/json"

customparamstypes "github.com/CoreumFoundation/coreum/v2/x/customparams/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

customparamstypes "github.com/CoreumFoundation/coreum/v3/x/customparams/types"
)

func (suite *DbTestSuite) TestSaveCustomParamsParams() {
Expand Down Expand Up @@ -33,7 +34,7 @@ func (suite *DbTestSuite) TestGetCustomParamsParams() {
paramsBz, err := json.Marshal(&customparamsParams)
suite.Require().NoError(err)

_, err = suite.database.Sql.Exec(
_, err = suite.database.SQL.Exec(
`INSERT INTO customparams_params (staking_params, height) VALUES ($1, $2)`,
string(paramsBz), 10,
)
Expand Down
9 changes: 5 additions & 4 deletions database/feemodel_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"encoding/json"
"fmt"

feemodeltypes "github.com/CoreumFoundation/coreum/v2/x/feemodel/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

feemodeltypes "github.com/CoreumFoundation/coreum/v3/x/feemodel/types"
)

// SaveFeeModelParams allows to store the given params into the database.
Expand All @@ -24,7 +25,7 @@ ON CONFLICT (one_row_id) DO UPDATE
height = excluded.height
WHERE feemodel_params.height <= excluded.height`

_, err = db.Sql.Exec(stmt, string(paramsBz), params.Height)
_, err = db.SQL.Exec(stmt, string(paramsBz), params.Height)
if err != nil {
return fmt.Errorf("error while storing feemodel params: %s", err)
}
Expand Down
9 changes: 5 additions & 4 deletions database/feemodel_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package database_test
import (
"encoding/json"

feemodeltypes "github.com/CoreumFoundation/coreum/v2/x/feemodel/types"
dbtypes "github.com/forbole/bdjuno/v3/database/types"
"github.com/forbole/bdjuno/v3/types"
dbtypes "github.com/forbole/bdjuno/v4/database/types"
"github.com/forbole/bdjuno/v4/types"

feemodeltypes "github.com/CoreumFoundation/coreum/v3/x/feemodel/types"
)

func (suite *DbTestSuite) TestSaveFeeModelParams() {
Expand All @@ -31,7 +32,7 @@ func (suite *DbTestSuite) TestGetFeeModelParams() {
paramsBz, err := json.Marshal(&feemodelParams)
suite.Require().NoError(err)

_, err = suite.database.Sql.Exec(
_, err = suite.database.SQL.Exec(
`INSERT INTO feemodel_params (params, height) VALUES ($1, $2)`,
string(paramsBz), 10,
)
Expand Down
14 changes: 7 additions & 7 deletions database/schema/00-cosmos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ CREATE INDEX block_hash_index ON block (hash);
CREATE INDEX block_proposer_address_index ON block (proposer_address);
ALTER TABLE block
SET (
autovacuum_vacuum_scale_factor = 0,
autovacuum_analyze_scale_factor = 0,
autovacuum_vacuum_threshold = 10000,
autovacuum_analyze_threshold = 10000
);
autovacuum_vacuum_scale_factor = 0,
autovacuum_analyze_scale_factor = 0,
autovacuum_vacuum_threshold = 10000,
autovacuum_analyze_threshold = 10000
);

CREATE TABLE transaction
(
Expand Down Expand Up @@ -99,9 +99,9 @@ SELECT * FROM message
WHERE (cardinality(types) = 0 OR type = ANY (types))
AND addresses && involved_accounts_addresses
ORDER BY height DESC LIMIT "limit" OFFSET "offset"
$$ LANGUAGE sql STABLE;
$$ LANGUAGE sql STABLE;

CREATE TABLE pruning
(
last_pruned_height BIGINT NOT NULL
);
);
6 changes: 3 additions & 3 deletions database/schema/01-auth.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ CREATE TABLE account

/* ---- Moved from bank.sql for vesting account usage ---- */
CREATE TYPE COIN AS
(
(
denom TEXT,
amount TEXT
);
);

/* ---- AUTH/ VESTING ACCOUNT ---- */
CREATE TABLE vesting_account
Expand All @@ -31,4 +31,4 @@ CREATE TABLE vesting_period
period_order BIGINT NOT NULL,
length BIGINT NOT NULL,
amount COIN[] NOT NULL DEFAULT '{}'
);
);
Loading

0 comments on commit 24954e0

Please sign in to comment.