From 740718f25f5a20cf5750ebe701fab8b31bf1a7f8 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 28 Mar 2024 10:32:01 +0100 Subject: [PATCH] feat(auction) msgs interfaces and validation (#2475) * update auction proto * checkers: number * tests in parallel * msgs implementation and tests * update checkers messages * comment * use coin for bid amount * update msgs * update coin fixtures --- proto/umee/auction/v1/auction.proto | 3 - proto/umee/auction/v1/genesis.proto | 10 ++- proto/umee/auction/v1/tx.proto | 7 +- util/checkers/number.go | 25 +++++- util/checkers/number_test.go | 55 +++++++++++++ util/coin/fixtures.go | 7 +- x/auction/auction.pb.go | 48 ++--------- x/auction/genesis.pb.go | 123 +++++++++++++++++++--------- x/auction/msgs.go | 64 +++++++++++++++ x/auction/msgs_test.go | 79 ++++++++++++++++++ x/auction/tx.pb.go | 70 ++++++++-------- 11 files changed, 364 insertions(+), 127 deletions(-) create mode 100644 x/auction/msgs.go create mode 100644 x/auction/msgs_test.go diff --git a/proto/umee/auction/v1/auction.proto b/proto/umee/auction/v1/auction.proto index 95b1d858bc..5cab299d13 100644 --- a/proto/umee/auction/v1/auction.proto +++ b/proto/umee/auction/v1/auction.proto @@ -10,7 +10,4 @@ option (gogoproto.goproto_getters_all) = false; message RewardsParams { // bid_duration is duration of the bid phase in seconds. int64 bid_duration = 1; - // Duration (in seconds) at the end of each auction, when we start collecting revenues for - // the next auction. - int64 revenu_collection_shift = 2; } diff --git a/proto/umee/auction/v1/genesis.proto b/proto/umee/auction/v1/genesis.proto index 3feb87d9d1..7a1dda9823 100644 --- a/proto/umee/auction/v1/genesis.proto +++ b/proto/umee/auction/v1/genesis.proto @@ -18,11 +18,13 @@ message GenesisState { // Latest active (in bid phase) reward auction. uint32 reward_auction_id = 2; // Latest highest bid. - string highest_bidder = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string highest_bidder = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin highest_bid = 4 [(gogoproto.nullable) = false]; + // Tokens collected for the current auction. - repeated cosmos.base.v1beta1.Coin current_rewards = 4 [(gogoproto.nullable) = false]; + repeated cosmos.base.v1beta1.Coin current_rewards = 5 [(gogoproto.nullable) = false]; // Tokens collected for the next auction, while the current reward auction is still in the // bid phase. - repeated cosmos.base.v1beta1.Coin next_rewards = 5 [(gogoproto.nullable) = false]; - google.protobuf.Timestamp current_rewards_auction_end = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + repeated cosmos.base.v1beta1.Coin next_rewards = 6 [(gogoproto.nullable) = false]; + google.protobuf.Timestamp current_rewards_auction_end = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; } diff --git a/proto/umee/auction/v1/tx.proto b/proto/umee/auction/v1/tx.proto index e65edfb59d..21f10822d9 100644 --- a/proto/umee/auction/v1/tx.proto +++ b/proto/umee/auction/v1/tx.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package umee.auction.v1; -import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; import "umee/auction/v1/auction.proto"; @@ -10,7 +10,6 @@ import "umee/auction/v1/auction.proto"; option go_package = "github.com/umee-network/umee/v6/x/auction"; option (gogoproto.goproto_getters_all) = false; option (gogoproto.messagename_all) = true; - // Msg defines the x/auction module's Msg service. service Msg { // @@ -43,8 +42,8 @@ message MsgRewardsBid { string sender = 1; // the current auction ID being bid on. Fails if the ID is not an ID of the current auction. uint32 id = 2; - // amount of the bid in the base tokens - cosmos.base.v1beta1.Coin bid_amount = 3 [(gogoproto.nullable) = false]; + // amount of the bid in the bond base tokens (uumee) + cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false]; } // MsgRewardsBidResponse response type for Msg/RewardsBid diff --git a/util/checkers/number.go b/util/checkers/number.go index e206e4fbd7..408d212970 100644 --- a/util/checkers/number.go +++ b/util/checkers/number.go @@ -22,7 +22,28 @@ func IntegerMaxDiff[T constraints.Integer](a, b, maxDiff T, note string) error { diff = b - a } if diff > maxDiff { - return fmt.Errorf("%s, diff (=%v) is too big", note, diff) + return fmt.Errorf("%s: diff (=%v) is too big", note, diff) + } + return nil +} + +func NumberMin[T constraints.Integer](a, minVal T, note string) error { + if a < minVal { + return fmt.Errorf("%s: must be at least %v", note, minVal) + } + return nil +} + +func NumberPositive[T constraints.Integer](a T, note string) error { + if a <= 0 { + return fmt.Errorf("%s: must be defined and must be positive", note) + } + return nil +} + +func BigNumPositive[T interface{ IsPositive() bool }](a T, note string) error { + if !a.IsPositive() { + return fmt.Errorf("%s: must be positive", note) } return nil } @@ -30,7 +51,7 @@ func IntegerMaxDiff[T constraints.Integer](a, b, maxDiff T, note string) error { func DecMaxDiff(a, b, maxDiff sdk.Dec, note string) error { diff := a.Sub(b).Abs() if diff.GT(maxDiff) { - return fmt.Errorf("%s, diff (=%v) is too big", note, diff) + return fmt.Errorf("%s: diff (=%v) is too big", note, diff) } return nil } diff --git a/util/checkers/number_test.go b/util/checkers/number_test.go index d7b64f3f4c..8324d85a59 100644 --- a/util/checkers/number_test.go +++ b/util/checkers/number_test.go @@ -9,6 +9,7 @@ import ( ) func TestNumberDiff(t *testing.T) { + t.Parallel() assert := assert.New(t) assert.NoError(IntegerMaxDiff(1, 1, 0, "")) @@ -32,6 +33,7 @@ func TestNumberDiff(t *testing.T) { } func TestDecDiff(t *testing.T) { + t.Parallel() assert := assert.New(t) decMaxDiff := func(a, b, maxDiff float64) error { return DecMaxDiff(tsdk.DecF(a), tsdk.DecF(b), tsdk.DecF(maxDiff), "") @@ -61,6 +63,7 @@ func TestDecDiff(t *testing.T) { } func TestDecInZeroOne(t *testing.T) { + t.Parallel() assert.NoError(t, DecInZeroOne(tsdk.DecF(0), "", true)) assert.NoError(t, DecInZeroOne(tsdk.DecF(0.01), "", true)) assert.NoError(t, DecInZeroOne(tsdk.DecF(0.999), "", true)) @@ -84,9 +87,61 @@ func TestDecInZeroOne(t *testing.T) { } func TestDecNotNegative(t *testing.T) { + t.Parallel() assert.NotNil(t, DecNotNegative(tsdk.DecF(-1), "")) assert.NotNil(t, DecNotNegative(sdk.Dec{}, "")) assert.Nil(t, DecNotNegative(sdk.ZeroDec(), "")) assert.Nil(t, DecNotNegative(tsdk.DecF(5), "")) } + +func TestNumPositive(t *testing.T) { + t.Parallel() + assert := assert.New(t) + + assert.NoError(NumberPositive(1, "")) + assert.NoError(NumberPositive(2, "")) + assert.NoError(NumberPositive(9999999999999, "")) + + assert.Error(NumberPositive(0, "")) + assert.Error(NumberPositive(-1, "")) + assert.Error(NumberPositive(-2, "")) + assert.Error(NumberPositive(-999999999999, "")) + + assert.NoError(BigNumPositive(tsdk.DecF(1.01), "")) + assert.NoError(BigNumPositive(tsdk.DecF(0.000001), "")) + assert.NoError(BigNumPositive(tsdk.DecF(0.123), "")) + assert.NoError(BigNumPositive(tsdk.DecF(9999999999999999999), "")) + + assert.Error(BigNumPositive(tsdk.DecF(0), "")) + assert.Error(BigNumPositive(tsdk.DecF(-0.01), "")) + assert.Error(BigNumPositive(sdk.NewDec(0), "")) + assert.Error(BigNumPositive(sdk.NewDec(-99999999999999999), "")) + + assert.NoError(BigNumPositive(sdk.NewInt(1), "")) + assert.NoError(BigNumPositive(sdk.NewInt(2), "")) + assert.NoError(BigNumPositive(sdk.NewInt(9), "")) + n, ok := sdk.NewIntFromString("111111119999999999999999999") + assert.True(ok) + assert.NoError(BigNumPositive(n, "")) +} + +func TestNumberMin(t *testing.T) { + t.Parallel() + assert := assert.New(t) + + assert.NoError(NumberMin(-1, -10, "")) + assert.NoError(NumberMin(1, 0, "")) + assert.NoError(NumberMin(10, 2, "")) + assert.NoError(NumberMin(999999999999999, 2, "")) + assert.NoError(NumberMin(999999999999999, 999999999999998, "")) + assert.NoError(NumberMin(0, 0, "")) + assert.NoError(NumberMin(-10, -10, "")) + assert.NoError(NumberMin(999999999999999, 999999999999999, "")) + + assert.Error(NumberMin(-10, -1, "")) + assert.Error(NumberMin(-1, 10, "")) + assert.Error(NumberMin(-10, 0, "")) + assert.Error(NumberMin(-10, 10, "")) + assert.Error(NumberMin(10, 11, "")) +} diff --git a/util/coin/fixtures.go b/util/coin/fixtures.go index 374adba363..63a7c295a1 100644 --- a/util/coin/fixtures.go +++ b/util/coin/fixtures.go @@ -41,7 +41,12 @@ var ( //revive:enable:var-naming -// UmeeCoins creates an Umee (uumee) sdk.Coins with given amount +// Umee creates a BondDenom sdk.Coin with the given amount +func Umee(amount int64) sdk.Coin { + return sdk.NewInt64Coin(umee, amount) +} + +// UmeeCoins creates an Umee (uumee) sdk.Coins with the given amount func UmeeCoins(amount int64) sdk.Coins { return sdk.NewCoins(sdk.NewInt64Coin(umee, amount)) } diff --git a/x/auction/auction.pb.go b/x/auction/auction.pb.go index fd51a40ee5..edb61ea20e 100644 --- a/x/auction/auction.pb.go +++ b/x/auction/auction.pb.go @@ -27,9 +27,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type RewardsParams struct { // bid_duration is duration of the bid phase in seconds. BidDuration int64 `protobuf:"varint,1,opt,name=bid_duration,json=bidDuration,proto3" json:"bid_duration,omitempty"` - // Duration (in seconds) at the end of each auction, when we start collecting revenues for - // the next auction. - RevenuCollectionShift int64 `protobuf:"varint,2,opt,name=revenu_collection_shift,json=revenuCollectionShift,proto3" json:"revenu_collection_shift,omitempty"` } func (m *RewardsParams) Reset() { *m = RewardsParams{} } @@ -72,21 +69,19 @@ func init() { func init() { proto.RegisterFile("umee/auction/v1/auction.proto", fileDescriptor_7a7eec280427e7e3) } var fileDescriptor_7a7eec280427e7e3 = []byte{ - // 221 bytes of a gzipped FileDescriptorProto + // 184 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xcd, 0x4d, 0x4d, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf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f3, 0x8b, - 0xb2, 0xc1, 0x1c, 0xfd, 0x32, 0x33, 0xfd, 0x0a, 0x98, 0x0f, 0x93, 0xd8, 0xc0, 0x6e, 0x37, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x54, 0x46, 0x9a, 0x8f, 0x03, 0x01, 0x00, 0x00, + 0x94, 0x99, 0xe2, 0x02, 0x15, 0x72, 0x72, 0x3f, 0xf1, 0x50, 0x8e, 0xe1, 0xc4, 0x23, 0x39, 0xc6, + 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, + 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x34, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, + 0x73, 0xf5, 0x41, 0x6e, 0xd0, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x06, 0x73, 0xf4, 0xcb, + 0xcc, 0xf4, 0x2b, 0x60, 0x2e, 0x4d, 0x62, 0x03, 0xbb, 0xc1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, + 0xa4, 0x42, 0x37, 0xb0, 0xcb, 0x00, 0x00, 0x00, } func (m *RewardsParams) Marshal() (dAtA []byte, err error) { @@ -109,11 +104,6 @@ func (m *RewardsParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.RevenuCollectionShift != 0 { - i = encodeVarintAuction(dAtA, i, uint64(m.RevenuCollectionShift)) - i-- - dAtA[i] = 0x10 - } if m.BidDuration != 0 { i = encodeVarintAuction(dAtA, i, uint64(m.BidDuration)) i-- @@ -142,9 +132,6 @@ func (m *RewardsParams) Size() (n int) { if m.BidDuration != 0 { n += 1 + sovAuction(uint64(m.BidDuration)) } - if m.RevenuCollectionShift != 0 { - n += 1 + sovAuction(uint64(m.RevenuCollectionShift)) - } return n } @@ -202,25 +189,6 @@ func (m *RewardsParams) Unmarshal(dAtA []byte) error { break } } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RevenuCollectionShift", wireType) - } - m.RevenuCollectionShift = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RevenuCollectionShift |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipAuction(dAtA[iNdEx:]) diff --git a/x/auction/genesis.pb.go b/x/auction/genesis.pb.go index 5dcc536ab2..18f94d3d82 100644 --- a/x/auction/genesis.pb.go +++ b/x/auction/genesis.pb.go @@ -35,13 +35,14 @@ type GenesisState struct { // Latest active (in bid phase) reward auction. RewardAuctionId uint32 `protobuf:"varint,2,opt,name=reward_auction_id,json=rewardAuctionId,proto3" json:"reward_auction_id,omitempty"` // Latest highest bid. - HighestBidder string `protobuf:"bytes,3,opt,name=highest_bidder,json=highestBidder,proto3" json:"highest_bidder,omitempty"` + HighestBidder string `protobuf:"bytes,3,opt,name=highest_bidder,json=highestBidder,proto3" json:"highest_bidder,omitempty"` + HighestBid types.Coin `protobuf:"bytes,4,opt,name=highest_bid,json=highestBid,proto3" json:"highest_bid"` // Tokens collected for the current auction. - CurrentRewards []types.Coin `protobuf:"bytes,4,rep,name=current_rewards,json=currentRewards,proto3" json:"current_rewards"` + CurrentRewards []types.Coin `protobuf:"bytes,5,rep,name=current_rewards,json=currentRewards,proto3" json:"current_rewards"` // Tokens collected for the next auction, while the current reward auction is still in the // bid phase. - NextRewards []types.Coin `protobuf:"bytes,5,rep,name=next_rewards,json=nextRewards,proto3" json:"next_rewards"` - CurrentRewardsAuctionEnd time.Time `protobuf:"bytes,6,opt,name=current_rewards_auction_end,json=currentRewardsAuctionEnd,proto3,stdtime" json:"current_rewards_auction_end"` + NextRewards []types.Coin `protobuf:"bytes,6,rep,name=next_rewards,json=nextRewards,proto3" json:"next_rewards"` + CurrentRewardsAuctionEnd time.Time `protobuf:"bytes,7,opt,name=current_rewards_auction_end,json=currentRewardsAuctionEnd,proto3,stdtime" json:"current_rewards_auction_end"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -84,35 +85,36 @@ func init() { func init() { proto.RegisterFile("umee/auction/v1/genesis.proto", fileDescriptor_15e83c50dcf6ac7b) } var fileDescriptor_15e83c50dcf6ac7b = []byte{ - // 441 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcf, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0x6d, 0x52, 0x2a, 0x70, 0x9a, 0x44, 0x58, 0x3d, 0xb8, 0x41, 0x6c, 0x22, 0x4e, 0x01, - 0xa9, 0xbb, 0x4a, 0x91, 0xb8, 0xa2, 0x1a, 0xa1, 0x82, 0xb8, 0x20, 0x97, 0x13, 0x17, 0xcb, 0xf6, - 0x0e, 0x9b, 0x15, 0x78, 0x37, 0xda, 0x5d, 0xa7, 0x7d, 0x8c, 0x3e, 0x0c, 0x37, 0x5e, 0x20, 0xc7, - 0x8a, 0x13, 0x27, 0xfe, 0x24, 0x2f, 0x82, 0xbc, 0xbb, 0xe6, 0x4f, 0xb8, 0xf4, 0xe6, 0x99, 0x6f, - 0xbe, 0xd1, 0x6f, 0x3f, 0x4f, 0xf4, 0xa0, 0xa9, 0x01, 0x48, 0xd1, 0x54, 0x86, 0x4b, 0x41, 0x56, - 0x73, 0xc2, 0x40, 0x80, 0xe6, 0x1a, 0x2f, 0x95, 0x34, 0x32, 0x1e, 0xb5, 0x32, 0xf6, 0x32, 0x5e, - 0xcd, 0xc7, 0x13, 0x26, 0x25, 0xfb, 0x08, 0xc4, 0xca, 0x65, 0xf3, 0x9e, 0x18, 0x5e, 0x83, 0x36, - 0x45, 0xbd, 0x74, 0x8e, 0xf1, 0x51, 0x25, 0x75, 0x2d,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xa2, 0x38, 0x8d, - 0x0e, 0x04, 0x5c, 0xfe, 0x59, 0x73, 0xfb, 0x66, 0x6b, 0xfa, 0xad, 0xa9, 0xdb, 0x51, 0x45, 0xf7, - 0x77, 0x68, 0x7e, 0x67, 0x00, 0x82, 0x26, 0xfb, 0x36, 0xd4, 0x31, 0x76, 0xf7, 0x80, 0xbb, 0x7b, - 0xc0, 0x6f, 0xbb, 0x7b, 0x48, 0xef, 0xb4, 0x3b, 0xaf, 0xbe, 0x4f, 0xc2, 0x2c, 0xf9, 0x17, 0xcf, - 0x47, 0xf6, 0x42, 0xd0, 0xf4, 0x6c, 0xfd, 0x13, 0x05, 0xeb, 0x0d, 0x0a, 0xaf, 0x37, 0x28, 0xfc, - 0xb1, 0x41, 0xe1, 0xd5, 0x16, 0x05, 0xd7, 0x5b, 0x14, 0x7c, 0xdd, 0xa2, 0xe0, 0xdd, 0x23, 0xc6, - 0xcd, 0xa2, 0x29, 0x71, 0x25, 0x6b, 0xd2, 0xfe, 0xbc, 0x63, 0x01, 0xe6, 0x42, 0xaa, 0x0f, 0xb6, - 0x20, 0xab, 0xa7, 0xe4, 0xb2, 0x3b, 0x86, 0x72, 0xdf, 0x02, 0x3c, 0xf9, 0x15, 0x00, 0x00, 0xff, - 0xff, 0x68, 0x1c, 0x46, 0x71, 0xd0, 0x02, 0x00, 0x00, + // 453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x6e, 0x13, 0x3d, + 0x14, 0x9d, 0xf9, 0xd2, 0xaf, 0x80, 0xd3, 0x24, 0x62, 0xd4, 0xc5, 0x34, 0x08, 0x27, 0x62, 0x15, + 0x90, 0x6a, 0x2b, 0x20, 0xb1, 0x85, 0x0e, 0x42, 0x05, 0xb1, 0x41, 0x53, 0x56, 0x6c, 0x46, 0x33, + 0xe3, 0xcb, 0xc4, 0x82, 0xb1, 0x23, 0xdb, 0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xb6, 0xdf, 0x7f, 0x28, 0xc0, 0x9c, 0x4a, 0xf5, 0xd1, 0x16, 0x74, 0xf5, 0x94, 0x9e, + 0x75, 0xe7, 0x54, 0xec, 0x5a, 0x03, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x78, 0xdf, 0x45, + 0x2b, 0x12, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -142,7 +144,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n1 i = encodeVarintGenesis(dAtA, i, uint64(n1)) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a if len(m.NextRewards) > 0 { for iNdEx := len(m.NextRewards) - 1; iNdEx >= 0; iNdEx-- { { @@ -154,7 +156,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } } if len(m.CurrentRewards) > 0 { @@ -168,9 +170,19 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a + } + } + { + size, err := m.HighestBid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x22 if len(m.HighestBidder) > 0 { i -= len(m.HighestBidder) copy(dAtA[i:], m.HighestBidder) @@ -222,6 +234,8 @@ func (m *GenesisState) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + l = m.HighestBid.Size() + n += 1 + l + sovGenesis(uint64(l)) if len(m.CurrentRewards) > 0 { for _, e := range m.CurrentRewards { l = e.Size() @@ -359,6 +373,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { m.HighestBidder = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HighestBid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.HighestBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CurrentRewards", wireType) } @@ -392,7 +439,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NextRewards", wireType) } @@ -426,7 +473,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CurrentRewardsAuctionEnd", wireType) } diff --git a/x/auction/msgs.go b/x/auction/msgs.go new file mode 100644 index 0000000000..f7002f8b37 --- /dev/null +++ b/x/auction/msgs.go @@ -0,0 +1,64 @@ +package auction + +import ( + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" + + appparams "github.com/umee-network/umee/v6/app/params" + "github.com/umee-network/umee/v6/util/checkers" +) + +var ( + _ sdk.Msg = &MsgGovSetRewardsParams{} + _ sdk.Msg = &MsgRewardsBid{} +) + +const minBidDuration = 3600 // 1h in seconds + +// +// MsgGovSetRewardsParams +// + +// ValidateBasic implements Msg +func (msg *MsgGovSetRewardsParams) ValidateBasic() error { + errs := checkers.AssertGovAuthority(msg.Authority) + return errors.Join(errs, checkers.NumberMin(msg.Params.BidDuration, minBidDuration, "bid_duration")) +} + +func (msg *MsgGovSetRewardsParams) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Authority) +} + +// LegacyMsg.Type implementations +func (msg MsgGovSetRewardsParams) Route() string { return "" } +func (msg MsgGovSetRewardsParams) Type() string { return sdk.MsgTypeURL(&msg) } +func (msg *MsgGovSetRewardsParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +// +// MsgRewardsBid +// + +// ValidateBasic implements Msg +func (msg *MsgRewardsBid) ValidateBasic() error { + errs := checkers.ValidateAddr(msg.Sender, "sender") + errs = errors.Join(errs, checkers.NumberPositive(msg.Id, "auction ID")) + errs = errors.Join(errs, checkers.BigNumPositive(msg.Amount.Amount, "bid_amount")) + if msg.Amount.Denom != appparams.BondDenom { + errs = errors.Join(errs, errors.New("bid amount must be in "+appparams.BondDenom)) + } + return errs +} + +func (msg *MsgRewardsBid) GetSigners() []sdk.AccAddress { + return checkers.Signers(msg.Sender) +} + +// LegacyMsg.Type implementations +func (msg MsgRewardsBid) Route() string { return "" } +func (msg MsgRewardsBid) Type() string { return sdk.MsgTypeURL(&msg) } +func (msg *MsgRewardsBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} diff --git a/x/auction/msgs_test.go b/x/auction/msgs_test.go new file mode 100644 index 0000000000..29728561a0 --- /dev/null +++ b/x/auction/msgs_test.go @@ -0,0 +1,79 @@ +package auction + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/umee-network/umee/v6/tests/accs" + "github.com/umee-network/umee/v6/tests/tcheckers" + "github.com/umee-network/umee/v6/util/checkers" + "github.com/umee-network/umee/v6/util/coin" +) + +func TestMsgGovSetRewardsParams(t *testing.T) { + t.Parallel() + validMsg := MsgGovSetRewardsParams{ + Authority: checkers.GovModuleAddr, + Params: RewardsParams{BidDuration: 3600 * 12}, // 12h + } + + invalidAuth := validMsg + invalidAuth.Authority = accs.Bob.String() + + invalidBidDuration1 := validMsg + invalidBidDuration1.Params.BidDuration = 0 + + invalidBidDuration2 := validMsg + invalidBidDuration2.Params.BidDuration = 1200 + + tcs := []struct { + name string + msg MsgGovSetRewardsParams + errMsg string + }{ + {"valid msg", validMsg, ""}, + {"wrong gov auth", invalidAuth, "expected gov account"}, + {"bid duration 0", invalidBidDuration1, "must be at least"}, + {"bid duration 1200", invalidBidDuration2, "must be at least"}, + } + for _, tc := range tcs { + tcheckers.ErrorContains(t, tc.msg.ValidateBasic(), tc.errMsg, tc.name) + } +} + +func TestMsgRewardsBid(t *testing.T) { + t.Parallel() + validMsg := MsgRewardsBid{ + Sender: accs.Alice.String(), + Id: 12, + Amount: coin.Umee10k, + } + + invalid := validMsg + invalid.Sender = "not a valid acc" + invalid.Id = 0 + invalid.Amount.Amount = sdk.ZeroInt() + + invalidAmount1 := validMsg + invalidAmount1.Amount.Amount = sdk.NewInt(-100) + + invalidDenom := validMsg + invalidDenom.Amount.Denom = "other" + + tcs := []struct { + name string + msg MsgRewardsBid + errMsg string + }{ + {"valid msg", validMsg, ""}, + {"invalid sender", invalid, "sender"}, + {"invalid ID", invalid, "auction ID"}, + {"amount zero", invalid, "bid_amount: must be positive"}, + {"amount negative", invalidAmount1, "bid_amount: must be positive"}, + {"wrong denom", invalidDenom, "bid amount must be in " + validMsg.Amount.Denom}, + } + for _, tc := range tcs { + tcheckers.ErrorContains(t, tc.msg.ValidateBasic(), tc.errMsg, tc.name) + } +} diff --git a/x/auction/tx.pb.go b/x/auction/tx.pb.go index 61e87ac737..2851660e40 100644 --- a/x/auction/tx.pb.go +++ b/x/auction/tx.pb.go @@ -121,8 +121,8 @@ type MsgRewardsBid struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` // the current auction ID being bid on. Fails if the ID is not an ID of the current auction. Id uint32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - // amount of the bid in the base tokens - BidAmount types.Coin `protobuf:"bytes,3,opt,name=bid_amount,json=bidAmount,proto3" json:"bid_amount"` + // amount of the bid in the bond base tokens (uumee) + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` } func (m *MsgRewardsBid) Reset() { *m = MsgRewardsBid{} } @@ -212,36 +212,36 @@ func init() { func init() { proto.RegisterFile("umee/auction/v1/tx.proto", fileDescriptor_44a5dea2889d94ea) } var fileDescriptor_44a5dea2889d94ea = []byte{ - // 461 bytes of a gzipped FileDescriptorProto + // 452 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6a, 0x14, 0x31, - 0x18, 0xc7, 0x27, 0x5b, 0x59, 0xd8, 0x94, 0x56, 0x18, 0x6b, 0x3b, 0x5d, 0x30, 0x2e, 0x7b, 0xd0, - 0x2a, 0x34, 0x61, 0x2b, 0xf4, 0x50, 0x44, 0xe8, 0x7a, 0xf0, 0x20, 0x0b, 0x32, 0xf5, 0xe4, 0xa5, - 0xcc, 0x6c, 0x42, 0x1a, 0x64, 0xe6, 0x5b, 0x92, 0xcc, 0xb4, 0x5e, 0xc5, 0x07, 0xf0, 0x09, 0x7c, - 0x06, 0x0f, 0x3e, 0xc4, 0x1e, 0x3c, 0x14, 0x4f, 0x9e, 0x44, 0x77, 0x0f, 0xbe, 0x86, 0x4c, 0x26, - 0xc3, 0xda, 0x3a, 0x48, 0x6f, 0xf3, 0xcd, 0x3f, 0xff, 0xff, 0xf7, 0xfb, 0xbe, 0x04, 0x47, 0x45, - 0x26, 0x04, 0x4b, 0x8a, 0xa9, 0x55, 0x90, 0xb3, 0x72, 0xc4, 0xec, 0x05, 0x9d, 0x69, 0xb0, 0x10, - 0xde, 0xae, 0x14, 0xea, 0x15, 0x5a, 0x8e, 0xfa, 0x64, 0x0a, 0x26, 0x03, 0xc3, 0xd2, 0xc4, 0x08, - 0x56, 0x8e, 0x52, 0x61, 0x93, 0x11, 0x9b, 0x82, 0xca, 0x6b, 0x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2f, 0x33, 0x0f, 0x8c, 0xf4, 0x67, 0x60, 0xdf, 0x56, 0x05, 0x2f, 0x8e, 0xf8, 0x79, 0xf3, + 0xf8, 0x26, 0xdd, 0xea, 0xf5, 0x3d, 0xfa, 0x13, 0x00, 0x00, 0xff, 0xff, 0x99, 0x65, 0xe1, 0x57, + 0x33, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -450,7 +450,7 @@ func (m *MsgRewardsBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.BidAmount.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -545,7 +545,7 @@ func (m *MsgRewardsBid) Size() (n int) { if m.Id != 0 { n += 1 + sovTx(uint64(m.Id)) } - l = m.BidAmount.Size() + l = m.Amount.Size() n += 1 + l + sovTx(uint64(l)) return n } @@ -812,7 +812,7 @@ func (m *MsgRewardsBid) Unmarshal(dAtA []byte) error { } case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BidAmount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -839,7 +839,7 @@ func (m *MsgRewardsBid) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.BidAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex