From 1df2ddfcd04adc37c68c8ed7eb7fa5db5c5e87ee Mon Sep 17 00:00:00 2001 From: TimmyExogenous Date: Mon, 25 Mar 2024 17:37:36 +0800 Subject: [PATCH] implement the interfaces expected by dogfood --- Makefile | 7 +- proto/exocore/operator/v1/tx.proto | 11 + x/dogfood/keeper/impl_sdk.go | 22 +- x/dogfood/types/expected_keepers.go | 5 +- x/operator/keeper/consensus_keys.go | 26 +- x/operator/keeper/operator.go | 39 ++- x/operator/keeper/operator_info_test.go | 4 + x/operator/keeper/opt.go | 274 +++++++++++++++ .../keeper/{state_update.go => slash.go} | 331 ++++-------------- x/operator/types/expected_keepers.go | 12 + x/operator/types/tx.pb.go | 277 +++++++++++---- 11 files changed, 642 insertions(+), 366 deletions(-) create mode 100644 x/operator/keeper/opt.go rename x/operator/keeper/{state_update.go => slash.go} (53%) diff --git a/Makefile b/Makefile index 5fa3aa0ce..922f6a15b 100644 --- a/Makefile +++ b/Makefile @@ -430,7 +430,7 @@ proto-download-deps: git remote add origin "https://github.com/cosmos/cosmos-sdk.git" && \ git config core.sparseCheckout true && \ printf "proto\nthird_party\n" > .git/info/sparse-checkout && \ - git pull origin main && \ + git pull origin release/v0.47.x && \ rm -f ./proto/buf.* && \ mv ./proto/* .. rm -rf "$(THIRD_PARTY_DIR)/cosmos_tmp" @@ -441,7 +441,7 @@ proto-download-deps: git remote add origin "https://github.com/cosmos/ibc-go.git" && \ git config core.sparseCheckout true && \ printf "proto\n" > .git/info/sparse-checkout && \ - git pull origin main && \ + git pull origin release/v7.2.x && \ rm -f ./proto/buf.* && \ mv ./proto/* .. rm -rf "$(THIRD_PARTY_DIR)/ibc_tmp" @@ -452,7 +452,8 @@ proto-download-deps: git remote add origin "https://github.com/cosmos/cosmos-proto.git" && \ git config core.sparseCheckout true && \ printf "proto\n" > .git/info/sparse-checkout && \ - git pull origin main && \ + git fetch origin tags/v1.0.0-beta.3 && \ + git checkout -b my_branch FETCH_HEAD && \ rm -f ./proto/buf.* && \ mv ./proto/* .. rm -rf "$(THIRD_PARTY_DIR)/cosmos_proto_tmp" diff --git a/proto/exocore/operator/v1/tx.proto b/proto/exocore/operator/v1/tx.proto index ce386e4b0..1d25c53cf 100644 --- a/proto/exocore/operator/v1/tx.proto +++ b/proto/exocore/operator/v1/tx.proto @@ -3,6 +3,7 @@ package exocore.operator.v1; import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; +import "cosmos/staking/v1beta1/staking.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; @@ -45,6 +46,14 @@ message OperatorInfo { string operator_meta_info = 3; // client_chain_earning_addr_list is the client chain earning address list. ClientChainEarningAddrList client_chain_earnings_addr = 4; + // commission defines the commission parameters. + cosmos.staking.v1beta1.Commission commission = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // min_self_delegation is the validator's self declared minimum self delegation. + string min_self_delegation = 6 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; } // OptedInfo is the opted information about operator @@ -55,6 +64,8 @@ message OptedInfo { uint64 opted_in_height = 2; // opted_out_height is the exocore block height at which the operator opted out uint64 opted_out_height = 3; + // jailed defined whether the operator has been jailed from bonded status or not. + bool jailed = 4; } // OptedInAssetState is the state of opted-in asset diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index 99e30d259..759b87c84 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -61,15 +61,8 @@ func (k Keeper) ValidatorByConsAddr( ctx sdk.Context, addr sdk.ConsAddress, ) stakingtypes.ValidatorI { - found, accAddr := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( - ctx, ctx.ChainID(), addr, - ) - if !found { - // replicate the behavior of the SDK's staking module; do not panic. - return nil - } return stakingtypes.Validator{ - Jailed: k.operatorKeeper.IsOperatorJailedForChainID(ctx, accAddr, ctx.ChainID()), + Jailed: k.operatorKeeper.IsOperatorJailedForChainID(ctx, addr, ctx.ChainID()), } } @@ -123,8 +116,8 @@ func (k Keeper) Jail(ctx sdk.Context, addr sdk.ConsAddress) { // The function is called by the slashing module only when it receives a request from the // operator to do so. TODO(mm): We need to use the SDK's slashing module to allow for downtime // slashing but somehow we need to prevent its Unjail function from being called by anyone. -func (k Keeper) Unjail(sdk.Context, sdk.ConsAddress) { - panic("unimplemented on this keeper") +func (k Keeper) Unjail(ctx sdk.Context, addr sdk.ConsAddress) { + k.operatorKeeper.Unjail(ctx, addr, ctx.ChainID()) } // Delegation is an implementation of the staking interface expected by the SDK's slashing @@ -154,14 +147,7 @@ func (k Keeper) GetAllValidators(sdk.Context) (validators []stakingtypes.Validat // slashing module. It is called by the slashing module to record validator signatures // for downtime tracking. We delegate the call to the operator keeper. func (k Keeper) IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool { - found, accAddr := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( - ctx, ctx.ChainID(), addr, - ) - if !found { - // replicate the behavior of the SDK's staking module - return false - } - return k.operatorKeeper.IsOperatorJailedForChainID(ctx, accAddr, ctx.ChainID()) + return k.operatorKeeper.IsOperatorJailedForChainID(ctx, addr, ctx.ChainID()) } // ApplyAndReturnValidatorSetUpdates is an implementation of the staking interface expected diff --git a/x/dogfood/types/expected_keepers.go b/x/dogfood/types/expected_keepers.go index a14789775..3c6146ab5 100644 --- a/x/dogfood/types/expected_keepers.go +++ b/x/dogfood/types/expected_keepers.go @@ -53,10 +53,11 @@ type OperatorKeeper interface { GetOperatorAddressForChainIDAndConsAddr( sdk.Context, string, sdk.ConsAddress, ) (bool, sdk.AccAddress) - IsOperatorJailedForChainID(sdk.Context, sdk.AccAddress, string) bool + IsOperatorJailedForChainID(sdk.Context, sdk.ConsAddress, string) bool Jail(sdk.Context, sdk.ConsAddress, string) + Unjail(sdk.Context, sdk.ConsAddress, string) // GetActiveOperatorsForChainID should return a list of operators and their public keys. - // These operators should not be in the process of opting our, and should not be jailed + // These operators should not be in the process of opting out, and should not be jailed // whether permanently or temporarily. GetActiveOperatorsForChainID( sdk.Context, string, diff --git a/x/operator/keeper/consensus_keys.go b/x/operator/keeper/consensus_keys.go index c6fd55434..52d154573 100644 --- a/x/operator/keeper/consensus_keys.go +++ b/x/operator/keeper/consensus_keys.go @@ -418,14 +418,24 @@ func (k *Keeper) CompleteOperatorOptOutFromChainID( store.Delete(types.KeyForOperatorOptOutFromChainID(opAccAddr, chainID)) } -// IsOperatorJailedForChainID add for dogfood -func (k *Keeper) IsOperatorJailedForChainID(sdk.Context, sdk.AccAddress, string) bool { - return false -} -func (k *Keeper) Jail(sdk.Context, sdk.ConsAddress, string) {} - func (k *Keeper) GetActiveOperatorsForChainID( - sdk.Context, string, + ctx sdk.Context, chainID string, ) ([]sdk.AccAddress, []tmprotocrypto.PublicKey) { - return nil, nil + operatorsAddr, pks := k.GetOperatorsForChainID(ctx, chainID) + avsAddr, err := k.avsKeeper.GetAvsAddrByChainID(ctx, chainID) + if err != nil { + k.Logger(ctx).Error(err.Error(), chainID) + return nil, nil + } + + activeOperator := make([]sdk.AccAddress, 0) + activePks := make([]tmprotocrypto.PublicKey, 0) + // check if the operator is active + for i, operator := range operatorsAddr { + if k.IsActive(ctx, operator.String(), avsAddr) { + activeOperator = append(activeOperator, operator) + activePks = append(activePks, pks[i]) + } + } + return activeOperator, activePks } diff --git a/x/operator/keeper/operator.go b/x/operator/keeper/operator.go index 9ef38595a..022092bf6 100644 --- a/x/operator/keeper/operator.go +++ b/x/operator/keeper/operator.go @@ -54,7 +54,30 @@ func (k *Keeper) IsOperator(ctx sdk.Context, addr sdk.AccAddress) bool { return store.Has(addr) } -func (k *Keeper) UpdateOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string, info *operatortypes.OptedInfo) error { +func (k *Keeper) HandleOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string, handleFunc func(info *operatortypes.OptedInfo)) error { + opAccAddr, err := sdk.AccAddressFromBech32(operatorAddr) + if err != nil { + return errorsmod.Wrap(err, "HandleOptedInfo: error occurred when parse acc address from Bech32") + } + store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo) + infoKey := assetstype.GetJoinedStoreKey(operatorAddr, avsAddr) + ifExist := store.Has(infoKey) + if !ifExist { + return errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("HandleOptedInfo: key is %suite", opAccAddr)) + } + // get info from the store + value := store.Get(infoKey) + info := &operatortypes.OptedInfo{} + k.cdc.MustUnmarshal(value, info) + // call the handleFunc + handleFunc(info) + // restore the info after handling + bz := k.cdc.MustMarshal(info) + store.Set(infoKey, bz) + return nil +} + +func (k *Keeper) SetOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string, info *operatortypes.OptedInfo) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo) // check operator address validation @@ -99,6 +122,20 @@ func (k *Keeper) IsOptedIn(ctx sdk.Context, operatorAddr, avsAddr string) bool { return true } +func (k *Keeper) IsActive(ctx sdk.Context, operatorAddr, avsAddr string) bool { + optedInfo, err := k.GetOptedInfo(ctx, operatorAddr, avsAddr) + if err != nil { + return false + } + if optedInfo.OptedOutHeight != operatortypes.DefaultOptedOutHeight { + return false + } + if optedInfo.Jailed { + return false + } + return true +} + func (k *Keeper) GetOptedInAVSForOperator(ctx sdk.Context, operatorAddr string) ([]string, error) { // get all opted-in info store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo) diff --git a/x/operator/keeper/operator_info_test.go b/x/operator/keeper/operator_info_test.go index 6c4109d35..5e435e526 100644 --- a/x/operator/keeper/operator_info_test.go +++ b/x/operator/keeper/operator_info_test.go @@ -1,8 +1,10 @@ package keeper_test import ( + "cosmossdk.io/math" "github.com/ExocoreNetwork/exocore/x/assets/types" operatortype "github.com/ExocoreNetwork/exocore/x/operator/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) func (suite *OperatorTestSuite) TestOperatorInfo() { @@ -15,6 +17,8 @@ func (suite *OperatorTestSuite) TestOperatorInfo() { {101, "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"}, }, }, + Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), + MinSelfDelegation: math.NewInt(0), } err := suite.App.OperatorKeeper.SetOperatorInfo(suite.Ctx, suite.AccAddress.String(), info) suite.NoError(err) diff --git a/x/operator/keeper/opt.go b/x/operator/keeper/opt.go new file mode 100644 index 000000000..2c67885a7 --- /dev/null +++ b/x/operator/keeper/opt.go @@ -0,0 +1,274 @@ +package keeper + +import ( + "fmt" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + + "github.com/ExocoreNetwork/exocore/x/operator/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type AssetPriceAndDecimal struct { + Price sdkmath.Int + PriceDecimal uint8 + Decimal uint32 +} + +type slashAmounts struct { + AmountFromUnbonding sdkmath.Int + AmountFromOptedIn sdkmath.Int +} +type SlashAssets struct { + slashStakerInfo map[string]map[string]*slashAmounts + slashOperatorInfo map[string]*slashAmounts +} + +// UpdateOptedInAssetsState will update the USD share state related to asset, operator and AVS when +// the asset amount changes caused by delegation, undelegation, slashStaker and slashOperator. +func (k *Keeper) UpdateOptedInAssetsState(ctx sdk.Context, stakerID, assetID, operatorAddr string, opAmount sdkmath.Int) error { + // get the AVS opted-in by the operator + avsList, err := k.GetOptedInAVSForOperator(ctx, operatorAddr) + if err != nil { + return err + } + // get price and priceDecimal from oracle + price, decimal, err := k.oracleKeeper.GetSpecifiedAssetsPrice(ctx, assetID) + if err != nil { + return err + } + + // get the decimal of asset + assetInfo, err := k.assetsKeeper.GetStakingAssetInfo(ctx, assetID) + if err != nil { + return err + } + opUSDValue := CalculateShare(opAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) + for _, avs := range avsList { + // get the assets supported by the AVS + avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avs) + if err != nil { + return err + } + + if _, ok := avsSupportedAssets[assetID]; ok { + // UpdateStakerShare + err = k.UpdateStakerShare(ctx, avs, stakerID, operatorAddr, opUSDValue) + if err != nil { + return err + } + + // UpdateStateForAsset + changeState := types.OptedInAssetStateChange{ + Amount: opAmount, + Value: opUSDValue, + } + err = k.UpdateStateForAsset(ctx, assetID, avs, operatorAddr, changeState) + if err != nil { + return err + } + + // UpdateOperatorShare + err = k.UpdateOperatorShare(ctx, avs, operatorAddr, opUSDValue) + if err != nil { + return err + } + + // UpdateAVSShare + err = k.UpdateAVSShare(ctx, avs, opUSDValue) + if err != nil { + return err + } + } + } + return nil +} + +// OptIn call this function to opt in AVS +func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { + // check optedIn info + if k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { + return types.ErrAlreadyOptedIn + } + // get the assets supported by the AVS + avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avsAddr) + if err != nil { + return err + } + + // get the Assets opted in the operator + operatorAssets, err := k.assetsKeeper.GetOperatorAssetInfos(ctx, operatorAddress, avsSupportedAssets) + if err != nil { + return err + } + + totalAssetUSDValue := sdkmath.LegacyNewDec(0) + operatorOwnAssetUSDValue := sdkmath.LegacyNewDec(0) + assetFilter := make(map[string]interface{}) + assetInfoRecord := make(map[string]*AssetPriceAndDecimal) + + for assetID, operatorAssetState := range operatorAssets { + // get price and priceDecimal from oracle + price, decimal, err := k.oracleKeeper.GetSpecifiedAssetsPrice(ctx, assetID) + if err != nil { + return err + } + + // get the decimal of asset + assetInfo, err := k.assetsKeeper.GetStakingAssetInfo(ctx, assetID) + if err != nil { + return err + } + assetInfoRecord[assetID] = &AssetPriceAndDecimal{ + Price: price, + PriceDecimal: decimal, + Decimal: assetInfo.AssetBasicInfo.Decimals, + } + assetUSDValue := CalculateShare(operatorAssetState.TotalAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) + operatorUSDValue := CalculateShare(operatorAssetState.OperatorAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) + operatorOwnAssetUSDValue = operatorOwnAssetUSDValue.Add(operatorUSDValue) + + // UpdateStateForAsset + changeState := types.OptedInAssetStateChange{ + Amount: operatorAssetState.TotalAmount, + Value: assetUSDValue, + } + err = k.UpdateStateForAsset(ctx, assetID, avsAddr, operatorAddress.String(), changeState) + if err != nil { + return err + } + totalAssetUSDValue = totalAssetUSDValue.Add(assetUSDValue) + assetFilter[assetID] = nil + } + + // update the share value of operator itself, the input stakerID should be empty + err = k.UpdateStakerShare(ctx, avsAddr, "", operatorAddress.String(), operatorOwnAssetUSDValue) + if err != nil { + return err + } + + // UpdateAVSShare + err = k.UpdateAVSShare(ctx, avsAddr, totalAssetUSDValue) + if err != nil { + return err + } + // UpdateOperatorShare + err = k.UpdateOperatorShare(ctx, avsAddr, operatorAddress.String(), totalAssetUSDValue) + if err != nil { + return err + } + + // UpdateStakerShare + relatedAssetsState, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetFilter) + if err != nil { + return err + } + + for stakerID, assetState := range relatedAssetsState { + stakerAssetsUSDValue := sdkmath.LegacyNewDec(0) + for assetID, amount := range assetState { + singleAssetUSDValue := CalculateShare(amount.UndelegatableAmount, assetInfoRecord[assetID].Price, assetInfoRecord[assetID].Decimal, assetInfoRecord[assetID].PriceDecimal) + stakerAssetsUSDValue = stakerAssetsUSDValue.Add(singleAssetUSDValue) + } + + err = k.UpdateStakerShare(ctx, avsAddr, stakerID, operatorAddress.String(), stakerAssetsUSDValue) + if err != nil { + return err + } + } + + // update opted-in info + slashContract, err := k.avsKeeper.GetAvsSlashContract(ctx, avsAddr) + if err != nil { + return err + } + optedInfo := &types.OptedInfo{ + SlashContract: slashContract, + // #nosec G701 + OptedInHeight: uint64(ctx.BlockHeight()), + OptedOutHeight: types.DefaultOptedOutHeight, + } + err = k.SetOptedInfo(ctx, operatorAddress.String(), avsAddr, optedInfo) + if err != nil { + return err + } + return nil +} + +// OptOut call this function to opt out of AVS +func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { + // check optedIn info + if !k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { + return types.ErrNotOptedIn + } + + // get the assets supported by the AVS + avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avsAddr) + if err != nil { + return err + } + // get the Assets opted in the operator + operatorAssets, err := k.assetsKeeper.GetOperatorAssetInfos(ctx, operatorAddress, avsSupportedAssets) + if err != nil { + return err + } + + assetFilter := make(map[string]interface{}) + + for assetID := range operatorAssets { + err = k.DeleteAssetState(ctx, assetID, avsAddr, operatorAddress.String()) + if err != nil { + return err + } + assetFilter[assetID] = nil + } + + avsOperatorTotalValue, err := k.GetOperatorShare(ctx, avsAddr, operatorAddress.String()) + if err != nil { + return err + } + if avsOperatorTotalValue.IsNegative() { + return errorsmod.Wrap(types.ErrTheValueIsNegative, fmt.Sprintf("OptOut,avsOperatorTotalValue:%suite", avsOperatorTotalValue)) + } + + // delete the share value of operator itself, the input stakerID should be empty + err = k.DeleteStakerShare(ctx, avsAddr, "", operatorAddress.String()) + if err != nil { + return err + } + + // UpdateAVSShare + err = k.UpdateAVSShare(ctx, avsAddr, avsOperatorTotalValue.Neg()) + if err != nil { + return err + } + // DeleteOperatorShare + err = k.DeleteOperatorShare(ctx, avsAddr, operatorAddress.String()) + if err != nil { + return err + } + + // DeleteStakerShare + relatedAssetsState, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetFilter) + if err != nil { + return err + } + for stakerID := range relatedAssetsState { + err = k.DeleteStakerShare(ctx, avsAddr, stakerID, operatorAddress.String()) + if err != nil { + return err + } + } + + // set opted-out height + handleFunc := func(info *types.OptedInfo) { + // #nosec G701 + info.OptedOutHeight = uint64(ctx.BlockHeight()) + } + err = k.HandleOptedInfo(ctx, operatorAddress.String(), avsAddr, handleFunc) + if err != nil { + return err + } + return nil +} diff --git a/x/operator/keeper/state_update.go b/x/operator/keeper/slash.go similarity index 53% rename from x/operator/keeper/state_update.go rename to x/operator/keeper/slash.go index e047ebb6e..f996b3e77 100644 --- a/x/operator/keeper/state_update.go +++ b/x/operator/keeper/slash.go @@ -6,277 +6,12 @@ import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" - types2 "github.com/ExocoreNetwork/exocore/x/assets/types" + assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" delegationtype "github.com/ExocoreNetwork/exocore/x/delegation/types" "github.com/ExocoreNetwork/exocore/x/operator/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -type AssetPriceAndDecimal struct { - Price sdkmath.Int - PriceDecimal uint8 - Decimal uint32 -} - -type slashAmounts struct { - AmountFromUnbonding sdkmath.Int - AmountFromOptedIn sdkmath.Int -} -type SlashAssets struct { - slashStakerInfo map[string]map[string]*slashAmounts - slashOperatorInfo map[string]*slashAmounts -} - -// UpdateOptedInAssetsState will update the USD share state related to asset, operator and AVS when -// the asset amount changes caused by delegation, undelegation, slashStaker and slashOperator. -func (k *Keeper) UpdateOptedInAssetsState(ctx sdk.Context, stakerID, assetID, operatorAddr string, opAmount sdkmath.Int) error { - // get the AVS opted-in by the operator - avsList, err := k.GetOptedInAVSForOperator(ctx, operatorAddr) - if err != nil { - return err - } - // get price and priceDecimal from oracle - price, decimal, err := k.oracleKeeper.GetSpecifiedAssetsPrice(ctx, assetID) - if err != nil { - return err - } - - // get the decimal of asset - assetInfo, err := k.assetsKeeper.GetStakingAssetInfo(ctx, assetID) - if err != nil { - return err - } - opUSDValue := CalculateShare(opAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) - for _, avs := range avsList { - // get the assets supported by the AVS - avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avs) - if err != nil { - return err - } - - if _, ok := avsSupportedAssets[assetID]; ok { - // UpdateStakerShare - err = k.UpdateStakerShare(ctx, avs, stakerID, operatorAddr, opUSDValue) - if err != nil { - return err - } - - // UpdateStateForAsset - changeState := types.OptedInAssetStateChange{ - Amount: opAmount, - Value: opUSDValue, - } - err = k.UpdateStateForAsset(ctx, assetID, avs, operatorAddr, changeState) - if err != nil { - return err - } - - // UpdateOperatorShare - err = k.UpdateOperatorShare(ctx, avs, operatorAddr, opUSDValue) - if err != nil { - return err - } - - // UpdateAVSShare - err = k.UpdateAVSShare(ctx, avs, opUSDValue) - if err != nil { - return err - } - } - } - return nil -} - -// OptIn call this function to opt in AVS -func (k *Keeper) OptIn(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { - // check optedIn info - if k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { - return types.ErrAlreadyOptedIn - } - // get the assets supported by the AVS - avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avsAddr) - if err != nil { - return err - } - - // get the Assets opted in the operator - operatorAssets, err := k.assetsKeeper.GetOperatorAssetInfos(ctx, operatorAddress, avsSupportedAssets) - if err != nil { - return err - } - - totalAssetUSDValue := sdkmath.LegacyNewDec(0) - operatorOwnAssetUSDValue := sdkmath.LegacyNewDec(0) - assetFilter := make(map[string]interface{}) - assetInfoRecord := make(map[string]*AssetPriceAndDecimal) - - for assetID, operatorAssetState := range operatorAssets { - // get price and priceDecimal from oracle - price, decimal, err := k.oracleKeeper.GetSpecifiedAssetsPrice(ctx, assetID) - if err != nil { - return err - } - - // get the decimal of asset - assetInfo, err := k.assetsKeeper.GetStakingAssetInfo(ctx, assetID) - if err != nil { - return err - } - assetInfoRecord[assetID] = &AssetPriceAndDecimal{ - Price: price, - PriceDecimal: decimal, - Decimal: assetInfo.AssetBasicInfo.Decimals, - } - assetUSDValue := CalculateShare(operatorAssetState.TotalAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) - operatorUSDValue := CalculateShare(operatorAssetState.OperatorAmount, price, assetInfo.AssetBasicInfo.Decimals, decimal) - operatorOwnAssetUSDValue = operatorOwnAssetUSDValue.Add(operatorUSDValue) - - // UpdateStateForAsset - changeState := types.OptedInAssetStateChange{ - Amount: operatorAssetState.TotalAmount, - Value: assetUSDValue, - } - err = k.UpdateStateForAsset(ctx, assetID, avsAddr, operatorAddress.String(), changeState) - if err != nil { - return err - } - totalAssetUSDValue = totalAssetUSDValue.Add(assetUSDValue) - assetFilter[assetID] = nil - } - - // update the share value of operator itself, the input stakerID should be empty - err = k.UpdateStakerShare(ctx, avsAddr, "", operatorAddress.String(), operatorOwnAssetUSDValue) - if err != nil { - return err - } - - // UpdateAVSShare - err = k.UpdateAVSShare(ctx, avsAddr, totalAssetUSDValue) - if err != nil { - return err - } - // UpdateOperatorShare - err = k.UpdateOperatorShare(ctx, avsAddr, operatorAddress.String(), totalAssetUSDValue) - if err != nil { - return err - } - - // UpdateStakerShare - relatedAssetsState, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetFilter) - if err != nil { - return err - } - - for stakerID, assetState := range relatedAssetsState { - stakerAssetsUSDValue := sdkmath.LegacyNewDec(0) - for assetID, amount := range assetState { - singleAssetUSDValue := CalculateShare(amount.UndelegatableAmount, assetInfoRecord[assetID].Price, assetInfoRecord[assetID].Decimal, assetInfoRecord[assetID].PriceDecimal) - stakerAssetsUSDValue = stakerAssetsUSDValue.Add(singleAssetUSDValue) - } - - err = k.UpdateStakerShare(ctx, avsAddr, stakerID, operatorAddress.String(), stakerAssetsUSDValue) - if err != nil { - return err - } - } - - // update opted-in info - slashContract, err := k.avsKeeper.GetAvsSlashContract(ctx, avsAddr) - if err != nil { - return err - } - optedInfo := &types.OptedInfo{ - SlashContract: slashContract, - // #nosec G701 - OptedInHeight: uint64(ctx.BlockHeight()), - OptedOutHeight: types.DefaultOptedOutHeight, - } - err = k.UpdateOptedInfo(ctx, operatorAddress.String(), avsAddr, optedInfo) - if err != nil { - return err - } - return nil -} - -// OptOut call this function to opt out of AVS -func (k *Keeper) OptOut(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string) error { - // check optedIn info - if !k.IsOptedIn(ctx, operatorAddress.String(), avsAddr) { - return types.ErrNotOptedIn - } - - // get the assets supported by the AVS - avsSupportedAssets, err := k.avsKeeper.GetAvsSupportedAssets(ctx, avsAddr) - if err != nil { - return err - } - // get the Assets opted in the operator - operatorAssets, err := k.assetsKeeper.GetOperatorAssetInfos(ctx, operatorAddress, avsSupportedAssets) - if err != nil { - return err - } - - assetFilter := make(map[string]interface{}) - - for assetID := range operatorAssets { - err = k.DeleteAssetState(ctx, assetID, avsAddr, operatorAddress.String()) - if err != nil { - return err - } - assetFilter[assetID] = nil - } - - avsOperatorTotalValue, err := k.GetOperatorShare(ctx, avsAddr, operatorAddress.String()) - if err != nil { - return err - } - if avsOperatorTotalValue.IsNegative() { - return errorsmod.Wrap(types.ErrTheValueIsNegative, fmt.Sprintf("OptOut,avsOperatorTotalValue:%suite", avsOperatorTotalValue)) - } - - // delete the share value of operator itself, the input stakerID should be empty - err = k.DeleteStakerShare(ctx, avsAddr, "", operatorAddress.String()) - if err != nil { - return err - } - - // UpdateAVSShare - err = k.UpdateAVSShare(ctx, avsAddr, avsOperatorTotalValue.Neg()) - if err != nil { - return err - } - // DeleteOperatorShare - err = k.DeleteOperatorShare(ctx, avsAddr, operatorAddress.String()) - if err != nil { - return err - } - - // DeleteStakerShare - relatedAssetsState, err := k.delegationKeeper.DelegationStateByOperatorAssets(ctx, operatorAddress.String(), assetFilter) - if err != nil { - return err - } - for stakerID := range relatedAssetsState { - err = k.DeleteStakerShare(ctx, avsAddr, stakerID, operatorAddress.String()) - if err != nil { - return err - } - } - - // set opted-out height - optedInfo, err := k.GetOptedInfo(ctx, operatorAddress.String(), avsAddr) - if err != nil { - return err - } - // #nosec G701 - optedInfo.OptedOutHeight = uint64(ctx.BlockHeight()) - err = k.UpdateOptedInfo(ctx, operatorAddress.String(), avsAddr, optedInfo) - if err != nil { - return err - } - return nil -} - // GetAssetsAmountToSlash It will slash the assets that are opting into AVS first, and if there isn't enough to slash, then it will slash the assets that have requested to undelegate but still locked. func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr string, slashEventHeight int64, slashProportion sdkmath.LegacyDec) (*SlashAssets, error) { ret := &SlashAssets{ @@ -285,7 +20,7 @@ func (k *Keeper) GetAssetsAmountToSlash(ctx sdk.Context, operatorAddress sdk.Acc } // get the state when the slash occurred - historicalStateCtx, err := types2.ContextForHistoricalState(ctx, slashEventHeight) + historicalStateCtx, err := assetstype.ContextForHistoricalState(ctx, slashEventHeight) if err != nil { return nil, err } @@ -382,7 +117,7 @@ func (k *Keeper) SlashStaker(ctx sdk.Context, operatorAddress sdk.AccAddress, sl slashSumValue := slashInfo.AmountFromUnbonding.Add(slashInfo.AmountFromOptedIn) // update staker and operator assets state - err = k.assetsKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, types2.StakerSingleAssetChangeInfo{ + err = k.assetsKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, assetstype.StakerSingleAssetChangeInfo{ TotalDepositAmount: slashSumValue.Neg(), }) if err != nil { @@ -396,7 +131,7 @@ func (k *Keeper) SlashStaker(ctx sdk.Context, operatorAddress sdk.AccAddress, sl } // handle the state that needs to be updated when slashing opted-in assets - err = k.assetsKeeper.UpdateOperatorAssetState(ctx, operatorAddress, assetID, types2.OperatorSingleAssetChangeInfo{ + err = k.assetsKeeper.UpdateOperatorAssetState(ctx, operatorAddress, assetID, assetstype.OperatorSingleAssetChangeInfo{ TotalAmount: slashInfo.AmountFromOptedIn.Neg(), }) if err != nil { @@ -416,7 +151,7 @@ func (k *Keeper) SlashOperator(ctx sdk.Context, operatorAddress sdk.AccAddress, for assetID, slashInfo := range slashOperatorInfo { slashSumValue := slashInfo.AmountFromUnbonding.Add(slashInfo.AmountFromOptedIn) // handle the state that needs to be updated when slashing both opted-in and unbonding assets - err := k.assetsKeeper.UpdateOperatorAssetState(ctx, operatorAddress, assetID, types2.OperatorSingleAssetChangeInfo{ + err := k.assetsKeeper.UpdateOperatorAssetState(ctx, operatorAddress, assetID, assetstype.OperatorSingleAssetChangeInfo{ TotalAmount: slashSumValue.Neg(), OperatorAmount: slashInfo.AmountFromOptedIn.Neg(), OperatorUnbondableAmountAfterSlash: slashInfo.AmountFromUnbonding.Neg(), @@ -449,7 +184,7 @@ func (k *Keeper) Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr, // get the state when the slash occurred // get the opted-in info - historicalSateCtx, err := types2.ContextForHistoricalState(ctx, slashEventHeight) + historicalSateCtx, err := assetstype.ContextForHistoricalState(ctx, slashEventHeight) if err != nil { return err } @@ -494,3 +229,57 @@ func (k *Keeper) Slash(ctx sdk.Context, operatorAddress sdk.AccAddress, avsAddr, } return nil } + +// IsOperatorJailedForChainID add for dogfood +func (k *Keeper) IsOperatorJailedForChainID(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string) bool { + found, operatorAddr := k.GetOperatorAddressForChainIDAndConsAddr(ctx, chainID, consAddr) + if !found { + k.Logger(ctx).Info("couldn't find operator by consensus address and chainID", consAddr, chainID) + return false + } + + avsAddr, err := k.avsKeeper.GetAvsAddrByChainID(ctx, chainID) + if err != nil { + k.Logger(ctx).Error(err.Error(), chainID) + return false + } + + optInfo, err := k.GetOptedInfo(ctx, operatorAddr.String(), avsAddr) + if err != nil { + k.Logger(ctx).Error(err.Error(), operatorAddr, avsAddr) + return false + } + return optInfo.Jailed +} + +func (k *Keeper) SetJailedState(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string, jailed bool) { + found, operatorAddr := k.GetOperatorAddressForChainIDAndConsAddr(ctx, chainID, consAddr) + if !found { + k.Logger(ctx).Info("couldn't find operator by consensus address and chainID", consAddr, chainID) + return + } + + avsAddr, err := k.avsKeeper.GetAvsAddrByChainID(ctx, chainID) + if err != nil { + k.Logger(ctx).Error(err.Error(), chainID) + return + } + + handleFunc := func(info *types.OptedInfo) { + info.Jailed = jailed + } + err = k.HandleOptedInfo(ctx, operatorAddr.String(), avsAddr, handleFunc) + if err != nil { + k.Logger(ctx).Error(err.Error(), chainID) + } +} + +// Jail an operator +func (k *Keeper) Jail(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string) { + k.SetJailedState(ctx, consAddr, chainID, true) +} + +// Unjail an operator +func (k *Keeper) Unjail(ctx sdk.Context, consAddr sdk.ConsAddress, chainID string) { + k.SetJailedState(ctx, consAddr, chainID, true) +} diff --git a/x/operator/types/expected_keepers.go b/x/operator/types/expected_keepers.go index 5377075f8..fc986ed44 100644 --- a/x/operator/types/expected_keepers.go +++ b/x/operator/types/expected_keepers.go @@ -80,12 +80,24 @@ func (MockAvs) GetAvsSlashContract(_ sdk.Context, _ string) (string, error) { return "", nil } +func (MockAvs) GetAvsAddrByChainID(_ sdk.Context, chainID string) (string, error) { + return chainID, nil +} + +func (MockAvs) GetOperatorsByAvs(_ sdk.Context, _ string) ([]string, error) { + return nil, nil +} + type AvsKeeper interface { // GetAvsSupportedAssets The ctx can be historical or current, depending on the state you wish to retrieve. // If the caller want to retrieve a historical assets info supported by Avs, it needs to generate a historical // context through calling `ContextForHistoricalState` implemented in x/assets/types/general.go GetAvsSupportedAssets(ctx sdk.Context, avsAddr string) (map[string]interface{}, error) GetAvsSlashContract(ctx sdk.Context, avsAddr string) (string, error) + // GetAvsAddrByChainID get the general Avs address for dogfood module. + GetAvsAddrByChainID(ctx sdk.Context, chainID string) (string, error) + // GetOperatorsByAvs get all opted-in operators by the avs address + GetOperatorsByAvs(ctx sdk.Context, avsAddr string) ([]string, error) } // add for dogfood diff --git a/x/operator/types/tx.pb.go b/x/operator/types/tx.pb.go index b162bfb3b..b303ef00b 100644 --- a/x/operator/types/tx.pb.go +++ b/x/operator/types/tx.pb.go @@ -10,6 +10,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + types "github.com/cosmos/cosmos-sdk/x/staking/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -184,6 +185,10 @@ type OperatorInfo struct { OperatorMetaInfo string `protobuf:"bytes,3,opt,name=operator_meta_info,json=operatorMetaInfo,proto3" json:"operator_meta_info,omitempty"` // client_chain_earning_addr_list is the client chain earning address list. ClientChainEarningsAddr *ClientChainEarningAddrList `protobuf:"bytes,4,opt,name=client_chain_earnings_addr,json=clientChainEarningsAddr,proto3" json:"client_chain_earnings_addr,omitempty"` + // commission defines the commission parameters. + Commission types.Commission `protobuf:"bytes,5,opt,name=commission,proto3" json:"commission"` + // min_self_delegation is the validator's self declared minimum self delegation. + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,6,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation"` } func (m *OperatorInfo) Reset() { *m = OperatorInfo{} } @@ -247,6 +252,13 @@ func (m *OperatorInfo) GetClientChainEarningsAddr() *ClientChainEarningAddrList return nil } +func (m *OperatorInfo) GetCommission() types.Commission { + if m != nil { + return m.Commission + } + return types.Commission{} +} + // OptedInfo is the opted information about operator type OptedInfo struct { // slash_contract is the slash contract address of AVS opted-in by the operator @@ -255,6 +267,8 @@ type OptedInfo struct { OptedInHeight uint64 `protobuf:"varint,2,opt,name=opted_in_height,json=optedInHeight,proto3" json:"opted_in_height,omitempty"` // opted_out_height is the exocore block height at which the operator opted out OptedOutHeight uint64 `protobuf:"varint,3,opt,name=opted_out_height,json=optedOutHeight,proto3" json:"opted_out_height,omitempty"` + // jailed defined whether the operator has been jailed from bonded status or not. + Jailed bool `protobuf:"varint,4,opt,name=jailed,proto3" json:"jailed,omitempty"` } func (m *OptedInfo) Reset() { *m = OptedInfo{} } @@ -311,6 +325,13 @@ func (m *OptedInfo) GetOptedOutHeight() uint64 { return 0 } +func (m *OptedInfo) GetJailed() bool { + if m != nil { + return m.Jailed + } + return false +} + // OptedInAssetState is the state of opted-in asset type OptedInAssetState struct { // amount of the opted-in asset @@ -729,69 +750,75 @@ func init() { func init() { proto.RegisterFile("exocore/operator/v1/tx.proto", fileDescriptor_b229d5663e4df167) } var fileDescriptor_b229d5663e4df167 = []byte{ - // 985 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0xc6, 0x4e, 0x9a, 0x3c, 0x3b, 0xb5, 0x33, 0xa9, 0x88, 0xbd, 0x14, 0x3b, 0xd9, 0x8a, - 0xca, 0x8d, 0x88, 0x57, 0x0d, 0x14, 0x89, 0xc2, 0x81, 0xfc, 0x68, 0x85, 0x45, 0x8a, 0xd1, 0xa6, - 0xea, 0x01, 0x0e, 0xab, 0xcd, 0xee, 0x64, 0x3d, 0x8a, 0xbd, 0xb3, 0xdd, 0x19, 0xbb, 0x49, 0x25, - 0x24, 0x40, 0x1c, 0x10, 0xe2, 0xc0, 0x95, 0x5b, 0xff, 0x84, 0x1c, 0x7a, 0xe1, 0x80, 0xb8, 0xf6, - 0x58, 0xf5, 0x84, 0x38, 0x44, 0x28, 0x39, 0x84, 0x33, 0x7f, 0x01, 0x9a, 0x1f, 0x9b, 0x38, 0x8d, - 0x43, 0x1b, 0x35, 0x97, 0xc4, 0xf3, 0xe6, 0x7b, 0xdf, 0x7b, 0xef, 0x7b, 0xef, 0x8d, 0x16, 0xae, - 0xe2, 0x6d, 0xea, 0xd3, 0x04, 0xdb, 0x34, 0xc6, 0x89, 0xc7, 0x69, 0x62, 0xf7, 0x6f, 0xda, 0x7c, - 0xbb, 0x11, 0x27, 0x94, 0x53, 0x34, 0xad, 0x6f, 0x1b, 0xe9, 0x6d, 0xa3, 0x7f, 0xd3, 0x9c, 0xf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0x40, 0xa7, 0xe5, 0x41, 0x8d, 0x33, 0xc6, - 0xe5, 0x8c, 0x36, 0x9a, 0xf6, 0x6b, 0xe3, 0xb5, 0xee, 0x19, 0xf4, 0xb3, 0x01, 0x95, 0x33, 0x35, - 0x41, 0xb7, 0x86, 0x12, 0xbe, 0xaa, 0x55, 0xe6, 0x87, 0xe7, 0x75, 0x4b, 0xd3, 0x31, 0x47, 0xbf, - 0x3d, 0xdc, 0x9d, 0x37, 0x96, 0xd7, 0x9e, 0xed, 0x57, 0x8d, 0xe7, 0xfb, 0x55, 0xe3, 0xef, 0xfd, - 0xaa, 0xf1, 0xcb, 0x41, 0x35, 0xf3, 0xfc, 0xa0, 0x9a, 0xf9, 0xf3, 0xa0, 0x9a, 0xf9, 0x6a, 0x71, - 0x60, 0xd7, 0xef, 0xa8, 0x20, 0x5f, 0x60, 0xfe, 0x88, 0x26, 0x5b, 0x76, 0xfa, 0x11, 0xb5, 0x7d, - 0xfc, 0x19, 0x25, 0x77, 0x7f, 0x63, 0x4c, 0x7e, 0xd5, 0xbc, 0xff, 0x5f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xde, 0x35, 0xd8, 0x13, 0x67, 0x09, 0x00, 0x00, + // 1078 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xbf, 0x4f, 0x1c, 0xc7, + 0x17, 0xbf, 0xe5, 0x00, 0xc3, 0xe3, 0xf0, 0x1d, 0x83, 0x65, 0x8e, 0xfb, 0xfa, 0x7b, 0xc0, 0x3a, + 0xb1, 0x30, 0x0a, 0x77, 0x82, 0xc4, 0x91, 0xe2, 0xa4, 0x08, 0x3f, 0x6c, 0xe5, 0x14, 0xc8, 0x45, + 0x83, 0xe5, 0x22, 0x29, 0x56, 0xcb, 0xee, 0xb0, 0x4c, 0xd8, 0xdd, 0x59, 0xef, 0xcc, 0x9d, 0xc1, + 0x52, 0xa4, 0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x63, 0xa5, 0xfe, 0xd2, 0x78, 0xa3, 0x7b, 0x0e, 0x7d, 0x6b, 0xc1, 0xe4, 0xb9, 0x9a, 0xa0, 0x5b, + 0x3d, 0x09, 0xff, 0xe9, 0xaa, 0x2a, 0x6f, 0x5f, 0x34, 0x2c, 0x2b, 0xa7, 0x32, 0xf0, 0x85, 0xfc, + 0xff, 0xb4, 0xbc, 0xf6, 0xf4, 0xb0, 0x6a, 0x3d, 0x3b, 0xac, 0x5a, 0x7f, 0x1c, 0x56, 0xad, 0xef, + 0x8e, 0xaa, 0xb9, 0x67, 0x47, 0xd5, 0xdc, 0x6f, 0x47, 0xd5, 0xdc, 0x27, 0x8b, 0x5d, 0x6f, 0xfd, + 0x8e, 0x4e, 0xf2, 0x11, 0x11, 0x0f, 0x59, 0xba, 0x53, 0xcf, 0xbe, 0x1f, 0x77, 0x4f, 0xbe, 0x20, + 0xd5, 0xdb, 0xdf, 0x1c, 0x54, 0x9f, 0x6a, 0x6f, 0xfe, 0x15, 0x00, 0x00, 0xff, 0xff, 0x07, 0x51, + 0x1b, 0x95, 0x62, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1091,6 +1118,26 @@ func (m *OperatorInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a if m.ClientChainEarningsAddr != nil { { size, err := m.ClientChainEarningsAddr.MarshalToSizedBuffer(dAtA[:i]) @@ -1147,6 +1194,16 @@ func (m *OptedInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if m.OptedOutHeight != 0 { i = encodeVarintTx(dAtA, i, uint64(m.OptedOutHeight)) i-- @@ -1542,6 +1599,10 @@ func (m *OperatorInfo) Size() (n int) { l = m.ClientChainEarningsAddr.Size() n += 1 + l + sovTx(uint64(l)) } + l = m.Commission.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -1561,6 +1622,9 @@ func (m *OptedInfo) Size() (n int) { if m.OptedOutHeight != 0 { n += 1 + sovTx(uint64(m.OptedOutHeight)) } + if m.Jailed { + n += 2 + } return n } @@ -2122,6 +2186,73 @@ func (m *OperatorInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2242,6 +2373,26 @@ func (m *OptedInfo) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])