diff --git a/proto/umee/oracle/v1/genesis.proto b/proto/umee/oracle/v1/genesis.proto index fa0a6bf790..73a5ff88b0 100644 --- a/proto/umee/oracle/v1/genesis.proto +++ b/proto/umee/oracle/v1/genesis.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package umee.oracle.v1; import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; import "umee/oracle/v1/oracle.proto"; option go_package = "github.com/umee-network/umee/v3/x/oracle/types"; @@ -23,8 +22,9 @@ message GenesisState { [(gogoproto.nullable) = false]; repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6 [(gogoproto.nullable) = false]; - repeated cosmos.base.v1beta1.DecCoin medians = 7 [(gogoproto.nullable) = false]; - repeated HistoricPrice historic_prices = 8 [(gogoproto.nullable) = false]; + repeated HistoricPrice historic_prices = 8 [(gogoproto.nullable) = false]; + repeated ExchangeRateTuple medians = 7 [(gogoproto.nullable) = false]; + repeated ExchangeRateTuple medianDeviations = 9 [(gogoproto.nullable) = false]; } // FeederDelegation is the address for where oracle feeder authority are @@ -41,3 +41,11 @@ message MissCounter { string validator_address = 1; uint64 miss_counter = 2; } + +// HistoricPrice is an instance of a price "stamp" +message HistoricPrice { + ExchangeRateTuple exchange_rate_tuple = 1 [ + (gogoproto.nullable) = false + ]; + uint64 block_num = 2; +} diff --git a/proto/umee/oracle/v1/oracle.proto b/proto/umee/oracle/v1/oracle.proto index baa0d6d349..0a6d46b281 100644 --- a/proto/umee/oracle/v1/oracle.proto +++ b/proto/umee/oracle/v1/oracle.proto @@ -108,12 +108,3 @@ message ExchangeRateTuple { (gogoproto.nullable) = false ]; } - -// HistoricPrice is an instance of a price "stamp" -message HistoricPrice { - ExchangeRateTuple exchange_rate = 1 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - uint64 block_num = 2; -} diff --git a/x/oracle/keeper/historic_price.go b/x/oracle/keeper/historic_price.go index eadeb5fc0e..cf6a84875e 100644 --- a/x/oracle/keeper/historic_price.go +++ b/x/oracle/keeper/historic_price.go @@ -12,34 +12,34 @@ import ( ) // median returns the median of a list of historic prices. -func median(prices []types.HistoricPrice) sdk.Dec { +func median(prices []sdk.Dec) sdk.Dec { lenPrices := len(prices) if lenPrices == 0 { return sdk.ZeroDec() } sort.Slice(prices, func(i, j int) bool { - return prices[i].ExchangeRate.BigInt(). - Cmp(prices[j].ExchangeRate.BigInt()) > 0 + return prices[i].BigInt(). + Cmp(prices[j].BigInt()) > 0 }) if lenPrices%2 == 0 { - return prices[lenPrices/2-1].ExchangeRate. - Add(prices[lenPrices/2].ExchangeRate). + return prices[lenPrices/2-1]. + Add(prices[lenPrices/2]). QuoInt64(2) } - return prices[lenPrices/2].ExchangeRate + return prices[lenPrices/2] } // medianDeviation returns the standard deviation around the // median of a list of prices. // medianDeviation = ∑((price - median)^2 / len(prices)) -func medianDeviation(median sdk.Dec, prices []types.HistoricPrice) sdk.Dec { +func medianDeviation(median sdk.Dec, prices []sdk.Dec) sdk.Dec { lenPrices := len(prices) medianDeviation := sdk.ZeroDec() for _, price := range prices { - medianDeviation = medianDeviation.Add(price.ExchangeRate. + medianDeviation = medianDeviation.Add(price. Sub(median).Abs().Power(2). QuoInt64(int64(lenPrices))) } @@ -52,18 +52,16 @@ func medianDeviation(median sdk.Dec, prices []types.HistoricPrice) sdk.Dec { func (k Keeper) GetMedian( ctx sdk.Context, denom string, - blockNum uint64, ) (sdk.Dec, error) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyMedian(denom, blockNum)) + bz := store.Get(types.KeyMedian(denom)) if bz == nil { - return sdk.ZeroDec(), sdkerrors.Wrap(types.ErrNoMedian, fmt.Sprintf("denom: %s block: %d", denom, blockNum)) + return sdk.ZeroDec(), sdkerrors.Wrap(types.ErrNoMedian, fmt.Sprintf("denom: %s", denom)) } - decProto := sdk.DecProto{} - k.cdc.MustUnmarshal(bz, &decProto) - - return decProto.Dec, nil + median := sdk.DecProto{} + k.cdc.MustUnmarshal(bz, &median) + return median.Dec, nil } // SetMedian uses all the historic prices of a given denom to calculate @@ -78,7 +76,7 @@ func (k Keeper) SetMedian( historicPrices := k.getHistoricPrices(ctx, denom) median := median(historicPrices) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: median}) - store.Set(types.KeyMedian(denom, uint64(ctx.BlockHeight())), bz) + store.Set(types.KeyMedian(denom), bz) k.setMedianDeviation(ctx, denom, median, historicPrices) } @@ -87,12 +85,11 @@ func (k Keeper) SetMedian( func (k Keeper) GetMedianDeviation( ctx sdk.Context, denom string, - blockNum uint64, ) (sdk.Dec, error) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyMedianDeviation(denom, blockNum)) + bz := store.Get(types.KeyMedianDeviation(denom)) if bz == nil { - return sdk.ZeroDec(), sdkerrors.Wrap(types.ErrNoMedianDeviation, fmt.Sprintf("denom: %s block: %d", denom, blockNum)) + return sdk.ZeroDec(), sdkerrors.Wrap(types.ErrNoMedianDeviation, fmt.Sprintf("denom: %s", denom)) } decProto := sdk.DecProto{} @@ -107,27 +104,23 @@ func (k Keeper) setMedianDeviation( ctx sdk.Context, denom string, median sdk.Dec, - prices []types.HistoricPrice, + prices []sdk.Dec, ) { store := ctx.KVStore(k.storeKey) medianDeviation := medianDeviation(median, prices) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: medianDeviation}) - store.Set(types.KeyMedianDeviation(denom, uint64(ctx.BlockHeight())), bz) + store.Set(types.KeyMedianDeviation(denom), bz) } // getHistoricPrices returns all the historic prices of a given denom. func (k Keeper) getHistoricPrices( ctx sdk.Context, denom string, -) []types.HistoricPrice { - historicPrices := []types.HistoricPrice{} - - k.IterateHistoricPrices(ctx, denom, func(exchangeRate sdk.Dec, blockNum uint64) bool { - historicPrices = append(historicPrices, types.HistoricPrice{ - ExchangeRate: exchangeRate, - BlockNum: blockNum, - }) +) []sdk.Dec { + historicPrices := []sdk.Dec{} + k.IterateHistoricPrices(ctx, denom, func(exchangeRate sdk.Dec) bool { + historicPrices = append(historicPrices, exchangeRate) return false }) @@ -140,7 +133,7 @@ func (k Keeper) getHistoricPrices( func (k Keeper) IterateHistoricPrices( ctx sdk.Context, denom string, - handler func(sdk.Dec, uint64) bool, + handler func(sdk.Dec) bool, ) { store := ctx.KVStore(k.storeKey) @@ -150,9 +143,9 @@ func (k Keeper) IterateHistoricPrices( defer iter.Close() for ; iter.Valid(); iter.Next() { - var historicPrice types.HistoricPrice - k.cdc.MustUnmarshal(iter.Value(), &historicPrice) - if handler(historicPrice.ExchangeRate, historicPrice.BlockNum) { + decProto := sdk.DecProto{} + k.cdc.MustUnmarshal(iter.Value(), &decProto) + if handler(decProto.Dec) { break } } @@ -167,10 +160,7 @@ func (k Keeper) AddHistoricPrice( ) { store := ctx.KVStore(k.storeKey) block := uint64(ctx.BlockHeight()) - bz := k.cdc.MustMarshal(&types.HistoricPrice{ - ExchangeRate: exchangeRate, - BlockNum: block, - }) + bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: exchangeRate}) store.Set(types.KeyHistoricPrice(denom, block), bz) } @@ -190,10 +180,9 @@ func (k Keeper) DeleteHistoricPrice( func (k Keeper) DeleteMedian( ctx sdk.Context, denom string, - blockNum uint64, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyMedian(denom, blockNum)) + store.Delete(types.KeyMedian(denom)) } // DeleteMedianDeviation deletes a given denom's standard deviation around @@ -201,8 +190,7 @@ func (k Keeper) DeleteMedian( func (k Keeper) DeleteMedianDeviation( ctx sdk.Context, denom string, - blockNum uint64, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyMedianDeviation(denom, blockNum)) + store.Delete(types.KeyMedianDeviation(denom)) } diff --git a/x/oracle/keeper/historic_price_test.go b/x/oracle/keeper/historic_price_test.go index f342645895..8be293bec1 100644 --- a/x/oracle/keeper/historic_price_test.go +++ b/x/oracle/keeper/historic_price_test.go @@ -27,24 +27,24 @@ func (s *IntegrationTestSuite) TestSetHistoraclePricing() { // set and check median and median standard deviation app.OracleKeeper.SetMedian(ctx, displayDenom) - median, err := app.OracleKeeper.GetMedian(ctx, displayDenom, uint64(ctx.BlockHeight())) + median, err := app.OracleKeeper.GetMedian(ctx, displayDenom) s.Require().NoError(err) s.Require().Equal(median, sdk.MustNewDecFromStr("1.15")) - medianDeviation, err := app.OracleKeeper.GetMedianDeviation(ctx, displayDenom, uint64(ctx.BlockHeight())) + medianDeviation, err := app.OracleKeeper.GetMedianDeviation(ctx, displayDenom) s.Require().NoError(err) s.Require().Equal(medianDeviation, sdk.MustNewDecFromStr("0.0225")) // delete first historic price, median, and median standard deviation app.OracleKeeper.DeleteHistoricPrice(ctx, displayDenom, uint64(ctx.BlockHeight()-3)) - app.OracleKeeper.DeleteMedian(ctx, displayDenom, uint64(ctx.BlockHeight())) - app.OracleKeeper.DeleteMedianDeviation(ctx, displayDenom, uint64(ctx.BlockHeight())) + app.OracleKeeper.DeleteMedian(ctx, displayDenom) + app.OracleKeeper.DeleteMedianDeviation(ctx, displayDenom) - median, err = app.OracleKeeper.GetMedian(ctx, displayDenom, uint64(ctx.BlockHeight())) + median, err = app.OracleKeeper.GetMedian(ctx, displayDenom) s.Require().Error(err, sdkerrors.Wrap(types.ErrUnknownDenom, displayDenom)) s.Require().Equal(median, sdk.ZeroDec()) - medianDeviation, err = app.OracleKeeper.GetMedianDeviation(ctx, displayDenom, uint64(ctx.BlockHeight())) + medianDeviation, err = app.OracleKeeper.GetMedianDeviation(ctx, displayDenom) s.Require().Error(err, sdkerrors.Wrap(types.ErrUnknownDenom, displayDenom)) s.Require().Equal(median, sdk.ZeroDec()) } diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 8833eabe74..a4e2adb6e6 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -32,8 +31,9 @@ type GenesisState struct { MissCounters []MissCounter `protobuf:"bytes,4,rep,name=miss_counters,json=missCounters,proto3" json:"miss_counters"` AggregateExchangeRatePrevotes []AggregateExchangeRatePrevote `protobuf:"bytes,5,rep,name=aggregate_exchange_rate_prevotes,json=aggregateExchangeRatePrevotes,proto3" json:"aggregate_exchange_rate_prevotes"` AggregateExchangeRateVotes []AggregateExchangeRateVote `protobuf:"bytes,6,rep,name=aggregate_exchange_rate_votes,json=aggregateExchangeRateVotes,proto3" json:"aggregate_exchange_rate_votes"` - Medians []types.DecCoin `protobuf:"bytes,7,rep,name=medians,proto3" json:"medians"` HistoricPrices []HistoricPrice `protobuf:"bytes,8,rep,name=historic_prices,json=historicPrices,proto3" json:"historic_prices"` + Medians []ExchangeRateTuple `protobuf:"bytes,7,rep,name=medians,proto3" json:"medians"` + MedianDeviations []ExchangeRateTuple `protobuf:"bytes,9,rep,name=medianDeviations,proto3" json:"medianDeviations"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -150,51 +150,93 @@ func (m *MissCounter) XXX_DiscardUnknown() { var xxx_messageInfo_MissCounter proto.InternalMessageInfo +// HistoricPrice is an instance of a price "stamp" +type HistoricPrice struct { + ExchangeRateTuple ExchangeRateTuple `protobuf:"bytes,1,opt,name=exchange_rate_tuple,json=exchangeRateTuple,proto3" json:"exchange_rate_tuple"` + BlockNum uint64 `protobuf:"varint,2,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` +} + +func (m *HistoricPrice) Reset() { *m = HistoricPrice{} } +func (m *HistoricPrice) String() string { return proto.CompactTextString(m) } +func (*HistoricPrice) ProtoMessage() {} +func (*HistoricPrice) Descriptor() ([]byte, []int) { + return fileDescriptor_c99b4af40468acc1, []int{3} +} +func (m *HistoricPrice) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistoricPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistoricPrice.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 *HistoricPrice) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricPrice.Merge(m, src) +} +func (m *HistoricPrice) XXX_Size() int { + return m.Size() +} +func (m *HistoricPrice) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricPrice.DiscardUnknown(m) +} + +var xxx_messageInfo_HistoricPrice proto.InternalMessageInfo + func init() { proto.RegisterType((*GenesisState)(nil), "umee.oracle.v1.GenesisState") proto.RegisterType((*FeederDelegation)(nil), "umee.oracle.v1.FeederDelegation") proto.RegisterType((*MissCounter)(nil), "umee.oracle.v1.MissCounter") + proto.RegisterType((*HistoricPrice)(nil), "umee.oracle.v1.HistoricPrice") } func init() { proto.RegisterFile("umee/oracle/v1/genesis.proto", fileDescriptor_c99b4af40468acc1) } var fileDescriptor_c99b4af40468acc1 = []byte{ - // 554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x40, - 0x14, 0x85, 0xe3, 0xfe, 0xc2, 0xa4, 0x0d, 0xed, 0x08, 0x21, 0x2b, 0x6d, 0xdd, 0xb4, 0x12, 0x52, - 0x11, 0x60, 0xab, 0x2d, 0x4b, 0x36, 0x4d, 0x4b, 0x61, 0x51, 0xa4, 0x28, 0xfc, 0x2c, 0x90, 0x90, - 0x35, 0xb1, 0x6f, 0x9c, 0x11, 0xb1, 0xc7, 0x9a, 0x3b, 0x09, 0x45, 0xbc, 0x04, 0xcf, 0xc1, 0x83, - 0xa0, 0x2c, 0xbb, 0x64, 0xc5, 0x4f, 0xf2, 0x22, 0xc8, 0xe3, 0x49, 0xe3, 0x9a, 0x16, 0xb1, 0x4b, - 0xee, 0xf9, 0xee, 0x39, 0x57, 0xc9, 0x19, 0xb2, 0x39, 0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de, 0x7d, 0x4f, 0xaa, 0x85, 0x1e, 0x5c, 0xbf, 0x6b, 0x5d, - 0xbf, 0x4b, 0x77, 0xc8, 0x4a, 0xb1, 0x68, 0x3a, 0x63, 0xa1, 0x5d, 0x2d, 0x94, 0xa8, 0x79, 0x36, - 0xfa, 0xed, 0x54, 0x46, 0x63, 0xc7, 0xba, 0x18, 0x3b, 0xd6, 0xaf, 0xb1, 0x63, 0x7d, 0x99, 0x38, - 0x95, 0x8b, 0x89, 0x53, 0xf9, 0x3e, 0x71, 0x2a, 0xef, 0xdc, 0x88, 0xab, 0xde, 0xa0, 0xe3, 0x06, - 0x22, 0xf6, 0xb2, 0xdf, 0xe8, 0x71, 0x02, 0xea, 0xa3, 0x90, 0x1f, 0xf4, 0x17, 0x6f, 0x78, 0xe8, - 0x9d, 0x4f, 0xdf, 0xb9, 0xfa, 0x94, 0x02, 0x76, 0x96, 0xf4, 0x23, 0x3f, 0xfc, 0x13, 0x00, 0x00, - 0xff, 0xff, 0xc2, 0x31, 0xa6, 0xac, 0x67, 0x04, 0x00, 0x00, + // 584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcd, 0x6e, 0xd3, 0x4e, + 0x14, 0xc5, 0xe3, 0xb6, 0xff, 0xb4, 0x9d, 0x34, 0xf9, 0xb7, 0x03, 0x42, 0x56, 0x4a, 0xdd, 0x34, + 0x12, 0x52, 0x11, 0x60, 0xab, 0x2d, 0x2f, 0xd0, 0x50, 0x0a, 0x8b, 0x82, 0xa2, 0x94, 0x0f, 0x09, + 0x09, 0x59, 0x13, 0xfb, 0xc6, 0xb1, 0x1a, 0x7b, 0xac, 0x99, 0xb1, 0x29, 0x62, 0xcd, 0x9e, 0x47, + 0x60, 0xcd, 0x93, 0x64, 0xd9, 0x25, 0x2b, 0x3e, 0x92, 0x17, 0x41, 0x1e, 0x4f, 0x1a, 0xc7, 0x6d, + 0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0xf3, 0x3d, 0xaa, 0xe4, 0x36, + 0xec, 0xfa, 0x5e, 0xed, 0xfa, 0x5e, 0xbc, 0x83, 0xd6, 0xf2, 0x2b, 0x2c, 0x33, 0x96, 0x3a, 0x95, + 0xdc, 0x7a, 0x36, 0x3f, 0x6b, 0xa8, 0x3a, 0xf3, 0x1b, 0xf0, 0x5b, 0x74, 0x6b, 0x76, 0x51, 0x44, + 0xfa, 0x1d, 0xd4, 0xb9, 0x9f, 0xfb, 0x83, 0x6d, 0x40, 0x51, 0xc0, 0x9b, 0x68, 0xb5, 0x3b, 0xa0, + 0xce, 0x99, 0x1d, 0xc6, 0x81, 0x1a, 0x65, 0x45, 0x16, 0x5e, 0xc6, 0x41, 0xeb, 0x64, 0xf8, 0xdb, + 0x28, 0x0d, 0x47, 0x86, 0x76, 0x31, 0x32, 0xb4, 0x5f, 0x23, 0x43, 0xfb, 0x32, 0x36, 0x4a, 0x17, + 0x63, 0xa3, 0xf4, 0x7d, 0x6c, 0x94, 0xde, 0x99, 0x9e, 0x2f, 0xfa, 0x71, 0xd7, 0x74, 0x68, 0x60, + 0xa5, 0x03, 0x3c, 0x0a, 0x41, 0x7c, 0xa0, 0xec, 0x4c, 0xbe, 0x58, 0xc9, 0x81, 0x75, 0x3e, 0xb9, + 0xc9, 0xc4, 0xc7, 0x08, 0x78, 0xb7, 0x2c, 0xaf, 0xb1, 0x83, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x05, 0xf1, 0x47, 0x75, 0x29, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -217,6 +259,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.MedianDeviations) > 0 { + for iNdEx := len(m.MedianDeviations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MedianDeviations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } if len(m.HistoricPrices) > 0 { for iNdEx := len(m.HistoricPrices) - 1; iNdEx >= 0; iNdEx-- { { @@ -400,6 +456,44 @@ func (m *MissCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *HistoricPrice) 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 *HistoricPrice) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockNum != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.BlockNum)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.ExchangeRateTuple.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -461,6 +555,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.MedianDeviations) > 0 { + for _, e := range m.MedianDeviations { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -497,6 +597,20 @@ func (m *MissCounter) Size() (n int) { return n } +func (m *HistoricPrice) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ExchangeRateTuple.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.BlockNum != 0 { + n += 1 + sovGenesis(uint64(m.BlockNum)) + } + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -764,7 +878,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Medians = append(m.Medians, types.DecCoin{}) + m.Medians = append(m.Medians, ExchangeRateTuple{}) if err := m.Medians[len(m.Medians)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -803,6 +917,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MedianDeviations", 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 + } + m.MedianDeviations = append(m.MedianDeviations, ExchangeRateTuple{}) + if err := m.MedianDeviations[len(m.MedianDeviations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -1039,6 +1187,108 @@ func (m *MissCounter) Unmarshal(dAtA []byte) error { } return nil } +func (m *HistoricPrice) 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 ErrIntOverflowGenesis + } + 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: HistoricPrice: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HistoricPrice: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRateTuple", 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.ExchangeRateTuple.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNum", wireType) + } + m.BlockNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNum |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 39d21967f9..c53dfee897 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -57,14 +57,14 @@ func KeyAggregateExchangeRateVote(v sdk.ValAddress) []byte { return util.ConcatBytes(0, KeyPrefixAggregateExchangeRateVote, address.MustLengthPrefix(v)) } -// KeyMedian - stored by *denom* and *block* -func KeyMedian(denom string, blockNum uint64) (key []byte) { - return util.ConcatBytes(0, KeyPrefixMedian, []byte(denom), uintWithNullPrefix(blockNum)) +// KeyMedian - stored by *denom* +func KeyMedian(denom string) (key []byte) { + return util.ConcatBytes(0, KeyPrefixMedian, []byte(denom)) } -// KeyMedianDeviation - stored by *denom* and *block* -func KeyMedianDeviation(denom string, blockNum uint64) (key []byte) { - return util.ConcatBytes(0, KeyPrefixMedianDeviation, []byte(denom), uintWithNullPrefix(blockNum)) +// KeyMedianDeviation - stored by *denom* +func KeyMedianDeviation(denom string) (key []byte) { + return util.ConcatBytes(0, KeyPrefixMedianDeviation, []byte(denom)) } // KeyHistoricPrice - stored by *denom* and *block* diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 0bded5ff66..c0580e2cf5 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -40,7 +40,7 @@ type Params struct { // Prune Period represents the maximum amount of blocks which we want // to keep a record of our set of exchange rates. PrunePeriod uint64 `protobuf:"varint,10,opt,name=prune_period,json=prunePeriod,proto3" json:"prune_period,omitempty"` - // Medion Period reperesents the amound blocks we will wait between + // Median Period represents the amount blocks we will wait between // calculating the median and standard deviation of the median of // historic prices in the last Prune Period. MedianPeriod uint64 `protobuf:"varint,11,opt,name=median_period,json=medianPeriod,proto3" json:"median_period,omitempty"` @@ -237,113 +237,70 @@ func (m *ExchangeRateTuple) XXX_DiscardUnknown() { var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo -// HistoricPrice is an instance of a price "stamp" -type HistoricPrice struct { - ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate" yaml:"exchange_rate"` - BlockNum uint64 `protobuf:"varint,2,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` -} - -func (m *HistoricPrice) Reset() { *m = HistoricPrice{} } -func (m *HistoricPrice) String() string { return proto.CompactTextString(m) } -func (*HistoricPrice) ProtoMessage() {} -func (*HistoricPrice) Descriptor() ([]byte, []int) { - return fileDescriptor_8893c9e0e94ceb54, []int{5} -} -func (m *HistoricPrice) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HistoricPrice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HistoricPrice.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 *HistoricPrice) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoricPrice.Merge(m, src) -} -func (m *HistoricPrice) XXX_Size() int { - return m.Size() -} -func (m *HistoricPrice) XXX_DiscardUnknown() { - xxx_messageInfo_HistoricPrice.DiscardUnknown(m) -} - -var xxx_messageInfo_HistoricPrice proto.InternalMessageInfo - func init() { proto.RegisterType((*Params)(nil), "umee.oracle.v1.Params") proto.RegisterType((*Denom)(nil), "umee.oracle.v1.Denom") proto.RegisterType((*AggregateExchangeRatePrevote)(nil), "umee.oracle.v1.AggregateExchangeRatePrevote") proto.RegisterType((*AggregateExchangeRateVote)(nil), "umee.oracle.v1.AggregateExchangeRateVote") proto.RegisterType((*ExchangeRateTuple)(nil), "umee.oracle.v1.ExchangeRateTuple") - proto.RegisterType((*HistoricPrice)(nil), "umee.oracle.v1.HistoricPrice") } func init() { proto.RegisterFile("umee/oracle/v1/oracle.proto", fileDescriptor_8893c9e0e94ceb54) } var fileDescriptor_8893c9e0e94ceb54 = []byte{ - // 869 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xbf, 0x6f, 0x23, 0x45, - 0x14, 0xf6, 0x72, 0x49, 0x88, 0xc7, 0xf6, 0x1d, 0xd9, 0x4b, 0xc0, 0x5c, 0x90, 0x37, 0x99, 0x13, - 0x47, 0x9a, 0xb3, 0x75, 0x1c, 0x12, 0x22, 0x1d, 0xab, 0x70, 0x50, 0x1c, 0xc8, 0x1a, 0x9d, 0x0e, - 0x89, 0x66, 0x35, 0xbb, 0x3b, 0xd8, 0xa3, 0xec, 0xee, 0xac, 0x66, 0x66, 0x9d, 0xa4, 0xa1, 0xa6, - 0x42, 0x94, 0x94, 0xa9, 0xe9, 0x41, 0x34, 0xf4, 0x29, 0xaf, 0x44, 0x14, 0x0b, 0x24, 0x0d, 0xf5, - 0xfe, 0x03, 0xa0, 0xf9, 0xb1, 0xc9, 0xda, 0x71, 0x91, 0x08, 0x51, 0x79, 0xde, 0xfb, 0xde, 0x8f, - 0xef, 0xbd, 0x99, 0xcf, 0x0b, 0xb6, 0x8b, 0x94, 0x90, 0x11, 0xe3, 0x38, 0x4a, 0xc8, 0x68, 0xf6, - 0xc4, 0x9e, 0x86, 0x39, 0x67, 0x92, 0xb9, 0x77, 0x15, 0x38, 0xb4, 0xae, 0xd9, 0x93, 0x07, 0x9b, - 0x13, 0x36, 0x61, 0x1a, 0x1a, 0xa9, 0x93, 0x89, 0x82, 0xff, 0xac, 0x81, 0xb5, 0x31, 0xe6, 0x38, - 0x15, 0xee, 0x87, 0xa0, 0x33, 0x63, 0x92, 0x04, 0x39, 0xe1, 0x94, 0xc5, 0x7d, 0x67, 0xc7, 0xd9, - 0x5b, 0xf1, 0xdf, 0xac, 0x4a, 0xcf, 0x3d, 0xc1, 0x69, 0xb2, 0x0f, 0x1b, 0x20, 0x44, 0x40, 0x59, - 0x63, 0x6d, 0xb8, 0x19, 0xb8, 0xab, 0x31, 0x39, 0xe5, 0x44, 0x4c, 0x59, 0x12, 0xf7, 0x5f, 0xdb, - 0x71, 0xf6, 0xda, 0xfe, 0xa7, 0x67, 0xa5, 0xd7, 0xfa, 0xbd, 0xf4, 0x1e, 0x4d, 0xa8, 0x9c, 0x16, - 0xe1, 0x30, 0x62, 0xe9, 0x28, 0x62, 0x22, 0x65, 0xc2, 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 0x8d, 0xc6, 0x9c, - 0x46, 0xfa, 0x46, 0x16, 0xd8, 0x28, 0xf6, 0x37, 0xba, 0x8a, 0xff, 0x85, 0xb0, 0xbb, 0x0d, 0xda, - 0xfa, 0x95, 0x05, 0x59, 0x61, 0x04, 0xb7, 0x82, 0xd6, 0xb5, 0xe3, 0x8b, 0x22, 0xf5, 0x9f, 0x9f, - 0xfd, 0x35, 0x68, 0x9d, 0x9d, 0x0f, 0x9c, 0x57, 0xe7, 0x03, 0xe7, 0xcf, 0xf3, 0x81, 0xf3, 0xfd, - 0xc5, 0xa0, 0xf5, 0xea, 0x62, 0xd0, 0xfa, 0xed, 0x62, 0xd0, 0xfa, 0x6a, 0xd8, 0x20, 0xa2, 0xd8, - 0x3f, 0xce, 0x88, 0x3c, 0x62, 0xfc, 0x50, 0x1b, 0xa3, 0xd9, 0xd3, 0xd1, 0x71, 0xfd, 0x41, 0xd7, - 0xa4, 0xc2, 0x35, 0xfd, 0x9d, 0x7e, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0x31, 0xeb, - 0x42, 0xec, 0x07, 0x00, 0x00, + // 827 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xbf, 0x6f, 0xe4, 0x44, + 0x14, 0xb6, 0xb9, 0x24, 0x64, 0xc7, 0xbb, 0x77, 0xc4, 0x97, 0x80, 0xb9, 0xa0, 0x75, 0x32, 0x27, + 0x8e, 0x34, 0xb7, 0xd6, 0x71, 0x48, 0x88, 0x74, 0x58, 0xe1, 0x68, 0x0e, 0x69, 0x65, 0x9d, 0x0e, + 0x89, 0xc6, 0x1a, 0xdb, 0xc3, 0xae, 0xb5, 0xb6, 0xc7, 0x9a, 0x99, 0xdd, 0x4d, 0x1a, 0x6a, 0x2a, + 0x44, 0x49, 0x99, 0x9a, 0x1e, 0xc4, 0x9f, 0x90, 0x32, 0x25, 0x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7, 0xde, 0x69, 0xf3, 0x41, 0x94, 0x2a, 0xa2, 0x2d, 0xf9, 0x9d, 0x7b, 0xfe, 0x5f, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x76, 0xbc, 0x54, 0x15, 0x2c, 0x07, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -680,44 +637,6 @@ func (m *ExchangeRateTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *HistoricPrice) 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 *HistoricPrice) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HistoricPrice) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BlockNum != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.BlockNum)) - i-- - dAtA[i] = 0x10 - } - { - size := m.ExchangeRate.Size() - i -= size - if _, err := m.ExchangeRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintOracle(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { offset -= sovOracle(v) base := offset @@ -844,20 +763,6 @@ func (m *ExchangeRateTuple) Size() (n int) { return n } -func (m *HistoricPrice) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ExchangeRate.Size() - n += 1 + l + sovOracle(uint64(l)) - if m.BlockNum != 0 { - n += 1 + sovOracle(uint64(m.BlockNum)) - } - return n -} - func sovOracle(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1696,108 +1601,6 @@ func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { } return nil } -func (m *HistoricPrice) 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: HistoricPrice: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HistoricPrice: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOracle - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNum", wireType) - } - m.BlockNum = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNum |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 skipOracle(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0