Skip to content

Commit

Permalink
feat!: add PSS reward distribution spike (#1632)
Browse files Browse the repository at this point in the history
* PSS reward distribution

* "add optin mapping to test"

* Update app/provider/app.go

Co-authored-by: Philip Offtermatt <[email protected]>

* docs

* add TODO

* fix Dos vector in IBCMiddlewarea

* add reformat

* fix DOS issue and make integration tests pass

* doc

* add integration test

* doc

* Compute total vp per consumer

* add comments

* remove opt-in comments and add TODOs

* format

* Update x/ccv/provider/keeper/distribution.go

Co-authored-by: insumity <[email protected]>

* add UT + doc

* Update tests/integration/distribution.go

Co-authored-by: insumity <[email protected]>

* Update tests/integration/distribution.go

Co-authored-by: insumity <[email protected]>

* nits

* Update x/ccv/provider/ibc_middleware.go

Co-authored-by: Marius Poke <[email protected]>

* add panics in IBC Middleware ICS4wrapper funcs

* address comments

---------

Co-authored-by: Philip Offtermatt <[email protected]>
Co-authored-by: insumity <[email protected]>
Co-authored-by: Marius Poke <[email protected]>
  • Loading branch information
4 people committed Mar 12, 2024
1 parent ee65399 commit 7497fc0
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 6 deletions.
2 changes: 1 addition & 1 deletion proto/interchain_security/ccv/provider/v1/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,4 @@ message OptedInValidator {
int64 power = 3;
// public key used by the validator on the consumer
bytes public_key = 4;
}
}
9 changes: 4 additions & 5 deletions tests/integration/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
icstestingutils "github.com/cosmos/interchain-security/v4/testutil/integration"
consumerkeeper "github.com/cosmos/interchain-security/v4/x/ccv/consumer/keeper"
consumertypes "github.com/cosmos/interchain-security/v4/x/ccv/consumer/types"
Expand Down Expand Up @@ -482,7 +481,7 @@ func (s *CCVTestSuite) TestSendRewardsToProvider() {
func (s *CCVTestSuite) TestIBCTransferMiddleware() {

var (
data ibctransfertypes.FungibleTokenPacketData
data transfertypes.FungibleTokenPacketData
packet channeltypes.Packet
getIBCDenom func(string, string) string
)
Expand Down Expand Up @@ -614,7 +613,7 @@ func (s *CCVTestSuite) TestIBCTransferMiddleware() {

tc.setup(s.providerCtx(), &providerKeeper, bankKeeper)

cbs, ok := s.providerChain.App.GetIBCKeeper().Router.GetRoute(ibctransfertypes.ModuleName)
cbs, ok := s.providerChain.App.GetIBCKeeper().Router.GetRoute(transfertypes.ModuleName)
s.Require().True(ok)

// save the IBC transfer rewards transferred
Expand Down Expand Up @@ -1108,12 +1107,12 @@ func (s *CCVTestSuite) TestMultiConsumerRewardsDistribution() {
)

// construct the denom of the reward tokens for the provider
prefixedDenom := ibctransfertypes.GetPrefixedDenom(
prefixedDenom := transfertypes.GetPrefixedDenom(
transfertypes.PortID,
bundle.TransferPath.EndpointB.ChannelID,
rewardsPerConsumer.Denom,
)
provIBCDenom := ibctransfertypes.ParseDenomTrace(prefixedDenom).IBCDenom()
provIBCDenom := transfertypes.ParseDenomTrace(prefixedDenom).IBCDenom()

// sum the total rewards transferred to the provider
totalConsumerRewards = totalConsumerRewards.
Expand Down
128 changes: 128 additions & 0 deletions testutil/keeper/mocks.go

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

0 comments on commit 7497fc0

Please sign in to comment.