Skip to content

Commit

Permalink
feat: add reward allocation to stakers
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebraver committed Aug 14, 2024
1 parent 5b8364e commit fd44a24
Show file tree
Hide file tree
Showing 29 changed files with 447 additions and 244 deletions.
1 change: 1 addition & 0 deletions app/ante/cosmos/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewAuthzLimiterDecorator(disabledMsgTypes ...string) AuthzLimiterDecorator

func (ald AuthzLimiterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if err := ald.checkDisabledMsgs(tx.GetMsgs(), false, 1); err != nil {
// nolint:govet
return ctx, errorsmod.Wrapf(errortypes.ErrUnauthorized, err.Error())
}
return next(ctx, tx, simulate)
Expand Down
1 change: 0 additions & 1 deletion precompiles/avs/avs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func (s *AVSManagerPrecompileSuite) TestRegisterAVS() {
for _, tc := range testcases {
tc := tc
s.Run(tc.name, func() {

baseFee := s.App.FeeMarketKeeper.GetBaseFee(s.Ctx)

// malleate testcase
Expand Down
4 changes: 2 additions & 2 deletions precompiles/avs/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package avs_test

import (
"fmt"
"math/big"

avsManagerPrecompile "github.com/ExocoreNetwork/exocore/precompiles/avs"
exocmn "github.com/ExocoreNetwork/exocore/precompiles/common"
"github.com/ExocoreNetwork/exocore/x/operator/types"
"math/big"

"github.com/ethereum/go-ethereum/core/vm"
)
Expand Down Expand Up @@ -102,7 +103,6 @@ func (s *AVSManagerPrecompileSuite) TestGetOptedInOperatorAccAddrs() {
s.Require().NoError(err, "failed to unpack output", err)
s.Require().Equal(1, len(out))
s.Require().Equal(operatorAddress, out[0])

},
100000,
false,
Expand Down
1 change: 1 addition & 0 deletions precompiles/testutil/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func CheckLogs(logArgs LogCheckArgs) error {
)
}

// nolint:govet
if err := CheckVMError(logArgs.Res, logArgs.ErrContains); err != nil {
return err
}
Expand Down
22 changes: 0 additions & 22 deletions proto/buf.gen.pulsar.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions proto/buf.gen.sta.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions proto/buf.gen.ts.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions proto/exocore/feedistribute/v1/distribution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ message ValidatorOutstandingRewards {
];
}

// StakerOutstandingRewards represents outstanding (un-withdrawn) rewards
// for a staker inexpensive to track, allows simple sanity checks.
message StakerOutstandingRewards {
// rewards represents the rewards for the operator
repeated cosmos.base.v1beta1.DecCoin rewards = 1 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
}

// FeePool is the global fee pool for distribution.
// It holds decimal coins. Once whole those coins can be burned or distributed to the community pool.
message FeePool {
Expand Down
2 changes: 2 additions & 0 deletions testutil/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func BroadcastTxBytes(app *app.ExocoreApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (
req := abci.RequestDeliverTx{Tx: bz}
res := app.BaseApp.DeliverTx(req)
if res.Code != 0 {
// nolint:govet
return abci.ResponseDeliverTx{}, errorsmod.Wrapf(errortypes.ErrInvalidRequest, res.Log)
}

Expand Down Expand Up @@ -238,6 +239,7 @@ func checkTxBytes(app *app.ExocoreApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (abci
req := abci.RequestCheckTx{Tx: bz}
res := app.BaseApp.CheckTx(req)
if res.Code != 0 {
// nolint:govet
return abci.ResponseCheckTx{}, errorsmod.Wrapf(errortypes.ErrInvalidRequest, res.Log)
}

Expand Down
7 changes: 1 addition & 6 deletions x/assets/types/tx.pb.gw.go

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

2 changes: 0 additions & 2 deletions x/avs/keeper/avs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func (suite *AVSTestSuite) TestAVS() {
suite.Equal(found, true)
suite.Equal(epoch.CurrentEpoch, int64(2))
suite.CommitAfter(48*time.Hour + time.Nanosecond)

}

func (suite *AVSTestSuite) TestAVSInfoUpdate_Register() {
Expand Down Expand Up @@ -157,5 +156,4 @@ func (suite *AVSTestSuite) TestAVSInfoUpdateWithOperator_Register() {

err = suite.App.AVSManagerKeeper.OperatorOptAction(suite.Ctx, operatorParams)
suite.NoError(err)

}
13 changes: 1 addition & 12 deletions x/avs/types/query.pb.gw.go

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

13 changes: 1 addition & 12 deletions x/avs/types/tx.pb.gw.go

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

2 changes: 1 addition & 1 deletion x/delegation/keeper/delegation_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (k *Keeper) DeleteStakersListForOperator(ctx sdk.Context, operator, assetID
return nil
}

func (k *Keeper) GetStakersByOperator(ctx sdk.Context, operator, assetID string) (delegationtype.StakerList, error) {
func (k Keeper) GetStakersByOperator(ctx sdk.Context, operator, assetID string) (delegationtype.StakerList, error) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixStakersByOperator)
Key := assetstype.GetJoinedStoreKey(operator, assetID)
value := store.Get(Key)
Expand Down
Loading

0 comments on commit fd44a24

Please sign in to comment.