Improve get-distribution CLI output and error handling (#279)

* refactor: rename variable

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2024-01-16 09:11:44 +01:00 committed by GitHub
parent 6d7a5f1acb
commit 525d6a8da6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 163 additions and 99 deletions

View File

@ -47148,7 +47148,7 @@ paths:
format: int64
tags:
- Query
/planetmint/planetmint-go/dao/get_distribution/{lastPopHeight}:
/planetmint/planetmint-go/dao/get_distribution/{height}:
get:
summary: Queries a list of GetDistribution items.
operationId: PlanetmintgoDaoGetDistribution
@ -47206,7 +47206,7 @@ paths:
type: string
additionalProperties: {}
parameters:
- name: lastPopHeight
- name: height
in: path
required: true
type: string

View File

@ -61,7 +61,7 @@ service Query {
// Queries a list of GetDistribution items.
rpc GetDistribution (QueryGetDistributionRequest) returns (QueryGetDistributionResponse) {
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_distribution/{lastPopHeight}";
option (google.api.http).get = "/planetmint/planetmint-go/dao/get_distribution/{height}";
}
}
@ -132,7 +132,7 @@ message QueryChallengesResponse {
}
message QueryGetDistributionRequest {
int64 lastPopHeight = 1;
int64 height = 1;
}
message QueryGetDistributionResponse {

View File

@ -1,6 +1,7 @@
package dao
import (
"fmt"
"math"
"strconv"
@ -9,6 +10,7 @@ import (
"github.com/planetmint/planetmint-go/testutil/network"
"github.com/planetmint/planetmint-go/testutil/sample"
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
@ -50,17 +52,55 @@ func (s *AssetDistributionE2ETestSuite) TestAssetDistribution() {
// wait so that we see exactly on reissuance/distribution round, e.g.
// wait = ceil((10 - 5) / 2) = ceil(2.5) = 3
wait := int(math.Ceil((float64(conf.ReissuanceEpochs) - float64(conf.DistributionOffset)) / 2.0))
height := conf.ReissuanceEpochs + conf.DistributionOffset + wait
for {
latestHeight, err = s.network.WaitForHeight(latestHeight + 1)
s.Require().NoError(err)
if latestHeight == int64(conf.ReissuanceEpochs+conf.DistributionOffset+wait) {
if latestHeight == int64(height) {
break
}
}
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdGetDistribution(), []string{
strconv.Itoa(conf.ReissuanceEpochs + conf.DistributionOffset),
})
s.Require().NoError(err)
testCases := []struct {
name string
requestHeight int
expectedErr string
}{
{
"request height too low",
conf.DistributionOffset,
fmt.Sprintf("distribution wrong height: must be equal to or greater then %d",
conf.ReissuanceEpochs+conf.DistributionOffset),
},
{
"wrong request height",
height,
fmt.Sprintf("distribution wrong height: must equal to (n * %d) + %d, where n = 1, 2, 3, and so on",
conf.ReissuanceEpochs, conf.DistributionOffset),
},
{
"request height too high",
2*conf.ReissuanceEpochs + conf.DistributionOffset,
fmt.Sprintf("height %d must be less than or equal to the current blockchain height %d",
2*conf.ReissuanceEpochs+conf.DistributionOffset, height),
},
{
"valid distribution request",
conf.ReissuanceEpochs + conf.DistributionOffset,
"",
},
}
for _, tc := range testCases {
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdGetDistribution(), []string{
strconv.Itoa(tc.requestHeight),
})
if tc.expectedErr == "" {
s.Require().NoError(err)
} else {
s.Require().Error(err)
assert.Equal(s.T(), tc.expectedErr, err.Error())
}
}
}

View File

@ -1,10 +1,13 @@
package cli
import (
"fmt"
"strconv"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/x/dao/types"
"github.com/spf13/cast"
"github.com/spf13/cobra"
@ -14,11 +17,12 @@ var _ = strconv.Itoa(0)
func CmdGetDistribution() *cobra.Command {
cmd := &cobra.Command{
Use: "get-distribution [block-height]",
Short: "Query get_distribution",
Use: "get-distribution [height]",
Short: "Query for distributions by height",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
reqLastPopHeight, err := cast.ToInt64E(args[0])
conf := config.GetConfig()
requestHeight, err := cast.ToInt64E(args[0])
if err != nil {
return err
}
@ -28,11 +32,31 @@ func CmdGetDistribution() *cobra.Command {
return err
}
latestHeight, err := rpc.GetChainHeight(clientCtx)
if err != nil {
return err
}
if requestHeight > latestHeight {
err = fmt.Errorf("height %d must be less than or equal to the current blockchain height %d",
requestHeight, latestHeight)
return err
}
if requestHeight < (int64(conf.ReissuanceEpochs) + int64(conf.DistributionOffset)) {
err = fmt.Errorf("%w: must be equal to or greater then %d",
types.ErrDistributionWrongHeight, conf.ReissuanceEpochs+conf.DistributionOffset)
return err
}
if requestHeight%int64(conf.ReissuanceEpochs) != int64(conf.DistributionOffset) {
err = fmt.Errorf("%w: must equal to (n * %d) + %d, where n = 1, 2, 3, and so on",
types.ErrDistributionWrongHeight, conf.ReissuanceEpochs, conf.DistributionOffset)
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryGetDistributionRequest{
LastPopHeight: reqLastPopHeight,
Height: requestHeight,
}
res, err := queryClient.GetDistribution(cmd.Context(), params)

View File

@ -16,9 +16,9 @@ func (k Keeper) StoreDistributionOrder(ctx sdk.Context, distributionOrder types.
store.Set(util.SerializeInt64(distributionOrder.LastPop), appendValue)
}
func (k Keeper) LookupDistributionOrder(ctx sdk.Context, lastPopHeight int64) (val types.DistributionOrder, found bool) {
func (k Keeper) LookupDistributionOrder(ctx sdk.Context, height int64) (val types.DistributionOrder, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.DistributionKey))
distributionOrder := store.Get(util.SerializeInt64(lastPopHeight))
distributionOrder := store.Get(util.SerializeInt64(height))
if distributionOrder == nil {
return val, false
}

View File

@ -16,7 +16,7 @@ func (k Keeper) GetDistribution(goCtx context.Context, req *types.QueryGetDistri
ctx := sdk.UnwrapSDKContext(goCtx)
distribution, found := k.LookupDistributionOrder(ctx, req.GetLastPopHeight())
distribution, found := k.LookupDistributionOrder(ctx, req.GetHeight())
if !found {
return nil, status.Error(codes.NotFound, "distribution not found")
}

View File

@ -25,4 +25,5 @@ var (
ErrResolvingStagedClaims = errorsmod.Register(ModuleName, 16, "resolving staged claims failed")
ErrReissuanceTxIDMissing = errorsmod.Register(ModuleName, 17, "reissuance has no transaction id")
ErrRestrictedMsg = errorsmod.Register(ModuleName, 18, "restricted validator msg")
ErrDistributionWrongHeight = errorsmod.Register(ModuleName, 19, "distribution wrong height")
)

View File

@ -659,7 +659,7 @@ func (m *QueryChallengesResponse) GetPagination() *query.PageResponse {
}
type QueryGetDistributionRequest struct {
LastPopHeight int64 `protobuf:"varint,1,opt,name=lastPopHeight,proto3" json:"lastPopHeight,omitempty"`
Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
}
func (m *QueryGetDistributionRequest) Reset() { *m = QueryGetDistributionRequest{} }
@ -695,9 +695,9 @@ func (m *QueryGetDistributionRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_QueryGetDistributionRequest proto.InternalMessageInfo
func (m *QueryGetDistributionRequest) GetLastPopHeight() int64 {
func (m *QueryGetDistributionRequest) GetHeight() int64 {
if m != nil {
return m.LastPopHeight
return m.Height
}
return 0
}
@ -768,69 +768,68 @@ func init() {
func init() { proto.RegisterFile("planetmintgo/dao/query.proto", fileDescriptor_07bad0eeb5b27724) }
var fileDescriptor_07bad0eeb5b27724 = []byte{
// 986 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4d, 0x6f, 0x1b, 0x45,
0x18, 0xc7, 0xb3, 0x6d, 0x09, 0xca, 0xe3, 0x54, 0xc0, 0xd0, 0x06, 0xb3, 0x49, 0x4c, 0xba, 0x09,
0x90, 0xb8, 0xed, 0x6e, 0xeb, 0x46, 0xe5, 0x45, 0x2d, 0x2f, 0x2e, 0x4a, 0xda, 0x43, 0x45, 0xd8,
0x03, 0x87, 0x5e,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0x68, 0x2f, 0xca, 0x3f, 0xc8, 0xb7, 0xfe, 0x0f, 0x00, 0x00,
0xff, 0xff, 0xd8, 0x6a, 0x48, 0x5f, 0x9f, 0x0c, 0x00, 0x00,
// 969 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x8f, 0xdb, 0x44,
0x18, 0xc6, 0xd7, 0x6d, 0x59, 0xb4, 0x6f, 0x16, 0x01, 0x43, 0xbb, 0x04, 0xef, 0x6e, 0xd8, 0x7a,
0x0b, 0xec, 0xa6, 0xad, 0xdd, 0xa6, 0x4b, 0x4b, 0x51, 0xab, 0x8a, 0x80, 0xba, 0xed, 0xa1, 0xa2,
0xf8, 0xc0, 0xa1, 0x97, 0x30, 0x49, 0x46, 0xb6, 0x45, 0xe2, 0x49, 0x3d, 0x0e, 0x62, 0xb5, 0xda,
0x0b, 0x37, 0x6e, 0x48, 0xfd, 0x00, 0x70, 0x41, 0x42, 0x1c, 0x10, 0xdc, 0x11, 0xe7, 0x1e, 0x2b,
0x71, 0xe1, 0x84, 0xd0, 0x2e, 0x12, 0x5f, 0x03, 0x79, 0xfc, 0x3a, 0x1e, 0x67, 0x62, 0x27, 0x95,
0x7a, 0x89, 0xc6, 0x9e, 0xf7, 0xcf, 0x6f, 0x9e, 0xf1, 0x3c, 0x13, 0xd8, 0x18, 0x0d, 0x68, 0xc8,
0xe2, 0x61, 0x10, 0xc6, 0x1e, 0x77, 0xfa, 0x94, 0x3b, 0x8f, 0xc7, 0x2c, 0x3a, 0xb0, 0x47, 0x11,
0x8f, 0x39, 0x79, 0x4d, 0x9d, 0xb5, 0xfb, 0x94, 0x9b, 0x67, 0x3d, 0xee, 0x71, 0x39, 0xe9, 0x24,
0xa3, 0x34, 0xce, 0xdc, 0xf0, 0x38, 0xf7, 0x06, 0xcc, 0xa1, 0xa3, 0xc0, 0xa1, 0x61, 0xc8, 0x63,
0x1a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, 0x37,
0xc9, 0x8d, 0xf9, 0x32, 0xaa, 0xc6, 0x38, 0x51, 0xb2, 0x7d, 0xff, 0xe9, 0x71, 0xc3, 0x78, 0x76,
0xdc, 0x30, 0xfe, 0x39, 0x6e, 0x18, 0xdf, 0x9d, 0x34, 0x96, 0x9e, 0x9d, 0x34, 0x96, 0xfe, 0x3a,
0x69, 0x2c, 0x3d, 0x72, 0xbc, 0x20, 0xf6, 0xc7, 0x5d, 0xbb, 0xc7, 0x87, 0xe5, 0xc5, 0xbf, 0x96,
0xe5, 0xe3, 0x83, 0x11, 0x13, 0xdd, 0x65, 0xf9, 0x5f, 0xf8, 0xda, 0xff, 0x01, 0x00, 0x00, 0xff,
0xff, 0x38, 0x68, 0x51, 0x55, 0x8a, 0x0c, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -1681,8 +1680,8 @@ func (m *QueryGetDistributionRequest) MarshalToSizedBuffer(dAtA []byte) (int, er
_ = i
var l int
_ = l
if m.LastPopHeight != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.LastPopHeight))
if m.Height != 0 {
i = encodeVarintQuery(dAtA, i, uint64(m.Height))
i--
dAtA[i] = 0x8
}
@ -1927,8 +1926,8 @@ func (m *QueryGetDistributionRequest) Size() (n int) {
}
var l int
_ = l
if m.LastPopHeight != 0 {
n += 1 + sovQuery(uint64(m.LastPopHeight))
if m.Height != 0 {
n += 1 + sovQuery(uint64(m.Height))
}
return n
}
@ -3174,9 +3173,9 @@ func (m *QueryGetDistributionRequest) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field LastPopHeight", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType)
}
m.LastPopHeight = 0
m.Height = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
@ -3186,7 +3185,7 @@ func (m *QueryGetDistributionRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.LastPopHeight |= int64(b&0x7F) << shift
m.Height |= int64(b&0x7F) << shift
if b < 0x80 {
break
}

View File

@ -350,15 +350,15 @@ func request_Query_GetDistribution_0(ctx context.Context, marshaler runtime.Mars
_ = err
)
val, ok = pathParams["lastPopHeight"]
val, ok = pathParams["height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lastPopHeight")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height")
}
protoReq.LastPopHeight, err = runtime.Int64(val)
protoReq.Height, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lastPopHeight", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err)
}
msg, err := client.GetDistribution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@ -377,15 +377,15 @@ func local_request_Query_GetDistribution_0(ctx context.Context, marshaler runtim
_ = err
)
val, ok = pathParams["lastPopHeight"]
val, ok = pathParams["height"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "lastPopHeight")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height")
}
protoReq.LastPopHeight, err = runtime.Int64(val)
protoReq.Height, err = runtime.Int64(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "lastPopHeight", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err)
}
msg, err := server.GetDistribution(ctx, &protoReq)
@ -802,7 +802,7 @@ var (
pattern_Query_Challenges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"planetmint", "planetmint-go", "dao", "challenges"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetDistribution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "dao", "get_distribution", "lastPopHeight"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetDistribution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"planetmint", "planetmint-go", "dao", "get_distribution", "height"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (