x/staking v0.43 Audit updates (#9267)
* update staking specs * use gosimple code in x/staking/client/testutil/suite.go * small fixes * add godoc to methods in msg_server and grpc_query * changes to godoc and small fixes * remove unnecessary lines * remove mentions of serviceMsg and avoid having slash after Msg
This commit is contained in:
parent
9038dfe3b6
commit
e96839de2f
|
@ -6182,9 +6182,9 @@ AuthorizationType defines the type of staking module authorization type
|
|||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| AUTHORIZATION_TYPE_UNSPECIFIED | 0 | AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type |
|
||||
| AUTHORIZATION_TYPE_DELEGATE | 1 | AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate |
|
||||
| AUTHORIZATION_TYPE_UNDELEGATE | 2 | AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate |
|
||||
| AUTHORIZATION_TYPE_REDELEGATE | 3 | AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate |
|
||||
| AUTHORIZATION_TYPE_DELEGATE | 1 | AUTHORIZATION_TYPE_DELEGATE defines an authorization type for MsgDelegate |
|
||||
| AUTHORIZATION_TYPE_UNDELEGATE | 2 | AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for MsgUndelegate |
|
||||
| AUTHORIZATION_TYPE_REDELEGATE | 3 | AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for MsgBeginRedelegate |
|
||||
|
||||
|
||||
<!-- end enums -->
|
||||
|
@ -7167,7 +7167,7 @@ of coins from a delegator and source validator to a destination validator.
|
|||
<a name="cosmos.staking.v1beta1.MsgBeginRedelegateResponse"></a>
|
||||
|
||||
### MsgBeginRedelegateResponse
|
||||
MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type.
|
||||
MsgBeginRedelegateResponse defines the MsgBeginRedelegate response type.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
|
@ -7203,7 +7203,7 @@ MsgCreateValidator defines a SDK message for creating a new validator.
|
|||
<a name="cosmos.staking.v1beta1.MsgCreateValidatorResponse"></a>
|
||||
|
||||
### MsgCreateValidatorResponse
|
||||
MsgCreateValidatorResponse defines the Msg/CreateValidator response type.
|
||||
MsgCreateValidatorResponse defines the MsgCreateValidator response type.
|
||||
|
||||
|
||||
|
||||
|
@ -7231,7 +7231,7 @@ from a delegator to a validator.
|
|||
<a name="cosmos.staking.v1beta1.MsgDelegateResponse"></a>
|
||||
|
||||
### MsgDelegateResponse
|
||||
MsgDelegateResponse defines the Msg/Delegate response type.
|
||||
MsgDelegateResponse defines the MsgDelegate response type.
|
||||
|
||||
|
||||
|
||||
|
@ -7259,7 +7259,7 @@ MsgEditValidator defines a SDK message for editing an existing validator.
|
|||
<a name="cosmos.staking.v1beta1.MsgEditValidatorResponse"></a>
|
||||
|
||||
### MsgEditValidatorResponse
|
||||
MsgEditValidatorResponse defines the Msg/EditValidator response type.
|
||||
MsgEditValidatorResponse defines the MsgEditValidator response type.
|
||||
|
||||
|
||||
|
||||
|
@ -7287,7 +7287,7 @@ delegate and a validator.
|
|||
<a name="cosmos.staking.v1beta1.MsgUndelegateResponse"></a>
|
||||
|
||||
### MsgUndelegateResponse
|
||||
MsgUndelegateResponse defines the Msg/Undelegate response type.
|
||||
MsgUndelegateResponse defines the MsgUndelegate response type.
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
|
|
|
@ -660,7 +660,6 @@ $ %s query staking historical-info 5
|
|||
|
||||
params := &types.QueryHistoricalInfoRequest{Height: height}
|
||||
res, err := queryClient.HistoricalInfo(cmd.Context(), params)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidator() {
|
|||
},
|
||||
{
|
||||
"happy case",
|
||||
[]string{fmt.Sprintf("%s", val.ValAddress), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
[]string{val.ValAddress.String(), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegations() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdQueryDelegationsTo() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdQueryValidatorDelegations() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
testCases := []struct {
|
||||
|
@ -755,7 +755,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryRedelegation() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestGetCmdQueryRedelegationsFrom() {
|
||||
func (s *IntegrationTestSuite) TestGetCmdQueryValidatorRedelegations() {
|
||||
val := s.network.Validators[0]
|
||||
val2 := s.network.Validators[1]
|
||||
|
||||
|
@ -925,7 +925,7 @@ not_bonded_tokens: "0"`, cli.DefaultTokens.Mul(sdk.NewInt(2)).String()),
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestNewCmdEditValidator() {
|
||||
func (s *IntegrationTestSuite) TestNewEditValidatorCmd() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
details := "bio"
|
||||
|
@ -1041,7 +1041,7 @@ func (s *IntegrationTestSuite) TestNewCmdEditValidator() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestNewCmdDelegate() {
|
||||
func (s *IntegrationTestSuite) TestNewDelegateCmd() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
info, _, err := val.ClientCtx.Keyring.NewMnemonic("NewAccount", keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
|
||||
|
@ -1123,7 +1123,7 @@ func (s *IntegrationTestSuite) TestNewCmdDelegate() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestNewCmdRedelegate() {
|
||||
func (s *IntegrationTestSuite) TestNewRedelegateCmd() {
|
||||
val := s.network.Validators[0]
|
||||
val2 := s.network.Validators[1]
|
||||
|
||||
|
@ -1209,7 +1209,7 @@ func (s *IntegrationTestSuite) TestNewCmdRedelegate() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IntegrationTestSuite) TestNewCmdUnbond() {
|
||||
func (s *IntegrationTestSuite) TestNewUnbondCmd() {
|
||||
val := s.network.Validators[0]
|
||||
|
||||
testCases := []struct {
|
||||
|
|
|
@ -384,6 +384,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) {
|
|||
selfDelegation := types.NewDelegation(addrVals[0].Bytes(), addrVals[0], issuedShares)
|
||||
app.StakingKeeper.SetDelegation(ctx, selfDelegation)
|
||||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
@ -470,6 +471,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
selfDelegation := types.NewDelegation(val0AccAddr, addrVals[0], issuedShares)
|
||||
app.StakingKeeper.SetDelegation(ctx, selfDelegation)
|
||||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
@ -518,7 +520,7 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) {
|
|||
_, err = app.StakingKeeper.Undelegate(ctx, addrDels[1], addrVals[0], remainingTokens.ToDec())
|
||||
require.NoError(t, err)
|
||||
|
||||
// now validator should now be deleted from state
|
||||
// now validator should be deleted from state
|
||||
validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[0])
|
||||
require.False(t, found, "%v", validator)
|
||||
}
|
||||
|
@ -556,6 +558,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) {
|
|||
validator, issuedShares = validator.AddTokensFromDel(delTokens)
|
||||
require.Equal(t, delTokens, issuedShares.RoundInt())
|
||||
|
||||
// add bonded tokens to pool for delegations
|
||||
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
|
||||
require.NoError(t, simapp.FundModuleAccount(app, ctx, bondedPool.GetName(), delCoins))
|
||||
app.AccountKeeper.SetModuleAccount(ctx, bondedPool)
|
||||
|
|
|
@ -61,7 +61,7 @@ func (k Querier) Validators(c context.Context, req *types.QueryValidatorsRequest
|
|||
return &types.QueryValidatorsResponse{Validators: validators, Pagination: pageRes}, nil
|
||||
}
|
||||
|
||||
// Validator queries validator info for given validator addr
|
||||
// Validator queries validator info for given validator address
|
||||
func (k Querier) Validator(c context.Context, req *types.QueryValidatorRequest) (*types.QueryValidatorResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "empty request")
|
||||
|
@ -380,6 +380,7 @@ func (k Querier) HistoricalInfo(c context.Context, req *types.QueryHistoricalInf
|
|||
return &types.QueryHistoricalInfoResponse{Hist: &hi}, nil
|
||||
}
|
||||
|
||||
// Redelegations queries redelegations of given address
|
||||
func (k Querier) Redelegations(c context.Context, req *types.QueryRedelegationsRequest) (*types.QueryRedelegationsResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "empty request")
|
||||
|
@ -410,6 +411,7 @@ func (k Querier) Redelegations(c context.Context, req *types.QueryRedelegationsR
|
|||
return &types.QueryRedelegationsResponse{RedelegationResponses: redelResponses, Pagination: pageRes}, nil
|
||||
}
|
||||
|
||||
// DelegatorValidators queries all validators info for given delegator address
|
||||
func (k Querier) DelegatorValidators(c context.Context, req *types.QueryDelegatorValidatorsRequest) (*types.QueryDelegatorValidatorsResponse, error) {
|
||||
if req == nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "empty request")
|
||||
|
|
|
@ -84,7 +84,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryValidators() {
|
|||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGRPCValidator() {
|
||||
func (suite *KeeperTestSuite) TestGRPCQueryValidator() {
|
||||
app, ctx, queryClient, vals := suite.app, suite.ctx, suite.queryClient, suite.vals
|
||||
validator, found := app.StakingKeeper.GetValidator(ctx, vals[0].GetOperator())
|
||||
suite.True(found)
|
||||
|
@ -586,7 +586,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryHistoricalInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGRPCQueryRedelegation() {
|
||||
func (suite *KeeperTestSuite) TestGRPCQueryRedelegations() {
|
||||
app, ctx, queryClient, addrs, vals := suite.app, suite.ctx, suite.queryClient, suite.addrs, suite.vals
|
||||
|
||||
addrAcc, addrAcc1 := addrs[0], addrs[1]
|
||||
|
|
|
@ -26,6 +26,7 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer {
|
|||
|
||||
var _ types.MsgServer = msgServer{}
|
||||
|
||||
// CreateValidator defines a method for creating a new validator
|
||||
func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateValidator) (*types.MsgCreateValidatorResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
|
@ -119,6 +120,7 @@ func (k msgServer) CreateValidator(goCtx context.Context, msg *types.MsgCreateVa
|
|||
return &types.MsgCreateValidatorResponse{}, nil
|
||||
}
|
||||
|
||||
// EditValidator defines a method for editing an existing validator
|
||||
func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValidator) (*types.MsgEditValidatorResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress)
|
||||
|
@ -181,6 +183,7 @@ func (k msgServer) EditValidator(goCtx context.Context, msg *types.MsgEditValida
|
|||
return &types.MsgEditValidatorResponse{}, nil
|
||||
}
|
||||
|
||||
// Delegate defines a method for performing a delegation of coins from a delegator to a validator
|
||||
func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*types.MsgDelegateResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
valAddr, valErr := sdk.ValAddressFromBech32(msg.ValidatorAddress)
|
||||
|
@ -237,6 +240,7 @@ func (k msgServer) Delegate(goCtx context.Context, msg *types.MsgDelegate) (*typ
|
|||
return &types.MsgDelegateResponse{}, nil
|
||||
}
|
||||
|
||||
// BeginRedelegate defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator
|
||||
func (k msgServer) BeginRedelegate(goCtx context.Context, msg *types.MsgBeginRedelegate) (*types.MsgBeginRedelegateResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
valSrcAddr, err := sdk.ValAddressFromBech32(msg.ValidatorSrcAddress)
|
||||
|
@ -302,6 +306,7 @@ func (k msgServer) BeginRedelegate(goCtx context.Context, msg *types.MsgBeginRed
|
|||
}, nil
|
||||
}
|
||||
|
||||
// Undelegate defines a method for performing an undelegation from a delegate and a validator
|
||||
func (k msgServer) Undelegate(goCtx context.Context, msg *types.MsgUndelegate) (*types.MsgUndelegateResponse, error) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
|
||||
|
|
|
@ -21,18 +21,18 @@ const (
|
|||
historicalEntries = "historical_entries"
|
||||
)
|
||||
|
||||
// GenUnbondingTime randomized UnbondingTime
|
||||
func GenUnbondingTime(r *rand.Rand) (ubdTime time.Duration) {
|
||||
// genUnbondingTime returns randomized UnbondingTime
|
||||
func genUnbondingTime(r *rand.Rand) (ubdTime time.Duration) {
|
||||
return time.Duration(simulation.RandIntBetween(r, 60, 60*60*24*3*2)) * time.Second
|
||||
}
|
||||
|
||||
// GenMaxValidators randomized MaxValidators
|
||||
func GenMaxValidators(r *rand.Rand) (maxValidators uint32) {
|
||||
// genMaxValidators returns randomized MaxValidators
|
||||
func genMaxValidators(r *rand.Rand) (maxValidators uint32) {
|
||||
return uint32(r.Intn(250) + 1)
|
||||
}
|
||||
|
||||
// GetHistEntries randomized HistoricalEntries between 0-100.
|
||||
func GetHistEntries(r *rand.Rand) uint32 {
|
||||
// getHistEntries returns randomized HistoricalEntries between 0-100.
|
||||
func getHistEntries(r *rand.Rand) uint32 {
|
||||
return uint32(r.Intn(int(types.DefaultHistoricalEntries + 1)))
|
||||
}
|
||||
|
||||
|
@ -47,17 +47,17 @@ func RandomizedGenState(simState *module.SimulationState) {
|
|||
|
||||
simState.AppParams.GetOrGenerate(
|
||||
simState.Cdc, unbondingTime, &unbondTime, simState.Rand,
|
||||
func(r *rand.Rand) { unbondTime = GenUnbondingTime(r) },
|
||||
func(r *rand.Rand) { unbondTime = genUnbondingTime(r) },
|
||||
)
|
||||
|
||||
simState.AppParams.GetOrGenerate(
|
||||
simState.Cdc, maxValidators, &maxVals, simState.Rand,
|
||||
func(r *rand.Rand) { maxVals = GenMaxValidators(r) },
|
||||
func(r *rand.Rand) { maxVals = genMaxValidators(r) },
|
||||
)
|
||||
|
||||
simState.AppParams.GetOrGenerate(
|
||||
simState.Cdc, historicalEntries, &histEntries, simState.Rand,
|
||||
func(r *rand.Rand) { histEntries = GetHistEntries(r) },
|
||||
func(r *rand.Rand) { histEntries = getHistEntries(r) },
|
||||
)
|
||||
|
||||
// NOTE: the slashing module need to be defined after the staking module on the
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestRandomizedGenState(t *testing.T) {
|
|||
require.Equal(t, "1", stakingGenesis.Validators[2].MinSelfDelegation.String())
|
||||
}
|
||||
|
||||
// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState.
|
||||
// TestRandomizedGenState1 tests abnormal scenarios of applying RandomizedGenState.
|
||||
func TestRandomizedGenState1(t *testing.T) {
|
||||
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
||||
cdc := codec.NewProtoCodec(interfaceRegistry)
|
||||
|
|
|
@ -6,9 +6,8 @@ import (
|
|||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/simulation"
|
||||
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/simulation"
|
||||
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
)
|
||||
|
||||
|
@ -18,17 +17,17 @@ func ParamChanges(r *rand.Rand) []simtypes.ParamChange {
|
|||
return []simtypes.ParamChange{
|
||||
simulation.NewSimParamChange(types.ModuleName, string(types.KeyMaxValidators),
|
||||
func(r *rand.Rand) string {
|
||||
return fmt.Sprintf("%d", GenMaxValidators(r))
|
||||
return fmt.Sprintf("%d", genMaxValidators(r))
|
||||
},
|
||||
),
|
||||
simulation.NewSimParamChange(types.ModuleName, string(types.KeyUnbondingTime),
|
||||
func(r *rand.Rand) string {
|
||||
return fmt.Sprintf("\"%d\"", GenUnbondingTime(r))
|
||||
return fmt.Sprintf("\"%d\"", genUnbondingTime(r))
|
||||
},
|
||||
),
|
||||
simulation.NewSimParamChange(types.ModuleName, string(types.KeyHistoricalEntries),
|
||||
func(r *rand.Rand) string {
|
||||
return fmt.Sprintf("%d", GetHistEntries(r))
|
||||
return fmt.Sprintf("%d", getHistEntries(r))
|
||||
},
|
||||
),
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@ order: 1
|
|||
|
||||
# State
|
||||
|
||||
## Pool
|
||||
|
||||
Pool is used for tracking bonded and not-bonded token supply of the bond denomination.
|
||||
|
||||
## LastTotalPower
|
||||
|
||||
LastTotalPower tracks the total amounts of bonded tokens recorded during the previous end block.
|
||||
|
|
|
@ -6,16 +6,16 @@ order: 3
|
|||
|
||||
In this section we describe the processing of the staking messages and the corresponding updates to the state. All created/modified state objects specified by each message are defined within the [state](./02_state_transitions.md) section.
|
||||
|
||||
## Msg/CreateValidator
|
||||
## MsgCreateValidator
|
||||
|
||||
A validator is created using the `Msg/CreateValidator` service message.
|
||||
A validator is created using the `MsgCreateValidator` message.
|
||||
The validator must be created with an initial delegation from the operator.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L16-L17
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L35-L51
|
||||
|
||||
This service message is expected to fail if:
|
||||
This message is expected to fail if:
|
||||
|
||||
- another validator with this operator address is already registered
|
||||
- another validator with this pubkey is already registered
|
||||
|
@ -26,32 +26,32 @@ This service message is expected to fail if:
|
|||
- the initial `MaxChangeRate` is either negative or > `MaxRate`
|
||||
- the description fields are too large
|
||||
|
||||
This service message creates and stores the `Validator` object at appropriate indexes.
|
||||
This message creates and stores the `Validator` object at appropriate indexes.
|
||||
Additionally a self-delegation is made with the initial tokens delegation
|
||||
tokens `Delegation`. The validator always starts as unbonded but may be bonded
|
||||
in the first end-block.
|
||||
|
||||
## Msg/EditValidator
|
||||
## MsgEditValidator
|
||||
|
||||
The `Description`, `CommissionRate` of a validator can be updated using the
|
||||
`Msg/EditCandidacy` service message.
|
||||
`MsgEditValidator` message.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L19-L20
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L56-L76
|
||||
|
||||
This service message is expected to fail if:
|
||||
This message is expected to fail if:
|
||||
|
||||
- the initial `CommissionRate` is either negative or > `MaxRate`
|
||||
- the `CommissionRate` has already been updated within the previous 24 hours
|
||||
- the `CommissionRate` is > `MaxChangeRate`
|
||||
- the description fields are too large
|
||||
|
||||
This service message stores the updated `Validator` object.
|
||||
This message stores the updated `Validator` object.
|
||||
|
||||
## Msg/Delegate
|
||||
## MsgDelegate
|
||||
|
||||
Within this service message the delegator provides coins, and in return receives
|
||||
Within this message the delegator provides coins, and in return receives
|
||||
some amount of their validator's (newly created) delegator-shares that are
|
||||
assigned to `Delegation.Shares`.
|
||||
|
||||
|
@ -59,9 +59,9 @@ assigned to `Delegation.Shares`.
|
|||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90
|
||||
|
||||
This service message is expected to fail if:
|
||||
This message is expected to fail if:
|
||||
|
||||
- the validator is does not exist
|
||||
- the validator does not exist
|
||||
- the `Amount` `Coin` has a denomination different than one defined by `params.BondDenom`
|
||||
- the exchange rate is invalid, meaning the validator has no tokens (due to slashing) but there are outstanding shares
|
||||
- the amount delegated is less than the minimum allowed delegation
|
||||
|
@ -82,20 +82,20 @@ will not be added to the power index until it is unjailed.
|
|||
|
||||
![Delegation sequence](../../../docs/uml/svg/delegation_sequence.svg)
|
||||
|
||||
## Msg/Undelegate
|
||||
## MsgUndelegate
|
||||
|
||||
The `Msg/Undelegate` service message allows delegators to undelegate their tokens from
|
||||
The `MsgUndelegate` message allows delegators to undelegate their tokens from
|
||||
validator.
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L30-L32
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121
|
||||
|
||||
This service message returns a response containing the completion time of the undelegation:
|
||||
This message returns a response containing the completion time of the undelegation:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L123-L126
|
||||
|
||||
This service message is expected to fail if:
|
||||
This message is expected to fail if:
|
||||
|
||||
- the delegation doesn't exist
|
||||
- the validator doesn't exist
|
||||
|
@ -103,7 +103,7 @@ This service message is expected to fail if:
|
|||
- existing `UnbondingDelegation` has maximum entries as defined by `params.MaxEntries`
|
||||
- the `Amount` has a denomination different than one defined by `params.BondDenom`
|
||||
|
||||
When this service message is processed the following actions occur:
|
||||
When this message is processed the following actions occur:
|
||||
|
||||
- validator's `DelegatorShares` and the delegation's `Shares` are both reduced by the message `SharesAmount`
|
||||
- calculate the token worth of the shares remove that amount tokens held within the validator
|
||||
|
@ -116,7 +116,7 @@ When this service message is processed the following actions occur:
|
|||
|
||||
![Unbond sequence](../../../docs/uml/svg/unbond_sequence.svg)
|
||||
|
||||
## Msg/BeginRedelegate
|
||||
## MsgBeginRedelegate
|
||||
|
||||
The redelegation command allows delegators to instantly switch validators. Once
|
||||
the unbonding period has passed, the redelegation is automatically completed in
|
||||
|
@ -126,11 +126,11 @@ the EndBlocker.
|
|||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105
|
||||
|
||||
This service message returns a response containing the completion time of the redelegation:
|
||||
This message returns a response containing the completion time of the redelegation:
|
||||
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L107-L110
|
||||
|
||||
This service message is expected to fail if:
|
||||
This message is expected to fail if:
|
||||
|
||||
- the delegation doesn't exist
|
||||
- the source or destination validators don't exist
|
||||
|
@ -139,7 +139,7 @@ This service message is expected to fail if:
|
|||
- existing `Redelegation` has maximum entries as defined by `params.MaxEntries`
|
||||
- the `Amount` `Coin` has a denomination different than one defined by `params.BondDenom`
|
||||
|
||||
When this service message is processed the following actions occur:
|
||||
When this message is processed the following actions occur:
|
||||
|
||||
- the source validator's `DelegatorShares` and the delegations `Shares` are both reduced by the message `SharesAmount`
|
||||
- calculate the token worth of the shares remove that amount tokens held within the source validator.
|
||||
|
|
|
@ -18,9 +18,9 @@ The staking module emits the following events:
|
|||
| complete_redelegation | destination_validator | {dstValidatorAddress} |
|
||||
| complete_redelegation | delegator | {delegatorAddress} |
|
||||
|
||||
## Service Messages
|
||||
## Msg's
|
||||
|
||||
### Msg/CreateValidator
|
||||
### MsgCreateValidator
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
| ---------------- | ------------- | ------------------ |
|
||||
|
@ -30,7 +30,7 @@ The staking module emits the following events:
|
|||
| message | action | create_validator |
|
||||
| message | sender | {senderAddress} |
|
||||
|
||||
### Msg/EditValidator
|
||||
### MsgEditValidator
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
| -------------- | ------------------- | ------------------- |
|
||||
|
@ -40,7 +40,7 @@ The staking module emits the following events:
|
|||
| message | action | edit_validator |
|
||||
| message | sender | {senderAddress} |
|
||||
|
||||
### Msg/Delegate
|
||||
### MsgDelegate
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
| -------- | ------------- | ------------------ |
|
||||
|
@ -50,7 +50,7 @@ The staking module emits the following events:
|
|||
| message | action | delegate |
|
||||
| message | sender | {senderAddress} |
|
||||
|
||||
### Msg/Undelegate
|
||||
### MsgUndelegate
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
| ------- | ------------------- | ------------------ |
|
||||
|
@ -63,7 +63,7 @@ The staking module emits the following events:
|
|||
|
||||
- [0] Time is formatted in the RFC3339 standard
|
||||
|
||||
### Msg/BeginRedelegate
|
||||
### MsgBeginRedelegate
|
||||
|
||||
| Type | Attribute Key | Attribute Value |
|
||||
| ---------- | --------------------- | --------------------- |
|
||||
|
|
|
@ -38,11 +38,11 @@ network.
|
|||
- [Delegations](02_state_transitions.md#delegations)
|
||||
- [Slashing](02_state_transitions.md#slashing)
|
||||
3. **[Messages](03_messages.md)**
|
||||
- [Msg/CreateValidator](03_messages.md#msgcreatevalidator)
|
||||
- [Msg/EditValidator](03_messages.md#msgeditvalidator)
|
||||
- [Msg/Delegate](03_messages.md#msgdelegate)
|
||||
- [Msg/BeginUnbonding](03_messages.md#msgbeginunbonding)
|
||||
- [Msg/BeginRedelegate](03_messages.md#msgbeginredelegate)
|
||||
- [MsgCreateValidator](03_messages.md#msgcreatevalidator)
|
||||
- [MsgEditValidator](03_messages.md#msgeditvalidator)
|
||||
- [MsgDelegate](03_messages.md#msgdelegate)
|
||||
- [MsgUndelegate](03_messages.md#msgundelegate)
|
||||
- [MsgBeginRedelegate](03_messages.md#msgbeginredelegate)
|
||||
4. **[Begin-Block](04_begin_block.md)**
|
||||
- [Historical Info Tracking](04_begin_block.md#historical-info-tracking)
|
||||
5. **[End-Block ](05_end_block.md)**
|
||||
|
@ -51,5 +51,5 @@ network.
|
|||
6. **[Hooks](06_hooks.md)**
|
||||
7. **[Events](07_events.md)**
|
||||
- [EndBlocker](07_events.md#endblocker)
|
||||
- [Handlers](07_events.md#handlers)
|
||||
- [Msg's](07_events.md#msg's)
|
||||
8. **[Parameters](08_params.md)**
|
||||
|
|
Loading…
Reference in New Issue