Skip to content

Commit

Permalink
fix: fields for genesis should be non nullable (#938)
Browse files Browse the repository at this point in the history
  • Loading branch information
seantking authored Feb 17, 2022
1 parent acc699d commit 9b2d96d
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 68 deletions.
4 changes: 2 additions & 2 deletions modules/apps/29-fee/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
Relayers: nil,
},
},
FeeEnabledChannels: []*types.FeeEnabledChannel{
FeeEnabledChannels: []types.FeeEnabledChannel{
{
PortId: transfertypes.PortID,
ChannelId: ibctesting.FirstChannelID,
},
},
RegisteredRelayers: []*types.RegisteredRelayerAddress{
RegisteredRelayers: []types.RegisteredRelayerAddress{
{
Address: sender,
CounterpartyAddress: counterparty,
Expand Down
18 changes: 9 additions & 9 deletions modules/apps/29-fee/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ func (k Keeper) IsFeeEnabled(ctx sdk.Context, portID, channelID string) bool {
}

// GetAllFeeEnabledChannels returns a list of all ics29 enabled channels containing portID & channelID that are stored in state
func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []*types.FeeEnabledChannel {
func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []types.FeeEnabledChannel {
store := ctx.KVStore(k.storeKey)
iterator := sdk.KVStorePrefixIterator(store, []byte(types.FeeEnabledKeyPrefix))
defer iterator.Close()

var enabledChArr []*types.FeeEnabledChannel
var enabledChArr []types.FeeEnabledChannel
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")

ch := &types.FeeEnabledChannel{
ch := types.FeeEnabledChannel{
PortId: keySplit[1],
ChannelId: keySplit[2],
}
Expand Down Expand Up @@ -154,16 +154,16 @@ func (k Keeper) GetCounterpartyAddress(ctx sdk.Context, address string) (string,
}

// GetAllRelayerAddresses returns all registered relayer addresses
func (k Keeper) GetAllRelayerAddresses(ctx sdk.Context) []*types.RegisteredRelayerAddress {
func (k Keeper) GetAllRelayerAddresses(ctx sdk.Context) []types.RegisteredRelayerAddress {
store := ctx.KVStore(k.storeKey)
iterator := sdk.KVStorePrefixIterator(store, []byte(types.RelayerAddressKeyPrefix))
defer iterator.Close()

var registeredAddrArr []*types.RegisteredRelayerAddress
var registeredAddrArr []types.RegisteredRelayerAddress
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")

addr := &types.RegisteredRelayerAddress{
addr := types.RegisteredRelayerAddress{
Address: keySplit[1],
CounterpartyAddress: string(iterator.Value()),
}
Expand Down Expand Up @@ -193,12 +193,12 @@ func (k Keeper) GetForwardRelayerAddress(ctx sdk.Context, packetId channeltypes.
}

// GetAllForwardRelayerAddresses returns all forward relayer addresses stored for async acknowledgements
func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []*types.ForwardRelayerAddress {
func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []types.ForwardRelayerAddress {
store := ctx.KVStore(k.storeKey)
iterator := sdk.KVStorePrefixIterator(store, []byte(types.ForwardRelayerPrefix))
defer iterator.Close()

var forwardRelayerAddr []*types.ForwardRelayerAddress
var forwardRelayerAddr []types.ForwardRelayerAddress
for ; iterator.Valid(); iterator.Next() {
keySplit := strings.Split(string(iterator.Key()), "/")

Expand All @@ -209,7 +209,7 @@ func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []*types.ForwardR

packetId := channeltypes.NewPacketId(keySplit[2], keySplit[1], seq)

addr := &types.ForwardRelayerAddress{
addr := types.ForwardRelayerAddress{
Address: string(iterator.Value()),
PacketId: packetId,
}
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (suite *KeeperTestSuite) TestGetAllFeeEnabledChannels() {
suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), ibctesting.MockFeePort, ibctesting.FirstChannelID)
suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), validPortId, ibctesting.FirstChannelID)

expectedCh := []*types.FeeEnabledChannel{
expectedCh := []types.FeeEnabledChannel{
{
PortId: validPortId,
ChannelId: ibctesting.FirstChannelID,
Expand All @@ -177,7 +177,7 @@ func (suite *KeeperTestSuite) TestGetAllRelayerAddresses() {

suite.chainA.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainA.GetContext(), sender, counterparty)

expectedAddr := []*types.RegisteredRelayerAddress{
expectedAddr := []types.RegisteredRelayerAddress{
{
Address: sender,
CounterpartyAddress: counterparty,
Expand Down
6 changes: 3 additions & 3 deletions modules/apps/29-fee/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// NewGenesisState creates a 29-fee GenesisState instance.
func NewGenesisState(identifiedFees []IdentifiedPacketFee, feeEnabledChannels []*FeeEnabledChannel, registeredRelayers []*RegisteredRelayerAddress) *GenesisState {
func NewGenesisState(identifiedFees []IdentifiedPacketFee, feeEnabledChannels []FeeEnabledChannel, registeredRelayers []RegisteredRelayerAddress) *GenesisState {
return &GenesisState{
IdentifiedFees: identifiedFees,
FeeEnabledChannels: feeEnabledChannels,
Expand All @@ -20,8 +20,8 @@ func NewGenesisState(identifiedFees []IdentifiedPacketFee, feeEnabledChannels []
func DefaultGenesisState() *GenesisState {
return &GenesisState{
IdentifiedFees: []IdentifiedPacketFee{},
FeeEnabledChannels: []*FeeEnabledChannel{},
RegisteredRelayers: []*RegisteredRelayerAddress{},
FeeEnabledChannels: []FeeEnabledChannel{},
RegisteredRelayers: []RegisteredRelayerAddress{},
}
}

Expand Down
94 changes: 47 additions & 47 deletions modules/apps/29-fee/types/genesis.pb.go

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

4 changes: 2 additions & 2 deletions modules/apps/29-fee/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ func TestValidateGenesis(t *testing.T) {
Relayers: nil,
},
},
FeeEnabledChannels: []*types.FeeEnabledChannel{
FeeEnabledChannels: []types.FeeEnabledChannel{
{
PortId: portID,
ChannelId: channelID,
},
},
RegisteredRelayers: []*types.RegisteredRelayerAddress{
RegisteredRelayers: []types.RegisteredRelayerAddress{
{
Address: sender,
CounterpartyAddress: counterparty,
Expand Down
6 changes: 3 additions & 3 deletions proto/ibc/applications/fee/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import "ibc/core/channel/v1/channel.proto";
message GenesisState {
repeated IdentifiedPacketFee identified_fees = 1
[(gogoproto.moretags) = "yaml:\"identified_fees\"", (gogoproto.nullable) = false];
repeated FeeEnabledChannel fee_enabled_channels = 2 [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\""];
repeated RegisteredRelayerAddress registered_relayers = 3 [(gogoproto.moretags) = "yaml:\"registered_relayers\""];
repeated ForwardRelayerAddress forward_relayers = 4 [(gogoproto.moretags) = "yaml:\"forward_relayers\""];
repeated FeeEnabledChannel fee_enabled_channels = 2 [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false];
repeated RegisteredRelayerAddress registered_relayers = 3 [(gogoproto.moretags) = "yaml:\"registered_relayers\"", (gogoproto.nullable) = false];
repeated ForwardRelayerAddress forward_relayers = 4 [(gogoproto.moretags) = "yaml:\"forward_relayers\"", (gogoproto.nullable) = false];
}

// FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel
Expand Down

0 comments on commit 9b2d96d

Please sign in to comment.