Skip to content

Commit

Permalink
Remove fallback regret
Browse files Browse the repository at this point in the history
  • Loading branch information
guilherme-brandao committed Dec 2, 2024
1 parent 9c13d60 commit 5a7708b
Show file tree
Hide file tree
Showing 15 changed files with 884 additions and 1,253 deletions.
3 changes: 0 additions & 3 deletions test/integration/update_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func UpdateParamsChecks(m testCommon.TestConfig) {
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
},
}
Expand Down Expand Up @@ -148,7 +147,6 @@ func UpdateParamsChecks(m testCommon.TestConfig) {
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
},
}
Expand Down Expand Up @@ -212,7 +210,6 @@ func UpdateParamsChecks(m testCommon.TestConfig) {
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
},
}
Expand Down
150 changes: 34 additions & 116 deletions x/emissions/api/emissions/v6/params.pulsar.go

Large diffs are not rendered by default.

1,248 changes: 553 additions & 695 deletions x/emissions/api/emissions/v6/tx.pulsar.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion x/emissions/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3815,7 +3815,6 @@ func mockUninitializedParams() types.Params {
PNormSafeDiv: alloraMath.ZeroDec(),
GlobalWhitelistEnabled: true,
TopicCreatorWhitelistEnabled: true,
FallbackListeningCoefficient: alloraMath.MustNewDecFromString("0.5"),
MinExperiencedWorkerRegrets: int64(10),
}
}
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 @@ -162,9 +162,6 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.UpdateParamsReq
if len(newParams.TopicCreatorWhitelistEnabled) == 1 {
existingParams.TopicCreatorWhitelistEnabled = newParams.TopicCreatorWhitelistEnabled[0]
}
if len(newParams.FallbackListeningCoefficient) == 1 {
existingParams.FallbackListeningCoefficient = newParams.FallbackListeningCoefficient[0]
}
if len(newParams.MinExperiencedWorkerRegrets) == 1 {
existingParams.MinExperiencedWorkerRegrets = newParams.MinExperiencedWorkerRegrets[0]
}
Expand Down
2 changes: 0 additions & 2 deletions x/emissions/keeper/msgserver/msg_server_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func (s *MsgServerTestSuite) TestUpdateAllParams() {
PNormSafeDiv: []alloraMath.Dec{alloraMath.ZeroDec()},
GlobalWhitelistEnabled: []bool{true},
TopicCreatorWhitelistEnabled: []bool{true},
FallbackListeningCoefficient: []alloraMath.Dec{alloraMath.MustNewDecFromString(".1234")},
MinExperiencedWorkerRegrets: []int64{1234},
}

Expand Down Expand Up @@ -175,7 +174,6 @@ func (s *MsgServerTestSuite) TestUpdateParamsNonWhitelistedUser() {
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ func (s *MsgServerTestSuite) TestMsgInsertWorkerPayloadWithFewTopElementsPerFore
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
}

Expand Down Expand Up @@ -764,7 +763,6 @@ func (s *MsgServerTestSuite) TestMsgInsertWorkerPayloadWithLowScoreForecastsAreR
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
}

Expand Down
1 change: 0 additions & 1 deletion x/emissions/migrations/v6/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func MigrateParams(store storetypes.KVStore, cdc codec.BinaryCodec) error {
// NEW PARAMS
GlobalWhitelistEnabled: defaultParams.GlobalWhitelistEnabled,
TopicCreatorWhitelistEnabled: defaultParams.TopicCreatorWhitelistEnabled,
FallbackListeningCoefficient: defaultParams.FallbackListeningCoefficient,
MinExperiencedWorkerRegrets: defaultParams.MinExperiencedWorkerRegrets,
}

Expand Down
1 change: 0 additions & 1 deletion x/emissions/module/rewards/rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,6 @@ func (s *RewardsTestSuite) SetParamsForTest() {
PNormSafeDiv: nil,
GlobalWhitelistEnabled: nil,
TopicCreatorWhitelistEnabled: nil,
FallbackListeningCoefficient: nil,
MinExperiencedWorkerRegrets: nil,
}

Expand Down
6 changes: 1 addition & 5 deletions x/emissions/proto/emissions/v6/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,5 @@ message Params {
bool global_whitelist_enabled = 50; // global whitelist enabled => all global whitelisted actors can create topics
// and participate in all topics as workers and reputers
bool topic_creator_whitelist_enabled = 51; // topic creator whitelist enabled => only topic creator whitelisted actors can create topics
string fallback_listening_coefficient = 52 [
(gogoproto.customtype) = "github.com/allora-network/allora-chain/math.Dec",
(gogoproto.nullable) = false
]; // listening coefficient to be used when there's just one reputer in the topic reward epoch and it has a previous listening coefficients of zero
int64 min_experienced_worker_regrets = 53; // minimum number of experienced workers required to use their regrets for calculating the topic initial regret
int64 min_experienced_worker_regrets = 52; // minimum number of experienced workers required to use their regrets for calculating the topic initial regret
}
6 changes: 1 addition & 5 deletions x/emissions/proto/emissions/v6/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,7 @@ message OptionalParams {
];
repeated bool global_whitelist_enabled = 50;
repeated bool topic_creator_whitelist_enabled = 51;
repeated string fallback_listening_coefficient = 52 [
(gogoproto.customtype) = "github.com/allora-network/allora-chain/math.Dec",
(gogoproto.nullable) = false
];
repeated int64 min_experienced_worker_regrets = 53;
repeated int64 min_experienced_worker_regrets = 52;
}

message UpdateParamsRequest {
Expand Down
11 changes: 0 additions & 11 deletions x/emissions/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func DefaultParams() Params {
PNormSafeDiv: alloraMath.MustNewDecFromString("8.25"), // pnorm divide value to calculate offset with cnorm
GlobalWhitelistEnabled: true, // global whitelist enabled => all global whitelisted actors can create topics and participate in all topics as workers and reputers
TopicCreatorWhitelistEnabled: true, // topic creator whitelist enabled => all topic creator whitelisted actors can create topics
FallbackListeningCoefficient: alloraMath.MustNewDecFromString("0.5"), // listening coefficient to be used when there's just one reputer in the topic reward epoch and it has a previous listening coefficients of zero
MinExperiencedWorkerRegrets: int64(10), // minimum number of experienced workers required to use their regrets for calculating the topic initial regret
}
}
Expand Down Expand Up @@ -193,9 +192,6 @@ func (p Params) Validate() error {
if err := validatePNormSafeDiv(p.PNormSafeDiv); err != nil {
return errorsmod.Wrap(err, "params validation failure: pnorm safe div")
}
if err := validateFallbackListeningCoefficient(p.FallbackListeningCoefficient); err != nil {
return errorsmod.Wrap(err, "params validation failure: fallback listening coefficient")
}
if err := validateMinExperiencedWorkerRegrets(p.MinExperiencedWorkerRegrets); err != nil {
return errorsmod.Wrap(err, "params validation failure: min experienced worker regrets")
}
Expand Down Expand Up @@ -611,13 +607,6 @@ func validateDataSendingFee(i cosmosMath.Int) error {
return nil
}

func validateFallbackListeningCoefficient(i alloraMath.Dec) error {
if err := ValidateDec(i); err != nil {
return err
}
return nil
}

func validateMinExperiencedWorkerRegrets(i int64) error {
if i < 0 {
return ErrValidationMustBeGreaterthanZero
Expand Down
Loading

0 comments on commit 5a7708b

Please sign in to comment.