Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Sep 12, 2023
1 parent 35b78f0 commit cba7f91
Show file tree
Hide file tree
Showing 16 changed files with 456 additions and 664 deletions.
14 changes: 4 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@

Add an entry to the unreleased section whenever merging a PR to main that is not targeted at a specific release. These entries will eventually be included in a release.

<<<<<<< HEAD
## v2.0.0-lsm
=======
## v2.1.0-provider

* (feature!) [#1280](https://github.com/cosmos/interchain-security/pull/1280) provider proposal for changing reward denoms
* (feature!) [#1244](https://github.com/cosmos/interchain-security/pull/1244) Update the default consumer unbonding period to 2 weeks.
* (deps) [#1259](https://github.com/cosmos/interchain-security/pull/1259) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5).
* (deps!) [#1258](https://github.com/cosmos/interchain-security/pull/1258) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0).
* (deps) [#1258](https://github.com/cosmos/interchain-security/pull/1258) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4).
* (deps!) [#1196](https://github.com/cosmos/interchain-security/pull/1196) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0).
* `[x/ccv/provider]` (fix) [#1076](https://github.com/cosmos/interchain-security/pull/1076) Add `InitTimeoutTimestamps` and `ExportedVscSendTimestamps` to exported genesis.
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))

## v2.0.0-lsm

Date: August 18th, 2023

Expand Down
15 changes: 1 addition & 14 deletions app/provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ var (
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
<<<<<<< HEAD
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.ProposalHandler,
Expand All @@ -141,19 +140,7 @@ var (
ibcproviderclient.ConsumerAdditionProposalHandler,
ibcproviderclient.ConsumerRemovalProposalHandler,
ibcproviderclient.EquivocationProposalHandler,
=======
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
ibcproviderclient.ConsumerAdditionProposalHandler,
ibcproviderclient.ConsumerRemovalProposalHandler,
ibcproviderclient.EquivocationProposalHandler,
ibcproviderclient.ChangeRewardDenomsProposalHandler,
},
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
ibcproviderclient.ChangeRewardDenomsProposalHandler,
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down
10 changes: 2 additions & 8 deletions proto/interchain_security/ccv/provider/v1/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ message EquivocationProposal {
repeated cosmos.evidence.v1beta1.Equivocation equivocations = 3;
}

<<<<<<< HEAD
// A persisted queue entry indicating that a slash packet data instance needs to be handled.
// This type belongs in the "global" queue, to coordinate slash packet handling times between consumers.
=======
// ChangeRewardDenomsProposal is a governance proposal on the provider chain to
// mutate the set of denoms accepted by the provider as rewards.
message ChangeRewardDenomsProposal {
Expand All @@ -112,10 +108,8 @@ message ChangeRewardDenomsProposal {
repeated string denoms_to_remove = 4;
}

// A persisted queue entry indicating that a slash packet data instance needs to
// be handled. This type belongs in the "global" queue, to coordinate slash
// packet handling times between consumers.
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
// A persisted queue entry indicating that a slash packet data instance needs to be handled.
// This type belongs in the "global" queue, to coordinate slash packet handling times between consumers.
message GlobalSlashEntry {
// Block time that slash packet was received by provider chain.
// This field is used for store key iteration ordering.
Expand Down
9 changes: 0 additions & 9 deletions proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ import "google/protobuf/any.proto";

// Msg defines the Msg service.
service Msg {
<<<<<<< HEAD
rpc AssignConsumerKey(MsgAssignConsumerKey) returns (MsgAssignConsumerKeyResponse);
rpc RegisterConsumerRewardDenom(MsgRegisterConsumerRewardDenom) returns (MsgRegisterConsumerRewardDenomResponse);
=======
rpc AssignConsumerKey(MsgAssignConsumerKey)
returns (MsgAssignConsumerKeyResponse);
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
}

message MsgAssignConsumerKey {
Expand All @@ -34,7 +28,6 @@ message MsgAssignConsumerKey {
}

message MsgAssignConsumerKeyResponse {}
<<<<<<< HEAD

// MsgRegisterConsumerRewardDenom allows an account to register
// a consumer reward denom, i.e., add it to the list of denoms
Expand All @@ -49,5 +42,3 @@ message MsgRegisterConsumerRewardDenom {

// MsgRegisterConsumerRewardDenomResponse defines the Msg/RegisterConsumerRewardDenom response type.
message MsgRegisterConsumerRewardDenomResponse {}
=======
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
18 changes: 0 additions & 18 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1684,20 +1684,6 @@ type submitChangeRewardDenomsProposalAction struct {
func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDenomsProposalAction, verbose bool) {
providerChain := tr.chainConfigs[chainID("provi")]

<<<<<<< HEAD
`--from`, `validator`+fmt.Sprint(action.from),
`--chain-id`, string(action.chain),
`--home`, tr.getValidatorHome(action.chain, action.from),
`--node`, tr.getValidatorNode(action.chain, action.from),
`--gas`, "9000000",
`--keyring-backend`, `test`,
`-b`, `block`,
`-y`,
).CombinedOutput()

if verbose {
fmt.Println("redelegate cmd:", string(bz))
=======
prop := client.ChangeRewardDenomsProposalJSON{
Summary: "Change reward denoms",
ChangeRewardDenomsProposal: types.ChangeRewardDenomsProposal{
Expand All @@ -1707,7 +1693,6 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno
DenomsToRemove: []string{"stake"},
},
Deposit: fmt.Sprint(action.deposit) + `stake`,
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
}

bz, err := json.Marshal(prop)
Expand All @@ -1727,8 +1712,6 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno
if err != nil {
log.Fatal(err, "\n", string(bz))
}
<<<<<<< HEAD
=======

//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
// CHANGE REWARDS DENOM PROPOSAL
Expand All @@ -1749,7 +1732,6 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno

// wait for inclusion in a block -> '--broadcast-mode block' is deprecated
tr.waitBlocks(chainID("provi"), 2, 30*time.Second)
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
}

// Creates an additional node on selected chain
Expand Down
31 changes: 1 addition & 30 deletions tests/integration/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,11 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
<<<<<<< HEAD
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"

consumertypes "github.com/cosmos/interchain-security/v2/x/ccv/consumer/types"
providertypes "github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
ccv "github.com/cosmos/interchain-security/v2/x/ccv/types"
=======

icstestingutils "github.com/cosmos/interchain-security/v3/testutil/integration"
consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
ccv "github.com/cosmos/interchain-security/v3/x/ccv/types"
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
)

// This test is valid for minimal viable consumer chain
Expand Down Expand Up @@ -106,28 +97,8 @@ func (s *CCVTestSuite) TestRewardsDistribution() {
rewardCoins = providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool)
s.Require().True(rewardCoins[ibcCoinIndex].Amount.Equal(providerExpectedRewards[0].Amount))

<<<<<<< HEAD
// Successfully register the consumer reward denom this time

// Send the coins back to the delAddr
err = providerBankKeeper.SendCoinsFromModuleToAccount(s.providerCtx(), govtypes.ModuleName, delAddr, senderCoins)
s.Require().NoError(err)

// log the sender's coins
senderCoins1 := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr)

// Register the consumer reward denom
err = s.providerApp.GetProviderKeeper().RegisterConsumerRewardDenom(s.providerCtx(), rewardCoins[ibcCoinIndex].Denom, delAddr)
s.Require().NoError(err)

// Check that the delAddr has the right amount less money in it after paying the fee
senderCoins2 := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr)
consumerRewardDenomRegistrationFee := s.providerApp.GetProviderKeeper().GetConsumerRewardDenomRegistrationFee(s.providerCtx())
s.Require().Equal(senderCoins1.Sub(senderCoins2), sdk.NewCoins(consumerRewardDenomRegistrationFee))
=======
// Set the consumer reward denom. This would be done by a governance proposal in prod
s.providerApp.GetProviderKeeper().SetConsumerRewardDenom(s.providerCtx(), rewardCoins[ibcCoinIndex].Denom)
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))

s.providerChain.NextBlock()

Expand Down
6 changes: 0 additions & 6 deletions x/ccv/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
<<<<<<< HEAD
"github.com/cosmos/cosmos-sdk/version"
=======
sdk "github.com/cosmos/cosmos-sdk/types"
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
)
Expand Down
62 changes: 41 additions & 21 deletions x/ccv/provider/client/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ import (
)

var (
<<<<<<< HEAD
ConsumerAdditionProposalHandler = govclient.NewProposalHandler(SubmitConsumerAdditionPropTxCmd, ConsumerAdditionProposalRESTHandler)
ConsumerRemovalProposalHandler = govclient.NewProposalHandler(SubmitConsumerRemovalProposalTxCmd, ConsumerRemovalProposalRESTHandler)
EquivocationProposalHandler = govclient.NewProposalHandler(SubmitEquivocationProposalTxCmd, EquivocationProposalRESTHandler)
=======
ConsumerAdditionProposalHandler = govclient.NewProposalHandler(SubmitConsumerAdditionPropTxCmd)
ConsumerRemovalProposalHandler = govclient.NewProposalHandler(SubmitConsumerRemovalProposalTxCmd)
EquivocationProposalHandler = govclient.NewProposalHandler(SubmitEquivocationProposalTxCmd)
ChangeRewardDenomsProposalHandler = govclient.NewProposalHandler(SubmitChangeRewardDenomsProposalTxCmd)
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
ConsumerAdditionProposalHandler = govclient.NewProposalHandler(SubmitConsumerAdditionPropTxCmd, ConsumerAdditionProposalRESTHandler)
ConsumerRemovalProposalHandler = govclient.NewProposalHandler(SubmitConsumerRemovalProposalTxCmd, ConsumerRemovalProposalRESTHandler)
EquivocationProposalHandler = govclient.NewProposalHandler(SubmitEquivocationProposalTxCmd, EquivocationProposalRESTHandler)
ChangeRewardDenomsProposalHandler = govclient.NewProposalHandler(SubmitChangeRewardDenomsProposalTxCmd, ChangeRewardDenomsProposalRESTHandler)
)

// SubmitConsumerAdditionPropTxCmd returns a CLI command handler for submitting
Expand Down Expand Up @@ -259,17 +253,12 @@ func SubmitChangeRewardDenomsProposalTxCmd() *cobra.Command {

from := clientCtx.GetFromAddress()

msgContent, err := govv1.NewLegacyContent(content, authtypes.NewModuleAddress(govtypes.ModuleName).String())
if err != nil {
return err
}

deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit)
if err != nil {
return err
}

msg, err := govv1.NewMsgSubmitProposal([]sdk.Msg{msgContent}, deposit, from.String(), "", content.GetTitle(), proposal.Summary)
msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from)
if err != nil {
return err
}
Expand Down Expand Up @@ -404,7 +393,6 @@ func ParseEquivocationProposalJSON(proposalFile string) (EquivocationProposalJSO
return proposal, nil
}

<<<<<<< HEAD
// EquivocationProposalRESTHandler returns a ProposalRESTHandler that exposes the equivocation rest handler.
func EquivocationProposalRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler {
return govrest.ProposalRESTHandler{
Expand All @@ -413,24 +401,21 @@ func EquivocationProposalRESTHandler(clientCtx client.Context) govrest.ProposalR
}
}

func ParseConsumerRemovalProposalJSON(proposalFile string) (ConsumerRemovalProposalJSON, error) {
proposal := ConsumerRemovalProposalJSON{}
=======
type ChangeRewardDenomsProposalJSON struct {
Summary string `json:"summary"`
types.ChangeRewardDenomsProposal
Deposit string `json:"deposit"`
}

type ChangeRewardDenomsProposalReq struct {
BaseReq rest.BaseReq `json:"base_req"`
Proposer sdk.AccAddress `json:"proposer"`
types.ChangeRewardDenomsProposal
Deposit sdk.Coins `json:"deposit"`
}

func ParseChangeRewardDenomsProposalJSON(proposalFile string) (ChangeRewardDenomsProposalJSON, error) {
proposal := ChangeRewardDenomsProposalJSON{}
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))

contents, err := os.ReadFile(filepath.Clean(proposalFile))
if err != nil {
Expand All @@ -442,6 +427,13 @@ func ParseChangeRewardDenomsProposalJSON(proposalFile string) (ChangeRewardDenom
return proposal, nil
}

func ChangeRewardDenomsProposalRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler {
return govrest.ProposalRESTHandler{
SubRoute: "change_reward_denoms",
Handler: postEquivocationProposalHandlerFn(clientCtx),
}
}

// ConsumerAdditionProposalRESTHandler returns a ProposalRESTHandler that exposes the consumer addition rest handler.
func ConsumerAdditionProposalRESTHandler(clientCtx client.Context) govrest.ProposalRESTHandler {
return govrest.ProposalRESTHandler{
Expand Down Expand Up @@ -567,3 +559,31 @@ provider unbonding: %s`,
providerUnbondingTime)
}
}

func postChangeRewardDenomsProposalHandlerFn(clientCtx client.Context) http.HandlerFunc {

Check failure on line 563 in x/ccv/provider/client/proposal_handler.go

View workflow job for this annotation

GitHub Actions / lint

func `postChangeRewardDenomsProposalHandlerFn` is unused (unused)
return func(w http.ResponseWriter, r *http.Request) {
var req ChangeRewardDenomsProposalReq
if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) {
return
}

req.BaseReq = req.BaseReq.Sanitize()
if !req.BaseReq.ValidateBasic(w) {
return
}

content := types.NewChangeRewardDenomsProposal(
req.Title, req.Description, req.DenomsToAdd, req.DenomsToRemove)

msg, err := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer)
if rest.CheckBadRequestError(w, err) {
return
}

if rest.CheckBadRequestError(w, msg.ValidateBasic()) {
return
}

tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg)
}
}
6 changes: 0 additions & 6 deletions x/ccv/provider/keeper/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
<<<<<<< HEAD
consumertypes "github.com/cosmos/interchain-security/v2/x/ccv/consumer/types"
"github.com/cosmos/interchain-security/v2/x/ccv/provider/types"
=======

"github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
>>>>>>> 48a2186 (feat!: provider proposal for changing reward denoms (#1280))
)

// EndBlockRD executes EndBlock logic for the Reward Distribution sub-protocol.
Expand Down
48 changes: 0 additions & 48 deletions x/ccv/provider/keeper/distribution_test.go

This file was deleted.

Loading

0 comments on commit cba7f91

Please sign in to comment.