diff --git a/proto/umee/oracle/v1/genesis.proto b/proto/umee/oracle/v1/genesis.proto index e0c6cd1b64..ae08880bc1 100644 --- a/proto/umee/oracle/v1/genesis.proto +++ b/proto/umee/oracle/v1/genesis.proto @@ -25,6 +25,11 @@ message GenesisState { repeated Price medians = 7 [(gogoproto.nullable) = false]; repeated Price historic_prices = 8 [(gogoproto.nullable) = false]; repeated Price medianDeviations = 9 [(gogoproto.nullable) = false]; + // Historic Avg Counter params + AvgCounterParams avg_counter_params = 10 [ + (gogoproto.moretags) = "yaml:\"avg_counter_params\"", + (gogoproto.nullable) = false + ]; } // FeederDelegation is the address for where oracle feeder authority are diff --git a/proto/umee/oracle/v1/oracle.proto b/proto/umee/oracle/v1/oracle.proto index 53c7c3dc8f..14bf477911 100644 --- a/proto/umee/oracle/v1/oracle.proto +++ b/proto/umee/oracle/v1/oracle.proto @@ -3,6 +3,7 @@ package umee.oracle.v1; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; option go_package = "github.com/umee-network/umee/v5/x/oracle/types"; @@ -57,6 +58,24 @@ message Params { uint64 maximum_median_stamps = 12; } +// AvgCounterParams - Historic avg counter params +message AvgCounterParams { + // avg_period + google.protobuf.Duration avg_period = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "avg_period,omitempty", + (gogoproto.moretags) = "yaml:\"avg_period\"" + ]; + // avg shift + google.protobuf.Duration avg_shift = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "avg_shift,omitempty", + (gogoproto.moretags) = "yaml:\"avg_shift\"" + ]; +} + // Denom - the object to hold configurations of each denom message Denom { option (gogoproto.equal) = false; diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index f686dcae52..bb1ef598ed 100644 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -71,6 +71,10 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, genState types.GenesisSt if moduleAcc == nil { panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } + + // set historic avg counter params (avgPeriod and avgShift) + err := keeper.SetHistoricAvgCounterParams(ctx, genState.AvgCounterParams) + util.Panic(err) } // ExportGenesis returns the x/oracle module's exported genesis. @@ -128,6 +132,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { historicPrices := keeper.AllHistoricPrices(ctx) medianPrices := keeper.AllMedianPrices(ctx) medianDeviationPrices := keeper.AllMedianDeviationPrices(ctx) + hacp := keeper.GetHistoricAvgCounterParams(ctx) return types.NewGenesisState( params, @@ -139,5 +144,6 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { historicPrices, medianPrices, medianDeviationPrices, + hacp, ) } diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index d458f6ea83..be773d655b 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -200,6 +200,7 @@ func (s *IntegrationTestSuite) TestGenesis_ExportGenesis() { BlockNum: 0, }, } + hacp := types.DefaultAvgCounterParams() genesisState := types.GenesisState{ Params: params, @@ -211,6 +212,7 @@ func (s *IntegrationTestSuite) TestGenesis_ExportGenesis() { Medians: medians, HistoricPrices: historicPrices, MedianDeviations: medianDeviations, + AvgCounterParams: hacp, } oracle.InitGenesis(ctx, keeper, genesisState) @@ -225,4 +227,5 @@ func (s *IntegrationTestSuite) TestGenesis_ExportGenesis() { assert.DeepEqual(s.T(), medians, result.Medians) assert.DeepEqual(s.T(), historicPrices, result.HistoricPrices) assert.DeepEqual(s.T(), medianDeviations, result.MedianDeviations) + assert.DeepEqual(s.T(), hacp, result.AvgCounterParams) } diff --git a/x/oracle/keeper/genesis.go b/x/oracle/keeper/genesis.go index 4017ccf753..45f051c46b 100644 --- a/x/oracle/keeper/genesis.go +++ b/x/oracle/keeper/genesis.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + storeutil "github.com/umee-network/umee/v5/util/store" "github.com/umee-network/umee/v5/x/oracle/types" ) @@ -111,3 +112,20 @@ func (k Keeper) AllMedianDeviationPrices(ctx sdk.Context) types.Prices { }) return prices } + +// SetAvgPeSetHistoricAvgCounterParams sets avg period and avg shift time duration +func (k Keeper) SetHistoricAvgCounterParams(ctx sdk.Context, acp types.AvgCounterParams) error { + kvs := ctx.KVStore(k.storeKey) + return storeutil.SetObject(kvs, k.cdc, types.KeyHistoricAvgCounterParams, &acp, "historic avg counter params") +} + +// GetHistoricAvgCounterParams gets the avg period and avg shift time duration from store +func (k Keeper) GetHistoricAvgCounterParams(ctx sdk.Context) types.AvgCounterParams { + kvs := ctx.KVStore(k.storeKey) + var acp types.AvgCounterParams + ok := storeutil.GetObject(kvs, k.cdc, types.KeyHistoricAvgCounterParams, &acp, "historic avg counter params") + if ok { + return acp + } + return types.AvgCounterParams{} +} diff --git a/x/oracle/keeper/historic_avg.go b/x/oracle/keeper/historic_avg.go index a550f48627..517243c079 100644 --- a/x/oracle/keeper/historic_avg.go +++ b/x/oracle/keeper/historic_avg.go @@ -17,7 +17,8 @@ type AvgKeeper struct { } func (k Keeper) AvgKeeper(ctx sdk.Context) AvgKeeper { - return AvgKeeper{store: ctx.KVStore(k.storeKey), period: k.AvgPeriod, shift: k.AvgShift} + p := k.GetHistoricAvgCounterParams(ctx) + return AvgKeeper{store: ctx.KVStore(k.storeKey), period: p.AvgPeriod, shift: p.AvgShift} } func (k AvgKeeper) numCounters() int64 { diff --git a/x/oracle/keeper/historic_avg_test.go b/x/oracle/keeper/historic_avg_test.go index a212d0fec5..fed89a4e92 100644 --- a/x/oracle/keeper/historic_avg_test.go +++ b/x/oracle/keeper/historic_avg_test.go @@ -37,7 +37,7 @@ func (s AvgKeeperSuite) newAvgKeeper(t *testing.T, period, shift time.Duration) } func (s AvgKeeperSuite) newDefAvgKeeper(t *testing.T) AvgKeeper { - return s.newAvgKeeper(t, defaultAvgPeriod, defaultAvgShift) + return s.newAvgKeeper(t, types.DefaultAvgPeriod, types.DefaultAvgPeriod) } func (s AvgKeeperSuite) testNewCounters(t *testing.T) { diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index f29633f740..951ed9c7c6 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -3,7 +3,6 @@ package keeper import ( "fmt" "strings" - "time" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -21,7 +20,7 @@ var ten = sdk.MustNewDecFromStr("10") // Keeper of the oracle store type Keeper struct { - cdc codec.BinaryCodec + cdc codec.Codec storeKey storetypes.StoreKey paramSpace paramstypes.Subspace @@ -31,19 +30,11 @@ type Keeper struct { StakingKeeper types.StakingKeeper distrName string - - AvgPeriod time.Duration - AvgShift time.Duration } -const ( - defaultAvgPeriod time.Duration = time.Hour * 16 - defaultAvgShift time.Duration = time.Hour * 2 -) - // NewKeeper constructs a new keeper for oracle func NewKeeper( - cdc codec.BinaryCodec, + cdc codec.Codec, storeKey storetypes.StoreKey, paramspace paramstypes.Subspace, accountKeeper types.AccountKeeper, @@ -71,10 +62,6 @@ func NewKeeper( distrKeeper: distrKeeper, StakingKeeper: stakingKeeper, distrName: distrName, - - // AvgPeriod and AvgShift must not be changed after an app started. - AvgPeriod: defaultAvgPeriod, - AvgShift: defaultAvgShift, } } diff --git a/x/oracle/keeper/migrations.go b/x/oracle/keeper/migrations.go index daa35c5932..4169429c97 100644 --- a/x/oracle/keeper/migrations.go +++ b/x/oracle/keeper/migrations.go @@ -35,6 +35,12 @@ func (m Migrator) HistoracleParams3x4(ctx sdk.Context) error { return nil } +// SetAvgPeriodAndShift updates the avg shift and period params +func (m Migrator) SetAvgPeriodAndShift(ctx sdk.Context) error { + p := types.DefaultAvgCounterParams() + return m.keeper.SetHistoricAvgCounterParams(ctx, p) +} + // MigrateBNB fixes the BNB base denom for the 4.1 upgrade without using leverage hooks func (m Migrator) MigrateBNB(ctx sdk.Context) { badDenom := "ibc/77BCD42E49E5B7E0FC6B269FEBF0185B15044F13F6F38CA285DF0AF883459F40" diff --git a/x/oracle/simulations/genesis.go b/x/oracle/simulations/genesis.go index fd346a6d60..107f4b03e8 100644 --- a/x/oracle/simulations/genesis.go +++ b/x/oracle/simulations/genesis.go @@ -4,9 +4,11 @@ import ( "encoding/json" "fmt" "math/rand" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/umee-network/umee/v5/x/oracle/types" ) @@ -23,6 +25,8 @@ const ( medianStampPeriodKey = "median_stamp_period" maximumPriceStampsKey = "maximum_price_stamps" maximumMedianStampsKey = "maximum_median_stamps" + avgPeriodKey = "avg_period" + avgShiftKey = "avg_shift" ) // GenVotePeriod produces a randomized VotePeriod in the range of [5, 100] @@ -30,6 +34,16 @@ func GenVotePeriod(r *rand.Rand) uint64 { return uint64(5 + r.Intn(100)) } +// GetAvgPeriod produces a randomized AvgPeriod in the range of 1 second to 1 day +func GetAvgPeriod(r *rand.Rand) time.Duration { + return time.Duration(simulation.RandIntBetween(r, 1, 60*60*24)) * time.Second +} + +// GetAvgShift produces a randomized AvgShift in the range of 1 second to 5 hours +func GetAvgShift(r *rand.Rand) time.Duration { + return time.Duration(simulation.RandIntBetween(r, 1, 60*60*5)) * time.Second +} + // GenVoteThreshold produces a randomized VoteThreshold in the range of [0.34, 0.67] func GenVoteThreshold(r *rand.Rand) sdk.Dec { return sdk.NewDecWithPrec(34, 2).Add(sdk.NewDecWithPrec(int64(r.Intn(33)), 2)) @@ -148,7 +162,23 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { maximumMedianStamps = GenMaximumMedianStamps(r) }, ) + var avgShift time.Duration + simState.AppParams.GetOrGenerate( + simState.Cdc, avgShiftKey, &avgShift, simState.Rand, + func(r *rand.Rand) { avgShift = GetAvgShift(r) }, + ) + + var avgPeriod time.Duration + simState.AppParams.GetOrGenerate( + simState.Cdc, avgPeriodKey, &avgPeriod, simState.Rand, + func(r *rand.Rand) { avgPeriod = GetAvgPeriod(r) }, + ) + oracleGenesis := types.DefaultGenesisState() + oracleGenesis.AvgCounterParams = types.AvgCounterParams{ + AvgPeriod: avgPeriod, + AvgShift: avgShift, + } oracleGenesis.Params = types.Params{ VotePeriod: votePeriod, VoteThreshold: voteThreshold, diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go index 6c72b6dc4c..946a0fb220 100644 --- a/x/oracle/types/genesis.go +++ b/x/oracle/types/genesis.go @@ -2,6 +2,7 @@ package types import ( "encoding/json" + "fmt" "github.com/cosmos/cosmos-sdk/codec" ) @@ -17,6 +18,7 @@ func NewGenesisState( historicPrices []Price, medianPrices []Price, medianDeviationPrices []Price, + acp AvgCounterParams, ) *GenesisState { return &GenesisState{ Params: params, @@ -28,6 +30,7 @@ func NewGenesisState( HistoricPrices: historicPrices, Medians: medianPrices, MedianDeviations: medianDeviationPrices, + AvgCounterParams: acp, } } @@ -44,12 +47,17 @@ func DefaultGenesisState() *GenesisState { HistoricPrices: []Price{}, Medians: []Price{}, MedianDeviations: []Price{}, + AvgCounterParams: DefaultAvgCounterParams(), } } // ValidateGenesis validates the oracle genesis state. func ValidateGenesis(data *GenesisState) error { - return data.Params.Validate() + if err := data.Params.Validate(); err != nil { + return err + } + + return data.AvgCounterParams.Validate() } // GetGenesisStateFromAppState returns x/oracle GenesisState given raw application @@ -63,3 +71,26 @@ func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.R return &genesisState } + +func DefaultAvgCounterParams() AvgCounterParams { + return AvgCounterParams{ + AvgPeriod: DefaultAvgPeriod, // 16 hours + AvgShift: DefaultAvgShift, // 12 hours + } +} + +func (acp AvgCounterParams) Equal(other *AvgCounterParams) bool { + return acp.AvgPeriod == other.AvgPeriod && acp.AvgShift == other.AvgShift +} + +func (acp AvgCounterParams) Validate() error { + if acp.AvgPeriod.Seconds() <= 0 { + return fmt.Errorf("avg period must be positive: %d", acp.AvgPeriod) + } + + if acp.AvgShift.Seconds() <= 0 { + return fmt.Errorf("avg shift must be positive: %d", acp.AvgShift) + } + + return nil +} diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 5267e9542b..e7a88fd7b3 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -34,6 +34,8 @@ type GenesisState struct { Medians []Price `protobuf:"bytes,7,rep,name=medians,proto3" json:"medians"` HistoricPrices []Price `protobuf:"bytes,8,rep,name=historic_prices,json=historicPrices,proto3" json:"historic_prices"` MedianDeviations []Price `protobuf:"bytes,9,rep,name=medianDeviations,proto3" json:"medianDeviations"` + // Historic Avg Counter params + AvgCounterParams AvgCounterParams `protobuf:"bytes,10,opt,name=avg_counter_params,json=avgCounterParams,proto3" json:"avg_counter_params" yaml:"avg_counter_params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -199,44 +201,46 @@ func init() { func init() { proto.RegisterFile("umee/oracle/v1/genesis.proto", fileDescriptor_c99b4af40468acc1) } var fileDescriptor_c99b4af40468acc1 = []byte{ - // 577 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8c, 0xfb, 0x93, 0xb6, 0x9b, 0x36, 0x5f, 0xba, 0x1f, 0x20, 0x2b, 0xa1, 0x6e, 0x1a, 0x09, - 0xa9, 0x08, 0xb0, 0xd5, 0x42, 0x1f, 0xa0, 0x21, 0xb4, 0x37, 0x80, 0xaa, 0xf0, 0x27, 0x21, 0x21, - 0x6b, 0x63, 0x9f, 0x38, 0x56, 0x63, 0xaf, 0xb5, 0xbb, 0x36, 0x45, 0x08, 0x89, 0x47, 0xe0, 0x39, - 0x78, 0x92, 0x5c, 0xf6, 0x92, 0x2b, 0x7e, 0x92, 0x17, 0x41, 0x5e, 0x6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 0x9a, 0x6a, 0xd0, 0xe5, 0xbb, 0xda, 0xe5, 0xbb, 0x78, - 0x07, 0xad, 0x4f, 0x57, 0x54, 0x7a, 0x2c, 0xb5, 0x4b, 0x53, 0xf5, 0x6b, 0x7c, 0x41, 0xcb, 0xf2, - 0x77, 0xe2, 0x77, 0xe8, 0xff, 0xd9, 0xff, 0x5f, 0xa4, 0xad, 0x57, 0xe7, 0x7c, 0x83, 0xcb, 0x51, - 0xd7, 0x08, 0x79, 0x00, 0xd7, 0xd0, 0x5a, 0xa7, 0x4f, 0x9d, 0x53, 0x3b, 0x8c, 0x03, 0x95, 0x60, - 0x55, 0x0e, 0x5e, 0xc6, 0x41, 0xf3, 0xf9, 0xe0, 0x8f, 0x51, 0x18, 0x0c, 0x0d, 0xed, 0x7c, 0x68, - 0x68, 0xbf, 0x87, 0x86, 0xf6, 0x6d, 0x64, 0x14, 0xce, 0x47, 0x46, 0xe1, 0xc7, 0xc8, 0x28, 0xbc, - 0x37, 0x3d, 0x5f, 0xf4, 0xe2, 0x8e, 0xe9, 0xd0, 0xc0, 0x4a, 0x03, 0x3c, 0x0a, 0x41, 0x7c, 0xa4, - 0xec, 0x54, 0x7e, 0xb1, 0x92, 0x03, 0xeb, 0x6c, 0xfc, 0x40, 0x89, 0x4f, 0x11, 0xf0, 0x4e, 0x51, - 0xbe, 0x4e, 0x8f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x77, 0x86, 0x18, 0x00, 0x05, 0x00, - 0x00, + // 619 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x4e, 0xd4, 0x4e, + 0x14, 0xdf, 0xf2, 0xb1, 0xc0, 0x2c, 0xec, 0x7f, 0x99, 0xbf, 0x9a, 0xba, 0x48, 0x59, 0x9a, 0x98, + 0x60, 0xd4, 0x36, 0xa0, 0xdc, 0x78, 0x07, 0x22, 0xd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x76, 0xe5, 0x1f, 0x3b, 0x5f, + 0xb6, 0xf7, 0xaa, 0x9b, 0x28, 0xf6, 0x53, 0xe0, 0x5b, 0x4d, 0x79, 0x10, 0x1f, 0xfd, 0x0d, 0x00, + 0x00, 0xff, 0xff, 0x5a, 0x0e, 0x46, 0xe0, 0x73, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -259,6 +263,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.AvgCounterParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 if len(m.MedianDeviations) > 0 { for iNdEx := len(m.MedianDeviations) - 1; iNdEx >= 0; iNdEx-- { { @@ -561,6 +575,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.AvgCounterParams.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -951,6 +967,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvgCounterParams", 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.AvgCounterParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/oracle/types/genesis_test.go b/x/oracle/types/genesis_test.go index 9bf05614f6..9067fbcce2 100644 --- a/x/oracle/types/genesis_test.go +++ b/x/oracle/types/genesis_test.go @@ -67,6 +67,7 @@ func TestGetGenesisStateFromAppState(t *testing.T) { MissCounters: []MissCounter{}, AggregateExchangeRatePrevotes: []AggregateExchangeRatePrevote{}, AggregateExchangeRateVotes: []AggregateExchangeRateVote{}, + AvgCounterParams: AvgCounterParams{}, } bz, err := json.Marshal(emptyGenesis) diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 0bccbce53d..d64fe7b271 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -85,6 +86,47 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +// AvgCounterParams - Historic avg counter params +type AvgCounterParams struct { + // avg_period + AvgPeriod time.Duration `protobuf:"bytes,1,opt,name=avg_period,json=avgPeriod,proto3,stdduration" json:"avg_period,omitempty" yaml:"avg_period"` + // avg shift + AvgShift time.Duration `protobuf:"bytes,2,opt,name=avg_shift,json=avgShift,proto3,stdduration" json:"avg_shift,omitempty" yaml:"avg_shift"` +} + +func (m *AvgCounterParams) Reset() { *m = AvgCounterParams{} } +func (m *AvgCounterParams) String() string { return proto.CompactTextString(m) } +func (*AvgCounterParams) ProtoMessage() {} +func (*AvgCounterParams) Descriptor() ([]byte, []int) { + return fileDescriptor_8893c9e0e94ceb54, []int{1} +} +func (m *AvgCounterParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AvgCounterParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AvgCounterParams.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 *AvgCounterParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_AvgCounterParams.Merge(m, src) +} +func (m *AvgCounterParams) XXX_Size() int { + return m.Size() +} +func (m *AvgCounterParams) XXX_DiscardUnknown() { + xxx_messageInfo_AvgCounterParams.DiscardUnknown(m) +} + +var xxx_messageInfo_AvgCounterParams proto.InternalMessageInfo + // Denom - the object to hold configurations of each denom type Denom struct { BaseDenom string `protobuf:"bytes,1,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty" yaml:"base_denom"` @@ -95,7 +137,7 @@ type Denom struct { func (m *Denom) Reset() { *m = Denom{} } func (*Denom) ProtoMessage() {} func (*Denom) Descriptor() ([]byte, []int) { - return fileDescriptor_8893c9e0e94ceb54, []int{1} + return fileDescriptor_8893c9e0e94ceb54, []int{2} } func (m *Denom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -138,7 +180,7 @@ type AggregateExchangeRatePrevote struct { func (m *AggregateExchangeRatePrevote) Reset() { *m = AggregateExchangeRatePrevote{} } func (*AggregateExchangeRatePrevote) ProtoMessage() {} func (*AggregateExchangeRatePrevote) Descriptor() ([]byte, []int) { - return fileDescriptor_8893c9e0e94ceb54, []int{2} + return fileDescriptor_8893c9e0e94ceb54, []int{3} } func (m *AggregateExchangeRatePrevote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -177,7 +219,7 @@ type AggregateExchangeRateVote struct { func (m *AggregateExchangeRateVote) Reset() { *m = AggregateExchangeRateVote{} } func (*AggregateExchangeRateVote) ProtoMessage() {} func (*AggregateExchangeRateVote) Descriptor() ([]byte, []int) { - return fileDescriptor_8893c9e0e94ceb54, []int{3} + return fileDescriptor_8893c9e0e94ceb54, []int{4} } func (m *AggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -215,7 +257,7 @@ type ExchangeRateTuple struct { func (m *ExchangeRateTuple) Reset() { *m = ExchangeRateTuple{} } func (*ExchangeRateTuple) ProtoMessage() {} func (*ExchangeRateTuple) Descriptor() ([]byte, []int) { - return fileDescriptor_8893c9e0e94ceb54, []int{4} + return fileDescriptor_8893c9e0e94ceb54, []int{5} } func (m *ExchangeRateTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -259,7 +301,7 @@ func (m *AvgCounter) Reset() { *m = AvgCounter{} } func (m *AvgCounter) String() string { return proto.CompactTextString(m) } func (*AvgCounter) ProtoMessage() {} func (*AvgCounter) Descriptor() ([]byte, []int) { - return fileDescriptor_8893c9e0e94ceb54, []int{5} + return fileDescriptor_8893c9e0e94ceb54, []int{6} } func (m *AvgCounter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -290,6 +332,7 @@ var xxx_messageInfo_AvgCounter proto.InternalMessageInfo func init() { proto.RegisterType((*Params)(nil), "umee.oracle.v1.Params") + proto.RegisterType((*AvgCounterParams)(nil), "umee.oracle.v1.AvgCounterParams") proto.RegisterType((*Denom)(nil), "umee.oracle.v1.Denom") proto.RegisterType((*AggregateExchangeRatePrevote)(nil), "umee.oracle.v1.AggregateExchangeRatePrevote") proto.RegisterType((*AggregateExchangeRateVote)(nil), "umee.oracle.v1.AggregateExchangeRateVote") @@ -300,67 +343,73 @@ func init() { func init() { proto.RegisterFile("umee/oracle/v1/oracle.proto", fileDescriptor_8893c9e0e94ceb54) } var fileDescriptor_8893c9e0e94ceb54 = []byte{ - // 953 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xbf, 0x73, 0xdc, 0x44, - 0x14, 0x3e, 0xe1, 0x1f, 0xb9, 0xdb, 0xbb, 0x4b, 0x62, 0xf9, 0x0c, 0xc2, 0x66, 0x4e, 0x8e, 0x18, - 0x82, 0x9b, 0x48, 0xc4, 0xc0, 0x30, 0x5c, 0x45, 0x84, 0x09, 0x4d, 0x32, 0x73, 0x23, 0x3c, 0x61, - 0x86, 0x46, 0xb3, 0x92, 0x36, 0xba, 0x1d, 0x4b, 0xda, 0x9b, 0xdd, 0xd5, 0xd9, 0x6e, 0xa8, 0x53, - 0x31, 0x29, 0x29, 0x5d, 0x51, 0xd0, 0xc3, 0xf0, 0x27, 0xb8, 0x4c, 0xc9, 0x50, 0x28, 0x60, 0x37, - 0xd4, 0xf7, 0x17, 0x30, 0xfb, 0x43, 0xb1, 0xce, 0x76, 0x81, 0x27, 0xd5, 0xed, 0xdb, 0xef, 0x7d, - 0xef, 0x7d, 0xfb, 0xf6, 0xbd, 0xd5, 0x81, 0xad, 0x32, 0x47, 0xc8, 0x23, 0x14, 0xc6, 0x19, 0xf2, - 0x66, 0x0f, 0xf5, 0xca, 0x9d, 0x52, 0xc2, 0x89, 0x79, 0x5b, 0x80, 0xae, 0xde, 0x9a, 0x3d, 0xdc, - 0x1c, 0xa4, 0x24, 0x25, 0x12, 0xf2, 0xc4, 0x4a, 0x79, 0x6d, 0xda, 0x29, 0x21, 0x69, 0x86, 0x3c, - 0x69, 0x45, 0xe5, 0x73, 0x8f, 0xe3, 0x1c, 0x31, 0x0e, 0xf3, 0xa9, 0x72, 0x70, 0xaa, 0x5b, 0x60, - 0x75, 0x0c, 0x29, 0xcc, 0x99, 0xf9, 0x05, 0xe8, 0xce, 0x08, 0x47, 0xe1, 0x14, 0x51, 0x4c, 0x12, - 0xcb, 0xd8, 0x36, 0x76, 0x96, 0xfd, 0x77, 0xe7, 0x95, 0x6d, 0x1e, 0xc3, 0x3c, 0x1b, 0x39, 0x0d, - 0xd0, 0x09, 0x80, 0xb0, 0xc6, 0xd2, 0x30, 0x0b, 0x70, 0x5b, 0x62, 0x7c, 0x42, 0x11, 0x9b, 0x90, - 0x2c, 0xb1, 0xde, 0xd9, 0x36, 0x76, 0x3a, 0xfe, 0xb7, 0xa7, 0x95, 0xdd, 0xfa, 0xab, 0xb2, 0xef, - 0xa7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// 1052 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0x5e, 0x93, 0x26, 0xdd, 0x9d, 0x4d, 0xda, 0xc4, 0xd9, 0x80, 0x9b, 0xa0, 0x75, 0x6a, 0x44, + 0xc9, 0x81, 0xda, 0x34, 0xa5, 0x42, 0xec, 0x89, 0x9a, 0x50, 0x2e, 0xad, 0x14, 0xb9, 0x51, 0x91, + 0xb8, 0x58, 0xb3, 0xf6, 0xc4, 0x3b, 0x8a, 0xed, 0x59, 0xcd, 0x8c, 0x37, 0xc9, 0x85, 0x73, 0x4f, + 0xa8, 0xc7, 0x1e, 0x73, 0xe2, 0xc0, 0x1d, 0xc4, 0x9f, 0x90, 0x63, 0x8f, 0x88, 0x83, 0x0b, 0xc9, + 0x05, 0x71, 0x42, 0xfb, 0x17, 0xa0, 0xf9, 0xe1, 0xac, 0x37, 0x1b, 0x21, 0x22, 0x4e, 0xeb, 0x37, + 0xdf, 0x7b, 0xef, 0xfb, 0xde, 0x9b, 0x37, 0x4f, 0x0b, 0x36, 0x8a, 0x0c, 0x21, 0x8f, 0x50, 0x18, + 0xa5, 0xc8, 0x1b, 0x3d, 0xd0, 0x5f, 0xee, 0x90, 0x12, 0x4e, 0xcc, 0x5b, 0x02, 0x74, 0xf5, 0xd1, + 0xe8, 0xc1, 0x7a, 0x27, 0x21, 0x09, 0x91, 0x90, 0x27, 0xbe, 0x94, 0xd7, 0xba, 0x9d, 0x10, 0x92, + 0xa4, 0xc8, 0x93, 0x56, 0xbf, 0xd8, 0xf7, 0x38, 0xce, 0x10, 0xe3, 0x30, 0x1b, 0x6a, 0x87, 0xee, + 0x65, 0x87, 0xb8, 0xa0, 0x90, 0x63, 0x92, 0x2b, 0xdc, 0x29, 0x6f, 0x82, 0x85, 0x5d, 0x48, 0x61, + 0xc6, 0xcc, 0xcf, 0x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 0xf6, 0x56, + 0xeb, 0x5c, 0xd1, 0x03, 0x27, 0x58, 0xac, 0x97, 0x79, 0x49, 0xf8, 0x0f, 0x06, 0x00, 0x93, 0x1d, + 0x60, 0x7e, 0x01, 0xe6, 0x58, 0x51, 0xe9, 0x75, 0xaf, 0xc7, 0x1f, 0x88, 0x50, 0x73, 0x19, 0xcc, + 0xe5, 0x85, 0x7a, 0x18, 0x4b, 0x81, 0xf8, 0x34, 0x7b, 0x60, 0x9e, 0x71, 0x48, 0xd5, 0xd0, 0xb7, + 0xb7, 0xd7, 0x67, 0x1e, 0xf7, 0x5e, 0xf5, 0xc7, 0xc4, 0x6f, 0x0a, 0xc6, 0x57, 0xe2, 0xc9, 0xaa, + 0x90, 0x5e, 0xf3, 0xa5, 0x16, 0xea, 0x3f, 0x3d, 0xfd, 0xa3, 0xdb, 0x38, 0x3d, 0xeb, 0x1a, 0x6f, + 0xce, 0xba, 0xc6, 0xef, 0x67, 0x5d, 0xe3, 0xd5, 0x79, 0xb7, 0xf1, 0xe6, 0xbc, 0xdb, 0xf8, 0xf5, + 0xbc, 0xdb, 0xf8, 0xd6, 0xad, 0x49, 0x14, 0x13, 0x73, 0x3f, 0x47, 0xfc, 0x90, 0xd0, 0x03, 0x69, + 0x78, 0xa3, 0x47, 0xde, 0x51, 0xf5, 0x67, 0x4a, 0xca, 0xed, 0x2f, 0x48, 0xf2, 0x87, 0xff, 0x04, + 0x00, 0x00, 0xff, 0xff, 0x50, 0x13, 0x1a, 0x2e, 0x68, 0x09, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -537,6 +586,45 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *AvgCounterParams) 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 *AvgCounterParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AvgCounterParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AvgShift, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AvgShift):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintOracle(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.AvgPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.AvgPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintOracle(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *Denom) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -725,12 +813,12 @@ func (m *AvgCounter) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Start):]) - if err1 != nil { - return 0, err1 + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Start, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Start):]) + if err3 != nil { + return 0, err3 } - i -= n1 - i = encodeVarintOracle(dAtA, i, uint64(n1)) + i -= n3 + i = encodeVarintOracle(dAtA, i, uint64(n3)) i-- dAtA[i] = 0x1a if m.Num != 0 { @@ -806,6 +894,19 @@ func (m *Params) Size() (n int) { return n } +func (m *AvgCounterParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AvgPeriod) + n += 1 + l + sovOracle(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.AvgShift) + n += 1 + l + sovOracle(uint64(l)) + return n +} + func (m *Denom) Size() (n int) { if m == nil { return 0 @@ -1255,6 +1356,122 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +func (m *AvgCounterParams) 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: AvgCounterParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AvgCounterParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvgPeriod", 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 := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AvgPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AvgShift", 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 := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.AvgShift, dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *Denom) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index 6a4c7d9662..69fad2c690 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -2,6 +2,7 @@ package types import ( "fmt" + time "time" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -18,6 +19,8 @@ var ( const ( MaxVoteThresholdPrecision = 2 MaxVoteThresholdMultiplier = 100 // must be 10^MaxVoteThresholdPrecision + DefaultAvgPeriod = time.Hour * 16 + DefaultAvgShift = time.Hour * 2 ) // Parameter keys @@ -34,6 +37,7 @@ var ( KeyMedianStampPeriod = []byte("MedianStampPeriod") KeyMaximumPriceStamps = []byte("MaximumPriceStamps") KeyMaximumMedianStamps = []byte("MedianStampAmount") + KeyHistoricAvgCounterParams = []byte("HistoricAvgCounterParams") ) var _ paramstypes.ParamSet = &Params{}