Skip to content

Commit

Permalink
Merge branch 'aj/docs-escape-brackets' of github.com:provenance-io/pr…
Browse files Browse the repository at this point in the history
…ovenance into aj/docs-escape-brackets
  • Loading branch information
webbushka committed May 21, 2024
2 parents 7950aa2 + f9af7d4 commit ad2c5e4
Show file tree
Hide file tree
Showing 51 changed files with 1,449 additions and 2,008 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Name module param migration [#1937](https://github.com/provenance-io/provenance/pull/1937).
* IbcHooks module param migration [#1939](https://github.com/provenance-io/provenance/pull/1939).
* Bank module param migration [#1967](https://github.com/provenance-io/provenance/pull/1967).
* Remove `msgfees` legacy gov proposals [#1953](https://github.com/provenance-io/provenance/pull/1953).
* Restore the hold module [#1930](https://github.com/provenance-io/provenance/pull/1930).
* Restore gov-prop cli commands and fix next key decoding [#1930](https://github.com/provenance-io/provenance/pull/1930).
* Switch to InputOutputCoinsProv for exchange transfers [#1930](https://github.com/provenance-io/provenance/pull/1930).
Expand All @@ -83,6 +84,13 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Clean up all the module codecs [#1957](https://github.com/provenance-io/provenance/pull/1957).
* Switch to auto-generated `String` and `Equal` methods for most proto messages [#1957](https://github.com/provenance-io/provenance/pull/1957).
* Clean up the marker module's expected BankKeeper interface [#1954](https://github.com/provenance-io/provenance/pull/1954).
* Add the auto-cli commands and a few others newly added by the SDK [#1971](https://github.com/provenance-io/provenance/pull/1971).

### Client Breaking

* The `provenanced query account` command has been removed. It is still available as `provenanced query auth account` [#1971](https://github.com/provenance-io/provenance/pull/1971).
* Move the genesis-related commands into a new `genesis` sub-command, and remove the `genesis-` parts of their names [#1971](https://github.com/provenance-io/provenance/pull/1971).
* Many of the SDK's query commands have had their usage altered [#1971](https://github.com/provenance-io/provenance/pull/1971).

### Deprecated

Expand All @@ -91,7 +99,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Dependencies

- Bump `github.com/cosmos/ibc-go/v8` from 8.0.0 to 8.2.1 ([#1910](https://github.com/provenance-io/provenance/pull/1910), [#1956](https://github.com/provenance-io/provenance/pull/1956))
- Bump `google.golang.org/grpc` from 1.62.1 to 1.63.2 ([#1903](https://github.com/provenance-io/provenance/pull/1903), [#1918](https://github.com/provenance-io/provenance/pull/1918))
- Bump `google.golang.org/grpc` from 1.62.1 to 1.64.0 ([#1903](https://github.com/provenance-io/provenance/pull/1903), [#1918](https://github.com/provenance-io/provenance/pull/1918), [#1972](https://github.com/provenance-io/provenance/pull/1972))
- Bump `bufbuild/buf-breaking-action` from 1.1.3 to 1.1.4 ([#1894](https://github.com/provenance-io/provenance/pull/1894))
- Bump `bufbuild/buf-lint-action` from 1.1.0 to 1.1.1 ([#1895](https://github.com/provenance-io/provenance/pull/1895))
- Bump `bufbuild/buf-setup-action` from 1.30.0 to 1.31.0 ([#1904](https://github.com/provenance-io/provenance/pull/1904), [#1949](https://github.com/provenance-io/provenance/pull/1949))
Expand Down
29 changes: 26 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
abci "github.com/cometbft/cometbft/abci/types"
cmtos "github.com/cometbft/cometbft/libs/os"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/log"
sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
Expand All @@ -42,6 +44,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/server/api"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down Expand Up @@ -152,7 +155,6 @@ import (
metadatakeeper "github.com/provenance-io/provenance/x/metadata/keeper"
metadatatypes "github.com/provenance-io/provenance/x/metadata/types"
metadatawasm "github.com/provenance-io/provenance/x/metadata/wasm"
"github.com/provenance-io/provenance/x/msgfees"
msgfeeskeeper "github.com/provenance-io/provenance/x/msgfees/keeper"
msgfeesmodule "github.com/provenance-io/provenance/x/msgfees/module"
msgfeestypes "github.com/provenance-io/provenance/x/msgfees/types"
Expand Down Expand Up @@ -689,8 +691,7 @@ func New(
govRouter := govtypesv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(markertypes.ModuleName, marker.NewProposalHandler(app.MarkerKeeper)).
AddRoute(msgfeestypes.ModuleName, msgfees.NewProposalHandler(app.MsgFeesKeeper, app.InterfaceRegistry()))
AddRoute(markertypes.ModuleName, marker.NewProposalHandler(app.MarkerKeeper))
govKeeper := govkeeper.NewKeeper(
appCodec, runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper,
app.StakingKeeper, app.DistrKeeper, app.BaseApp.MsgServiceRouter(), govtypes.Config{MaxMetadataLen: 10000}, govAuthority,
Expand Down Expand Up @@ -1320,6 +1321,28 @@ func (app *App) RegisterNodeService(clientCtx client.Context, cfg serverconfig.C
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg)
}

// AutoCliOpts returns the autocli options for the app.
func (app *App) AutoCliOpts() autocli.AppOptions {
modules := make(map[string]appmodule.AppModule, 0)
for _, m := range app.mm.Modules {
if moduleWithName, ok := m.(module.HasName); ok {
moduleName := moduleWithName.Name()
if appModule, ok := moduleWithName.(appmodule.AppModule); ok {
modules[moduleName] = appModule
}
}
}

cfg := sdk.GetConfig()
return autocli.AppOptions{
Modules: modules,
ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.mm.Modules),
AddressCodec: authcodec.NewBech32Codec(cfg.GetBech32AccountAddrPrefix()),
ValidatorAddressCodec: authcodec.NewBech32Codec(cfg.GetBech32ValidatorAddrPrefix()),
ConsensusAddressCodec: authcodec.NewBech32Codec(cfg.GetBech32ConsensusAddrPrefix()),
}
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) {
statikFS, err := fs.New()
Expand Down
5 changes: 3 additions & 2 deletions cmd/provenanced/cmd/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ Excess (hex): %s
// AddMetaAddressEncoder returns metadata address encoder cobra Command.
func AddMetaAddressEncoder() *cobra.Command {
cmd := &cobra.Command{
Use: "encode [type] [uuid] [uuid|name]",
Short: "Encodes metadata uuids to bech32 address for specific type",
Use: "encode [type] [uuid] [uuid|name]",
Aliases: []string{"e"},
Short: "Encodes metadata uuids to bech32 address for specific type",
Long: fmt.Sprintf(`Encodes metadata uuids to bech32 address for specific type.
%[1]s encode type uuid [uuid|name]
Expand Down
57 changes: 0 additions & 57 deletions cmd/provenanced/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil/client/cli"

"github.com/provenance-io/provenance/cmd/provenanced/cmd"
"github.com/provenance-io/provenance/testutil/assertions"
)

func TestInitCmd(t *testing.T) {
Expand All @@ -28,59 +27,3 @@ func TestInitCmd(t *testing.T) {
err := cmd.Execute(rootCmd)
require.NoError(t, err)
}

func TestGenAutoCompleteCmd(t *testing.T) {
home := t.TempDir()

tests := []struct {
name string
args []string
err string
}{
{
name: "failure - missing arg",
err: "accepts 1 arg(s), received 0",
},
{
name: "failure - too many args",
args: []string{"bash", "fish"},
err: "accepts 1 arg(s), received 2",
},
{
name: "failure - invalid shell type",
args: []string{"badshellname"},
err: "shell badshellname is not supported",
},
{
name: "success - works with bash",
args: []string{"bash"},
},
{
name: "success - works with zsh",
args: []string{"zsh"},
},
{
name: "success - works with fish",
args: []string{"fish"},
},
{
name: "success - works with powershell",
args: []string{"powershell"},
},
}

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
args := []string{"--home", home, "enable-cli-autocomplete"}
args = append(args, tc.args...)

rootCmd, _ := cmd.NewRootCmd(false)
rootCmd.SetArgs(args)
rootCmd.SetOut(io.Discard)
rootCmd.SetErr(io.Discard)

err := cmd.Execute(rootCmd)
assertions.AssertErrorValue(t, err, tc.err, "should have the correct output value")
})
}
}
10 changes: 10 additions & 0 deletions cmd/provenanced/cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/provenance-io/provenance/app"
simappparams "github.com/provenance-io/provenance/app/params"
Expand All @@ -46,10 +47,15 @@ type ConfigTestSuite struct {
BaseFNApp string
BaseFNCMT string
baseFNClient string

origAddrCacheEnabled bool
}

func (s *ConfigTestSuite) SetupTest() {
s.Home = s.T().TempDir()
s.origAddrCacheEnabled = sdk.IsAddrCacheEnabled()
sdk.SetAddrCacheEnabled(false)

s.T().Logf("%s Home: %s", s.T().Name(), s.Home)

pioconfig.SetProvenanceConfig("confcoin", 5)
Expand Down Expand Up @@ -81,6 +87,10 @@ func (s *ConfigTestSuite) SetupTest() {
s.ensureConfigFiles()
}

func (s *ConfigTestSuite) TearDownTest() {
sdk.SetAddrCacheEnabled(s.origAddrCacheEnabled)
}

func TestConfigTestSuite(t *testing.T) {
suite.Run(t, new(ConfigTestSuite))
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/provenanced/cmd/docgen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil"

"github.com/provenance-io/provenance/app"
Expand All @@ -25,6 +26,10 @@ import (
)

func TestDocGen(t *testing.T) {
origCache := sdk.IsAddrCacheEnabled()
defer sdk.SetAddrCacheEnabled(origCache)
sdk.SetAddrCacheEnabled(false)

appCodec := app.MakeTestEncodingConfig(t).Marshaler
tests := []struct {
name string
Expand Down
Loading

0 comments on commit ad2c5e4

Please sign in to comment.