From badf8551b9117f6367466ff7f02983d5b0e39e71 Mon Sep 17 00:00:00 2001 From: antstalepresh Date: Sun, 21 Jul 2024 20:52:35 +0800 Subject: [PATCH] sdk50 upgrade test fix --- app/upgrades.go | 15 +- proto/kujira/oracle/oracle.proto | 9 ++ x/oracle/migrations/v1/migrate.go | 2 +- x/oracle/types/legacy.go | 20 ++- x/oracle/types/oracle.pb.go | 259 ++++++++++++++++++++++++------ x/oracle/types/params.go | 36 +++++ 6 files changed, 285 insertions(+), 56 deletions(-) diff --git a/app/upgrades.go b/app/upgrades.go index 9256108..48b8285 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -5,6 +5,7 @@ import ( storetypes "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/types/module" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" @@ -65,9 +66,21 @@ func (app App) RegisterUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler( UpgradeName, func(ctx context.Context, - _ upgradetypes.Plan, + plan upgradetypes.Plan, fromVM module.VersionMap, ) (module.VersionMap, error) { + params, err := app.ConsensusParamsKeeper.ParamsStore.Get(ctx) + if err != nil { + return fromVM, err + } + params.Abci = &tmproto.ABCIParams{ + VoteExtensionsEnableHeight: plan.Height + 1, + } + err = app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params) + if err != nil { + return fromVM, err + } + return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) }, ) diff --git a/proto/kujira/oracle/oracle.proto b/proto/kujira/oracle/oracle.proto index 3a8ac1d..df12424 100644 --- a/proto/kujira/oracle/oracle.proto +++ b/proto/kujira/oracle/oracle.proto @@ -40,6 +40,15 @@ message Params { ]; } +// Denom - the object to hold configurations of each denom +message Denom { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + string name = 1 [(gogoproto.moretags) = "yaml:\"name\""]; +} + // Symbol - the object to hold configurations of each symbol message Symbol { option (gogoproto.equal) = false; diff --git a/x/oracle/migrations/v1/migrate.go b/x/oracle/migrations/v1/migrate.go index 743afac..041aa03 100644 --- a/x/oracle/migrations/v1/migrate.go +++ b/x/oracle/migrations/v1/migrate.go @@ -37,7 +37,7 @@ func MigrateParams( for id, denom := range whitelist { symbols = append(symbols, oracletypes.Symbol{ Id: uint32(id + 1), - Symbol: denom.Symbol, + Symbol: denom.Name, }) } diff --git a/x/oracle/types/legacy.go b/x/oracle/types/legacy.go index f700e87..bce81aa 100644 --- a/x/oracle/types/legacy.go +++ b/x/oracle/types/legacy.go @@ -7,18 +7,13 @@ import ( ) // String implements fmt.Stringer interface -func (d Symbol) String() string { +func (d Denom) String() string { out, _ := yaml.Marshal(d) return string(out) } -// Equal implements equal interface -func (d Symbol) Equal(d1 *Symbol) bool { - return d.Symbol == d1.Symbol -} - // DenomList is array of Denom -type DenomList []Symbol +type DenomList []Denom // String implements fmt.Stringer interface func (dl DenomList) String() (out string) { @@ -27,3 +22,14 @@ func (dl DenomList) String() (out string) { } return strings.TrimSpace(out) } + +// String implements fmt.Stringer interface +func (d Symbol) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +// Equal implements equal interface +func (d Symbol) Equal(d1 *Symbol) bool { + return d.Symbol == d1.Symbol +} diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index d7459b5..42465b3 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -97,6 +97,43 @@ func (m *Params) GetSlashWindow() uint64 { return 0 } +// Denom - the object to hold configurations of each denom +type Denom struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" yaml:"name"` +} + +func (m *Denom) Reset() { *m = Denom{} } +func (*Denom) ProtoMessage() {} +func (*Denom) Descriptor() ([]byte, []int) { + return fileDescriptor_8fffe8fb5ee63325, []int{1} +} +func (m *Denom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Denom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Denom.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Denom) XXX_Merge(src proto.Message) { + xxx_messageInfo_Denom.Merge(m, src) +} +func (m *Denom) XXX_Size() int { + return m.Size() +} +func (m *Denom) XXX_DiscardUnknown() { + xxx_messageInfo_Denom.DiscardUnknown(m) +} + +var xxx_messageInfo_Denom proto.InternalMessageInfo + // Symbol - the object to hold configurations of each symbol type Symbol struct { Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` @@ -106,7 +143,7 @@ type Symbol struct { func (m *Symbol) Reset() { *m = Symbol{} } func (*Symbol) ProtoMessage() {} func (*Symbol) Descriptor() ([]byte, []int) { - return fileDescriptor_8fffe8fb5ee63325, []int{1} + return fileDescriptor_8fffe8fb5ee63325, []int{2} } func (m *Symbol) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -144,7 +181,7 @@ type ExchangeRateTuple struct { func (m *ExchangeRateTuple) Reset() { *m = ExchangeRateTuple{} } func (*ExchangeRateTuple) ProtoMessage() {} func (*ExchangeRateTuple) Descriptor() ([]byte, []int) { - return fileDescriptor_8fffe8fb5ee63325, []int{2} + return fileDescriptor_8fffe8fb5ee63325, []int{3} } func (m *ExchangeRateTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -182,7 +219,7 @@ func (m *VoteExtension) Reset() { *m = VoteExtension{} } func (m *VoteExtension) String() string { return proto.CompactTextString(m) } func (*VoteExtension) ProtoMessage() {} func (*VoteExtension) Descriptor() ([]byte, []int) { - return fileDescriptor_8fffe8fb5ee63325, []int{3} + return fileDescriptor_8fffe8fb5ee63325, []int{4} } func (m *VoteExtension) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -227,6 +264,7 @@ func (m *VoteExtension) GetPrices() map[uint32][]byte { func init() { proto.RegisterType((*Params)(nil), "kujira.oracle.Params") + proto.RegisterType((*Denom)(nil), "kujira.oracle.Denom") proto.RegisterType((*Symbol)(nil), "kujira.oracle.Symbol") proto.RegisterType((*ExchangeRateTuple)(nil), "kujira.oracle.ExchangeRateTuple") proto.RegisterType((*VoteExtension)(nil), "kujira.oracle.VoteExtension") @@ -236,50 +274,52 @@ func init() { func init() { proto.RegisterFile("kujira/oracle/oracle.proto", fileDescriptor_8fffe8fb5ee63325) } var fileDescriptor_8fffe8fb5ee63325 = []byte{ - // 684 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6e, 0xd3, 0x4a, - 0x14, 0x8d, 0x93, 0x36, 0xaf, 0x9d, 0xc4, 0x7d, 0xed, 0xbc, 0xb4, 0x8d, 0x52, 0x29, 0x8e, 0xac, - 0xb7, 0x08, 0x48, 0xd8, 0x2a, 0x2c, 0x80, 0x80, 0x10, 0x8a, 0x5a, 0x24, 0x04, 0x8b, 0x68, 0xa8, - 0x8a, 0xc4, 0x26, 0x9d, 0xd8, 0x43, 0x3c, 0xd4, 0xf6, 0x84, 0x99, 0x49, 0x9a, 0xfc, 0x01, 0x4b, - 0x96, 0x2c, 0xbb, 0x60, 0x8d, 0xc4, 0x5f, 0x74, 0xd9, 0x25, 0x62, 0x61, 0xa1, 0x76, 0xc3, 0x3a, - 0x5f, 0x80, 0x3c, 0xe3, 0x54, 0x49, 0xc5, 0xa2, 0xb0, 0xb2, 0xcf, 0xb9, 0xf7, 0x9e, 0x7b, 0xe7, - 0xce, 0xd1, 0x80, 0xda, 0xf1, 0xf0, 0x1d, 0xe5, 0xd8, 0x65, 0x1c, 0x7b, 0x21, 0xc9, 0x3e, 0xce, - 0x80, 0x33, 0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9b, 0x9c, 0x0c, 0x88, 0xe8, 0x15, 0xd5, 0xc3, 0x74, 0xef, 0x57, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x18, 0x31, 0x48, 0xc6, 0xfb, 0x04, 0x00, 0x00, + // 712 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x8d, 0x93, 0x26, 0xaf, 0x9d, 0xc4, 0xfd, 0x98, 0x97, 0xb6, 0x51, 0x2a, 0xc5, 0x91, 0xdf, + 0x5b, 0x04, 0x24, 0x6c, 0x15, 0x16, 0x40, 0x40, 0x08, 0x45, 0x29, 0x12, 0x82, 0x45, 0x34, 0x54, + 0x45, 0x62, 0x93, 0x4e, 0xec, 0x21, 0x1e, 0x6a, 0x7b, 0x82, 0x67, 0x92, 0x26, 0xff, 0x80, 0x25, + 0x4b, 0x96, 0x5d, 0xb0, 0x46, 0xe2, 0x5f, 0x74, 0xd9, 0x25, 0x62, 0x61, 0xa1, 0x76, 0xc3, 0x3a, + 0xbf, 0x00, 0x79, 0xc6, 0xa9, 0x92, 0x88, 0x45, 0x61, 0x15, 0x9f, 0x73, 0xef, 0x39, 0xf7, 0xce, + 0x9d, 0x9b, 0x01, 0xd5, 0x93, 0xe1, 0x3b, 0x1a, 0x61, 0x9b, 0x45, 0xd8, 0xf1, 0x49, 0xfa, 0x63, + 0x0d, 0x22, 0x26, 0x18, 0xd4, 0x55, 0xcc, 0x52, 0x64, 0xb5, 0xdc, 0x67, 0x7d, 0x26, 0x23, 0x76, + 0xf2, 0xa5, 0x92, 0xaa, 0x35, 0x87, 0xf1, 0x80, 0x71, 0xbb, 0x87, 0x39, 0xb1, 0x47, 0xfb, 0x3d, + 0x22, 0xf0, 0xbe, 0xed, 0x30, 0x1a, 0xaa, 0xb8, 0xf9, 0x35, 0x0f, 0x0a, 0x1d, 0x1c, 0xe1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x5b, 0xd3, 0xd8, + 0xd0, 0xd3, 0x31, 0x4a, 0xde, 0xbc, 0xb6, 0x3f, 0x06, 0x3a, 0x49, 0xf5, 0xdd, 0x08, 0x0b, 0x92, + 0xfe, 0x57, 0xfe, 0x6c, 0x8f, 0x17, 0x1c, 0x4c, 0x54, 0x22, 0x73, 0x1d, 0x2d, 0x35, 0xfc, 0x59, + 0x03, 0xfa, 0x11, 0x13, 0xe4, 0x60, 0x2c, 0x48, 0xc8, 0x93, 0x9b, 0xdf, 0x01, 0x05, 0x8f, 0xd0, + 0xbe, 0x27, 0x64, 0xb3, 0x39, 0x94, 0x22, 0xf8, 0x14, 0x14, 0x06, 0x11, 0x75, 0x08, 0xaf, 0x64, + 0xe5, 0xd6, 0x37, 0x96, 0xb6, 0x7e, 0xc1, 0xc5, 0xea, 0xc8, 0xd4, 0x83, 0x50, 0x44, 0x13, 0x94, + 0xea, 0xaa, 0x0f, 0x41, 0x71, 0x8e, 0x86, 0x9b, 0x20, 0x77, 0x42, 0x26, 0xb2, 0x8a, 0x8e, 0x92, + 0x4f, 0x58, 0x06, 0xf9, 0x11, 0xf6, 0x87, 0xea, 0xd0, 0x25, 0xa4, 0x40, 0x33, 0xfb, 0x40, 0x6b, + 0xb5, 0xcf, 0x2f, 0x6b, 0xda, 0xc5, 0x65, 0x4d, 0xfb, 0x71, 0x59, 0xd3, 0x3e, 0x5e, 0xd5, 0x32, + 0x17, 0x57, 0xb5, 0xcc, 0xb7, 0xab, 0x5a, 0xe6, 0xcd, 0xed, 0x3e, 0x15, 0xde, 0xb0, 0x67, 0x39, + 0x2c, 0xb0, 0x0f, 0x09, 0x0e, 0xee, 0xbc, 0x50, 0x4f, 0xa2, 0xc3, 0x22, 0x62, 0x8f, 0x67, 0x2f, + 0xa3, 0x98, 0x0c, 0x08, 0xef, 0x15, 0xe4, 0xa3, 0x76, 0xef, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x72, 0xfb, 0xac, 0x6d, 0x37, 0x05, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -424,6 +464,36 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Denom) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Denom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Symbol) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -589,6 +659,19 @@ func (m *Params) Size() (n int) { return n } +func (m *Denom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + func (m *Symbol) Size() (n int) { if m == nil { return 0 @@ -927,6 +1010,88 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +func (m *Denom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Denom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Denom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Symbol) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index 3975e64..8659f1a 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -62,6 +62,8 @@ func ParamKeyTable() paramstypes.KeyTable { // ParamSetPairs implements the ParamSet interface and returns all the key/value pairs // pairs of oracle module's parameters. func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { + rewardBand := math.LegacyDec{} + whitelist := DenomList{} return paramstypes.ParamSetPairs{ paramstypes.NewParamSetPair(KeyVotePeriod, &p.VotePeriod, validateVotePeriod), paramstypes.NewParamSetPair(KeyVoteThreshold, &p.VoteThreshold, validateVoteThreshold), @@ -70,6 +72,8 @@ func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { paramstypes.NewParamSetPair(KeySlashFraction, &p.SlashFraction, validateSlashFraction), paramstypes.NewParamSetPair(KeySlashWindow, &p.SlashWindow, validateSlashWindow), paramstypes.NewParamSetPair(KeyMinValidPerWindow, &p.MinValidPerWindow, validateMinValidPerWindow), + paramstypes.NewParamSetPair(KeyRewardBand, &rewardBand, validateRewardBand), + paramstypes.NewParamSetPair(KeyWhitelist, &whitelist, validateWhitelist), } } @@ -232,3 +236,35 @@ func validateMinValidPerWindow(i interface{}) error { return nil } + +func validateRewardBand(i interface{}) error { + v, ok := i.(math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("reward band must be positive: %s", v) + } + + if v.GT(math.LegacyOneDec()) { + return fmt.Errorf("reward band is too large: %s", v) + } + + return nil +} + +func validateWhitelist(i interface{}) error { + v, ok := i.(DenomList) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + for _, d := range v { + if len(d.Name) == 0 { + return fmt.Errorf("oracle parameter Whitelist Denom must have name") + } + } + + return nil +}