diff --git a/.github/workflows/issue-label-automation.yml b/.github/workflows/issue-label-automation.yml index 6a8a0aaa6c..18edcf093c 100644 --- a/.github/workflows/issue-label-automation.yml +++ b/.github/workflows/issue-label-automation.yml @@ -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: @@ -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" diff --git a/app/default_overrides.go b/app/default_overrides.go index e072c54b3a..b68ceee335 100644 --- a/app/default_overrides.go +++ b/app/default_overrides.go @@ -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) } diff --git a/proto/celestia/mint/v1/genesis.proto b/proto/celestia/mint/v1/genesis.proto index 60810ed8b3..a9f88e7320 100644 --- a/proto/celestia/mint/v1/genesis.proto +++ b/proto/celestia/mint/v1/genesis.proto @@ -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; } diff --git a/x/mint/keeper/genesis.go b/x/mint/keeper/genesis.go index 3f267967ca..757e1e3f25 100644 --- a/x/mint/keeper/genesis.go +++ b/x/mint/keeper/genesis.go @@ -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{ @@ -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) } diff --git a/x/mint/types/genesis.go b/x/mint/types/genesis.go index 4e8b9260b9..9fec24f16d 100644 --- a/x/mint/types/genesis.go +++ b/x/mint/types/genesis.go @@ -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 } diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index cf8a6e95ec..518ebd1555 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -25,8 +24,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the mint module's genesis state. type GenesisState struct { - // minter is a space for holding current inflation information. - Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter"` + // BondDenom is the denomination of the token that should be minted. + BondDenom string `protobuf:"bytes,2,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -62,11 +61,11 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetMinter() Minter { +func (m *GenesisState) GetBondDenom() string { if m != nil { - return m.Minter + return m.BondDenom } - return Minter{} + return "" } func init() { @@ -76,20 +75,18 @@ func init() { func init() { proto.RegisterFile("celestia/mint/v1/genesis.proto", fileDescriptor_1932cb996a3161e7) } var fileDescriptor_1932cb996a3161e7 = []byte{ - // 197 bytes of a gzipped FileDescriptorProto + // 176 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4e, 0xcd, 0x49, 0x2d, 0x2e, 0xc9, 0x4c, 0xd4, 0xcf, 0xcd, 0xcc, 0x2b, 0xd1, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xc9, 0xeb, 0x81, - 0xe4, 0xf5, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, - 0x9d, 0x94, 0x34, 0x86, 0x39, 0x60, 0xf5, 0x60, 0x49, 0x25, 0x37, 0x2e, 0x1e, 0x77, 0x88, 0xa9, - 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x66, 0x5c, 0x6c, 0x20, 0xd9, 0xd4, 0x22, 0x09, 0x46, 0x05, - 0x46, 0x0d, 0x6e, 0x23, 0x09, 0x3d, 0x74, 0x5b, 0xf4, 0x7c, 0xc1, 0xf2, 0x4e, 0x2c, 0x27, 0xee, - 0xc9, 0x33, 0x04, 0x41, 0x55, 0x3b, 0x79, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, - 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, - 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xcc, 0xac, - 0xfc, 0xa2, 0x74, 0x38, 0x5b, 0x37, 0xb1, 0xa0, 0x40, 0xbf, 0x02, 0xe2, 0xb6, 0x92, 0xca, 0x82, - 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xd3, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xfa, 0xc5, - 0x86, 0x01, 0x01, 0x00, 0x00, + 0xe4, 0xf5, 0xca, 0x0c, 0x95, 0x8c, 0xb9, 0x78, 0xdc, 0x21, 0x4a, 0x82, 0x4b, 0x12, 0x4b, 0x52, + 0x85, 0x64, 0xb9, 0xb8, 0x92, 0xf2, 0xf3, 0x52, 0xe2, 0x53, 0x52, 0xf3, 0xf2, 0x73, 0x25, 0x98, + 0x14, 0x18, 0x35, 0x38, 0x83, 0x38, 0x41, 0x22, 0x2e, 0x20, 0x01, 0x2f, 0x16, 0x0e, 0x46, 0x01, + 0x26, 0x27, 0xaf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, + 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x48, 0xcf, + 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0xd9, 0x95, 0x5f, 0x94, 0x0e, 0x67, + 0xeb, 0x26, 0x16, 0x14, 0xe8, 0x57, 0x40, 0x5c, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, + 0x76, 0x99, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x47, 0xd0, 0x42, 0xbb, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -112,16 +109,13 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Minter.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + if len(m.BondDenom) > 0 { + i -= len(m.BondDenom) + copy(dAtA[i:], m.BondDenom) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.BondDenom))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -142,8 +136,10 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Minter.Size() - n += 1 + l + sovGenesis(uint64(l)) + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -182,11 +178,11 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Minter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -196,24 +192,23 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenesis } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenesis } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Minter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.BondDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex