Skip to content

Commit

Permalink
Merge branch 'main' into kwtalley/serde-any-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iramiller committed Jun 17, 2024
2 parents 154de11 + 9906915 commit cfb3ac0
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/proto-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Buf setup action
uses: bufbuild/buf-setup-action@v1.32.2
uses: bufbuild/buf-setup-action@v1.33.0
- name: Buf push 'third_party/proto'
uses: bufbuild/buf-push-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fi
echo "Setting output: base-branch=$branch"
echo "base-branch=$branch" >> "$GITHUB_OUTPUT"
- uses: bufbuild/buf-setup-action@v1.32.2
- uses: bufbuild/buf-setup-action@v1.33.0
- uses: bufbuild/buf-lint-action@v1.1.1
if: always()
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Buf setup action
uses: bufbuild/buf-setup-action@v1.32.2
uses: bufbuild/buf-setup-action@v1.33.0
- name: Buf push 'proto/'
uses: bufbuild/buf-push-action@v1
with:
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* The `add-net-asset-values` command now correctly uses the from `flag`'s `AccAddress` [#1995](https://github.com/provenance-io/provenance/issues/1995).
* Fix the sim tests [#2015](https://github.com/provenance-io/provenance/pull/2015).
* Fix the `umber` and `umber-rc1` upgrades [#2033](https://github.com/provenance-io/provenance/pull/2033).

### Deprecated

Expand All @@ -131,7 +132,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- 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.32.2 ([#1904](https://github.com/provenance-io/provenance/pull/1904), [#1949](https://github.com/provenance-io/provenance/pull/1949), [#1979](https://github.com/provenance-io/provenance/pull/1979), [#1990](https://github.com/provenance-io/provenance/pull/1990), [#2011](https://github.com/provenance-io/provenance/pull/2011))
- Bump `bufbuild/buf-setup-action` from 1.30.0 to 1.33.0 ([#1904](https://github.com/provenance-io/provenance/pull/1904), [#1949](https://github.com/provenance-io/provenance/pull/1949), [#1979](https://github.com/provenance-io/provenance/pull/1979), [#1990](https://github.com/provenance-io/provenance/pull/1990), [#2011](https://github.com/provenance-io/provenance/pull/2011), [#2036](https://github.com/provenance-io/provenance/pull/2036))
- Bump `github.com/cometbft/cometbft` from 0.38.5 to 0.38.7 ([#1912](https://github.com/provenance-io/provenance/pull/1912), [#1959](https://github.com/provenance-io/provenance/pull/1959))
- Bump `cosmossdk.io/x/upgrade` from 0.1.0 to 0.1.3 ([#1913](https://github.com/provenance-io/provenance/pull/1913), [#2026](https://github.com/provenance-io/provenance/pull/2026))
- Bump `github.com/hashicorp/go-metrics` from 0.5.2 to 0.5.3 ([#1914](https://github.com/provenance-io/provenance/pull/1914))
Expand All @@ -152,6 +153,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
- Bump `cosmossdk.io/store` from 1.0.2 to 1.1.0 [#2026](https://github.com/provenance-io/provenance/pull/2026)
- Bump `cosmossdk.io/x/feegrant` from 0.1.0 to 0.1.1 [#2026](https://github.com/provenance-io/provenance/pull/2026)
- Bump `cosmossdk.io/x/evidence` from 0.1.0 to 0.1.1 [#2026](https://github.com/provenance-io/provenance/pull/2026)
- Bump `cosmossdk.io/x/circuit` from 0.1.0 to 0.1.1 ([#2035](https://github.com/provenance-io/provenance/pull/2035))
- Bump `github.com/spf13/cobra` from 1.8.0 to 1.8.1 ([#2038](https://github.com/provenance-io/provenance/pull/2038))

---

Expand Down
68 changes: 34 additions & 34 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmv2 "github.com/CosmWasm/wasmd/x/wasm/migrations/v2"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
Expand Down Expand Up @@ -92,6 +93,7 @@ import (
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/group"
groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper"
Expand Down Expand Up @@ -332,13 +334,14 @@ func New(
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
) *App {
sdkConfig := sdk.GetConfig()
addrPrefix := sdkConfig.GetBech32AccountAddrPrefix()
valAddrPrefix := sdkConfig.GetBech32ValidatorAddrPrefix()
consAddrPrefix := sdkConfig.GetBech32ConsensusAddrPrefix()

signingOptions := signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
AddressCodec: address.Bech32Codec{Bech32Prefix: addrPrefix},
ValidatorAddressCodec: address.Bech32Codec{Bech32Prefix: valAddrPrefix},
}
exchange.DefineCustomGetSigners(&signingOptions)
interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
Expand All @@ -359,7 +362,6 @@ func New(
bApp.SetInterfaceRegistry(interfaceRegistry)
sdk.SetCoinDenomRegex(SdkCoinDenomRegex)

// TODO[1760]: Add the circuit breaker module to the app.
keys := storetypes.NewKVStoreKeys(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
Expand Down Expand Up @@ -434,13 +436,8 @@ func New(
// capability keeper must be sealed after scope to module registrations are completed.
app.CapabilityKeeper.Seal()

// Obtain prefixes so running tests can use "cosmos" while we use "pb"
addrPrefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
valAddrPrefix := sdk.GetConfig().GetBech32ValidatorAddrPrefix()
consAddrPrefix := sdk.GetConfig().GetBech32ConsensusAddrPrefix()

// add keepers
app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(addrPrefix), addrPrefix, govAuthority)
app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, signingOptions.AddressCodec, addrPrefix, govAuthority)

app.BankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
Expand Down Expand Up @@ -957,11 +954,6 @@ func New(
panic(err)
}

// Register upgrade handlers and set the store loader.
// This must be done after the module manager and configurator are set,
// but before the baseapp is sealed via LoadLatestVersion() down below.
app.registerUpgradeHandlers(appOpts)

autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules))

reflectionSvc, err := runtimeservices.NewReflectionService()
Expand Down Expand Up @@ -993,6 +985,11 @@ func New(
app.setFeeHandler()
app.SetAggregateEventsFunc(piohandlers.AggregateEvents)

// Register upgrade handlers and set the store loader.
// This must be done after the module manager, configurator, and pre-blocker are set,
// but before the baseapp is sealed via LoadLatestVersion() below.
app.registerUpgradeHandlers(appOpts)

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
cmtos.Exit(err.Error())
Expand Down Expand Up @@ -1346,31 +1343,33 @@ func GetMaccPerms() map[string][]string {
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)

paramsKeeper.Subspace(authtypes.ModuleName)
//nolint:staticcheck // The ParamKeyTable functions are deprecated, but needed here for the migrations.
paramsKeeper.Subspace(authtypes.ModuleName).WithKeyTable(authtypes.ParamKeyTable())
paramsKeeper.Subspace(banktypes.ModuleName)
paramsKeeper.Subspace(stakingtypes.ModuleName)
paramsKeeper.Subspace(minttypes.ModuleName)
paramsKeeper.Subspace(distrtypes.ModuleName)
paramsKeeper.Subspace(slashingtypes.ModuleName)
paramsKeeper.Subspace(govtypes.ModuleName)
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(stakingtypes.ModuleName).WithKeyTable(stakingtypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(minttypes.ModuleName).WithKeyTable(minttypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable()) //nolint:staticcheck
paramsKeeper.Subspace(crisistypes.ModuleName).WithKeyTable(crisistypes.ParamKeyTable()) //nolint:staticcheck

paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName).WithKeyTable(wasmv2.ParamKeyTable()) //nolint:staticcheck

// register the key tables for legacy param subspaces
keyTable := ibcclienttypes.ParamKeyTable()
keyTable.RegisterParamSet(&ibcconnectiontypes.Params{})
paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable)
paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable())
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())
paramsKeeper.Subspace(icqtypes.ModuleName).WithKeyTable(icqtypes.ParamKeyTable())

return paramsKeeper
}

// injectUpgrade causes the named upgrade to be run as the chain starts.
//
// To use this, add a call to it in New after the call to InstallCustomUpgradeHandlers
// but before the line that looks for an upgrade file.
// To use this, add a call to it in registerUpgradeHandlers immediately after the
// call to InstallCustomUpgradeHandlers, but before the line that looks for an upgrade file.
//
// This function is for testing an upgrade against an existing chain's data (e.g. mainnet).
// Here's how:
Expand Down Expand Up @@ -1401,15 +1400,16 @@ func (app *App) injectUpgrade(name string) { //nolint:unused // This is designed
if err := app.UpgradeKeeper.DumpUpgradeInfoToDisk(plan.Height, plan); err != nil {
panic(err)
}
// Define a new BeginBlocker that will inject the upgrade.

// Define a new PreBlocker that will inject the upgrade.
injected := false
app.SetBeginBlocker(func(ctx sdk.Context) (sdk.BeginBlock, error) {
app.SetPreBlocker(func(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) {
if !injected {
app.Logger().Info("Injecting upgrade plan", "plan", plan)
// Ideally, we'd just call ScheduleUpgrade(ctx, plan) here (and panic on error).
// But the upgrade keeper often its own migration stuff that change some store key stuff.
// ScheduleUpgrade tries to read some of that changed store stuff and fails if the migration hasn't
// been applied yet. So we're doing things the hard way here.
// But the upgrade keeper often has its own migration stuff that change some store stuff.
// ScheduleUpgrade would try to read some of that old state using the update pattern,
// causing a failure. So we're doing things the hard way here.
if err := app.UpgradeKeeper.ClearUpgradePlan(ctx); err != nil {
panic(err)
}
Expand All @@ -1418,6 +1418,6 @@ func (app *App) injectUpgrade(name string) { //nolint:unused // This is designed
store.Set(upgradetypes.PlanKey(), bz)
injected = true
}
return app.BeginBlocker(ctx)
return app.PreBlocker(ctx, req)
})
}
14 changes: 8 additions & 6 deletions app/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,25 @@ var (

// SetConfig sets the configuration for the network using mainnet or testnet
func SetConfig(testnet bool, seal bool) {
// not the default (mainnet) so reset with testnet config
AccountAddressPrefix = AccountAddressPrefixMainNet
CoinType = CoinTypeMainNet
if testnet {
AccountAddressPrefix = AccountAddressPrefixTestNet
AccountPubKeyPrefix = AccountAddressPrefixTestNet + "pub"
ValidatorAddressPrefix = AccountAddressPrefixTestNet + "valoper"
ValidatorPubKeyPrefix = AccountAddressPrefixTestNet + "valoperpub"
ConsNodeAddressPrefix = AccountAddressPrefixTestNet + "valcons"
ConsNodePubKeyPrefix = AccountAddressPrefixTestNet + "valconspub"
CoinType = CoinTypeTestNet
}
AccountPubKeyPrefix = AccountAddressPrefix + "pub"
ValidatorAddressPrefix = AccountAddressPrefix + "valoper"
ValidatorPubKeyPrefix = AccountAddressPrefix + "valoperpub"
ConsNodeAddressPrefix = AccountAddressPrefix + "valcons"
ConsNodePubKeyPrefix = AccountAddressPrefix + "valconspub"

config := sdk.GetConfig()
config.SetCoinType(uint32(CoinType))
config.SetPurpose(Purpose)
config.SetBech32PrefixForAccount(AccountAddressPrefix, AccountPubKeyPrefix)
config.SetBech32PrefixForValidator(ValidatorAddressPrefix, ValidatorPubKeyPrefix)
config.SetBech32PrefixForConsensusNode(ConsNodeAddressPrefix, ConsNodePubKeyPrefix)

if seal {
config.Seal()
}
Expand Down
Loading

0 comments on commit cfb3ac0

Please sign in to comment.