Skip to content

Commit

Permalink
feat!: add memo to IBC transfers of ICS rewards (#2290)
Browse files Browse the repository at this point in the history
* add consumer ID to consumer genesis

* add RewardMemo to token transfer

* handle memo on provider side

* fix democ tests

* wip

* add e2e-test

* refactor consumer reward tests

* add consumer migration info

* add changelog

* fix changelog filename

---------

Co-authored-by: Simon Noetzlin <[email protected]>
(cherry picked from commit 0d78295)

# Conflicts:
#	tests/e2e/actions.go
#	tests/e2e/steps_democracy.go
#	tests/e2e/steps_inactive_vals.go
#	tests/e2e/test_driver.go
#	tests/e2e/v4/state.go
#	x/ccv/provider/ibc_middleware.go
#	x/ccv/provider/keeper/consumer_lifecycle.go
#	x/ccv/provider/keeper/consumer_lifecycle_test.go
#	x/ccv/provider/keeper/grpc_query.go
#	x/ccv/provider/types/errors.go
#	x/ccv/provider/types/msg.go
#	x/ccv/provider/types/msg_test.go
#	x/ccv/types/errors.go
#	x/ccv/types/shared_consumer.pb.go
#	x/ccv/types/shared_params.go
  • Loading branch information
mpoke authored and mergify[bot] committed Nov 6, 2024
1 parent a221871 commit eb4336f
Show file tree
Hide file tree
Showing 34 changed files with 4,677 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `[x/consumer]` Populate the memo on the IBC transfer packets used to send ICS rewards.
with the required consumer chain Id to identify the consumer to the provider.
- `[x/provider]` Identify the source of ICS rewards from the IBC transfer packet memo.
([\#2290](https://github.com/cosmos/interchain-security/pull/2290))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `[x/consumer]` Populate the memo on the IBC transfer packets used to send ICS rewards.
with the required consumer chain Id to identify the consumer to the provider.
- `[x/provider]` Identify the source of ICS rewards from the IBC transfer packet memo.
([\#2290](https://github.com/cosmos/interchain-security/pull/2290))
20 changes: 20 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

## v5.2.x

### Consumer

Upgrading a consumer from v4.4.x to v4.5.x and from v5.x or v6.1.x to v6.2.x requires state migrations. The following migrators should be added to the upgrade handler of the consumer chain:


```go
// InitializeConsumerId sets the consumer Id parameter in the consumer module,
// to the consumer id for which the consumer is registered on the provider chain.
// The consumer id can be obtained in by querying the provider, e.g. by using the
// QueryConsumerIdFromClientId query.
func InitializeConsumerId(ctx sdk.Context, consumerKeeper consumerkeeper.Keeper) error {
params, err := consumerKeeper.GetParams(ctx)
if err != nil {
return err
}
params.ConsumerId = ConsumerId
return consumerKeeper.SetParams(ctx, params)
}
```

### Provider

Providers using versions `v5.1.x` can upgrade to `v5.2.x`.
Expand Down
4 changes: 4 additions & 0 deletions proto/interchain_security/ccv/v1/shared_consumer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ message ConsumerParams {
// The period after which a consumer can retry sending a throttled packet.
google.protobuf.Duration retry_delay_period = 13
[ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ];

// The consumer ID of this consumer chain. Used by the consumer module to send
// ICS rewards.
string consumer_id = 14;
}

// ConsumerGenesisState defines shared genesis information between provider and
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/action_rapid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func CreateSubmitChangeRewardDenomsProposalActionGen() *rapid.Generator[SubmitCh
return SubmitChangeRewardDenomsProposalAction{
From: GetValidatorIDGen().Draw(t, "From"),
Deposit: rapid.Uint().Draw(t, "Deposit"),
Denom: rapid.String().Draw(t, "Denom"),
Denoms: rapid.SliceOf(rapid.String()).Draw(t, "Denoms"),
}
})
}
Expand Down
Loading

0 comments on commit eb4336f

Please sign in to comment.