Skip to content

Commit

Permalink
Merge branch 'v1.x' into mergify/bp/v1.x/pr-2202
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp authored Aug 14, 2023
2 parents 15f0b89 + f700fa6 commit 16b558e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/issue-label-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
pull-requests: write
steps:
- name: Check if issue or PR was created by external contributor
if: ${{ github.actor != 'dependabot[bot]' }}
if: ${{ github.actor != 'dependabot[bot]' }} && ${{ github.actor == 'mergify[bot]' }}
uses: tspascoal/get-user-teams-membership@v2
id: teamCheck
with:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:

# If a PR was created by dependabot add the `bot` label.
- name: Maybe label PR with `bot`
if: ${{ github.actor == 'dependabot[bot]' }}
if: ${{ github.actor == 'dependabot[bot]' }} || ${{ github.actor == 'mergify[bot]' }}
uses: andymckay/labeler@master
with:
add-labels: "bot"
Expand Down
2 changes: 1 addition & 1 deletion app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type mintModule struct {
// DefaultGenesis returns custom x/mint module genesis state.
func (mintModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
genState := minttypes.DefaultGenesisState()
genState.Minter.BondDenom = BondDenom
genState.BondDenom = BondDenom

return cdc.MustMarshalJSON(genState)
}
Expand Down
9 changes: 4 additions & 5 deletions proto/celestia/mint/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
syntax = "proto3";
package celestia.mint.v1;

import "gogoproto/gogo.proto";
import "celestia/mint/v1/mint.proto";

option go_package = "github.com/celestiaorg/celestia-app/x/mint/types";

// GenesisState defines the mint module's genesis state.
message GenesisState {
// minter is a space for holding current inflation information.
Minter minter = 1 [ (gogoproto.nullable) = false ];
reserved 1; // 1 was previously used for the `Minter` field.

// BondDenom is the denomination of the token that should be minted.
string bond_denom = 2;
}
8 changes: 5 additions & 3 deletions x/mint/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (

// InitGenesis initializes the x/mint store with data from the genesis state.
func (k Keeper) InitGenesis(ctx sdk.Context, ak types.AccountKeeper, data *types.GenesisState) {
k.SetMinter(ctx, data.Minter)
minter := types.DefaultMinter()
minter.BondDenom = data.BondDenom
k.SetMinter(ctx, minter)
// override the genesis time with the actual genesis time supplied in `InitChain`
blockTime := ctx.BlockTime()
gt := types.GenesisTime{
Expand All @@ -19,6 +21,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, ak types.AccountKeeper, data *types

// ExportGenesis returns a x/mint GenesisState for the given context.
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
minter := k.GetMinter(ctx)
return types.NewGenesisState(minter)
bondDenom := k.GetMinter(ctx).BondDenom
return types.NewGenesisState(bondDenom)
}
13 changes: 9 additions & 4 deletions x/mint/types/genesis.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
package types

import "errors"

// NewGenesisState creates a new GenesisState object
func NewGenesisState(minter Minter) *GenesisState {
func NewGenesisState(bondDenom string) *GenesisState {
return &GenesisState{
Minter: minter,
BondDenom: bondDenom,
}
}

// DefaultGenesisState creates a default GenesisState object
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Minter: DefaultMinter(),
BondDenom: DefaultBondDenom,
}
}

// ValidateGenesis validates the provided genesis state to ensure the
// expected invariants holds.
func ValidateGenesis(data GenesisState) error {
return data.Minter.Validate()
if data.BondDenom == "" {
return errors.New("bond denom cannot be empty")
}
return nil
}
69 changes: 32 additions & 37 deletions x/mint/types/genesis.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 16b558e

Please sign in to comment.