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

Remove Ignite CLI #796

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9804a91
use 45.15
faddat Mar 23, 2023
3c3f7bc
remove ignite
faddat Mar 23, 2023
2f1a331
fix ibc_testing
faddat Mar 23, 2023
7e4383f
fumpt
faddat Mar 23, 2023
1f2f288
format code
faddat Mar 23, 2023
a6c879c
introduce revive
faddat Mar 23, 2023
ed1c15b
Merge branch 'main' into upgrade-sdk-45
faddat Mar 23, 2023
c8c6196
Merge branch 'main' into revive-lints
faddat Mar 23, 2023
21230b0
unused recievers
faddat Mar 23, 2023
63281e1
additional gofumpt rules
faddat Mar 23, 2023
8bb531b
if-return
faddat Mar 23, 2023
cb277f1
unused recievers
faddat Mar 23, 2023
90c0b60
fully linted with strict settings and primed for upgrades
faddat Mar 23, 2023
0382161
gonna need testutil
faddat Mar 23, 2023
161ab17
Merge branch 'main' into ibc-go-43
faddat Mar 23, 2023
e9c596c
use gosec as part of golang-ci
faddat Mar 23, 2023
e4d8b99
introduce typically used linters
faddat Mar 23, 2023
af07395
Merge remote-tracking branch 'origin/main' into revive-lints
faddat Mar 28, 2023
39fa788
resolve a bare return and unused parameter
faddat Mar 28, 2023
9fd0b55
Merge branch 'main' into ibc-go-43
faddat Mar 28, 2023
2048126
Merge branch 'main' into upgrade-sdk-45
faddat Mar 28, 2023
61444f3
fix gofumpt lints
faddat Mar 28, 2023
286ecf6
fix main.go 3x
faddat Mar 28, 2023
6617518
add vscode config
faddat Mar 28, 2023
7ef9d80
Merge remote-tracking branch 'faddat/upgrade-sdk-45' into ibc-go-43
faddat Mar 28, 2023
5c6d8b7
fix lints
faddat Mar 28, 2023
6de6776
Merge remote-tracking branch 'faddat/revive-lints' into ibc-go-43
faddat Mar 28, 2023
340b2cf
update app and testutil
faddat Mar 28, 2023
74c2044
fix lints
faddat Mar 28, 2023
af933ff
Merge branch 'main' into ibc-go-43
faddat Mar 28, 2023
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
17 changes: 1 addition & 16 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,14 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: "1.20"
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

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

# Optional: golangci-lint command line arguments.
args: --timeout=20m --skip-dirs legacy_ibc_testing

# 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 all caching functionality will be complete disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
20 changes: 0 additions & 20 deletions .github/workflows/gosec.yml

This file was deleted.

90 changes: 86 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,87 @@
run:
tests: true
timeout: 5m


linters:
disable-all: true
enable:
- depguard
- exportloopref
- goconst
- gocritic
- gofumpt
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- staticcheck
- revive
- stylecheck
- typecheck
- unconvert
- unused

issues:
max-issues-per-linter: 10000
max-same-issues: 10000


linters-settings:
staticcheck:
checks:
- all
- "-SA1019" # cosmosEd25519 allowed in tests
gofumpt:
# Module path which contains the source code being formatted.
# Default: ""
module-path: github.com/cosmos/interchain-security
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
revive:
ignore-generated-header: true
severity: error
enable-all-rules: true
rules:
- name: function-result-limit
disabled: true
- name: argument-limit
disabled: true
- name: function-length
disabled: true
- name: cyclomatic
disabled: true
- name: file-header
disabled: true
- name: max-public-structs
disabled: true
- name: cognitive-complexity
disabled: true
- name: line-length-limit
disabled: true
- name: banned-characters
disabled: true
- name: unhandled-error
arguments : ["fmt.Printf", "fmt.Println"]
- name: add-constant
disabled: true
- name: flag-parameter
disabled: true
- name: comment-spacings
disabled: true
- name: deep-exit
disabled: true
- name: defer
disabled: true
- name: nested-structs
disabled: true
- name: early-return
disabled: true








5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"go.formatTool": "gofumpt",
"go.lintOnSave": "workspace",
"go.lintTool": "golangci-lint"
}
2 changes: 1 addition & 1 deletion app/consumer-democracy/ante/forbidden_proposals_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (decorator ForbiddenProposalsDecorator) AnteHandle(ctx sdk.Context, tx sdk.

for _, msg := range tx.GetMsgs() {
submitProposalMgs, ok := msg.(*govtypes.MsgSubmitProposal)
//if the message is MsgSubmitProposal, check if proposal is whitelisted
// if the message is MsgSubmitProposal, check if proposal is whitelisted
if ok {
if !decorator.IsProposalWhitelisted(submitProposalMgs.GetContent()) {
return ctx, fmt.Errorf("tx contains unsupported proposal message types at height %d", currHeight)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestForbiddenProposalsDecorator(t *testing.T) {
ctx: sdk.Context{},
msgs: []sdk.Msg{
newParamChangeProposalMsg([]proposal.ParamChange{
//only subspace and key are relevant for testing
// only subspace and key are relevant for testing
{Subspace: banktypes.ModuleName, Key: "SendEnabled", Value: ""},
}),
},
Expand Down
2 changes: 1 addition & 1 deletion app/consumer-democracy/ante_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

var sigGasConsumer = options.SigGasConsumer
sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}
Expand Down
40 changes: 19 additions & 21 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import (
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
appparams "github.com/cosmos/interchain-security/app/consumer-democracy/params"

"github.com/cosmos/cosmos-sdk/x/slashing"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
Expand All @@ -74,7 +75,6 @@ import (
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
"github.com/tendermint/spm/cosmoscmd"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -145,7 +145,7 @@ var (
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
//router.AppModuleBasic{},
// router.AppModuleBasic{},
consumer.AppModuleBasic{},
)

Expand All @@ -166,14 +166,13 @@ var (
var (
_ simapp.App = (*App)(nil)
_ servertypes.Application = (*App)(nil)
_ cosmoscmd.CosmosApp = (*App)(nil)
_ ibctesting.TestingApp = (*App)(nil)
_ ibctesting.AppTest = (*App)(nil)
)

// App extends an ABCI application, but with most of its parameters exported.
// They are exported for convenience in creating helper functions, as object
// capabilities aren't needed for testing.
type App struct { // nolint: golint
type App struct { //nolint: golint
*baseapp.BaseApp
legacyAmino *codec.LegacyAmino
appCodec codec.Codec
Expand Down Expand Up @@ -236,12 +235,11 @@ func New(
skipUpgradeHeights map[int64]bool,
homePath string,
invCheckPeriod uint,
encodingConfig cosmoscmd.EncodingConfig,
encodingConfig appparams.EncodingConfig,
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) cosmoscmd.App {

appCodec := encodingConfig.Marshaler
) *App {
appCodec := encodingConfig.Codec
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

Expand Down Expand Up @@ -694,7 +692,7 @@ func (app *App) LoadHeight(height int64) error {
}

// ModuleAccountAddrs returns all the app's module account addresses.
func (app *App) ModuleAccountAddrs() map[string]bool {
func (*App) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
for acc := range maccPerms {
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
Expand Down Expand Up @@ -766,42 +764,42 @@ func (app *App) GetConsumerKeeper() consumerkeeper.Keeper {
}

// GetE2eBankKeeper implements the ConsumerApp interface.
func (app *App) GetE2eBankKeeper() e2e.E2eBankKeeper {
func (app *App) GetE2eBankKeeper() e2e.BankKeeper {
return app.BankKeeper
}

// GetE2eAccountKeeper implements the ConsumerApp interface.
func (app *App) GetE2eAccountKeeper() e2e.E2eAccountKeeper {
func (app *App) GetE2eAccountKeeper() e2e.AccountKeeper {
return app.AccountKeeper
}

// GetE2eSlashingKeeper implements the ConsumerApp interface.
func (app *App) GetE2eSlashingKeeper() e2e.E2eSlashingKeeper {
func (app *App) GetE2eSlashingKeeper() e2e.SlashingKeeper {
return app.SlashingKeeper
}

// GetE2eEvidenceKeeper implements the ConsumerApp interface.
func (app *App) GetE2eEvidenceKeeper() e2e.E2eEvidenceKeeper {
func (app *App) GetE2eEvidenceKeeper() e2e.EvidenceKeeper {
return app.EvidenceKeeper
}

// GetE2eStakingKeeper implements the ConsumerApp interface.
func (app *App) GetE2eStakingKeeper() e2e.E2eStakingKeeper {
func (app *App) GetE2eStakingKeeper() e2e.StakingKeeper {
return app.StakingKeeper
}

// GetE2eDistributionKeeper implements the ConsumerApp interface.
func (app *App) GetE2eDistributionKeeper() e2e.E2eDistributionKeeper {
func (app *App) GetE2eDistributionKeeper() e2e.DistributionKeeper {
return app.DistrKeeper
}

// GetE2eMintKeeper implements the ConsumerApp interface.
func (app *App) GetE2eMintKeeper() e2e.E2eMintKeeper {
func (app *App) GetE2eMintKeeper() e2e.MintKeeper {
return app.MintKeeper
}

// GetE2eGovKeeper implements the ConsumerApp interface.
func (app *App) GetE2eGovKeeper() e2e.E2eGovKeeper {
func (app *App) GetE2eGovKeeper() e2e.GovKeeper {
return app.GovKeeper
}

Expand All @@ -828,13 +826,13 @@ func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
}

// GetTxConfig implements the TestingApp interface.
func (app *App) GetTxConfig() client.TxConfig {
return cosmoscmd.MakeEncodingConfig(ModuleBasics).TxConfig
func (*App) GetTxConfig() client.TxConfig {
return appparams.MakeEncodingConfig().TxConfig
}

// RegisterAPIRoutes registers all application module routes with the provided
// API server.
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
func (*App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
clientCtx := apiSvr.ClientCtx
rpc.RegisterRoutes(clientCtx, apiSvr.Router)
// Register legacy tx routes.
Expand Down
7 changes: 3 additions & 4 deletions app/consumer-democracy/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import (
// ExportAppStateAndValidators exports the state of the application for a genesis
// file.
func (app *App) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string,
forZeroHeight bool, _ []string,
) (servertypes.ExportedApp, error) {

// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})

Expand All @@ -26,7 +25,7 @@ func (app *App) ExportAppStateAndValidators(
height := app.LastBlockHeight() + 1
if forZeroHeight {
height = 0
app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs)
app.prepForZeroHeightGenesis(ctx)
}

genState := app.MM.ExportGenesis(ctx, app.appCodec)
Expand All @@ -51,7 +50,7 @@ func (app *App) ExportAppStateAndValidators(
// NOTE zero height genesis is a temporary feature which will be deprecated
//
// in favour of export at a block height
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
func (app *App) prepForZeroHeightGenesis(ctx sdk.Context) {
// applyAllowedAddrs := false

// check if there is a allowed address list
Expand Down
35 changes: 35 additions & 0 deletions app/consumer-democracy/params/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package params

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

var (
Bech32Prefix = "democracy"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key
Bech32PrefixAccPub = Bech32Prefix + sdk.PrefixPublic
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address
Bech32PrefixValAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator
// Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key
Bech32PrefixValPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic
// Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address
Bech32PrefixConsAddr = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key
Bech32PrefixConsPub = Bech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

// SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format.
// Not sealed yet
func SetAddressPrefixes() {
cfg := sdk.GetConfig()
cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub)
cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub)
cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub)
}

func init() {
SetAddressPrefixes()
}
19 changes: 19 additions & 0 deletions app/consumer-democracy/params/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Package params defines the simulation parameters in the gaia.

It contains the default weights used for each transaction used on the module's
simulation. These weights define the chance for a transaction to be simulated at
any gived operation.

You can repace the default values for the weights by providing a params.json
file with the weights defined for each of the transaction operations:

{
"op_weight_msg_send": 60,
"op_weight_msg_delegate": 100,
}

In the example above, the `MsgSend` has 60% chance to be simulated, while the
`MsgDelegate` will always be simulated.
*/
package params
Loading