Skip to content

Commit

Permalink
Remove rewards module
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Apr 8, 2024
1 parent 0583a63 commit cdaab53
Show file tree
Hide file tree
Showing 74 changed files with 1 addition and 27,694 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Remove handlers from provenance modules [#1760](https://github.com/provenance-io/provenance/issues/1760).
* Updated app.go to use RegisterStreamingServices on BaseApp [#1760](https://github.com/provenance-io/provenance/issues/1760).
* Bump the SDK to `v0.50.5-pio-1` (from an earlier ephemeral version) [#1897](https://github.com/provenance-io/provenance/pull/1897).
* Removed `rewards` module [#1905](https://github.com/provenance-io/provenance/pull/1905).

### Dependencies

Expand Down
16 changes: 0 additions & 16 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ import (
oraclekeeper "github.com/provenance-io/provenance/x/oracle/keeper"
oraclemodule "github.com/provenance-io/provenance/x/oracle/module"
oracletypes "github.com/provenance-io/provenance/x/oracle/types"
rewardkeeper "github.com/provenance-io/provenance/x/reward/keeper"
rewardmodule "github.com/provenance-io/provenance/x/reward/module"
rewardtypes "github.com/provenance-io/provenance/x/reward/types"
triggerkeeper "github.com/provenance-io/provenance/x/trigger/keeper"
triggermodule "github.com/provenance-io/provenance/x/trigger/module"
triggertypes "github.com/provenance-io/provenance/x/trigger/types"
Expand Down Expand Up @@ -207,7 +204,6 @@ var (
attributetypes.ModuleName: nil,
markertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
wasmtypes.ModuleName: {authtypes.Burner},
rewardtypes.ModuleName: nil,
triggertypes.ModuleName: nil,
oracletypes.ModuleName: nil,
}
Expand Down Expand Up @@ -264,7 +260,6 @@ type App struct {
EvidenceKeeper evidencekeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
MsgFeesKeeper msgfeeskeeper.Keeper
RewardKeeper rewardkeeper.Keeper
// QuarantineKeeper quarantinekeeper.Keeper // TODO[1760]: quarantine
// SanctionKeeper sanctionkeeper.Keeper // TODO[1760]: sanction
TriggerKeeper triggerkeeper.Keeper
Expand Down Expand Up @@ -363,7 +358,6 @@ func New(
nametypes.StoreKey,
msgfeestypes.StoreKey,
wasmtypes.StoreKey,
rewardtypes.StoreKey,
// quarantine.StoreKey, // TODO[1760]: quarantine
// sanction.StoreKey, // TODO[1760]: sanction
triggertypes.StoreKey,
Expand Down Expand Up @@ -488,8 +482,6 @@ func New(
stakingtypes.NewMultiStakingHooks(restrictHooks, app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()),
)

app.RewardKeeper = rewardkeeper.NewKeeper(appCodec, keys[rewardtypes.StoreKey], app.StakingKeeper, &app.GovKeeper, app.BankKeeper, app.AccountKeeper)

app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.BaseApp.MsgServiceRouter(), app.AccountKeeper)

app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), app.AccountKeeper, group.DefaultConfig())
Expand Down Expand Up @@ -554,7 +546,6 @@ func New(

markerReqAttrBypassAddrs := []sdk.AccAddress{
authtypes.NewModuleAddress(authtypes.FeeCollectorName), // Allow collecting fees in restricted coins.
authtypes.NewModuleAddress(rewardtypes.ModuleName), // Allow rewards to hold onto restricted coins.
// authtypes.NewModuleAddress(quarantine.ModuleName), // Allow quarantine to hold onto restricted coins. // TODO[1760]: quarantine
authtypes.NewModuleAddress(govtypes.ModuleName), // Allow restricted coins in deposits.
authtypes.NewModuleAddress(distrtypes.ModuleName), // Allow fee denoms to be restricted coins.
Expand Down Expand Up @@ -773,7 +764,6 @@ func New(
attribute.NewAppModule(appCodec, app.AttributeKeeper, app.AccountKeeper, app.BankKeeper, app.NameKeeper),
msgfeesmodule.NewAppModule(appCodec, app.MsgFeesKeeper, app.interfaceRegistry),
wasm.NewAppModule(appCodec, app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, nil, app.GetSubspace(wasmtypes.ModuleName)), // TODO[1760]: Need to pass message router instead of nil
rewardmodule.NewAppModule(appCodec, app.RewardKeeper, app.AccountKeeper, app.BankKeeper),
triggermodule.NewAppModule(appCodec, app.TriggerKeeper, app.AccountKeeper, app.BankKeeper),
oracleModule,
holdmodule.NewAppModule(appCodec, app.HoldKeeper),
Expand Down Expand Up @@ -827,7 +817,6 @@ func New(
markertypes.ModuleName,
icatypes.ModuleName,
attributetypes.ModuleName,
rewardtypes.ModuleName,
triggertypes.ModuleName,

// no-ops
Expand Down Expand Up @@ -864,7 +853,6 @@ func New(
authtypes.ModuleName,
icatypes.ModuleName,
group.ModuleName,
rewardtypes.ModuleName,
triggertypes.ModuleName,

// no-ops
Expand Down Expand Up @@ -938,7 +926,6 @@ func New(
ibchookstypes.ModuleName,
// wasm after ibc transfer
wasmtypes.ModuleName,
rewardtypes.ModuleName,
triggertypes.ModuleName,
oracletypes.ModuleName,

Expand Down Expand Up @@ -985,7 +972,6 @@ func New(
msgfeestypes.ModuleName,
metadatatypes.ModuleName,
nametypes.ModuleName,
rewardtypes.ModuleName,
triggertypes.ModuleName,
oracletypes.ModuleName,

Expand Down Expand Up @@ -1019,7 +1005,6 @@ func New(
name.NewAppModule(appCodec, app.NameKeeper, app.AccountKeeper, app.BankKeeper),
attribute.NewAppModule(appCodec, app.AttributeKeeper, app.AccountKeeper, app.BankKeeper, app.NameKeeper),
msgfeesmodule.NewAppModule(appCodec, app.MsgFeesKeeper, app.interfaceRegistry),
rewardmodule.NewAppModule(appCodec, app.RewardKeeper, app.AccountKeeper, app.BankKeeper),
triggermodule.NewAppModule(appCodec, app.TriggerKeeper, app.AccountKeeper, app.BankKeeper),
oraclemodule.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper, app.IBCKeeper.ChannelKeeper),
holdmodule.NewAppModule(appCodec, app.HoldKeeper),
Expand Down Expand Up @@ -1362,7 +1347,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(attributetypes.ModuleName) // TODO[1760]: params: Migrate attribute params.
paramsKeeper.Subspace(msgfeestypes.ModuleName) // TODO[1760]: params: Migrate msgFees params.
paramsKeeper.Subspace(wasmtypes.ModuleName)
paramsKeeper.Subspace(rewardtypes.ModuleName) // TODO[1760]: params: Migrate reward params.
paramsKeeper.Subspace(triggertypes.ModuleName) // TODO[1760]: params: Migrate trigger params.

// register the key tables for legacy param subspaces
Expand Down
62 changes: 0 additions & 62 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"github.com/provenance-io/provenance/app/params"
"github.com/provenance-io/provenance/internal"
"github.com/provenance-io/provenance/internal/pioconfig"
rewardtypes "github.com/provenance-io/provenance/x/reward/types"
)

// DefaultConsensusParams defines the default Tendermint consensus params used in
Expand Down Expand Up @@ -516,64 +515,3 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
}
return &ed25519.PubKey{Key: pkBytes}
}

// SetupWithGenesisRewardsProgram initializes a new SimApp with the provided
// rewards programs, genesis accounts, validators, and balances.
func SetupWithGenesisRewardsProgram(t *testing.T, nextRewardProgramID uint64, genesisRewards []rewardtypes.RewardProgram, genAccs []authtypes.GenesisAccount, valSet *cmttypes.ValidatorSet, balances ...banktypes.Balance) *App {
t.Helper()

// Make sure there's a validator set with at least one validator in it.
if valSet == nil || len(valSet.Validators) == 0 {
privVal := mock.NewPV()
pubKey, err := privVal.GetPubKey()
require.NoError(t, err)
validator := cmttypes.NewValidator(pubKey, 1)
if valSet == nil {
valSet = cmttypes.NewValidatorSet([]*cmttypes.Validator{validator})
} else {
require.NoError(t, valSet.UpdateWithChangeSet([]*cmttypes.Validator{validator}))
}
}

app, genesisState := setup(t, true, 0, "")
genesisState = genesisStateWithValSet(t, app, genesisState, valSet, genAccs, balances...)
genesisState = genesisStateWithRewards(t, app, genesisState, nextRewardProgramID, genesisRewards)

stateBytes, err := json.MarshalIndent(genesisState, "", " ")
require.NoError(t, err, "marshaling genesis state to json")

_, err = app.InitChain(
&abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
ConsensusParams: DefaultConsensusParams,
AppStateBytes: stateBytes,
},
)
require.NoError(t, err, "InitChain")

_, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: app.LastBlockHeight() + 1,
Hash: app.LastCommitID().Hash,
NextValidatorsHash: valSet.Hash(),
Time: time.Now().UTC(),
})
require.NoError(t, err, "FinalizeBlock")

return app
}

func genesisStateWithRewards(t *testing.T,
app *App, genesisState GenesisState,
nextRewardProgramID uint64, genesisRewards []rewardtypes.RewardProgram,
) GenesisState {
rewardGenesisState := rewardtypes.NewGenesisState(
nextRewardProgramID,
genesisRewards,
[]rewardtypes.ClaimPeriodRewardDistribution{},
[]rewardtypes.RewardAccountState{},
)
var err error
genesisState[rewardtypes.ModuleName], err = app.AppCodec().MarshalJSON(rewardGenesisState)
require.NoError(t, err, "marshaling reward genesis state JSON")
return genesisState
}
Loading

0 comments on commit cdaab53

Please sign in to comment.