Skip to content

Commit

Permalink
rm reward cadence env var (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpeluso authored May 15, 2024
1 parent 2551a64 commit 0d7fa9b
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 23 deletions.
2 changes: 0 additions & 2 deletions x/emissions/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,6 @@ func (s *KeeperTestSuite) TestSetParams() {

params := types.Params{
Version: "v1.0.0",
RewardCadence: 60 * 60 * 24 * 7 * 24,
MinTopicWeight: alloraMath.NewDecFromInt64(100),
MaxTopicsPerBlock: 1000,
MaxMissingInferencePercent: alloraMath.NewDecFromInt64(10),
Expand Down Expand Up @@ -1502,7 +1501,6 @@ func (s *KeeperTestSuite) TestSetParams() {
paramsFromKeeper, err := keeper.GetParams(ctx)
s.Require().NoError(err)
s.Require().Equal(params.Version, paramsFromKeeper.Version, "Params should be equal to the set params: Version")
s.Require().Equal(params.RewardCadence, paramsFromKeeper.RewardCadence, "Params should be equal to the set params: EpochLength")
s.Require().True(params.MinTopicWeight.Equal(paramsFromKeeper.MinTopicWeight), "Params should be equal to the set params: MinTopicWeight")
s.Require().Equal(params.MaxTopicsPerBlock, paramsFromKeeper.MaxTopicsPerBlock, "Params should be equal to the set params: MaxTopicsPerBlock")
s.Require().Equal(params.MaxMissingInferencePercent, paramsFromKeeper.MaxMissingInferencePercent, "Params should be equal to the set params: MaxMissingInferencePercent")
Expand Down
3 changes: 0 additions & 3 deletions x/emissions/keeper/msgserver/msg_server_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
if len(newParams.Version) == 1 {
existingParams.Version = newParams.Version[0]
}
if len(newParams.RewardCadence) == 1 {
existingParams.RewardCadence = newParams.RewardCadence[0]
}
if len(newParams.MinTopicWeight) == 1 {
existingParams.MinTopicWeight = newParams.MinTopicWeight[0]
}
Expand Down
3 changes: 0 additions & 3 deletions x/emissions/keeper/msgserver/msg_server_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func (s *KeeperTestSuite) TestUpdateParams() {
require.Equal(uint64(20), updatedParams.MaxTopicsPerBlock)

require.Equal(existingParams.Version, updatedParams.Version)
require.Equal(existingParams.RewardCadence, updatedParams.RewardCadence)
}

func (s *KeeperTestSuite) TestUpdateAllParams() {
Expand All @@ -57,7 +56,6 @@ func (s *KeeperTestSuite) TestUpdateAllParams() {

newParams := &types.OptionalParams{
Version: []string{"1234"},
RewardCadence: []int64{1234},
MinTopicWeight: []alloraMath.Dec{alloraMath.NewDecFromInt64(1234)},
MaxTopicsPerBlock: []uint64{1234},
MaxMissingInferencePercent: []alloraMath.Dec{alloraMath.NewDecFromInt64(1234)},
Expand Down Expand Up @@ -110,7 +108,6 @@ func (s *KeeperTestSuite) TestUpdateAllParams() {
require.NoError(err)

require.Equal(newParams.Version[0], updatedParams.Version)
require.Equal(newParams.RewardCadence[0], updatedParams.RewardCadence)
require.Equal(newParams.MinTopicWeight[0], updatedParams.MinTopicWeight)
require.Equal(newParams.MaxTopicsPerBlock[0], updatedParams.MaxTopicsPerBlock)
require.Equal(newParams.MaxMissingInferencePercent[0], updatedParams.MaxMissingInferencePercent)
Expand Down
4 changes: 1 addition & 3 deletions x/emissions/keeper/queryserver/query_server_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ func (s *KeeperTestSuite) TestParams() {
queryServer := s.queryServer

expectedParams := types.Params{
Version: "1.0",
RewardCadence: 86400,
Version: "1.0",
}

err := keeper.SetParams(ctx, expectedParams)
Expand All @@ -20,5 +19,4 @@ func (s *KeeperTestSuite) TestParams() {
s.Require().NoError(err, "Retrieving parameters should not produce an error")
s.Require().NotNil(response, "The response should not be nil")
s.Require().Equal(expectedParams.Version, response.Params.Version)
s.Require().Equal(expectedParams.RewardCadence, response.Params.RewardCadence)
}
1 change: 0 additions & 1 deletion x/emissions/module/rewards/topic_skimming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
func (s *RewardsTestSuite) UtilSetParams() {
s.emissionsKeeper.SetParams(s.ctx, types.Params{
Version: "0.0.3",
RewardCadence: int64(5),
MinTopicWeight: alloraMath.NewDecFromInt64(100),
MaxTopicsPerBlock: uint64(1000),
MaxMissingInferencePercent: alloraMath.MustNewDecFromString("0.1"),
Expand Down
5 changes: 2 additions & 3 deletions x/emissions/proto/emissions/v1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import "gogoproto/gogo.proto";

// Params defines the parameters of the module.
message Params {
string version = 1; // version of the protocol should be in lockstep with github release tag version
int64 reward_cadence = 2; // length of an "epoch" for rewards payouts in blocks
string version = 1; // version of the protocol should be in lockstep with github release tag version
int64 max_serialized_msg_length = 2; // max length of input data for msg and query server calls
string min_topic_weight = 3 [
(gogoproto.customtype) = "github.com/allora-network/allora-chain/math.Dec",
(gogoproto.nullable) = false
Expand Down Expand Up @@ -117,5 +117,4 @@ message Params {
uint64 max_limit = 37; // max limit for pagination
int64 min_epoch_length_record_limit =
38; // min number of epochs to keep network losses, reputer losses, inferences, forecasts
int64 max_serialized_msg_length = 39; // max length of input data for msg and query server calls
}
3 changes: 1 addition & 2 deletions x/emissions/proto/emissions/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ service Msg {
// same as if the field was not set
message OptionalParams {
repeated string version = 1;
repeated int64 reward_cadence = 2;
repeated int64 max_serialized_msg_length = 2;
repeated string min_topic_weight = 3
[(gogoproto.customtype) = "github.com/allora-network/allora-chain/math.Dec", (gogoproto.nullable) = false];
repeated uint64 max_topics_per_block = 4;
Expand Down Expand Up @@ -128,7 +128,6 @@ message OptionalParams {
repeated uint64 default_limit = 36;
repeated uint64 max_limit = 37;
repeated int64 min_epoch_length_record_limit = 38;
repeated int64 max_serialized_msg_length = 39;
}

message MsgUpdateParams {
Expand Down
7 changes: 1 addition & 6 deletions x/emissions/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type BlockHeight = int64
func DefaultParams() Params {
return Params{
Version: "0.0.3", // version of the protocol should be in lockstep with github release tag version
RewardCadence: int64(1), // length of an "epoch" for rewards payouts in blocks; coupled with TopicRewardAlpha
MinTopicWeight: alloraMath.MustNewDecFromString("100"), // total weight for a topic < this => don't run inference solicatation or loss update
MaxTopicsPerBlock: uint64(128), // max number of topics to run cadence for per block
MaxMissingInferencePercent: alloraMath.MustNewDecFromString("0.2"), // if a worker has this percentage of inferences missing, they are penalized
Expand All @@ -31,7 +30,7 @@ func DefaultParams() Params {
MaxUnfulfilledReputerRequests: uint64(100), // maximum number of outstanding nonces for reputer requests per topic from the chain
TopicRewardStakeImportance: alloraMath.MustNewDecFromString("0.5"), // importance of stake in determining rewards for a topic
TopicRewardFeeRevenueImportance: alloraMath.MustNewDecFromString("0.5"), // importance of fee revenue in determining rewards for a topic
TopicRewardAlpha: alloraMath.MustNewDecFromString("0.5"), // alpha for topic reward calculation; coupled with RewardCadence
TopicRewardAlpha: alloraMath.MustNewDecFromString("0.5"), // alpha for topic reward calculation; coupled with blocktime, or how often rewards are calculated
TaskRewardAlpha: alloraMath.MustNewDecFromString("0.1"), // alpha for task reward calculation used to calculate ~U_ij, ~V_ik, ~W_im
ValidatorsVsAlloraPercentReward: alloraMath.MustNewDecFromString("0.25"), // 25% rewards go to cosmos network validators
MaxSamplesToScaleScores: uint64(10), // maximum number of previous scores to store and use for standard deviation calculation
Expand All @@ -56,10 +55,6 @@ func DefaultParamsVersion() string {
return DefaultParams().Version
}

func DefaultParamsEpochLength() BlockHeight {
return DefaultParams().RewardCadence
}

func DefaultParamsMinTopicUnmetDemand() alloraMath.Dec {
return DefaultParams().MinTopicWeight
}
Expand Down

0 comments on commit 0d7fa9b

Please sign in to comment.