diff --git a/README.md b/README.md index b483890b8..a6d0917ea 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,6 @@ The slinky repository is composed of the following core packages: * **oracle** - This [package](./oracle/) contains the main oracle that aggregates external data sources before broadcasting it to the network. You can reference the provider documentation [here](./providers/base/README.md) to get a high level overview of how the oracle works. * **providers** - This package contains a collection of [websocket](./providers/websockets/README.md) and [API](./providers/apis/README.md) based data providers that are used by the oracle to collect external data. * **x/oracle** - This package contains a Cosmos SDK module that allows you to store oracle data on a blockchain. -* **x/alerts** - This package contains a Cosmos SDK module that allows network participants to create alerts when oracle data that is in violation of some condition is broadcast to the network and stored on the blockchain. -* **x/sla** - This package contains a Cosmos SDK module that allows you to create service level agreements (SLAs) that can be used to incentivize network participants to consistently, reliably provide data with high uptime. * **x/marketmap** - This [package](./x/marketmap/README.md) contains a Cosmos SDK module that allows for market configuration to be stored and updated on a blockchain. ## Validator Usage diff --git a/abci/preblock/sla/interfaces.go b/abci/preblock/sla/interfaces.go deleted file mode 100644 index 0392160c4..000000000 --- a/abci/preblock/sla/interfaces.go +++ /dev/null @@ -1,35 +0,0 @@ -package sla - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slakeeper "github.com/skip-mev/slinky/x/sla/keeper" -) - -// Keeper defines the interface that must be fulfilled by the SLA keeper. -// -//go:generate mockery --name Keeper --filename mock_sla_keeper.go -type Keeper interface { - // UpdatePriceFeeds will update all price feed incentives given the latest updates. - UpdatePriceFeeds(ctx sdk.Context, updates slakeeper.PriceFeedUpdates) error -} - -// OracleKeeper defines the interface that must be fulfilled by the oracle keeper. -// -//go:generate mockery --name OracleKeeper --filename mock_oracle_keeper.go -type OracleKeeper interface { - // GetAllCurrencyPairs returns all CurrencyPairs that have currently been stored to state. - GetAllCurrencyPairs(ctx sdk.Context) []slinkytypes.CurrencyPair -} - -// StakingKeeper defines the interface that must be fulfilled by the staking keeper. -// -//go:generate mockery --name StakingKeeper --filename mock_staking_keeper.go -type StakingKeeper interface { - // GetBondedValidatorsByPower returns all bonded validators that have currently been stored to state. - GetBondedValidatorsByPower(ctx context.Context) ([]stakingtypes.Validator, error) -} diff --git a/abci/preblock/sla/mocks/mock_oracle_keeper.go b/abci/preblock/sla/mocks/mock_oracle_keeper.go deleted file mode 100644 index 86dccc055..000000000 --- a/abci/preblock/sla/mocks/mock_oracle_keeper.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - pkgtypes "github.com/skip-mev/slinky/pkg/types" - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// OracleKeeper is an autogenerated mock type for the OracleKeeper type -type OracleKeeper struct { - mock.Mock -} - -// GetAllCurrencyPairs provides a mock function with given fields: ctx -func (_m *OracleKeeper) GetAllCurrencyPairs(ctx types.Context) []pkgtypes.CurrencyPair { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetAllCurrencyPairs") - } - - var r0 []pkgtypes.CurrencyPair - if rf, ok := ret.Get(0).(func(types.Context) []pkgtypes.CurrencyPair); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]pkgtypes.CurrencyPair) - } - } - - return r0 -} - -// NewOracleKeeper creates a new instance of OracleKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewOracleKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *OracleKeeper { - mock := &OracleKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/abci/preblock/sla/mocks/mock_sla_keeper.go b/abci/preblock/sla/mocks/mock_sla_keeper.go deleted file mode 100644 index 6fbc50606..000000000 --- a/abci/preblock/sla/mocks/mock_sla_keeper.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - keeper "github.com/skip-mev/slinky/x/sla/keeper" - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// Keeper is an autogenerated mock type for the Keeper type -type Keeper struct { - mock.Mock -} - -// UpdatePriceFeeds provides a mock function with given fields: ctx, updates -func (_m *Keeper) UpdatePriceFeeds(ctx types.Context, updates keeper.PriceFeedUpdates) error { - ret := _m.Called(ctx, updates) - - if len(ret) == 0 { - panic("no return value specified for UpdatePriceFeeds") - } - - var r0 error - if rf, ok := ret.Get(0).(func(types.Context, keeper.PriceFeedUpdates) error); ok { - r0 = rf(ctx, updates) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewKeeper creates a new instance of Keeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *Keeper { - mock := &Keeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/abci/preblock/sla/mocks/mock_staking_keeper.go b/abci/preblock/sla/mocks/mock_staking_keeper.go deleted file mode 100644 index b8ff67753..000000000 --- a/abci/preblock/sla/mocks/mock_staking_keeper.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// StakingKeeper is an autogenerated mock type for the StakingKeeper type -type StakingKeeper struct { - mock.Mock -} - -// GetBondedValidatorsByPower provides a mock function with given fields: ctx -func (_m *StakingKeeper) GetBondedValidatorsByPower(ctx context.Context) ([]types.Validator, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetBondedValidatorsByPower") - } - - var r0 []types.Validator - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]types.Validator, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) []types.Validator); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]types.Validator) - } - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewStakingKeeper creates a new instance of StakingKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewStakingKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *StakingKeeper { - mock := &StakingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/abci/preblock/sla/preblock.go b/abci/preblock/sla/preblock.go deleted file mode 100644 index 6f6ca22a7..000000000 --- a/abci/preblock/sla/preblock.go +++ /dev/null @@ -1,187 +0,0 @@ -package sla - -import ( - "fmt" - - cometabci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - voteaggregator "github.com/skip-mev/slinky/abci/strategies/aggregator" - compression "github.com/skip-mev/slinky/abci/strategies/codec" - "github.com/skip-mev/slinky/abci/strategies/currencypair" - "github.com/skip-mev/slinky/abci/ve" - slakeeper "github.com/skip-mev/slinky/x/sla/keeper" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// PreBlockHandler is responsible for aggregating information about -// oracle price feeds that each validator is including via their vote extensions. -// This handler is run before any transactions are executed/finalized for -// a given block. The handler check's the vote extensions included in each -// transaction and updates the price feed incentives for each validator. -type PreBlockHandler struct { - // Expected keepers required by the handler. - oracleKeeper OracleKeeper - stakingKeeper StakingKeeper - slaKeeper Keeper - - // currencyPairIDStrategy is the strategy used for generating / retrieving - // IDs for currency-pairs - currencyPairIDStrategy currencypair.CurrencyPairStrategy - - // voteExtensionCodec is the codec used for encoding / decoding vote extensions. - // This is used to decode vote extensions included in transactions. - voteExtensionCodec compression.VoteExtensionCodec - - // extendedCommitCodec is the codec used for encoding / decoding extended - // commit messages. This is used to decode extended commit messages included - // in transactions. - extendedCommitCodec compression.ExtendedCommitCodec -} - -// NewSLAPreBlockHandler returns a new PreBlockHandler. -func NewSLAPreBlockHandler( - oracleKeeper OracleKeeper, - stakingKeeper StakingKeeper, - slaKeeper Keeper, - strategy currencypair.CurrencyPairStrategy, - voteExtCodec compression.VoteExtensionCodec, - extendedCommitCodec compression.ExtendedCommitCodec, -) *PreBlockHandler { - return &PreBlockHandler{ - oracleKeeper: oracleKeeper, - stakingKeeper: stakingKeeper, - slaKeeper: slaKeeper, - currencyPairIDStrategy: strategy, - voteExtensionCodec: voteExtCodec, - extendedCommitCodec: extendedCommitCodec, - } -} - -// PreBlocker is called by the base app before the block is finalized. Specifically, this -// function is called before any transactions are executed, but after oracle prices have -// been written to the oracle store. This function will retrieve all of the vote extensions -// that were included in the block, determine which currency pairs each validator included -// prices for, and update the price feed incentives for each validator. Enforcements of SLAs -// is done in the SLA BeginBlocker. -func (h *PreBlockHandler) PreBlocker() sdk.PreBlocker { - return func(ctx sdk.Context, req *cometabci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { - if req == nil { - ctx.Logger().Error( - "received nil RequestFinalizeBlock in SLA preblocker", - "height", ctx.BlockHeight(), - ) - - return &sdk.ResponsePreBlock{}, fmt.Errorf("received nil RequestFinalizeBlock in SLA preblocker: height %d", ctx.BlockHeight()) - } - - if !ve.VoteExtensionsEnabled(ctx) { - ctx.Logger().Info( - "skipping sla price feed preblocker because vote extensions are not enabled", - "height", ctx.BlockHeight(), - ) - - return &sdk.ResponsePreBlock{}, nil - } - - ctx.Logger().Info( - "executing price feed sla pre-block hook", - "height", ctx.BlockHeight(), - ) - - // Retrieve all vote extensions that were included in the block. This - // returns a list of validators and the price updates that they made. - votes, err := voteaggregator.GetOracleVotes(req.Txs, h.voteExtensionCodec, h.extendedCommitCodec) - if err != nil { - ctx.Logger().Error( - "failed to get extended commit info from proposal", - "height", ctx.BlockHeight(), - "num_txs", len(req.Txs), - "err", err, - ) - - return &sdk.ResponsePreBlock{}, err - } - - // Create a mapping of price updates by status for each validator. - updates, err := h.GetUpdates(ctx, votes) - if err != nil { - ctx.Logger().Error( - "failed to get price feed updates", - "height", ctx.BlockHeight(), - "votes", votes, - "err", err, - ) - - return &sdk.ResponsePreBlock{}, err - } - - // Update all of the price feeds for each validator. - if err := h.slaKeeper.UpdatePriceFeeds(ctx, updates); err != nil { - ctx.Logger().Error( - "failed to update price feeds", - "height", ctx.BlockHeight(), - "votes", votes, - "err", err, - ) - } - - return &sdk.ResponsePreBlock{}, nil - } -} - -// GetUpdates returns a mapping of every validator's price feed status updates. This function -// will iterate through the active set of validators, determine which currency pairs they -// included prices for via their vote extensions, and return a mapping of each validator's -// status updates. -func (h *PreBlockHandler) GetUpdates(ctx sdk.Context, votes []voteaggregator.Vote) (slakeeper.PriceFeedUpdates, error) { - updates := slakeeper.NewPriceFeedUpdates() - - // Retrieve all bonded validators which will be considered for updates. - bondedValidators, err := h.stakingKeeper.GetBondedValidatorsByPower(ctx) - if err != nil { - ctx.Logger().Error("failed to get bonded validators", "err", err) - return updates, err - } - - currencyPairs := h.oracleKeeper.GetAllCurrencyPairs(ctx) - for _, cp := range currencyPairs { - updates.CurrencyPairs[cp] = struct{}{} - } - - // Initialize an empty status for each of the bonded validators. - for _, validator := range bondedValidators { - consAddrBz, err := validator.GetConsAddr() - if err != nil { - ctx.Logger().Error("failed to get consensus address", "err", err) - return updates, err - } - consAddress := sdk.ConsAddress(consAddrBz) - - // Initialize the status for each currency pair to NoVote. - validator := slakeeper.NewValidatorUpdate(consAddress) - for _, cp := range currencyPairs { - validator.Updates[cp] = slatypes.NoVote - } - - updates.ValidatorUpdates[consAddress.String()] = validator - } - - // Determine the price feed status updates for each validator that included - // their vote extension in the block. - for _, vote := range votes { - valUpdates := getStatuses(ctx, h.currencyPairIDStrategy, currencyPairs, vote.OracleVoteExtension.Prices) - - ctx.Logger().Debug( - "retrieved status updates by validator", - "validator", vote.ConsAddress.String(), - "updates", valUpdates, - ) - - validator := updates.ValidatorUpdates[vote.ConsAddress.String()] - validator.Updates = valUpdates - updates.ValidatorUpdates[vote.ConsAddress.String()] = validator - } - - return updates, nil -} diff --git a/abci/preblock/sla/preblock_test.go b/abci/preblock/sla/preblock_test.go deleted file mode 100644 index a481e1e91..000000000 --- a/abci/preblock/sla/preblock_test.go +++ /dev/null @@ -1,1039 +0,0 @@ -package sla_test - -import ( - "math/big" - "testing" - - "cosmossdk.io/log" - "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" - cometabci "github.com/cometbft/cometbft/abci/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/suite" - - "github.com/skip-mev/slinky/abci/preblock/sla" - "github.com/skip-mev/slinky/abci/preblock/sla/mocks" - voteaggregator "github.com/skip-mev/slinky/abci/strategies/aggregator" - compression "github.com/skip-mev/slinky/abci/strategies/codec" - currencypairmocks "github.com/skip-mev/slinky/abci/strategies/currencypair/mocks" - "github.com/skip-mev/slinky/abci/testutils" - oraclevetypes "github.com/skip-mev/slinky/abci/ve/types" - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slakeeper "github.com/skip-mev/slinky/x/sla/keeper" - slatypes "github.com/skip-mev/slinky/x/sla/types" - slamocks "github.com/skip-mev/slinky/x/sla/types/mocks" -) - -var oneHundred = big.NewInt(100) - -type SLAPreBlockerHandlerTestSuite struct { - suite.Suite - - ctx sdk.Context - - // The handler being tested. - handler *sla.PreBlockHandler - - // Mocks for the handler's dependencies. - oracleKeeper *mocks.OracleKeeper - stakingKeeper *mocks.StakingKeeper - slaKeeper *slakeeper.Keeper - currencyPairIDStrategy *currencypairmocks.CurrencyPairStrategy - - veCodec compression.VoteExtensionCodec - extCommitCodec compression.ExtendedCommitCodec - - val1 stakingtypes.Validator - consAddr1 sdk.ConsAddress - - val2 stakingtypes.Validator - consAddr2 sdk.ConsAddress - - val3 stakingtypes.Validator - consAddr3 sdk.ConsAddress - - cp1 slinkytypes.CurrencyPair - cp2 slinkytypes.CurrencyPair - cp3 slinkytypes.CurrencyPair - - veEnabled bool - - sla slatypes.PriceFeedSLA - setSLA bool -} - -func TestSLAPreBlockerHandlerTestSuite(t *testing.T) { - suite.Run(t, new(SLAPreBlockerHandlerTestSuite)) -} - -func (s *SLAPreBlockerHandlerTestSuite) SetupTest() { - pks := simtestutil.CreateTestPubKeys(4) - - var err error - val1 := sdk.ValAddress("val1") - s.val1, err = stakingtypes.NewValidator(val1.String(), pks[0], stakingtypes.Description{}) - s.Require().NoError(err) - s.consAddr1, err = s.val1.GetConsAddr() - s.Require().NoError(err) - - val2 := sdk.ValAddress("val2") - s.val2, err = stakingtypes.NewValidator(val2.String(), pks[1], stakingtypes.Description{}) - s.Require().NoError(err) - s.consAddr2, err = s.val2.GetConsAddr() - s.Require().NoError(err) - - val3 := sdk.ValAddress("val3") - s.val3, err = stakingtypes.NewValidator(val3.String(), pks[2], stakingtypes.Description{}) - s.Require().NoError(err) - s.consAddr3, err = s.val3.GetConsAddr() - s.Require().NoError(err) - - s.cp1 = slinkytypes.NewCurrencyPair("btc", "usd") - s.cp2 = slinkytypes.NewCurrencyPair("eth", "usd") - s.cp3 = slinkytypes.NewCurrencyPair("btc", "eth") - - s.currencyPairIDStrategy = currencypairmocks.NewCurrencyPairStrategy(s.T()) - - s.veCodec = compression.NewCompressionVoteExtensionCodec( - compression.NewDefaultVoteExtensionCodec(), - compression.NewZLibCompressor(), - ) - - s.extCommitCodec = compression.NewCompressionExtendedCommitCodec( - compression.NewDefaultExtendedCommitCodec(), - compression.NewZLibCompressor(), - ) - - // Set a single sla in the store for subsequent testing. - s.initHandler(s.veEnabled, s.setSLA) -} - -func (s *SLAPreBlockerHandlerTestSuite) SetupSubTest() { - s.initHandler(s.veEnabled, s.setSLA) -} - -func (s *SLAPreBlockerHandlerTestSuite) TestPreBlocker() { - s.Run("returns error if req is nil", func() { - _, err := s.handler.PreBlocker()(s.ctx, nil) - s.Require().Error(err) - }) - - s.Run("returns if vote extensions have not been enabled", func() { - req := &cometabci.RequestFinalizeBlock{} - - _, err := s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - }) - - // Enable vote extensions. - s.veEnabled = true - - s.Run("returns an error if the vote extensions are not included", func() { - req := &cometabci.RequestFinalizeBlock{} - _, err := s.handler.PreBlocker()(s.ctx, req) - s.Require().Error(err) - }) - - s.Run("returns with no vote extensions in the block", func() { - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo(nil, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{}) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(0, len(cps)) - }) - - s.setSLA = true - - s.Run("returns with no vote extensions in the block with a single sla set", func() { - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo(nil, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{}) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that no currency pairs were added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(0, len(cps)) - - // Check that no new price feeds were created. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(0, len(feeds)) - }) - - s.Run("returns with single validator, single cp, and vote with price", func() { - ve1, err := testutils.CreateExtendedVoteInfo( - s.consAddr1, - map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - s.veCodec, - ) - s.Require().NoError(err) - - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo([]cometabci.ExtendedVoteInfo{ve1}, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - s.currencyPairIDStrategy.On("ID", mock.Anything, s.cp1).Return(uint64(0), nil) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that the currency pair was added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - - // Check that the price feed was created. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(1, len(feeds)) - - // Check that the price feed was created with the correct values. - feed := feeds[0] - s.Require().Equal(s.cp1, feed.CurrencyPair) - s.Require().Equal(s.consAddr1, sdk.ConsAddress(feed.Validator)) - - updates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), updates) - - votes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), votes) - }) - - s.Run("correctly updates with single validator, single cp, and validator with no vote extension", func() { - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo([]cometabci.ExtendedVoteInfo{}, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that the currency pair was added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - - // Check that the price feed was created. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(1, len(feeds)) - - // Check that the price feed was created with the correct values. - feed := feeds[0] - s.Require().Equal(s.cp1, feed.CurrencyPair) - s.Require().Equal(s.consAddr1, sdk.ConsAddress(feed.Validator)) - - updates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), updates) - - votes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), votes) - }) - - s.Run("correctly updates with single validator, single cp, and vote extension without the price", func() { - ve1, err := testutils.CreateExtendedVoteInfo( - s.consAddr1, - map[uint64][]byte{}, - s.veCodec, - ) - s.Require().NoError(err) - - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo([]cometabci.ExtendedVoteInfo{ve1}, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that the currency pair was added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - - // Check that the price feed was created. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(1, len(feeds)) - - // Check that the price feed was created with the correct values. - feed := feeds[0] - s.Require().Equal(s.cp1, feed.CurrencyPair) - s.Require().Equal(s.consAddr1, sdk.ConsAddress(feed.Validator)) - - updates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), updates) - - votes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), votes) - }) - - s.Run("correctly updates an existing price feed with single validator, single cp, and vote extension with price", func() { - feed, err := slatypes.NewPriceFeed( - uint(s.sla.MaximumViableWindow), - s.consAddr1, - s.cp1, - s.sla.ID, - ) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - // Add the feed to the store. - err = s.slaKeeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - ve1, err := testutils.CreateExtendedVoteInfo( - s.consAddr1, - map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - s.veCodec, - ) - s.Require().NoError(err) - - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo([]cometabci.ExtendedVoteInfo{ve1}, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that the currency pair was added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - - // Check that the price feed was updated. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(1, len(feeds)) - - // Check that the price feed was updated with the correct values. - feed = feeds[0] - s.Require().Equal(s.cp1, feed.CurrencyPair) - s.Require().Equal(s.consAddr1, sdk.ConsAddress(feed.Validator)) - - updates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), updates) - - votes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), votes) - - updates, err = feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), updates) - - votes, err = feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), votes) - }) - - s.Run("correctly updates an existing price feed with single validator, single cp, and no vote extension", func() { - feed, err := slatypes.NewPriceFeed( - uint(s.sla.MaximumViableWindow), - s.consAddr1, - s.cp1, - s.sla.ID, - ) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - // Add the feed to the store. - err = s.slaKeeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo([]cometabci.ExtendedVoteInfo{}, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that the currency pair was added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - - // Check that the price feed was updated. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(1, len(feeds)) - - // Check that the price feed was updated with the correct values. - feed = feeds[0] - s.Require().Equal(s.cp1, feed.CurrencyPair) - s.Require().Equal(s.consAddr1, sdk.ConsAddress(feed.Validator)) - - updates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), updates) - - votes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), votes) - - updates, err = feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), updates) - - votes, err = feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), votes) - }) - - s.Run("correctly updates an existing price feed with single validator, single cp, and vote extension without price", func() { - feed, err := slatypes.NewPriceFeed( - uint(s.sla.MaximumViableWindow), - s.consAddr1, - s.cp1, - s.sla.ID, - ) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - // Add the feed to the store. - err = s.slaKeeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - ve1, err := testutils.CreateExtendedVoteInfo( - s.consAddr1, - map[uint64][]byte{}, - s.veCodec, - ) - s.Require().NoError(err) - - // create the vote extensions - _, bz, err := testutils.CreateExtendedCommitInfo([]cometabci.ExtendedVoteInfo{ve1}, s.extCommitCodec) - s.Require().NoError(err) - - // create the request - req := &cometabci.RequestFinalizeBlock{ - Txs: [][]byte{bz}, - } - - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - - _, err = s.handler.PreBlocker()(s.ctx, req) - s.Require().NoError(err) - - // Check that the currency pair was added. - cps, err := s.slaKeeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - - // Check that the price feed was updated. - feeds, err := s.slaKeeper.GetAllPriceFeeds(s.ctx, s.sla.ID) - s.Require().NoError(err) - s.Require().Equal(1, len(feeds)) - - // Check that the price feed was updated with the correct values. - feed = feeds[0] - s.Require().Equal(s.cp1, feed.CurrencyPair) - s.Require().Equal(s.consAddr1, sdk.ConsAddress(feed.Validator)) - - updates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), updates) - - votes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), votes) - - updates, err = feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), updates) - - votes, err = feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), votes) - }) -} - -func (s *SLAPreBlockerHandlerTestSuite) TestGetUpdates() { - s.Run("returns with no voting updates", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{}) - - updates, err := s.handler.GetUpdates(s.ctx, nil) - s.Require().NoError(err) - - s.Require().Equal(0, len(updates.CurrencyPairs)) - s.Require().Equal(0, len(updates.ValidatorUpdates)) - }) - - s.Run("returns single validator, with single currency pair, and no updates", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - updates, err := s.handler.GetUpdates(s.ctx, nil) - s.Require().NoError(err) - - s.Require().Equal(1, len(updates.CurrencyPairs)) - s.Require().Equal(1, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - s.Require().Equal(1, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.NoVote, validator.Updates[s.cp1]) - }) - - s.Run("returns with single validator, single cp, and vote with price", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(1, len(updates.CurrencyPairs)) - s.Require().Equal(1, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - }) - - s.Run("returns with single validator, single cp, and vote without price", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{}, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(1, len(updates.CurrencyPairs)) - s.Require().Equal(1, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithoutPrice, validator.Updates[s.cp1]) - }) - - s.Run("returns with single validator, multiple cps, and votes with Prices", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1, s.cp2, s.cp3}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - 1: oneHundred.Bytes(), - 2: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp2).Return(uint64(1), nil) - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp3).Return(uint64(2), nil) - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(3, len(updates.CurrencyPairs)) - s.Require().Equal(1, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.CurrencyPairs, s.cp2) - s.Require().Contains(updates.CurrencyPairs, s.cp3) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp3]) - }) - - s.Run("returns with single validator, multiple cps, and some Prices", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1, s.cp2, s.cp3}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - 1: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp2).Return(uint64(1), nil) - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp3).Return(uint64(2), nil) - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(3, len(updates.CurrencyPairs)) - s.Require().Equal(1, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.CurrencyPairs, s.cp2) - s.Require().Contains(updates.CurrencyPairs, s.cp3) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.VoteWithoutPrice, validator.Updates[s.cp3]) - }) - - s.Run("returns with 2 validators, single cp, and votes with Prices", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1, s.val2}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - }, - }, - { - ConsAddress: s.consAddr2, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil).Twice() - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(1, len(updates.CurrencyPairs)) - s.Require().Equal(2, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr2.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - s.Require().Equal(1, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - validator = updates.ValidatorUpdates[s.consAddr2.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr2) - s.Require().Equal(1, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - }) - - s.Run("multiple validators, single cp, and one validator did not post any price updates", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1, s.val2}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil) - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(1, len(updates.CurrencyPairs)) - s.Require().Equal(2, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr2.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(1, len(validator.Updates)) - s.Require().Equal(validator.ConsAddress, s.consAddr1) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - validator = updates.ValidatorUpdates[s.consAddr2.String()] - s.Require().Equal(1, len(validator.Updates)) - s.Require().Equal(validator.ConsAddress, s.consAddr2) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.NoVote, validator.Updates[s.cp1]) - }) - - s.Run("multiple validators, multiple cps, and all validators posted Prices", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1, s.val2}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1, s.cp2, s.cp3}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - 1: oneHundred.Bytes(), - 2: oneHundred.Bytes(), - }, - }, - }, - { - ConsAddress: s.consAddr2, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - 1: oneHundred.Bytes(), - 2: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil).Twice() - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp2).Return(uint64(1), nil).Twice() - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp3).Return(uint64(2), nil).Twice() - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(3, len(updates.CurrencyPairs)) - s.Require().Equal(2, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.CurrencyPairs, s.cp2) - s.Require().Contains(updates.CurrencyPairs, s.cp3) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr2.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp3]) - - validator = updates.ValidatorUpdates[s.consAddr2.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr2) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp3]) - }) - - s.Run("3 validators, 3 cps, 1 validator did not vote, 1 validator posted Prices for some, 1 posted for all", func() { - s.stakingKeeper.On("GetBondedValidatorsByPower", s.ctx).Return([]stakingtypes.Validator{s.val1, s.val2, s.val3}, nil) - s.oracleKeeper.On("GetAllCurrencyPairs", s.ctx).Return([]slinkytypes.CurrencyPair{s.cp1, s.cp2, s.cp3}) - - votes := []voteaggregator.Vote{ - { - ConsAddress: s.consAddr1, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - 1: oneHundred.Bytes(), - 2: oneHundred.Bytes(), - }, - }, - }, - { - ConsAddress: s.consAddr2, - OracleVoteExtension: oraclevetypes.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: oneHundred.Bytes(), - }, - }, - }, - } - - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp1).Return(uint64(0), nil).Twice() - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp2).Return(uint64(1), nil) - s.currencyPairIDStrategy.On("ID", s.ctx, s.cp3).Return(uint64(2), nil) - - updates, err := s.handler.GetUpdates(s.ctx, votes) - s.Require().NoError(err) - - s.Require().Equal(3, len(updates.CurrencyPairs)) - s.Require().Equal(3, len(updates.ValidatorUpdates)) - s.Require().Contains(updates.CurrencyPairs, s.cp1) - s.Require().Contains(updates.CurrencyPairs, s.cp2) - s.Require().Contains(updates.CurrencyPairs, s.cp3) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr1.String()) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr2.String()) - s.Require().Contains(updates.ValidatorUpdates, s.consAddr3.String()) - - // Ensure the values are correct. - validator := updates.ValidatorUpdates[s.consAddr1.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr1) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp3]) - - validator = updates.ValidatorUpdates[s.consAddr2.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr2) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.VoteWithPrice, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.VoteWithoutPrice, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.VoteWithoutPrice, validator.Updates[s.cp3]) - - validator = updates.ValidatorUpdates[s.consAddr3.String()] - s.Require().Equal(validator.ConsAddress, s.consAddr3) - s.Require().Equal(3, len(validator.Updates)) - - s.Require().Contains(validator.Updates, s.cp1) - s.Require().Equal(slatypes.NoVote, validator.Updates[s.cp1]) - - s.Require().Contains(validator.Updates, s.cp2) - s.Require().Equal(slatypes.NoVote, validator.Updates[s.cp2]) - - s.Require().Contains(validator.Updates, s.cp3) - s.Require().Equal(slatypes.NoVote, validator.Updates[s.cp3]) - }) -} - -func (s *SLAPreBlockerHandlerTestSuite) initHandler(veEnabled, setSLA bool) { - // Set up context - key := storetypes.NewKVStoreKey(slatypes.StoreKey) - testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) - s.ctx = testCtx.Ctx - - if veEnabled { - s.ctx = s.ctx.WithConsensusParams(cmtproto.ConsensusParams{ - Abci: &cmtproto.ABCIParams{VoteExtensionsEnableHeight: 1}, - }) - - s.ctx = s.ctx.WithBlockHeight(3) - } - - s.ctx = s.ctx.WithLogger(log.NewTestLogger(s.T())) - - // Set up for sla keeper - // Set up store and encoding configs - storeService := runtime.NewKVStoreService(key) - encodingConfig := moduletestutil.MakeTestEncodingConfig() - - slatypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) - - // Set up keeper - s.slaKeeper = slakeeper.NewKeeper( - storeService, - encodingConfig.Codec, - sdk.AccAddress("authority"), - slamocks.NewStakingKeeper(s.T()), - slamocks.NewSlashingKeeper(s.T()), - ) - - s.Require().NoError(s.slaKeeper.SetParams(s.ctx, slatypes.DefaultParams())) - - if setSLA { - id := "slaID1" - s.sla = slatypes.NewPriceFeedSLA( - id, - 10, - math.LegacyMustNewDecFromStr("0.1"), - math.LegacyMustNewDecFromStr("0.1"), - 5, - uint64(s.ctx.BlockHeight()), - ) - err := s.slaKeeper.SetSLA(s.ctx, s.sla) - s.Require().NoError(err) - - slas, err := s.slaKeeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(slas)) - s.Require().Equal(s.sla, slas[0]) - } - - s.oracleKeeper = mocks.NewOracleKeeper(s.T()) - s.stakingKeeper = mocks.NewStakingKeeper(s.T()) - - s.handler = sla.NewSLAPreBlockHandler( - s.oracleKeeper, - s.stakingKeeper, - s.slaKeeper, - s.currencyPairIDStrategy, - s.veCodec, - s.extCommitCodec, - ) -} diff --git a/abci/preblock/sla/utils.go b/abci/preblock/sla/utils.go deleted file mode 100644 index 423528b5e..000000000 --- a/abci/preblock/sla/utils.go +++ /dev/null @@ -1,29 +0,0 @@ -package sla - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/abci/strategies/currencypair" - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// getStatuses returns the price feed status updates for each currency pair. -func getStatuses(ctx sdk.Context, currencyPairIDStrategy currencypair.CurrencyPairStrategy, currencyPairs []slinkytypes.CurrencyPair, prices map[uint64][]byte) map[slinkytypes.CurrencyPair]slatypes.UpdateStatus { - validatorUpdates := make(map[slinkytypes.CurrencyPair]slatypes.UpdateStatus) - - for _, cp := range currencyPairs { - id, err := currencyPairIDStrategy.ID(ctx, cp) - if err != nil { - continue - } - - if _, ok := prices[id]; !ok { - validatorUpdates[cp] = slatypes.VoteWithoutPrice - } else { - validatorUpdates[cp] = slatypes.VoteWithPrice - } - } - - return validatorUpdates -} diff --git a/abci/strategies/aggregator/price_applier.go b/abci/strategies/aggregator/price_applier.go index 9554148c3..88ba3b2e7 100644 --- a/abci/strategies/aggregator/price_applier.go +++ b/abci/strategies/aggregator/price_applier.go @@ -126,7 +126,7 @@ func (opa *oraclePriceApplier) ApplyPricesFromVoteExtensions(ctx sdk.Context, re quotePrice := oracletypes.QuotePrice{ Price: math.NewIntFromBigInt(price), BlockTimestamp: ctx.BlockHeader().Time, - BlockHeight: uint64(ctx.BlockHeight()), + BlockHeight: uint64(ctx.BlockHeight()), //nolint:gosec } if err := opa.ok.SetPriceForCurrencyPair(ctx, cp, quotePrice); err != nil { diff --git a/abci/strategies/aggregator/price_applier_test.go b/abci/strategies/aggregator/price_applier_test.go index 2b93b5039..2d72d1c9f 100644 --- a/abci/strategies/aggregator/price_applier_test.go +++ b/abci/strategies/aggregator/price_applier_test.go @@ -208,7 +208,7 @@ func TestPriceApplier(t *testing.T) { require.Equal(t, qp.Price.BigInt(), big.NewInt(150)) require.Equal(t, qp.BlockTimestamp, ctx.BlockHeader().Time) - require.Equal(t, qp.BlockHeight, uint64(ctx.BlockHeight())) + require.Equal(t, qp.BlockHeight, uint64(ctx.BlockHeight())) //nolint:gosec }) prices, err := pa.ApplyPricesFromVoteExtensions(ctx, &abcitypes.RequestFinalizeBlock{ diff --git a/api/slinky/alerts/module/v1/module.pulsar.go b/api/slinky/alerts/module/v1/module.pulsar.go deleted file mode 100644 index 0c1c94ec7..000000000 --- a/api/slinky/alerts/module/v1/module.pulsar.go +++ /dev/null @@ -1,585 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package modulev1 - -import ( - _ "cosmossdk.io/api/cosmos/app/v1alpha1" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Module protoreflect.MessageDescriptor - fd_Module_authority protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_module_v1_module_proto_init() - md_Module = File_slinky_alerts_module_v1_module_proto.Messages().ByName("Module") - fd_Module_authority = md_Module.Fields().ByName("authority") -} - -var _ protoreflect.Message = (*fastReflection_Module)(nil) - -type fastReflection_Module Module - -func (x *Module) ProtoReflect() protoreflect.Message { - return (*fastReflection_Module)(x) -} - -func (x *Module) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_module_v1_module_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Module_messageType fastReflection_Module_messageType -var _ protoreflect.MessageType = fastReflection_Module_messageType{} - -type fastReflection_Module_messageType struct{} - -func (x fastReflection_Module_messageType) Zero() protoreflect.Message { - return (*fastReflection_Module)(nil) -} -func (x fastReflection_Module_messageType) New() protoreflect.Message { - return new(fastReflection_Module) -} -func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Module) Type() protoreflect.MessageType { - return _fastReflection_Module_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Module) New() protoreflect.Message { - return new(fastReflection_Module) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { - return (*Module)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_Module_authority, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.module.v1.Module.authority": - return x.Authority != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.alerts.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.module.v1.Module.authority": - x.Authority = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.alerts.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.module.v1.Module.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.alerts.module.v1.Module does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.module.v1.Module.authority": - x.Authority = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.alerts.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.module.v1.Module.authority": - panic(fmt.Errorf("field authority of message slinky.alerts.module.v1.Module is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.alerts.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.module.v1.Module.authority": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.alerts.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.module.v1.Module", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Module) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/alerts/module/v1/module.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Module is the config object of the alerts module. -type Module struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Authority defines the custom module authority. The authority will default - // to the governance module account if not set. If the authority is set, the - // address provided must be a valid bech-32 address - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *Module) Reset() { - *x = Module{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_module_v1_module_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Module) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Module) ProtoMessage() {} - -// Deprecated: Use Module.ProtoReflect.Descriptor instead. -func (*Module) Descriptor() ([]byte, []int) { - return file_slinky_alerts_module_v1_module_proto_rawDescGZIP(), []int{0} -} - -func (x *Module) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -var File_slinky_alerts_module_v1_module_proto protoreflect.FileDescriptor - -var file_slinky_alerts_module_v1_module_proto_rawDesc = []byte{ - 0x0a, 0x24, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, - 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x06, - 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2b, - 0xba, 0xc0, 0x96, 0xda, 0x01, 0x25, 0x0a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x73, 0x6b, 0x69, 0x70, 0x2d, 0x6d, 0x65, 0x76, 0x2f, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x42, 0xdc, 0x01, 0x0a, 0x1b, - 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, - 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, - 0x53, 0x41, 0x4d, 0xaa, 0x02, 0x17, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x5c, 0x4d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x23, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1a, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x3a, 0x3a, - 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_slinky_alerts_module_v1_module_proto_rawDescOnce sync.Once - file_slinky_alerts_module_v1_module_proto_rawDescData = file_slinky_alerts_module_v1_module_proto_rawDesc -) - -func file_slinky_alerts_module_v1_module_proto_rawDescGZIP() []byte { - file_slinky_alerts_module_v1_module_proto_rawDescOnce.Do(func() { - file_slinky_alerts_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_alerts_module_v1_module_proto_rawDescData) - }) - return file_slinky_alerts_module_v1_module_proto_rawDescData -} - -var file_slinky_alerts_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_alerts_module_v1_module_proto_goTypes = []interface{}{ - (*Module)(nil), // 0: slinky.alerts.module.v1.Module -} -var file_slinky_alerts_module_v1_module_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_slinky_alerts_module_v1_module_proto_init() } -func file_slinky_alerts_module_v1_module_proto_init() { - if File_slinky_alerts_module_v1_module_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_alerts_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Module); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_alerts_module_v1_module_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_alerts_module_v1_module_proto_goTypes, - DependencyIndexes: file_slinky_alerts_module_v1_module_proto_depIdxs, - MessageInfos: file_slinky_alerts_module_v1_module_proto_msgTypes, - }.Build() - File_slinky_alerts_module_v1_module_proto = out.File - file_slinky_alerts_module_v1_module_proto_rawDesc = nil - file_slinky_alerts_module_v1_module_proto_goTypes = nil - file_slinky_alerts_module_v1_module_proto_depIdxs = nil -} diff --git a/api/slinky/alerts/v1/alerts.pulsar.go b/api/slinky/alerts/v1/alerts.pulsar.go deleted file mode 100644 index 67e4c7de5..000000000 --- a/api/slinky/alerts/v1/alerts.pulsar.go +++ /dev/null @@ -1,4599 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package alertsv1 - -import ( - _ "cosmossdk.io/api/amino" - abci "cosmossdk.io/api/tendermint/abci" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - _ "github.com/skip-mev/slinky/api/slinky/oracle/v1" - v1 "github.com/skip-mev/slinky/api/slinky/types/v1" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Alert protoreflect.MessageDescriptor - fd_Alert_height protoreflect.FieldDescriptor - fd_Alert_signer protoreflect.FieldDescriptor - fd_Alert_currency_pair protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_Alert = File_slinky_alerts_v1_alerts_proto.Messages().ByName("Alert") - fd_Alert_height = md_Alert.Fields().ByName("height") - fd_Alert_signer = md_Alert.Fields().ByName("signer") - fd_Alert_currency_pair = md_Alert.Fields().ByName("currency_pair") -} - -var _ protoreflect.Message = (*fastReflection_Alert)(nil) - -type fastReflection_Alert Alert - -func (x *Alert) ProtoReflect() protoreflect.Message { - return (*fastReflection_Alert)(x) -} - -func (x *Alert) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Alert_messageType fastReflection_Alert_messageType -var _ protoreflect.MessageType = fastReflection_Alert_messageType{} - -type fastReflection_Alert_messageType struct{} - -func (x fastReflection_Alert_messageType) Zero() protoreflect.Message { - return (*fastReflection_Alert)(nil) -} -func (x fastReflection_Alert_messageType) New() protoreflect.Message { - return new(fastReflection_Alert) -} -func (x fastReflection_Alert_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Alert -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Alert) Descriptor() protoreflect.MessageDescriptor { - return md_Alert -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Alert) Type() protoreflect.MessageType { - return _fastReflection_Alert_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Alert) New() protoreflect.Message { - return new(fastReflection_Alert) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Alert) Interface() protoreflect.ProtoMessage { - return (*Alert)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Alert) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Height != uint64(0) { - value := protoreflect.ValueOfUint64(x.Height) - if !f(fd_Alert_height, value) { - return - } - } - if x.Signer != "" { - value := protoreflect.ValueOfString(x.Signer) - if !f(fd_Alert_signer, value) { - return - } - } - if x.CurrencyPair != nil { - value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - if !f(fd_Alert_currency_pair, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Alert) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.Alert.height": - return x.Height != uint64(0) - case "slinky.alerts.v1.Alert.signer": - return x.Signer != "" - case "slinky.alerts.v1.Alert.currency_pair": - return x.CurrencyPair != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Alert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Alert does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Alert) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.Alert.height": - x.Height = uint64(0) - case "slinky.alerts.v1.Alert.signer": - x.Signer = "" - case "slinky.alerts.v1.Alert.currency_pair": - x.CurrencyPair = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Alert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Alert does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Alert) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.Alert.height": - value := x.Height - return protoreflect.ValueOfUint64(value) - case "slinky.alerts.v1.Alert.signer": - value := x.Signer - return protoreflect.ValueOfString(value) - case "slinky.alerts.v1.Alert.currency_pair": - value := x.CurrencyPair - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Alert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Alert does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Alert) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.Alert.height": - x.Height = value.Uint() - case "slinky.alerts.v1.Alert.signer": - x.Signer = value.Interface().(string) - case "slinky.alerts.v1.Alert.currency_pair": - x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Alert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Alert does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Alert) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.Alert.currency_pair": - if x.CurrencyPair == nil { - x.CurrencyPair = new(v1.CurrencyPair) - } - return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - case "slinky.alerts.v1.Alert.height": - panic(fmt.Errorf("field height of message slinky.alerts.v1.Alert is not mutable")) - case "slinky.alerts.v1.Alert.signer": - panic(fmt.Errorf("field signer of message slinky.alerts.v1.Alert is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Alert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Alert does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Alert) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.Alert.height": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.alerts.v1.Alert.signer": - return protoreflect.ValueOfString("") - case "slinky.alerts.v1.Alert.currency_pair": - m := new(v1.CurrencyPair) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Alert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Alert does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Alert) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.Alert", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Alert) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Alert) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Alert) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Alert) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Alert) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Height != 0 { - n += 1 + runtime.Sov(uint64(x.Height)) - } - l = len(x.Signer) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.CurrencyPair != nil { - l = options.Size(x.CurrencyPair) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Alert) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.CurrencyPair != nil { - encoded, err := options.Marshal(x.CurrencyPair) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if len(x.Signer) > 0 { - i -= len(x.Signer) - copy(dAtA[i:], x.Signer) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) - i-- - dAtA[i] = 0x12 - } - if x.Height != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Height)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Alert) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Alert: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Alert: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - x.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Height |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.CurrencyPair == nil { - x.CurrencyPair = &v1.CurrencyPair{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_AlertStatus protoreflect.MessageDescriptor - fd_AlertStatus_conclusion_status protoreflect.FieldDescriptor - fd_AlertStatus_submission_height protoreflect.FieldDescriptor - fd_AlertStatus_submission_timestamp protoreflect.FieldDescriptor - fd_AlertStatus_purge_height protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_AlertStatus = File_slinky_alerts_v1_alerts_proto.Messages().ByName("AlertStatus") - fd_AlertStatus_conclusion_status = md_AlertStatus.Fields().ByName("conclusion_status") - fd_AlertStatus_submission_height = md_AlertStatus.Fields().ByName("submission_height") - fd_AlertStatus_submission_timestamp = md_AlertStatus.Fields().ByName("submission_timestamp") - fd_AlertStatus_purge_height = md_AlertStatus.Fields().ByName("purge_height") -} - -var _ protoreflect.Message = (*fastReflection_AlertStatus)(nil) - -type fastReflection_AlertStatus AlertStatus - -func (x *AlertStatus) ProtoReflect() protoreflect.Message { - return (*fastReflection_AlertStatus)(x) -} - -func (x *AlertStatus) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_AlertStatus_messageType fastReflection_AlertStatus_messageType -var _ protoreflect.MessageType = fastReflection_AlertStatus_messageType{} - -type fastReflection_AlertStatus_messageType struct{} - -func (x fastReflection_AlertStatus_messageType) Zero() protoreflect.Message { - return (*fastReflection_AlertStatus)(nil) -} -func (x fastReflection_AlertStatus_messageType) New() protoreflect.Message { - return new(fastReflection_AlertStatus) -} -func (x fastReflection_AlertStatus_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AlertStatus -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AlertStatus) Descriptor() protoreflect.MessageDescriptor { - return md_AlertStatus -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_AlertStatus) Type() protoreflect.MessageType { - return _fastReflection_AlertStatus_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AlertStatus) New() protoreflect.Message { - return new(fastReflection_AlertStatus) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AlertStatus) Interface() protoreflect.ProtoMessage { - return (*AlertStatus)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_AlertStatus) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ConclusionStatus != uint64(0) { - value := protoreflect.ValueOfUint64(x.ConclusionStatus) - if !f(fd_AlertStatus_conclusion_status, value) { - return - } - } - if x.SubmissionHeight != uint64(0) { - value := protoreflect.ValueOfUint64(x.SubmissionHeight) - if !f(fd_AlertStatus_submission_height, value) { - return - } - } - if x.SubmissionTimestamp != uint64(0) { - value := protoreflect.ValueOfUint64(x.SubmissionTimestamp) - if !f(fd_AlertStatus_submission_timestamp, value) { - return - } - } - if x.PurgeHeight != uint64(0) { - value := protoreflect.ValueOfUint64(x.PurgeHeight) - if !f(fd_AlertStatus_purge_height, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_AlertStatus) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.AlertStatus.conclusion_status": - return x.ConclusionStatus != uint64(0) - case "slinky.alerts.v1.AlertStatus.submission_height": - return x.SubmissionHeight != uint64(0) - case "slinky.alerts.v1.AlertStatus.submission_timestamp": - return x.SubmissionTimestamp != uint64(0) - case "slinky.alerts.v1.AlertStatus.purge_height": - return x.PurgeHeight != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertStatus does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertStatus) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertStatus.conclusion_status": - x.ConclusionStatus = uint64(0) - case "slinky.alerts.v1.AlertStatus.submission_height": - x.SubmissionHeight = uint64(0) - case "slinky.alerts.v1.AlertStatus.submission_timestamp": - x.SubmissionTimestamp = uint64(0) - case "slinky.alerts.v1.AlertStatus.purge_height": - x.PurgeHeight = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertStatus does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_AlertStatus) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.AlertStatus.conclusion_status": - value := x.ConclusionStatus - return protoreflect.ValueOfUint64(value) - case "slinky.alerts.v1.AlertStatus.submission_height": - value := x.SubmissionHeight - return protoreflect.ValueOfUint64(value) - case "slinky.alerts.v1.AlertStatus.submission_timestamp": - value := x.SubmissionTimestamp - return protoreflect.ValueOfUint64(value) - case "slinky.alerts.v1.AlertStatus.purge_height": - value := x.PurgeHeight - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertStatus does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertStatus) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertStatus.conclusion_status": - x.ConclusionStatus = value.Uint() - case "slinky.alerts.v1.AlertStatus.submission_height": - x.SubmissionHeight = value.Uint() - case "slinky.alerts.v1.AlertStatus.submission_timestamp": - x.SubmissionTimestamp = value.Uint() - case "slinky.alerts.v1.AlertStatus.purge_height": - x.PurgeHeight = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertStatus does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertStatus) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertStatus.conclusion_status": - panic(fmt.Errorf("field conclusion_status of message slinky.alerts.v1.AlertStatus is not mutable")) - case "slinky.alerts.v1.AlertStatus.submission_height": - panic(fmt.Errorf("field submission_height of message slinky.alerts.v1.AlertStatus is not mutable")) - case "slinky.alerts.v1.AlertStatus.submission_timestamp": - panic(fmt.Errorf("field submission_timestamp of message slinky.alerts.v1.AlertStatus is not mutable")) - case "slinky.alerts.v1.AlertStatus.purge_height": - panic(fmt.Errorf("field purge_height of message slinky.alerts.v1.AlertStatus is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertStatus does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_AlertStatus) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertStatus.conclusion_status": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.alerts.v1.AlertStatus.submission_height": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.alerts.v1.AlertStatus.submission_timestamp": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.alerts.v1.AlertStatus.purge_height": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertStatus does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_AlertStatus) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.AlertStatus", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_AlertStatus) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertStatus) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_AlertStatus) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_AlertStatus) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AlertStatus) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.ConclusionStatus != 0 { - n += 1 + runtime.Sov(uint64(x.ConclusionStatus)) - } - if x.SubmissionHeight != 0 { - n += 1 + runtime.Sov(uint64(x.SubmissionHeight)) - } - if x.SubmissionTimestamp != 0 { - n += 1 + runtime.Sov(uint64(x.SubmissionTimestamp)) - } - if x.PurgeHeight != 0 { - n += 1 + runtime.Sov(uint64(x.PurgeHeight)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AlertStatus) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.PurgeHeight != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.PurgeHeight)) - i-- - dAtA[i] = 0x20 - } - if x.SubmissionTimestamp != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.SubmissionTimestamp)) - i-- - dAtA[i] = 0x18 - } - if x.SubmissionHeight != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.SubmissionHeight)) - i-- - dAtA[i] = 0x10 - } - if x.ConclusionStatus != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.ConclusionStatus)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AlertStatus) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ConclusionStatus", wireType) - } - x.ConclusionStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.ConclusionStatus |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SubmissionHeight", wireType) - } - x.SubmissionHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.SubmissionHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SubmissionTimestamp", wireType) - } - x.SubmissionTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.SubmissionTimestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PurgeHeight", wireType) - } - x.PurgeHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.PurgeHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_AlertWithStatus protoreflect.MessageDescriptor - fd_AlertWithStatus_alert protoreflect.FieldDescriptor - fd_AlertWithStatus_status protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_AlertWithStatus = File_slinky_alerts_v1_alerts_proto.Messages().ByName("AlertWithStatus") - fd_AlertWithStatus_alert = md_AlertWithStatus.Fields().ByName("alert") - fd_AlertWithStatus_status = md_AlertWithStatus.Fields().ByName("status") -} - -var _ protoreflect.Message = (*fastReflection_AlertWithStatus)(nil) - -type fastReflection_AlertWithStatus AlertWithStatus - -func (x *AlertWithStatus) ProtoReflect() protoreflect.Message { - return (*fastReflection_AlertWithStatus)(x) -} - -func (x *AlertWithStatus) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_AlertWithStatus_messageType fastReflection_AlertWithStatus_messageType -var _ protoreflect.MessageType = fastReflection_AlertWithStatus_messageType{} - -type fastReflection_AlertWithStatus_messageType struct{} - -func (x fastReflection_AlertWithStatus_messageType) Zero() protoreflect.Message { - return (*fastReflection_AlertWithStatus)(nil) -} -func (x fastReflection_AlertWithStatus_messageType) New() protoreflect.Message { - return new(fastReflection_AlertWithStatus) -} -func (x fastReflection_AlertWithStatus_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AlertWithStatus -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AlertWithStatus) Descriptor() protoreflect.MessageDescriptor { - return md_AlertWithStatus -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_AlertWithStatus) Type() protoreflect.MessageType { - return _fastReflection_AlertWithStatus_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AlertWithStatus) New() protoreflect.Message { - return new(fastReflection_AlertWithStatus) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AlertWithStatus) Interface() protoreflect.ProtoMessage { - return (*AlertWithStatus)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_AlertWithStatus) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Alert != nil { - value := protoreflect.ValueOfMessage(x.Alert.ProtoReflect()) - if !f(fd_AlertWithStatus_alert, value) { - return - } - } - if x.Status != nil { - value := protoreflect.ValueOfMessage(x.Status.ProtoReflect()) - if !f(fd_AlertWithStatus_status, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_AlertWithStatus) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.AlertWithStatus.alert": - return x.Alert != nil - case "slinky.alerts.v1.AlertWithStatus.status": - return x.Status != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertWithStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertWithStatus does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertWithStatus) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertWithStatus.alert": - x.Alert = nil - case "slinky.alerts.v1.AlertWithStatus.status": - x.Status = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertWithStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertWithStatus does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_AlertWithStatus) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.AlertWithStatus.alert": - value := x.Alert - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.AlertWithStatus.status": - value := x.Status - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertWithStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertWithStatus does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertWithStatus) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertWithStatus.alert": - x.Alert = value.Message().Interface().(*Alert) - case "slinky.alerts.v1.AlertWithStatus.status": - x.Status = value.Message().Interface().(*AlertStatus) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertWithStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertWithStatus does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertWithStatus) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertWithStatus.alert": - if x.Alert == nil { - x.Alert = new(Alert) - } - return protoreflect.ValueOfMessage(x.Alert.ProtoReflect()) - case "slinky.alerts.v1.AlertWithStatus.status": - if x.Status == nil { - x.Status = new(AlertStatus) - } - return protoreflect.ValueOfMessage(x.Status.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertWithStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertWithStatus does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_AlertWithStatus) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertWithStatus.alert": - m := new(Alert) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.AlertWithStatus.status": - m := new(AlertStatus) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertWithStatus")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertWithStatus does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_AlertWithStatus) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.AlertWithStatus", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_AlertWithStatus) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertWithStatus) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_AlertWithStatus) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_AlertWithStatus) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AlertWithStatus) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Alert != nil { - l = options.Size(x.Alert) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Status != nil { - l = options.Size(x.Status) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AlertWithStatus) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Status != nil { - encoded, err := options.Marshal(x.Status) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if x.Alert != nil { - encoded, err := options.Marshal(x.Alert) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AlertWithStatus) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertWithStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertWithStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Alert == nil { - x.Alert = &Alert{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Alert); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Status == nil { - x.Status = &AlertStatus{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Status); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_Signature protoreflect.MessageDescriptor - fd_Signature_signer protoreflect.FieldDescriptor - fd_Signature_signature protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_Signature = File_slinky_alerts_v1_alerts_proto.Messages().ByName("Signature") - fd_Signature_signer = md_Signature.Fields().ByName("signer") - fd_Signature_signature = md_Signature.Fields().ByName("signature") -} - -var _ protoreflect.Message = (*fastReflection_Signature)(nil) - -type fastReflection_Signature Signature - -func (x *Signature) ProtoReflect() protoreflect.Message { - return (*fastReflection_Signature)(x) -} - -func (x *Signature) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Signature_messageType fastReflection_Signature_messageType -var _ protoreflect.MessageType = fastReflection_Signature_messageType{} - -type fastReflection_Signature_messageType struct{} - -func (x fastReflection_Signature_messageType) Zero() protoreflect.Message { - return (*fastReflection_Signature)(nil) -} -func (x fastReflection_Signature_messageType) New() protoreflect.Message { - return new(fastReflection_Signature) -} -func (x fastReflection_Signature_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Signature -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Signature) Descriptor() protoreflect.MessageDescriptor { - return md_Signature -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Signature) Type() protoreflect.MessageType { - return _fastReflection_Signature_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Signature) New() protoreflect.Message { - return new(fastReflection_Signature) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Signature) Interface() protoreflect.ProtoMessage { - return (*Signature)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Signature) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Signer != "" { - value := protoreflect.ValueOfString(x.Signer) - if !f(fd_Signature_signer, value) { - return - } - } - if len(x.Signature) != 0 { - value := protoreflect.ValueOfBytes(x.Signature) - if !f(fd_Signature_signature, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Signature) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.Signature.signer": - return x.Signer != "" - case "slinky.alerts.v1.Signature.signature": - return len(x.Signature) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Signature")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Signature does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Signature) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.Signature.signer": - x.Signer = "" - case "slinky.alerts.v1.Signature.signature": - x.Signature = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Signature")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Signature does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Signature) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.Signature.signer": - value := x.Signer - return protoreflect.ValueOfString(value) - case "slinky.alerts.v1.Signature.signature": - value := x.Signature - return protoreflect.ValueOfBytes(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Signature")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Signature does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Signature) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.Signature.signer": - x.Signer = value.Interface().(string) - case "slinky.alerts.v1.Signature.signature": - x.Signature = value.Bytes() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Signature")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Signature does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Signature) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.Signature.signer": - panic(fmt.Errorf("field signer of message slinky.alerts.v1.Signature is not mutable")) - case "slinky.alerts.v1.Signature.signature": - panic(fmt.Errorf("field signature of message slinky.alerts.v1.Signature is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Signature")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Signature does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Signature) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.Signature.signer": - return protoreflect.ValueOfString("") - case "slinky.alerts.v1.Signature.signature": - return protoreflect.ValueOfBytes(nil) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Signature")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Signature does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Signature) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.Signature", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Signature) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Signature) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Signature) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Signature) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Signature) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Signer) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Signature) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Signature) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Signature) > 0 { - i -= len(x.Signature) - copy(dAtA[i:], x.Signature) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signature))) - i-- - dAtA[i] = 0x12 - } - if len(x.Signer) > 0 { - i -= len(x.Signer) - copy(dAtA[i:], x.Signer) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Signature) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Signature = append(x.Signature[:0], dAtA[iNdEx:postIndex]...) - if x.Signature == nil { - x.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_MultiSigConclusion_3_list)(nil) - -type _MultiSigConclusion_3_list struct { - list *[]*Signature -} - -func (x *_MultiSigConclusion_3_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MultiSigConclusion_3_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MultiSigConclusion_3_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Signature) - (*x.list)[i] = concreteValue -} - -func (x *_MultiSigConclusion_3_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Signature) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MultiSigConclusion_3_list) AppendMutable() protoreflect.Value { - v := new(Signature) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MultiSigConclusion_3_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MultiSigConclusion_3_list) NewElement() protoreflect.Value { - v := new(Signature) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MultiSigConclusion_3_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MultiSigConclusion protoreflect.MessageDescriptor - fd_MultiSigConclusion_alert protoreflect.FieldDescriptor - fd_MultiSigConclusion_extended_commit_info protoreflect.FieldDescriptor - fd_MultiSigConclusion_signatures protoreflect.FieldDescriptor - fd_MultiSigConclusion_price_bound protoreflect.FieldDescriptor - fd_MultiSigConclusion_status protoreflect.FieldDescriptor - fd_MultiSigConclusion_currency_pair_i_d protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_MultiSigConclusion = File_slinky_alerts_v1_alerts_proto.Messages().ByName("MultiSigConclusion") - fd_MultiSigConclusion_alert = md_MultiSigConclusion.Fields().ByName("alert") - fd_MultiSigConclusion_extended_commit_info = md_MultiSigConclusion.Fields().ByName("extended_commit_info") - fd_MultiSigConclusion_signatures = md_MultiSigConclusion.Fields().ByName("signatures") - fd_MultiSigConclusion_price_bound = md_MultiSigConclusion.Fields().ByName("price_bound") - fd_MultiSigConclusion_status = md_MultiSigConclusion.Fields().ByName("status") - fd_MultiSigConclusion_currency_pair_i_d = md_MultiSigConclusion.Fields().ByName("currency_pair_i_d") -} - -var _ protoreflect.Message = (*fastReflection_MultiSigConclusion)(nil) - -type fastReflection_MultiSigConclusion MultiSigConclusion - -func (x *MultiSigConclusion) ProtoReflect() protoreflect.Message { - return (*fastReflection_MultiSigConclusion)(x) -} - -func (x *MultiSigConclusion) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MultiSigConclusion_messageType fastReflection_MultiSigConclusion_messageType -var _ protoreflect.MessageType = fastReflection_MultiSigConclusion_messageType{} - -type fastReflection_MultiSigConclusion_messageType struct{} - -func (x fastReflection_MultiSigConclusion_messageType) Zero() protoreflect.Message { - return (*fastReflection_MultiSigConclusion)(nil) -} -func (x fastReflection_MultiSigConclusion_messageType) New() protoreflect.Message { - return new(fastReflection_MultiSigConclusion) -} -func (x fastReflection_MultiSigConclusion_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MultiSigConclusion -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MultiSigConclusion) Descriptor() protoreflect.MessageDescriptor { - return md_MultiSigConclusion -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MultiSigConclusion) Type() protoreflect.MessageType { - return _fastReflection_MultiSigConclusion_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MultiSigConclusion) New() protoreflect.Message { - return new(fastReflection_MultiSigConclusion) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MultiSigConclusion) Interface() protoreflect.ProtoMessage { - return (*MultiSigConclusion)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MultiSigConclusion) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Alert != nil { - value := protoreflect.ValueOfMessage(x.Alert.ProtoReflect()) - if !f(fd_MultiSigConclusion_alert, value) { - return - } - } - if x.ExtendedCommitInfo != nil { - value := protoreflect.ValueOfMessage(x.ExtendedCommitInfo.ProtoReflect()) - if !f(fd_MultiSigConclusion_extended_commit_info, value) { - return - } - } - if len(x.Signatures) != 0 { - value := protoreflect.ValueOfList(&_MultiSigConclusion_3_list{list: &x.Signatures}) - if !f(fd_MultiSigConclusion_signatures, value) { - return - } - } - if x.PriceBound != nil { - value := protoreflect.ValueOfMessage(x.PriceBound.ProtoReflect()) - if !f(fd_MultiSigConclusion_price_bound, value) { - return - } - } - if x.Status != false { - value := protoreflect.ValueOfBool(x.Status) - if !f(fd_MultiSigConclusion_status, value) { - return - } - } - if x.CurrencyPairID != uint64(0) { - value := protoreflect.ValueOfUint64(x.CurrencyPairID) - if !f(fd_MultiSigConclusion_currency_pair_i_d, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MultiSigConclusion) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusion.alert": - return x.Alert != nil - case "slinky.alerts.v1.MultiSigConclusion.extended_commit_info": - return x.ExtendedCommitInfo != nil - case "slinky.alerts.v1.MultiSigConclusion.signatures": - return len(x.Signatures) != 0 - case "slinky.alerts.v1.MultiSigConclusion.price_bound": - return x.PriceBound != nil - case "slinky.alerts.v1.MultiSigConclusion.status": - return x.Status != false - case "slinky.alerts.v1.MultiSigConclusion.currency_pair_i_d": - return x.CurrencyPairID != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusion does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusion) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusion.alert": - x.Alert = nil - case "slinky.alerts.v1.MultiSigConclusion.extended_commit_info": - x.ExtendedCommitInfo = nil - case "slinky.alerts.v1.MultiSigConclusion.signatures": - x.Signatures = nil - case "slinky.alerts.v1.MultiSigConclusion.price_bound": - x.PriceBound = nil - case "slinky.alerts.v1.MultiSigConclusion.status": - x.Status = false - case "slinky.alerts.v1.MultiSigConclusion.currency_pair_i_d": - x.CurrencyPairID = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusion does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MultiSigConclusion) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.MultiSigConclusion.alert": - value := x.Alert - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.extended_commit_info": - value := x.ExtendedCommitInfo - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.signatures": - if len(x.Signatures) == 0 { - return protoreflect.ValueOfList(&_MultiSigConclusion_3_list{}) - } - listValue := &_MultiSigConclusion_3_list{list: &x.Signatures} - return protoreflect.ValueOfList(listValue) - case "slinky.alerts.v1.MultiSigConclusion.price_bound": - value := x.PriceBound - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.status": - value := x.Status - return protoreflect.ValueOfBool(value) - case "slinky.alerts.v1.MultiSigConclusion.currency_pair_i_d": - value := x.CurrencyPairID - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusion does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusion) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusion.alert": - x.Alert = value.Message().Interface().(*Alert) - case "slinky.alerts.v1.MultiSigConclusion.extended_commit_info": - x.ExtendedCommitInfo = value.Message().Interface().(*abci.ExtendedCommitInfo) - case "slinky.alerts.v1.MultiSigConclusion.signatures": - lv := value.List() - clv := lv.(*_MultiSigConclusion_3_list) - x.Signatures = *clv.list - case "slinky.alerts.v1.MultiSigConclusion.price_bound": - x.PriceBound = value.Message().Interface().(*PriceBound) - case "slinky.alerts.v1.MultiSigConclusion.status": - x.Status = value.Bool() - case "slinky.alerts.v1.MultiSigConclusion.currency_pair_i_d": - x.CurrencyPairID = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusion does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusion) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusion.alert": - if x.Alert == nil { - x.Alert = new(Alert) - } - return protoreflect.ValueOfMessage(x.Alert.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.extended_commit_info": - if x.ExtendedCommitInfo == nil { - x.ExtendedCommitInfo = new(abci.ExtendedCommitInfo) - } - return protoreflect.ValueOfMessage(x.ExtendedCommitInfo.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.signatures": - if x.Signatures == nil { - x.Signatures = []*Signature{} - } - value := &_MultiSigConclusion_3_list{list: &x.Signatures} - return protoreflect.ValueOfList(value) - case "slinky.alerts.v1.MultiSigConclusion.price_bound": - if x.PriceBound == nil { - x.PriceBound = new(PriceBound) - } - return protoreflect.ValueOfMessage(x.PriceBound.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.status": - panic(fmt.Errorf("field status of message slinky.alerts.v1.MultiSigConclusion is not mutable")) - case "slinky.alerts.v1.MultiSigConclusion.currency_pair_i_d": - panic(fmt.Errorf("field currency_pair_i_d of message slinky.alerts.v1.MultiSigConclusion is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusion does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MultiSigConclusion) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusion.alert": - m := new(Alert) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.extended_commit_info": - m := new(abci.ExtendedCommitInfo) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.signatures": - list := []*Signature{} - return protoreflect.ValueOfList(&_MultiSigConclusion_3_list{list: &list}) - case "slinky.alerts.v1.MultiSigConclusion.price_bound": - m := new(PriceBound) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.MultiSigConclusion.status": - return protoreflect.ValueOfBool(false) - case "slinky.alerts.v1.MultiSigConclusion.currency_pair_i_d": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusion does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MultiSigConclusion) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MultiSigConclusion", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MultiSigConclusion) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusion) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MultiSigConclusion) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MultiSigConclusion) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MultiSigConclusion) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Alert != nil { - l = options.Size(x.Alert) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.ExtendedCommitInfo != nil { - l = options.Size(x.ExtendedCommitInfo) - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.Signatures) > 0 { - for _, e := range x.Signatures { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.PriceBound != nil { - l = options.Size(x.PriceBound) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Status { - n += 2 - } - if x.CurrencyPairID != 0 { - n += 1 + runtime.Sov(uint64(x.CurrencyPairID)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MultiSigConclusion) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.CurrencyPairID != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.CurrencyPairID)) - i-- - dAtA[i] = 0x30 - } - if x.Status { - i-- - if x.Status { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if x.PriceBound != nil { - encoded, err := options.Marshal(x.PriceBound) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x22 - } - if len(x.Signatures) > 0 { - for iNdEx := len(x.Signatures) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Signatures[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - } - if x.ExtendedCommitInfo != nil { - encoded, err := options.Marshal(x.ExtendedCommitInfo) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if x.Alert != nil { - encoded, err := options.Marshal(x.Alert) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MultiSigConclusion) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MultiSigConclusion: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MultiSigConclusion: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Alert == nil { - x.Alert = &Alert{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Alert); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExtendedCommitInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.ExtendedCommitInfo == nil { - x.ExtendedCommitInfo = &abci.ExtendedCommitInfo{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ExtendedCommitInfo); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Signatures = append(x.Signatures, &Signature{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Signatures[len(x.Signatures)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PriceBound", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.PriceBound == nil { - x.PriceBound = &PriceBound{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PriceBound); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Status = bool(v != 0) - case 6: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrencyPairID", wireType) - } - x.CurrencyPairID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.CurrencyPairID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_MultiSigConclusionVerificationParams_1_list)(nil) - -type _MultiSigConclusionVerificationParams_1_list struct { - list *[]*anypb.Any -} - -func (x *_MultiSigConclusionVerificationParams_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MultiSigConclusionVerificationParams_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MultiSigConclusionVerificationParams_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*anypb.Any) - (*x.list)[i] = concreteValue -} - -func (x *_MultiSigConclusionVerificationParams_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*anypb.Any) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MultiSigConclusionVerificationParams_1_list) AppendMutable() protoreflect.Value { - v := new(anypb.Any) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MultiSigConclusionVerificationParams_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MultiSigConclusionVerificationParams_1_list) NewElement() protoreflect.Value { - v := new(anypb.Any) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MultiSigConclusionVerificationParams_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MultiSigConclusionVerificationParams protoreflect.MessageDescriptor - fd_MultiSigConclusionVerificationParams_signers protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_MultiSigConclusionVerificationParams = File_slinky_alerts_v1_alerts_proto.Messages().ByName("MultiSigConclusionVerificationParams") - fd_MultiSigConclusionVerificationParams_signers = md_MultiSigConclusionVerificationParams.Fields().ByName("signers") -} - -var _ protoreflect.Message = (*fastReflection_MultiSigConclusionVerificationParams)(nil) - -type fastReflection_MultiSigConclusionVerificationParams MultiSigConclusionVerificationParams - -func (x *MultiSigConclusionVerificationParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_MultiSigConclusionVerificationParams)(x) -} - -func (x *MultiSigConclusionVerificationParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MultiSigConclusionVerificationParams_messageType fastReflection_MultiSigConclusionVerificationParams_messageType -var _ protoreflect.MessageType = fastReflection_MultiSigConclusionVerificationParams_messageType{} - -type fastReflection_MultiSigConclusionVerificationParams_messageType struct{} - -func (x fastReflection_MultiSigConclusionVerificationParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_MultiSigConclusionVerificationParams)(nil) -} -func (x fastReflection_MultiSigConclusionVerificationParams_messageType) New() protoreflect.Message { - return new(fastReflection_MultiSigConclusionVerificationParams) -} -func (x fastReflection_MultiSigConclusionVerificationParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MultiSigConclusionVerificationParams -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MultiSigConclusionVerificationParams) Descriptor() protoreflect.MessageDescriptor { - return md_MultiSigConclusionVerificationParams -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MultiSigConclusionVerificationParams) Type() protoreflect.MessageType { - return _fastReflection_MultiSigConclusionVerificationParams_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MultiSigConclusionVerificationParams) New() protoreflect.Message { - return new(fastReflection_MultiSigConclusionVerificationParams) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MultiSigConclusionVerificationParams) Interface() protoreflect.ProtoMessage { - return (*MultiSigConclusionVerificationParams)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MultiSigConclusionVerificationParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Signers) != 0 { - value := protoreflect.ValueOfList(&_MultiSigConclusionVerificationParams_1_list{list: &x.Signers}) - if !f(fd_MultiSigConclusionVerificationParams_signers, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MultiSigConclusionVerificationParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusionVerificationParams.signers": - return len(x.Signers) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusionVerificationParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusionVerificationParams does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusionVerificationParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusionVerificationParams.signers": - x.Signers = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusionVerificationParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusionVerificationParams does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MultiSigConclusionVerificationParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.MultiSigConclusionVerificationParams.signers": - if len(x.Signers) == 0 { - return protoreflect.ValueOfList(&_MultiSigConclusionVerificationParams_1_list{}) - } - listValue := &_MultiSigConclusionVerificationParams_1_list{list: &x.Signers} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusionVerificationParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusionVerificationParams does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusionVerificationParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusionVerificationParams.signers": - lv := value.List() - clv := lv.(*_MultiSigConclusionVerificationParams_1_list) - x.Signers = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusionVerificationParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusionVerificationParams does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusionVerificationParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusionVerificationParams.signers": - if x.Signers == nil { - x.Signers = []*anypb.Any{} - } - value := &_MultiSigConclusionVerificationParams_1_list{list: &x.Signers} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusionVerificationParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusionVerificationParams does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MultiSigConclusionVerificationParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MultiSigConclusionVerificationParams.signers": - list := []*anypb.Any{} - return protoreflect.ValueOfList(&_MultiSigConclusionVerificationParams_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MultiSigConclusionVerificationParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MultiSigConclusionVerificationParams does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MultiSigConclusionVerificationParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MultiSigConclusionVerificationParams", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MultiSigConclusionVerificationParams) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MultiSigConclusionVerificationParams) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MultiSigConclusionVerificationParams) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MultiSigConclusionVerificationParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MultiSigConclusionVerificationParams) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Signers) > 0 { - for _, e := range x.Signers { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MultiSigConclusionVerificationParams) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Signers) > 0 { - for iNdEx := len(x.Signers) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Signers[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MultiSigConclusionVerificationParams) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MultiSigConclusionVerificationParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MultiSigConclusionVerificationParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Signers = append(x.Signers, &anypb.Any{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Signers[len(x.Signers)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_PriceBound protoreflect.MessageDescriptor - fd_PriceBound_high protoreflect.FieldDescriptor - fd_PriceBound_low protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_alerts_proto_init() - md_PriceBound = File_slinky_alerts_v1_alerts_proto.Messages().ByName("PriceBound") - fd_PriceBound_high = md_PriceBound.Fields().ByName("high") - fd_PriceBound_low = md_PriceBound.Fields().ByName("low") -} - -var _ protoreflect.Message = (*fastReflection_PriceBound)(nil) - -type fastReflection_PriceBound PriceBound - -func (x *PriceBound) ProtoReflect() protoreflect.Message { - return (*fastReflection_PriceBound)(x) -} - -func (x *PriceBound) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_PriceBound_messageType fastReflection_PriceBound_messageType -var _ protoreflect.MessageType = fastReflection_PriceBound_messageType{} - -type fastReflection_PriceBound_messageType struct{} - -func (x fastReflection_PriceBound_messageType) Zero() protoreflect.Message { - return (*fastReflection_PriceBound)(nil) -} -func (x fastReflection_PriceBound_messageType) New() protoreflect.Message { - return new(fastReflection_PriceBound) -} -func (x fastReflection_PriceBound_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_PriceBound -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_PriceBound) Descriptor() protoreflect.MessageDescriptor { - return md_PriceBound -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_PriceBound) Type() protoreflect.MessageType { - return _fastReflection_PriceBound_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_PriceBound) New() protoreflect.Message { - return new(fastReflection_PriceBound) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_PriceBound) Interface() protoreflect.ProtoMessage { - return (*PriceBound)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_PriceBound) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.High != "" { - value := protoreflect.ValueOfString(x.High) - if !f(fd_PriceBound_high, value) { - return - } - } - if x.Low != "" { - value := protoreflect.ValueOfString(x.Low) - if !f(fd_PriceBound_low, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_PriceBound) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.PriceBound.high": - return x.High != "" - case "slinky.alerts.v1.PriceBound.low": - return x.Low != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PriceBound")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PriceBound does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceBound) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.PriceBound.high": - x.High = "" - case "slinky.alerts.v1.PriceBound.low": - x.Low = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PriceBound")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PriceBound does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_PriceBound) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.PriceBound.high": - value := x.High - return protoreflect.ValueOfString(value) - case "slinky.alerts.v1.PriceBound.low": - value := x.Low - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PriceBound")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PriceBound does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceBound) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.PriceBound.high": - x.High = value.Interface().(string) - case "slinky.alerts.v1.PriceBound.low": - x.Low = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PriceBound")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PriceBound does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceBound) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.PriceBound.high": - panic(fmt.Errorf("field high of message slinky.alerts.v1.PriceBound is not mutable")) - case "slinky.alerts.v1.PriceBound.low": - panic(fmt.Errorf("field low of message slinky.alerts.v1.PriceBound is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PriceBound")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PriceBound does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_PriceBound) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.PriceBound.high": - return protoreflect.ValueOfString("") - case "slinky.alerts.v1.PriceBound.low": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PriceBound")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PriceBound does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_PriceBound) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.PriceBound", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_PriceBound) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceBound) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_PriceBound) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_PriceBound) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*PriceBound) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.High) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Low) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*PriceBound) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Low) > 0 { - i -= len(x.Low) - copy(dAtA[i:], x.Low) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Low))) - i-- - dAtA[i] = 0x12 - } - if len(x.High) > 0 { - i -= len(x.High) - copy(dAtA[i:], x.High) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.High))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*PriceBound) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PriceBound: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PriceBound: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field High", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.High = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Low", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Low = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/alerts/v1/alerts.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Alert defines the basic meta-data necessary for the alerts module to resolve -// a claim that the price of a CurrencyPair on-chain is deviating from the price -// off-chain. -type Alert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // height represents the height for which the alert is filed. - Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - // signer is the signer of this alert, this is the address that will receive - // the reward in the case of a positive conclusion, or whose bond will get - // slashed in the event of a negative conclusion. - Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` - // currency_pair is the currency-pair that this claim asserts is deviating - // from the price off-chain. - CurrencyPair *v1.CurrencyPair `protobuf:"bytes,3,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair,omitempty"` -} - -func (x *Alert) Reset() { - *x = Alert{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Alert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Alert) ProtoMessage() {} - -// Deprecated: Use Alert.ProtoReflect.Descriptor instead. -func (*Alert) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{0} -} - -func (x *Alert) GetHeight() uint64 { - if x != nil { - return x.Height - } - return 0 -} - -func (x *Alert) GetSigner() string { - if x != nil { - return x.Signer - } - return "" -} - -func (x *Alert) GetCurrencyPair() *v1.CurrencyPair { - if x != nil { - return x.CurrencyPair - } - return nil -} - -// AlertStatus contains the module specific state for an alert: Has the alert -// been concluded? What height was the alert submitted, what height should the -// alert be purged? -type AlertStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ConclusionStatus determines whether the alert has been concluded. - ConclusionStatus uint64 `protobuf:"varint,1,opt,name=conclusion_status,json=conclusionStatus,proto3" json:"conclusion_status,omitempty"` - // SubmissionHeight is the height that the alert was submitted in. - SubmissionHeight uint64 `protobuf:"varint,2,opt,name=submission_height,json=submissionHeight,proto3" json:"submission_height,omitempty"` - // SubmissionTimestamp is the block-timestamp of the block that the alert was - // submitted in (as a UTC value in Unix time). - SubmissionTimestamp uint64 `protobuf:"varint,3,opt,name=submission_timestamp,json=submissionTimestamp,proto3" json:"submission_timestamp,omitempty"` - // PurgeHeight is the height at which the alert should be purged. - PurgeHeight uint64 `protobuf:"varint,4,opt,name=purge_height,json=purgeHeight,proto3" json:"purge_height,omitempty"` -} - -func (x *AlertStatus) Reset() { - *x = AlertStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlertStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlertStatus) ProtoMessage() {} - -// Deprecated: Use AlertStatus.ProtoReflect.Descriptor instead. -func (*AlertStatus) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{1} -} - -func (x *AlertStatus) GetConclusionStatus() uint64 { - if x != nil { - return x.ConclusionStatus - } - return 0 -} - -func (x *AlertStatus) GetSubmissionHeight() uint64 { - if x != nil { - return x.SubmissionHeight - } - return 0 -} - -func (x *AlertStatus) GetSubmissionTimestamp() uint64 { - if x != nil { - return x.SubmissionTimestamp - } - return 0 -} - -func (x *AlertStatus) GetPurgeHeight() uint64 { - if x != nil { - return x.PurgeHeight - } - return 0 -} - -// AlertWithStatus represents a wrapper around the Alert and AlertStatus -// objects, this is so that the module specific information about Alerts can be -// packaged together. -type AlertWithStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // alert is the alert that this status corresponds to. - Alert *Alert `protobuf:"bytes,1,opt,name=alert,proto3" json:"alert,omitempty"` - // status is the status of the alert. - Status *AlertStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` -} - -func (x *AlertWithStatus) Reset() { - *x = AlertWithStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlertWithStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlertWithStatus) ProtoMessage() {} - -// Deprecated: Use AlertWithStatus.ProtoReflect.Descriptor instead. -func (*AlertWithStatus) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{2} -} - -func (x *AlertWithStatus) GetAlert() *Alert { - if x != nil { - return x.Alert - } - return nil -} - -func (x *AlertWithStatus) GetStatus() *AlertStatus { - if x != nil { - return x.Status - } - return nil -} - -// Signature is a container for a signer address mapped to a signature. -type Signature struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (x *Signature) Reset() { - *x = Signature{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Signature) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Signature) ProtoMessage() {} - -// Deprecated: Use Signature.ProtoReflect.Descriptor instead. -func (*Signature) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{3} -} - -func (x *Signature) GetSigner() string { - if x != nil { - return x.Signer - } - return "" -} - -func (x *Signature) GetSignature() []byte { - if x != nil { - return x.Signature - } - return nil -} - -// MultiSigConcluson defines a conclusion that is accompanied by a set of -// signatures. The signature is defined over the alert UID, status, OracleData, -// and PriceBound. The signatures are used to verify that the conclusion is -// valid. -type MultiSigConclusion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // alert is the alert that this conclusion corresponds to. - Alert *Alert `protobuf:"bytes,1,opt,name=alert,proto3" json:"alert,omitempty"` - // oracle_data is the oracle data that this conclusion references. - ExtendedCommitInfo *abci.ExtendedCommitInfo `protobuf:"bytes,2,opt,name=extended_commit_info,json=extendedCommitInfo,proto3" json:"extended_commit_info,omitempty"` - // signatures is a map of signer -> signature. Where the signature is over - // Alert.UID, PriceBound, the marshalled ExtendedCommitInfo, and status. - Signatures []*Signature `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` - // price-bound is the price bound of the currency-pair off-chain for the - // designated time-range. - PriceBound *PriceBound `protobuf:"bytes,4,opt,name=price_bound,json=priceBound,proto3" json:"price_bound,omitempty"` - // status is the status of the conclusion. - Status bool `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` - // CurrencyPairID is the ID of the currency-pair that this conclusion - // corresponds to. - CurrencyPairID uint64 `protobuf:"varint,6,opt,name=currency_pair_i_d,json=currencyPairID,proto3" json:"currency_pair_i_d,omitempty"` -} - -func (x *MultiSigConclusion) Reset() { - *x = MultiSigConclusion{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MultiSigConclusion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MultiSigConclusion) ProtoMessage() {} - -// Deprecated: Use MultiSigConclusion.ProtoReflect.Descriptor instead. -func (*MultiSigConclusion) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{4} -} - -func (x *MultiSigConclusion) GetAlert() *Alert { - if x != nil { - return x.Alert - } - return nil -} - -func (x *MultiSigConclusion) GetExtendedCommitInfo() *abci.ExtendedCommitInfo { - if x != nil { - return x.ExtendedCommitInfo - } - return nil -} - -func (x *MultiSigConclusion) GetSignatures() []*Signature { - if x != nil { - return x.Signatures - } - return nil -} - -func (x *MultiSigConclusion) GetPriceBound() *PriceBound { - if x != nil { - return x.PriceBound - } - return nil -} - -func (x *MultiSigConclusion) GetStatus() bool { - if x != nil { - return x.Status - } - return false -} - -func (x *MultiSigConclusion) GetCurrencyPairID() uint64 { - if x != nil { - return x.CurrencyPairID - } - return 0 -} - -// MultiSigConclusionVerificationParams defines the parameters necessary to -// verify a MultiSigConclusion. It contains a map between signer and public key. -// Notice, the public-key (value) are the base-64 encoded bytes of the public -// key. And the signer (key) is the bech32 encoded address of the signer. -// Notice, all public keys must be secp256 keys. -type MultiSigConclusionVerificationParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // signers is a map of signer -> public key. - Signers []*anypb.Any `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"` -} - -func (x *MultiSigConclusionVerificationParams) Reset() { - *x = MultiSigConclusionVerificationParams{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MultiSigConclusionVerificationParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MultiSigConclusionVerificationParams) ProtoMessage() {} - -// Deprecated: Use MultiSigConclusionVerificationParams.ProtoReflect.Descriptor instead. -func (*MultiSigConclusionVerificationParams) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{5} -} - -func (x *MultiSigConclusionVerificationParams) GetSigners() []*anypb.Any { - if x != nil { - return x.Signers - } - return nil -} - -// PriceBound represents the bounds of the price of a currency-pair off chain -// for a designated time-range -type PriceBound struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - High string `protobuf:"bytes,1,opt,name=high,proto3" json:"high,omitempty"` - Low string `protobuf:"bytes,2,opt,name=low,proto3" json:"low,omitempty"` -} - -func (x *PriceBound) Reset() { - *x = PriceBound{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_alerts_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PriceBound) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PriceBound) ProtoMessage() {} - -// Deprecated: Use PriceBound.ProtoReflect.Descriptor instead. -func (*PriceBound) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_alerts_proto_rawDescGZIP(), []int{6} -} - -func (x *PriceBound) GetHigh() string { - if x != nil { - return x.High - } - return "" -} - -func (x *PriceBound) GetLow() string { - if x != nil { - return x.Low - } - return "" -} - -var File_slinky_alerts_v1_alerts_proto protoreflect.FileDescriptor - -var file_slinky_alerts_v1_alerts_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x10, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x1a, 0x1e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x74, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xb7, 0x01, 0x0a, 0x05, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x68, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, - 0x3a, 0x1a, 0x8a, 0xe7, 0xb0, 0x2a, 0x15, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x22, 0xdf, 0x01, 0x0a, - 0x0b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x11, - 0x63, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, - 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x75, 0x62, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x31, 0x0a, 0x14, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x72, - 0x67, 0x65, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x70, 0x75, 0x72, 0x67, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x3a, 0x20, 0x8a, 0xe7, - 0xb0, 0x2a, 0x1b, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x2f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xa9, - 0x01, 0x0a, 0x0f, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x33, 0x0a, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x3b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x3a, 0x24, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x57, 0x69, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x41, 0x0a, 0x09, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, - 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0xb1, 0x03, - 0x0a, 0x12, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x69, 0x67, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x5b, 0x0a, 0x14, 0x65, 0x78, 0x74, - 0x65, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x6d, 0x69, 0x6e, 0x74, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x64, - 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x12, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x41, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0b, 0x70, 0x72, 0x69, - 0x63, 0x65, 0x5f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x63, 0x65, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x29, 0x0a, 0x11, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x5f, 0x69, 0x5f, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x49, - 0x44, 0x3a, 0x3e, 0xca, 0xb4, 0x2d, 0x1b, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, - 0x6f, 0x6e, 0x8a, 0xe7, 0xb0, 0x2a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, - 0x6e, 0x22, 0xba, 0x01, 0x0a, 0x24, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x53, 0x69, 0x67, 0x43, 0x6f, - 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2e, 0x0a, 0x07, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x73, 0x3a, 0x62, 0xca, 0xb4, 0x2d, 0x2d, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x8a, 0xe7, 0xb0, - 0x2a, 0x2c, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, - 0x73, 0x2f, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x32, - 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x68, 0x69, 0x67, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x69, 0x67, 0x68, - 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, - 0x6f, 0x77, 0x42, 0xb1, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x10, 0x53, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, - 0x02, 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x12, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x41, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_alerts_v1_alerts_proto_rawDescOnce sync.Once - file_slinky_alerts_v1_alerts_proto_rawDescData = file_slinky_alerts_v1_alerts_proto_rawDesc -) - -func file_slinky_alerts_v1_alerts_proto_rawDescGZIP() []byte { - file_slinky_alerts_v1_alerts_proto_rawDescOnce.Do(func() { - file_slinky_alerts_v1_alerts_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_alerts_v1_alerts_proto_rawDescData) - }) - return file_slinky_alerts_v1_alerts_proto_rawDescData -} - -var file_slinky_alerts_v1_alerts_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_slinky_alerts_v1_alerts_proto_goTypes = []interface{}{ - (*Alert)(nil), // 0: slinky.alerts.v1.Alert - (*AlertStatus)(nil), // 1: slinky.alerts.v1.AlertStatus - (*AlertWithStatus)(nil), // 2: slinky.alerts.v1.AlertWithStatus - (*Signature)(nil), // 3: slinky.alerts.v1.Signature - (*MultiSigConclusion)(nil), // 4: slinky.alerts.v1.MultiSigConclusion - (*MultiSigConclusionVerificationParams)(nil), // 5: slinky.alerts.v1.MultiSigConclusionVerificationParams - (*PriceBound)(nil), // 6: slinky.alerts.v1.PriceBound - (*v1.CurrencyPair)(nil), // 7: slinky.types.v1.CurrencyPair - (*abci.ExtendedCommitInfo)(nil), // 8: tendermint.abci.ExtendedCommitInfo - (*anypb.Any)(nil), // 9: google.protobuf.Any -} -var file_slinky_alerts_v1_alerts_proto_depIdxs = []int32{ - 7, // 0: slinky.alerts.v1.Alert.currency_pair:type_name -> slinky.types.v1.CurrencyPair - 0, // 1: slinky.alerts.v1.AlertWithStatus.alert:type_name -> slinky.alerts.v1.Alert - 1, // 2: slinky.alerts.v1.AlertWithStatus.status:type_name -> slinky.alerts.v1.AlertStatus - 0, // 3: slinky.alerts.v1.MultiSigConclusion.alert:type_name -> slinky.alerts.v1.Alert - 8, // 4: slinky.alerts.v1.MultiSigConclusion.extended_commit_info:type_name -> tendermint.abci.ExtendedCommitInfo - 3, // 5: slinky.alerts.v1.MultiSigConclusion.signatures:type_name -> slinky.alerts.v1.Signature - 6, // 6: slinky.alerts.v1.MultiSigConclusion.price_bound:type_name -> slinky.alerts.v1.PriceBound - 9, // 7: slinky.alerts.v1.MultiSigConclusionVerificationParams.signers:type_name -> google.protobuf.Any - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name -} - -func init() { file_slinky_alerts_v1_alerts_proto_init() } -func file_slinky_alerts_v1_alerts_proto_init() { - if File_slinky_alerts_v1_alerts_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_alerts_v1_alerts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Alert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_alerts_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlertStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_alerts_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlertWithStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_alerts_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Signature); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_alerts_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MultiSigConclusion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_alerts_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MultiSigConclusionVerificationParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_alerts_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PriceBound); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_alerts_v1_alerts_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_alerts_v1_alerts_proto_goTypes, - DependencyIndexes: file_slinky_alerts_v1_alerts_proto_depIdxs, - MessageInfos: file_slinky_alerts_v1_alerts_proto_msgTypes, - }.Build() - File_slinky_alerts_v1_alerts_proto = out.File - file_slinky_alerts_v1_alerts_proto_rawDesc = nil - file_slinky_alerts_v1_alerts_proto_goTypes = nil - file_slinky_alerts_v1_alerts_proto_depIdxs = nil -} diff --git a/api/slinky/alerts/v1/genesis.pulsar.go b/api/slinky/alerts/v1/genesis.pulsar.go deleted file mode 100644 index 20f748f88..000000000 --- a/api/slinky/alerts/v1/genesis.pulsar.go +++ /dev/null @@ -1,2589 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package alertsv1 - -import ( - _ "cosmossdk.io/api/amino" - v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_AlertParams protoreflect.MessageDescriptor - fd_AlertParams_enabled protoreflect.FieldDescriptor - fd_AlertParams_bond_amount protoreflect.FieldDescriptor - fd_AlertParams_max_block_age protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_genesis_proto_init() - md_AlertParams = File_slinky_alerts_v1_genesis_proto.Messages().ByName("AlertParams") - fd_AlertParams_enabled = md_AlertParams.Fields().ByName("enabled") - fd_AlertParams_bond_amount = md_AlertParams.Fields().ByName("bond_amount") - fd_AlertParams_max_block_age = md_AlertParams.Fields().ByName("max_block_age") -} - -var _ protoreflect.Message = (*fastReflection_AlertParams)(nil) - -type fastReflection_AlertParams AlertParams - -func (x *AlertParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_AlertParams)(x) -} - -func (x *AlertParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_AlertParams_messageType fastReflection_AlertParams_messageType -var _ protoreflect.MessageType = fastReflection_AlertParams_messageType{} - -type fastReflection_AlertParams_messageType struct{} - -func (x fastReflection_AlertParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_AlertParams)(nil) -} -func (x fastReflection_AlertParams_messageType) New() protoreflect.Message { - return new(fastReflection_AlertParams) -} -func (x fastReflection_AlertParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AlertParams -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AlertParams) Descriptor() protoreflect.MessageDescriptor { - return md_AlertParams -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_AlertParams) Type() protoreflect.MessageType { - return _fastReflection_AlertParams_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AlertParams) New() protoreflect.Message { - return new(fastReflection_AlertParams) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AlertParams) Interface() protoreflect.ProtoMessage { - return (*AlertParams)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_AlertParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Enabled != false { - value := protoreflect.ValueOfBool(x.Enabled) - if !f(fd_AlertParams_enabled, value) { - return - } - } - if x.BondAmount != nil { - value := protoreflect.ValueOfMessage(x.BondAmount.ProtoReflect()) - if !f(fd_AlertParams_bond_amount, value) { - return - } - } - if x.MaxBlockAge != uint64(0) { - value := protoreflect.ValueOfUint64(x.MaxBlockAge) - if !f(fd_AlertParams_max_block_age, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_AlertParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.AlertParams.enabled": - return x.Enabled != false - case "slinky.alerts.v1.AlertParams.bond_amount": - return x.BondAmount != nil - case "slinky.alerts.v1.AlertParams.max_block_age": - return x.MaxBlockAge != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertParams does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertParams.enabled": - x.Enabled = false - case "slinky.alerts.v1.AlertParams.bond_amount": - x.BondAmount = nil - case "slinky.alerts.v1.AlertParams.max_block_age": - x.MaxBlockAge = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertParams does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_AlertParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.AlertParams.enabled": - value := x.Enabled - return protoreflect.ValueOfBool(value) - case "slinky.alerts.v1.AlertParams.bond_amount": - value := x.BondAmount - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.AlertParams.max_block_age": - value := x.MaxBlockAge - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertParams does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertParams.enabled": - x.Enabled = value.Bool() - case "slinky.alerts.v1.AlertParams.bond_amount": - x.BondAmount = value.Message().Interface().(*v1beta1.Coin) - case "slinky.alerts.v1.AlertParams.max_block_age": - x.MaxBlockAge = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertParams does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertParams.bond_amount": - if x.BondAmount == nil { - x.BondAmount = new(v1beta1.Coin) - } - return protoreflect.ValueOfMessage(x.BondAmount.ProtoReflect()) - case "slinky.alerts.v1.AlertParams.enabled": - panic(fmt.Errorf("field enabled of message slinky.alerts.v1.AlertParams is not mutable")) - case "slinky.alerts.v1.AlertParams.max_block_age": - panic(fmt.Errorf("field max_block_age of message slinky.alerts.v1.AlertParams is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertParams does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_AlertParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertParams.enabled": - return protoreflect.ValueOfBool(false) - case "slinky.alerts.v1.AlertParams.bond_amount": - m := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.AlertParams.max_block_age": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertParams does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_AlertParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.AlertParams", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_AlertParams) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertParams) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_AlertParams) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_AlertParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AlertParams) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Enabled { - n += 2 - } - if x.BondAmount != nil { - l = options.Size(x.BondAmount) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.MaxBlockAge != 0 { - n += 1 + runtime.Sov(uint64(x.MaxBlockAge)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AlertParams) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.MaxBlockAge != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxBlockAge)) - i-- - dAtA[i] = 0x18 - } - if x.BondAmount != nil { - encoded, err := options.Marshal(x.BondAmount) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if x.Enabled { - i-- - if x.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AlertParams) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Enabled = bool(v != 0) - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BondAmount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.BondAmount == nil { - x.BondAmount = &v1beta1.Coin{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BondAmount); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaxBlockAge", wireType) - } - x.MaxBlockAge = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.MaxBlockAge |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_PruningParams protoreflect.MessageDescriptor - fd_PruningParams_enabled protoreflect.FieldDescriptor - fd_PruningParams_blocks_to_prune protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_genesis_proto_init() - md_PruningParams = File_slinky_alerts_v1_genesis_proto.Messages().ByName("PruningParams") - fd_PruningParams_enabled = md_PruningParams.Fields().ByName("enabled") - fd_PruningParams_blocks_to_prune = md_PruningParams.Fields().ByName("blocks_to_prune") -} - -var _ protoreflect.Message = (*fastReflection_PruningParams)(nil) - -type fastReflection_PruningParams PruningParams - -func (x *PruningParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_PruningParams)(x) -} - -func (x *PruningParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_PruningParams_messageType fastReflection_PruningParams_messageType -var _ protoreflect.MessageType = fastReflection_PruningParams_messageType{} - -type fastReflection_PruningParams_messageType struct{} - -func (x fastReflection_PruningParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_PruningParams)(nil) -} -func (x fastReflection_PruningParams_messageType) New() protoreflect.Message { - return new(fastReflection_PruningParams) -} -func (x fastReflection_PruningParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_PruningParams -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_PruningParams) Descriptor() protoreflect.MessageDescriptor { - return md_PruningParams -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_PruningParams) Type() protoreflect.MessageType { - return _fastReflection_PruningParams_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_PruningParams) New() protoreflect.Message { - return new(fastReflection_PruningParams) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_PruningParams) Interface() protoreflect.ProtoMessage { - return (*PruningParams)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_PruningParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Enabled != false { - value := protoreflect.ValueOfBool(x.Enabled) - if !f(fd_PruningParams_enabled, value) { - return - } - } - if x.BlocksToPrune != uint64(0) { - value := protoreflect.ValueOfUint64(x.BlocksToPrune) - if !f(fd_PruningParams_blocks_to_prune, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_PruningParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.PruningParams.enabled": - return x.Enabled != false - case "slinky.alerts.v1.PruningParams.blocks_to_prune": - return x.BlocksToPrune != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PruningParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PruningParams does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PruningParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.PruningParams.enabled": - x.Enabled = false - case "slinky.alerts.v1.PruningParams.blocks_to_prune": - x.BlocksToPrune = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PruningParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PruningParams does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_PruningParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.PruningParams.enabled": - value := x.Enabled - return protoreflect.ValueOfBool(value) - case "slinky.alerts.v1.PruningParams.blocks_to_prune": - value := x.BlocksToPrune - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PruningParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PruningParams does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PruningParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.PruningParams.enabled": - x.Enabled = value.Bool() - case "slinky.alerts.v1.PruningParams.blocks_to_prune": - x.BlocksToPrune = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PruningParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PruningParams does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PruningParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.PruningParams.enabled": - panic(fmt.Errorf("field enabled of message slinky.alerts.v1.PruningParams is not mutable")) - case "slinky.alerts.v1.PruningParams.blocks_to_prune": - panic(fmt.Errorf("field blocks_to_prune of message slinky.alerts.v1.PruningParams is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PruningParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PruningParams does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_PruningParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.PruningParams.enabled": - return protoreflect.ValueOfBool(false) - case "slinky.alerts.v1.PruningParams.blocks_to_prune": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.PruningParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.PruningParams does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_PruningParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.PruningParams", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_PruningParams) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PruningParams) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_PruningParams) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_PruningParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*PruningParams) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Enabled { - n += 2 - } - if x.BlocksToPrune != 0 { - n += 1 + runtime.Sov(uint64(x.BlocksToPrune)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*PruningParams) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.BlocksToPrune != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.BlocksToPrune)) - i-- - dAtA[i] = 0x10 - } - if x.Enabled { - i-- - if x.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*PruningParams) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PruningParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PruningParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Enabled = bool(v != 0) - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlocksToPrune", wireType) - } - x.BlocksToPrune = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.BlocksToPrune |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_Params protoreflect.MessageDescriptor - fd_Params_alert_params protoreflect.FieldDescriptor - fd_Params_conclusion_verification_params protoreflect.FieldDescriptor - fd_Params_pruning_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_genesis_proto_init() - md_Params = File_slinky_alerts_v1_genesis_proto.Messages().ByName("Params") - fd_Params_alert_params = md_Params.Fields().ByName("alert_params") - fd_Params_conclusion_verification_params = md_Params.Fields().ByName("conclusion_verification_params") - fd_Params_pruning_params = md_Params.Fields().ByName("pruning_params") -} - -var _ protoreflect.Message = (*fastReflection_Params)(nil) - -type fastReflection_Params Params - -func (x *Params) ProtoReflect() protoreflect.Message { - return (*fastReflection_Params)(x) -} - -func (x *Params) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Params_messageType fastReflection_Params_messageType -var _ protoreflect.MessageType = fastReflection_Params_messageType{} - -type fastReflection_Params_messageType struct{} - -func (x fastReflection_Params_messageType) Zero() protoreflect.Message { - return (*fastReflection_Params)(nil) -} -func (x fastReflection_Params_messageType) New() protoreflect.Message { - return new(fastReflection_Params) -} -func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Params) Type() protoreflect.MessageType { - return _fastReflection_Params_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Params) New() protoreflect.Message { - return new(fastReflection_Params) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { - return (*Params)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.AlertParams != nil { - value := protoreflect.ValueOfMessage(x.AlertParams.ProtoReflect()) - if !f(fd_Params_alert_params, value) { - return - } - } - if x.ConclusionVerificationParams != nil { - value := protoreflect.ValueOfMessage(x.ConclusionVerificationParams.ProtoReflect()) - if !f(fd_Params_conclusion_verification_params, value) { - return - } - } - if x.PruningParams != nil { - value := protoreflect.ValueOfMessage(x.PruningParams.ProtoReflect()) - if !f(fd_Params_pruning_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.Params.alert_params": - return x.AlertParams != nil - case "slinky.alerts.v1.Params.conclusion_verification_params": - return x.ConclusionVerificationParams != nil - case "slinky.alerts.v1.Params.pruning_params": - return x.PruningParams != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Params")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.Params.alert_params": - x.AlertParams = nil - case "slinky.alerts.v1.Params.conclusion_verification_params": - x.ConclusionVerificationParams = nil - case "slinky.alerts.v1.Params.pruning_params": - x.PruningParams = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Params")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.Params.alert_params": - value := x.AlertParams - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.Params.conclusion_verification_params": - value := x.ConclusionVerificationParams - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.Params.pruning_params": - value := x.PruningParams - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Params")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Params does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.Params.alert_params": - x.AlertParams = value.Message().Interface().(*AlertParams) - case "slinky.alerts.v1.Params.conclusion_verification_params": - x.ConclusionVerificationParams = value.Message().Interface().(*anypb.Any) - case "slinky.alerts.v1.Params.pruning_params": - x.PruningParams = value.Message().Interface().(*PruningParams) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Params")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.Params.alert_params": - if x.AlertParams == nil { - x.AlertParams = new(AlertParams) - } - return protoreflect.ValueOfMessage(x.AlertParams.ProtoReflect()) - case "slinky.alerts.v1.Params.conclusion_verification_params": - if x.ConclusionVerificationParams == nil { - x.ConclusionVerificationParams = new(anypb.Any) - } - return protoreflect.ValueOfMessage(x.ConclusionVerificationParams.ProtoReflect()) - case "slinky.alerts.v1.Params.pruning_params": - if x.PruningParams == nil { - x.PruningParams = new(PruningParams) - } - return protoreflect.ValueOfMessage(x.PruningParams.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Params")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Params does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.Params.alert_params": - m := new(AlertParams) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.Params.conclusion_verification_params": - m := new(anypb.Any) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.Params.pruning_params": - m := new(PruningParams) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.Params")) - } - panic(fmt.Errorf("message slinky.alerts.v1.Params does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.Params", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Params) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.AlertParams != nil { - l = options.Size(x.AlertParams) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.ConclusionVerificationParams != nil { - l = options.Size(x.ConclusionVerificationParams) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.PruningParams != nil { - l = options.Size(x.PruningParams) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.PruningParams != nil { - encoded, err := options.Marshal(x.PruningParams) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if x.ConclusionVerificationParams != nil { - encoded, err := options.Marshal(x.ConclusionVerificationParams) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if x.AlertParams != nil { - encoded, err := options.Marshal(x.AlertParams) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AlertParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.AlertParams == nil { - x.AlertParams = &AlertParams{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AlertParams); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ConclusionVerificationParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.ConclusionVerificationParams == nil { - x.ConclusionVerificationParams = &anypb.Any{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ConclusionVerificationParams); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PruningParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.PruningParams == nil { - x.PruningParams = &PruningParams{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PruningParams); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_GenesisState_2_list)(nil) - -type _GenesisState_2_list struct { - list *[]*AlertWithStatus -} - -func (x *_GenesisState_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*AlertWithStatus) - (*x.list)[i] = concreteValue -} - -func (x *_GenesisState_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*AlertWithStatus) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { - v := new(AlertWithStatus) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GenesisState_2_list) NewElement() protoreflect.Value { - v := new(AlertWithStatus) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_alerts protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_genesis_proto_init() - md_GenesisState = File_slinky_alerts_v1_genesis_proto.Messages().ByName("GenesisState") - fd_GenesisState_params = md_GenesisState.Fields().ByName("params") - fd_GenesisState_alerts = md_GenesisState.Fields().ByName("alerts") -} - -var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) - -type fastReflection_GenesisState GenesisState - -func (x *GenesisState) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisState)(x) -} - -func (x *GenesisState) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType -var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} - -type fastReflection_GenesisState_messageType struct{} - -func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisState)(nil) -} -func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} -func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { - return _fastReflection_GenesisState_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisState) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { - return (*GenesisState)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_GenesisState_params, value) { - return - } - } - if len(x.Alerts) != 0 { - value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Alerts}) - if !f(fd_GenesisState_alerts, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.GenesisState.params": - return x.Params != nil - case "slinky.alerts.v1.GenesisState.alerts": - return len(x.Alerts) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.alerts.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.GenesisState.params": - x.Params = nil - case "slinky.alerts.v1.GenesisState.alerts": - x.Alerts = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.alerts.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.GenesisState.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.GenesisState.alerts": - if len(x.Alerts) == 0 { - return protoreflect.ValueOfList(&_GenesisState_2_list{}) - } - listValue := &_GenesisState_2_list{list: &x.Alerts} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.alerts.v1.GenesisState does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.GenesisState.params": - x.Params = value.Message().Interface().(*Params) - case "slinky.alerts.v1.GenesisState.alerts": - lv := value.List() - clv := lv.(*_GenesisState_2_list) - x.Alerts = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.alerts.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.GenesisState.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "slinky.alerts.v1.GenesisState.alerts": - if x.Alerts == nil { - x.Alerts = []*AlertWithStatus{} - } - value := &_GenesisState_2_list{list: &x.Alerts} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.alerts.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.GenesisState.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.GenesisState.alerts": - list := []*AlertWithStatus{} - return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.alerts.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.GenesisState", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GenesisState) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.Alerts) > 0 { - for _, e := range x.Alerts { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Alerts) > 0 { - for iNdEx := len(x.Alerts) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Alerts[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Alerts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Alerts = append(x.Alerts, &AlertWithStatus{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Alerts[len(x.Alerts)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/alerts/v1/genesis.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// AlertParams is the set of parameters for the x/Alerts module's Alerting. It -// defines whether or not Alerts can be submitted, and if so, the minimum -// bond amount required to submit an Alert. -type AlertParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Enabled is a boolean defining whether or not Alerts can be submitted - // to the module - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - // BondAmount is the minimum amount of bond required to submit an - // Alert - BondAmount *v1beta1.Coin `protobuf:"bytes,2,opt,name=bond_amount,json=bondAmount,proto3" json:"bond_amount,omitempty"` - // MaxBlockAge defines the maximum age of an Alert before it is pruned, notice - // this is defined wrt. the height that the Alert references, i.e Alerts are - // only relevant until Alert.Height + MaxBlockAge is reached. - MaxBlockAge uint64 `protobuf:"varint,3,opt,name=max_block_age,json=maxBlockAge,proto3" json:"max_block_age,omitempty"` -} - -func (x *AlertParams) Reset() { - *x = AlertParams{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlertParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlertParams) ProtoMessage() {} - -// Deprecated: Use AlertParams.ProtoReflect.Descriptor instead. -func (*AlertParams) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_genesis_proto_rawDescGZIP(), []int{0} -} - -func (x *AlertParams) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -func (x *AlertParams) GetBondAmount() *v1beta1.Coin { - if x != nil { - return x.BondAmount - } - return nil -} - -func (x *AlertParams) GetMaxBlockAge() uint64 { - if x != nil { - return x.MaxBlockAge - } - return 0 -} - -// PruningParams defines the criterion for pruning Alerts from the state. -type PruningParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Enabled defines whether Alerts are to be pruned - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - // BlocksToPrune defines the number of blocks until an Alert will be pruned - // from state, notice this is defined wrt. the current block height, i.e - // Alerts will be stored in state until current_height + BlocksToPrune is - // reached. - BlocksToPrune uint64 `protobuf:"varint,2,opt,name=blocks_to_prune,json=blocksToPrune,proto3" json:"blocks_to_prune,omitempty"` -} - -func (x *PruningParams) Reset() { - *x = PruningParams{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PruningParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PruningParams) ProtoMessage() {} - -// Deprecated: Use PruningParams.ProtoReflect.Descriptor instead. -func (*PruningParams) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_genesis_proto_rawDescGZIP(), []int{1} -} - -func (x *PruningParams) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -func (x *PruningParams) GetBlocksToPrune() uint64 { - if x != nil { - return x.BlocksToPrune - } - return 0 -} - -// Params is the set of parameters for the x/Alerts module. -type Params struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // AlertParams is the set of parameters for the x/Alerts module's Alerting. - AlertParams *AlertParams `protobuf:"bytes,1,opt,name=alert_params,json=alertParams,proto3" json:"alert_params,omitempty"` - // ConclusionVerificationParams is the set of parameters for the x/Alerts - // module's conclusion verification. - ConclusionVerificationParams *anypb.Any `protobuf:"bytes,2,opt,name=conclusion_verification_params,json=conclusionVerificationParams,proto3" json:"conclusion_verification_params,omitempty"` - // PruningParams is the set of parameters for the x/Alerts module's pruning. - PruningParams *PruningParams `protobuf:"bytes,3,opt,name=pruning_params,json=pruningParams,proto3" json:"pruning_params,omitempty"` -} - -func (x *Params) Reset() { - *x = Params{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Params) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Params) ProtoMessage() {} - -// Deprecated: Use Params.ProtoReflect.Descriptor instead. -func (*Params) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_genesis_proto_rawDescGZIP(), []int{2} -} - -func (x *Params) GetAlertParams() *AlertParams { - if x != nil { - return x.AlertParams - } - return nil -} - -func (x *Params) GetConclusionVerificationParams() *anypb.Any { - if x != nil { - return x.ConclusionVerificationParams - } - return nil -} - -func (x *Params) GetPruningParams() *PruningParams { - if x != nil { - return x.PruningParams - } - return nil -} - -// GenesisState is the state that must be provided at genesis. It contains -// params for the module, and the set initial Alerts. -type GenesisState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Params is the set of x/Alerts parameters - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - // Alerts is the set of Alerts that have been submitted to the module - Alerts []*AlertWithStatus `protobuf:"bytes,2,rep,name=alerts,proto3" json:"alerts,omitempty"` -} - -func (x *GenesisState) Reset() { - *x = GenesisState{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_genesis_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisState) ProtoMessage() {} - -// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. -func (*GenesisState) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_genesis_proto_rawDescGZIP(), []int{3} -} - -func (x *GenesisState) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -func (x *GenesisState) GetAlerts() []*AlertWithStatus { - if x != nil { - return x.Alerts - } - return nil -} - -var File_slinky_alerts_v1_genesis_proto protoreflect.FileDescriptor - -var file_slinky_alerts_v1_genesis_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x10, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, - 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x92, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x45, 0x0a, 0x0b, 0x62, 0x6f, - 0x6e, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, - 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0a, 0x62, 0x6f, 0x6e, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x61, - 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x41, 0x67, 0x65, 0x22, 0x51, 0x0a, 0x0d, 0x50, 0x72, 0x75, 0x6e, 0x69, 0x6e, 0x67, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x12, 0x26, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x70, 0x72, - 0x75, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x73, 0x54, 0x6f, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x22, 0xae, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x46, 0x0a, 0x0c, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x8d, 0x01, 0x0a, 0x1e, - 0x63, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x31, 0xca, 0xb4, 0x2d, 0x2d, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x1c, 0x63, - 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x4c, 0x0a, 0x0e, 0x70, - 0x72, 0x75, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x75, 0x6e, 0x69, 0x6e, 0x67, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x70, 0x72, 0x75, 0x6e, - 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x0c, 0x47, 0x65, - 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x3f, 0x0a, 0x06, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x42, 0xb2, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, - 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, - 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_alerts_v1_genesis_proto_rawDescOnce sync.Once - file_slinky_alerts_v1_genesis_proto_rawDescData = file_slinky_alerts_v1_genesis_proto_rawDesc -) - -func file_slinky_alerts_v1_genesis_proto_rawDescGZIP() []byte { - file_slinky_alerts_v1_genesis_proto_rawDescOnce.Do(func() { - file_slinky_alerts_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_alerts_v1_genesis_proto_rawDescData) - }) - return file_slinky_alerts_v1_genesis_proto_rawDescData -} - -var file_slinky_alerts_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_slinky_alerts_v1_genesis_proto_goTypes = []interface{}{ - (*AlertParams)(nil), // 0: slinky.alerts.v1.AlertParams - (*PruningParams)(nil), // 1: slinky.alerts.v1.PruningParams - (*Params)(nil), // 2: slinky.alerts.v1.Params - (*GenesisState)(nil), // 3: slinky.alerts.v1.GenesisState - (*v1beta1.Coin)(nil), // 4: cosmos.base.v1beta1.Coin - (*anypb.Any)(nil), // 5: google.protobuf.Any - (*AlertWithStatus)(nil), // 6: slinky.alerts.v1.AlertWithStatus -} -var file_slinky_alerts_v1_genesis_proto_depIdxs = []int32{ - 4, // 0: slinky.alerts.v1.AlertParams.bond_amount:type_name -> cosmos.base.v1beta1.Coin - 0, // 1: slinky.alerts.v1.Params.alert_params:type_name -> slinky.alerts.v1.AlertParams - 5, // 2: slinky.alerts.v1.Params.conclusion_verification_params:type_name -> google.protobuf.Any - 1, // 3: slinky.alerts.v1.Params.pruning_params:type_name -> slinky.alerts.v1.PruningParams - 2, // 4: slinky.alerts.v1.GenesisState.params:type_name -> slinky.alerts.v1.Params - 6, // 5: slinky.alerts.v1.GenesisState.alerts:type_name -> slinky.alerts.v1.AlertWithStatus - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_slinky_alerts_v1_genesis_proto_init() } -func file_slinky_alerts_v1_genesis_proto_init() { - if File_slinky_alerts_v1_genesis_proto != nil { - return - } - file_slinky_alerts_v1_alerts_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_alerts_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlertParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PruningParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_genesis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Params); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_genesis_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_alerts_v1_genesis_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_alerts_v1_genesis_proto_goTypes, - DependencyIndexes: file_slinky_alerts_v1_genesis_proto_depIdxs, - MessageInfos: file_slinky_alerts_v1_genesis_proto_msgTypes, - }.Build() - File_slinky_alerts_v1_genesis_proto = out.File - file_slinky_alerts_v1_genesis_proto_rawDesc = nil - file_slinky_alerts_v1_genesis_proto_goTypes = nil - file_slinky_alerts_v1_genesis_proto_depIdxs = nil -} diff --git a/api/slinky/alerts/v1/query.pulsar.go b/api/slinky/alerts/v1/query.pulsar.go deleted file mode 100644 index 0cd05e01e..000000000 --- a/api/slinky/alerts/v1/query.pulsar.go +++ /dev/null @@ -1,2087 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package alertsv1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_AlertsRequest protoreflect.MessageDescriptor - fd_AlertsRequest_status protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_query_proto_init() - md_AlertsRequest = File_slinky_alerts_v1_query_proto.Messages().ByName("AlertsRequest") - fd_AlertsRequest_status = md_AlertsRequest.Fields().ByName("status") -} - -var _ protoreflect.Message = (*fastReflection_AlertsRequest)(nil) - -type fastReflection_AlertsRequest AlertsRequest - -func (x *AlertsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_AlertsRequest)(x) -} - -func (x *AlertsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_AlertsRequest_messageType fastReflection_AlertsRequest_messageType -var _ protoreflect.MessageType = fastReflection_AlertsRequest_messageType{} - -type fastReflection_AlertsRequest_messageType struct{} - -func (x fastReflection_AlertsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_AlertsRequest)(nil) -} -func (x fastReflection_AlertsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_AlertsRequest) -} -func (x fastReflection_AlertsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AlertsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AlertsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_AlertsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_AlertsRequest) Type() protoreflect.MessageType { - return _fastReflection_AlertsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AlertsRequest) New() protoreflect.Message { - return new(fastReflection_AlertsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AlertsRequest) Interface() protoreflect.ProtoMessage { - return (*AlertsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_AlertsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Status != 0 { - value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.Status)) - if !f(fd_AlertsRequest_status, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_AlertsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsRequest.status": - return x.Status != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsRequest.status": - x.Status = 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_AlertsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.AlertsRequest.status": - value := x.Status - return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsRequest.status": - x.Status = (AlertStatusID)(value.Enum()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsRequest.status": - panic(fmt.Errorf("field status of message slinky.alerts.v1.AlertsRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_AlertsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsRequest.status": - return protoreflect.ValueOfEnum(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_AlertsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.AlertsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_AlertsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_AlertsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_AlertsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AlertsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Status != 0 { - n += 1 + runtime.Sov(uint64(x.Status)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AlertsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Status != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Status)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AlertsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - x.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Status |= AlertStatusID(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_AlertsResponse_1_list)(nil) - -type _AlertsResponse_1_list struct { - list *[]*Alert -} - -func (x *_AlertsResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_AlertsResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_AlertsResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Alert) - (*x.list)[i] = concreteValue -} - -func (x *_AlertsResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Alert) - *x.list = append(*x.list, concreteValue) -} - -func (x *_AlertsResponse_1_list) AppendMutable() protoreflect.Value { - v := new(Alert) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_AlertsResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_AlertsResponse_1_list) NewElement() protoreflect.Value { - v := new(Alert) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_AlertsResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_AlertsResponse protoreflect.MessageDescriptor - fd_AlertsResponse_alerts protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_query_proto_init() - md_AlertsResponse = File_slinky_alerts_v1_query_proto.Messages().ByName("AlertsResponse") - fd_AlertsResponse_alerts = md_AlertsResponse.Fields().ByName("alerts") -} - -var _ protoreflect.Message = (*fastReflection_AlertsResponse)(nil) - -type fastReflection_AlertsResponse AlertsResponse - -func (x *AlertsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_AlertsResponse)(x) -} - -func (x *AlertsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_AlertsResponse_messageType fastReflection_AlertsResponse_messageType -var _ protoreflect.MessageType = fastReflection_AlertsResponse_messageType{} - -type fastReflection_AlertsResponse_messageType struct{} - -func (x fastReflection_AlertsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_AlertsResponse)(nil) -} -func (x fastReflection_AlertsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_AlertsResponse) -} -func (x fastReflection_AlertsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AlertsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AlertsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_AlertsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_AlertsResponse) Type() protoreflect.MessageType { - return _fastReflection_AlertsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AlertsResponse) New() protoreflect.Message { - return new(fastReflection_AlertsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AlertsResponse) Interface() protoreflect.ProtoMessage { - return (*AlertsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_AlertsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Alerts) != 0 { - value := protoreflect.ValueOfList(&_AlertsResponse_1_list{list: &x.Alerts}) - if !f(fd_AlertsResponse_alerts, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_AlertsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsResponse.alerts": - return len(x.Alerts) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsResponse.alerts": - x.Alerts = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_AlertsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.AlertsResponse.alerts": - if len(x.Alerts) == 0 { - return protoreflect.ValueOfList(&_AlertsResponse_1_list{}) - } - listValue := &_AlertsResponse_1_list{list: &x.Alerts} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsResponse.alerts": - lv := value.List() - clv := lv.(*_AlertsResponse_1_list) - x.Alerts = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsResponse.alerts": - if x.Alerts == nil { - x.Alerts = []*Alert{} - } - value := &_AlertsResponse_1_list{list: &x.Alerts} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_AlertsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.AlertsResponse.alerts": - list := []*Alert{} - return protoreflect.ValueOfList(&_AlertsResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.AlertsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.AlertsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_AlertsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.AlertsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_AlertsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AlertsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_AlertsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_AlertsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AlertsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Alerts) > 0 { - for _, e := range x.Alerts { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AlertsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Alerts) > 0 { - for iNdEx := len(x.Alerts) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Alerts[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AlertsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AlertsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Alerts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Alerts = append(x.Alerts, &Alert{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Alerts[len(x.Alerts)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_ParamsRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_alerts_v1_query_proto_init() - md_ParamsRequest = File_slinky_alerts_v1_query_proto.Messages().ByName("ParamsRequest") -} - -var _ protoreflect.Message = (*fastReflection_ParamsRequest)(nil) - -type fastReflection_ParamsRequest ParamsRequest - -func (x *ParamsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsRequest)(x) -} - -func (x *ParamsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ParamsRequest_messageType fastReflection_ParamsRequest_messageType -var _ protoreflect.MessageType = fastReflection_ParamsRequest_messageType{} - -type fastReflection_ParamsRequest_messageType struct{} - -func (x fastReflection_ParamsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsRequest)(nil) -} -func (x fastReflection_ParamsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} -func (x fastReflection_ParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ParamsRequest) Type() protoreflect.MessageType { - return _fastReflection_ParamsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsRequest) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsRequest) Interface() protoreflect.ProtoMessage { - return (*ParamsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.ParamsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ParamsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ParamsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ParamsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_ParamsResponse protoreflect.MessageDescriptor - fd_ParamsResponse_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_query_proto_init() - md_ParamsResponse = File_slinky_alerts_v1_query_proto.Messages().ByName("ParamsResponse") - fd_ParamsResponse_params = md_ParamsResponse.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_ParamsResponse)(nil) - -type fastReflection_ParamsResponse ParamsResponse - -func (x *ParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsResponse)(x) -} - -func (x *ParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ParamsResponse_messageType fastReflection_ParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_ParamsResponse_messageType{} - -type fastReflection_ParamsResponse_messageType struct{} - -func (x fastReflection_ParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsResponse)(nil) -} -func (x fastReflection_ParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} -func (x fastReflection_ParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_ParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsResponse) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsResponse) Interface() protoreflect.ProtoMessage { - return (*ParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_ParamsResponse_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.ParamsResponse.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.ParamsResponse.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.ParamsResponse.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.ParamsResponse.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.ParamsResponse.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.ParamsResponse.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.ParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/alerts/v1/query.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// AlertStatus is the type for the status of an Alert, it can be Unconcluded or -// Concluded. -type AlertStatusID int32 - -const ( - AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED AlertStatusID = 0 - AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED AlertStatusID = 1 - AlertStatusID_CONCLUSION_STATUS_CONCLUDED AlertStatusID = 2 -) - -// Enum value maps for AlertStatusID. -var ( - AlertStatusID_name = map[int32]string{ - 0: "CONCLUSION_STATUS_UNSPECIFIED", - 1: "CONCLUSION_STATUS_UNCONCLUDED", - 2: "CONCLUSION_STATUS_CONCLUDED", - } - AlertStatusID_value = map[string]int32{ - "CONCLUSION_STATUS_UNSPECIFIED": 0, - "CONCLUSION_STATUS_UNCONCLUDED": 1, - "CONCLUSION_STATUS_CONCLUDED": 2, - } -) - -func (x AlertStatusID) Enum() *AlertStatusID { - p := new(AlertStatusID) - *p = x - return p -} - -func (x AlertStatusID) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AlertStatusID) Descriptor() protoreflect.EnumDescriptor { - return file_slinky_alerts_v1_query_proto_enumTypes[0].Descriptor() -} - -func (AlertStatusID) Type() protoreflect.EnumType { - return &file_slinky_alerts_v1_query_proto_enumTypes[0] -} - -func (x AlertStatusID) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AlertStatusID.Descriptor instead. -func (AlertStatusID) EnumDescriptor() ([]byte, []int) { - return file_slinky_alerts_v1_query_proto_rawDescGZIP(), []int{0} -} - -// AlertsRequest is the request type for the Query.Alerts RPC method, the status -// field indicates whether the request should return only Unconcluded / -// Concluded Alerts, or all Alerts. -type AlertsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status AlertStatusID `protobuf:"varint,1,opt,name=status,proto3,enum=slinky.alerts.v1.AlertStatusID" json:"status,omitempty"` -} - -func (x *AlertsRequest) Reset() { - *x = AlertsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlertsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlertsRequest) ProtoMessage() {} - -// Deprecated: Use AlertsRequest.ProtoReflect.Descriptor instead. -func (*AlertsRequest) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_query_proto_rawDescGZIP(), []int{0} -} - -func (x *AlertsRequest) GetStatus() AlertStatusID { - if x != nil { - return x.Status - } - return AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED -} - -// AlertsResponse is the response type for the Query.Alerts RPC method, it -// contains the list of Alerts that are being tracked by the alerts module. -type AlertsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Alerts []*Alert `protobuf:"bytes,1,rep,name=alerts,proto3" json:"alerts,omitempty"` -} - -func (x *AlertsResponse) Reset() { - *x = AlertsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AlertsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlertsResponse) ProtoMessage() {} - -// Deprecated: Use AlertsResponse.ProtoReflect.Descriptor instead. -func (*AlertsResponse) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_query_proto_rawDescGZIP(), []int{1} -} - -func (x *AlertsResponse) GetAlerts() []*Alert { - if x != nil { - return x.Alerts - } - return nil -} - -// ParamsRequest is the request type for the Query.Params RPC method. -type ParamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ParamsRequest) Reset() { - *x = ParamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsRequest) ProtoMessage() {} - -// Deprecated: Use ParamsRequest.ProtoReflect.Descriptor instead. -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_query_proto_rawDescGZIP(), []int{2} -} - -// ParamsResponse is the response type for the Query.Params RPC method, it -// contains the Params of the module. -type ParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *ParamsResponse) Reset() { - *x = ParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsResponse) ProtoMessage() {} - -// Deprecated: Use ParamsResponse.ProtoReflect.Descriptor instead. -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_query_proto_rawDescGZIP(), []int{3} -} - -func (x *ParamsResponse) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -var File_slinky_alerts_v1_query_proto protoreflect.FileDescriptor - -var file_slinky_alerts_v1_query_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, - 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, - 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, - 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x48, 0x0a, 0x0d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x49, 0x44, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x47, 0x0a, - 0x0e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x35, 0x0a, 0x06, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x2a, 0x76, 0x0a, 0x0d, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x49, 0x44, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x4f, 0x4e, 0x43, 0x4c, 0x55, 0x53, 0x49, 0x4f, 0x4e, - 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x4f, 0x4e, 0x43, 0x4c, 0x55, 0x53, - 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x43, 0x4f, 0x4e, - 0x43, 0x4c, 0x55, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x43, 0x4f, 0x4e, 0x43, - 0x4c, 0x55, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x43, 0x4f, - 0x4e, 0x43, 0x4c, 0x55, 0x44, 0x45, 0x44, 0x10, 0x02, 0x32, 0xe5, 0x01, 0x0a, 0x05, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x6d, 0x0a, 0x06, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x12, 0x1f, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x12, 0x6d, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x42, 0xb0, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x10, 0x53, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x1c, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x12, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_alerts_v1_query_proto_rawDescOnce sync.Once - file_slinky_alerts_v1_query_proto_rawDescData = file_slinky_alerts_v1_query_proto_rawDesc -) - -func file_slinky_alerts_v1_query_proto_rawDescGZIP() []byte { - file_slinky_alerts_v1_query_proto_rawDescOnce.Do(func() { - file_slinky_alerts_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_alerts_v1_query_proto_rawDescData) - }) - return file_slinky_alerts_v1_query_proto_rawDescData -} - -var file_slinky_alerts_v1_query_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_slinky_alerts_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_slinky_alerts_v1_query_proto_goTypes = []interface{}{ - (AlertStatusID)(0), // 0: slinky.alerts.v1.AlertStatusID - (*AlertsRequest)(nil), // 1: slinky.alerts.v1.AlertsRequest - (*AlertsResponse)(nil), // 2: slinky.alerts.v1.AlertsResponse - (*ParamsRequest)(nil), // 3: slinky.alerts.v1.ParamsRequest - (*ParamsResponse)(nil), // 4: slinky.alerts.v1.ParamsResponse - (*Alert)(nil), // 5: slinky.alerts.v1.Alert - (*Params)(nil), // 6: slinky.alerts.v1.Params -} -var file_slinky_alerts_v1_query_proto_depIdxs = []int32{ - 0, // 0: slinky.alerts.v1.AlertsRequest.status:type_name -> slinky.alerts.v1.AlertStatusID - 5, // 1: slinky.alerts.v1.AlertsResponse.alerts:type_name -> slinky.alerts.v1.Alert - 6, // 2: slinky.alerts.v1.ParamsResponse.params:type_name -> slinky.alerts.v1.Params - 1, // 3: slinky.alerts.v1.Query.Alerts:input_type -> slinky.alerts.v1.AlertsRequest - 3, // 4: slinky.alerts.v1.Query.Params:input_type -> slinky.alerts.v1.ParamsRequest - 2, // 5: slinky.alerts.v1.Query.Alerts:output_type -> slinky.alerts.v1.AlertsResponse - 4, // 6: slinky.alerts.v1.Query.Params:output_type -> slinky.alerts.v1.ParamsResponse - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_slinky_alerts_v1_query_proto_init() } -func file_slinky_alerts_v1_query_proto_init() { - if File_slinky_alerts_v1_query_proto != nil { - return - } - file_slinky_alerts_v1_alerts_proto_init() - file_slinky_alerts_v1_genesis_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_alerts_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlertsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlertsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_alerts_v1_query_proto_rawDesc, - NumEnums: 1, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_alerts_v1_query_proto_goTypes, - DependencyIndexes: file_slinky_alerts_v1_query_proto_depIdxs, - EnumInfos: file_slinky_alerts_v1_query_proto_enumTypes, - MessageInfos: file_slinky_alerts_v1_query_proto_msgTypes, - }.Build() - File_slinky_alerts_v1_query_proto = out.File - file_slinky_alerts_v1_query_proto_rawDesc = nil - file_slinky_alerts_v1_query_proto_goTypes = nil - file_slinky_alerts_v1_query_proto_depIdxs = nil -} diff --git a/api/slinky/alerts/v1/query_grpc.pb.go b/api/slinky/alerts/v1/query_grpc.pb.go deleted file mode 100644 index 5840f808b..000000000 --- a/api/slinky/alerts/v1/query_grpc.pb.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc (unknown) -// source: slinky/alerts/v1/query.proto - -package alertsv1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Query_Alerts_FullMethodName = "/slinky.alerts.v1.Query/Alerts" - Query_Params_FullMethodName = "/slinky.alerts.v1.Query/Params" -) - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Query is the query service for the x/alerts module. -type QueryClient interface { - // Alerts gets all alerts in state under the given status. If no status is - // given, all Alerts are returned - Alerts(ctx context.Context, in *AlertsRequest, opts ...grpc.CallOption) (*AlertsResponse, error) - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryClient struct { - cc grpc.ClientConnInterface -} - -func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Alerts(ctx context.Context, in *AlertsRequest, opts ...grpc.CallOption) (*AlertsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AlertsResponse) - err := c.cc.Invoke(ctx, Query_Alerts_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -// All implementations must embed UnimplementedQueryServer -// for forward compatibility. -// -// Query is the query service for the x/alerts module. -type QueryServer interface { - // Alerts gets all alerts in state under the given status. If no status is - // given, all Alerts are returned - Alerts(context.Context, *AlertsRequest) (*AlertsResponse, error) - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) - mustEmbedUnimplementedQueryServer() -} - -// UnimplementedQueryServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedQueryServer struct{} - -func (UnimplementedQueryServer) Alerts(context.Context, *AlertsRequest) (*AlertsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Alerts not implemented") -} -func (UnimplementedQueryServer) Params(context.Context, *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} -func (UnimplementedQueryServer) testEmbeddedByValue() {} - -// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to QueryServer will -// result in compilation errors. -type UnsafeQueryServer interface { - mustEmbedUnimplementedQueryServer() -} - -func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { - // If the following call pancis, it indicates UnimplementedQueryServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Query_ServiceDesc, srv) -} - -func _Query_Alerts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AlertsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Alerts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_Alerts_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Alerts(ctx, req.(*AlertsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_Params_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Query_ServiceDesc is the grpc.ServiceDesc for Query service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Query_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.alerts.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Alerts", - Handler: _Query_Alerts_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/alerts/v1/query.proto", -} diff --git a/api/slinky/alerts/v1/strategies.pulsar.go b/api/slinky/alerts/v1/strategies.pulsar.go deleted file mode 100644 index 0797e512b..000000000 --- a/api/slinky/alerts/v1/strategies.pulsar.go +++ /dev/null @@ -1,744 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package alertsv1 - -import ( - _ "cosmossdk.io/api/amino" - abci "cosmossdk.io/api/tendermint/abci" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_ValidatorAlertIncentive protoreflect.MessageDescriptor - fd_ValidatorAlertIncentive_validator protoreflect.FieldDescriptor - fd_ValidatorAlertIncentive_alert_signer protoreflect.FieldDescriptor - fd_ValidatorAlertIncentive_alert_height protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_strategies_proto_init() - md_ValidatorAlertIncentive = File_slinky_alerts_v1_strategies_proto.Messages().ByName("ValidatorAlertIncentive") - fd_ValidatorAlertIncentive_validator = md_ValidatorAlertIncentive.Fields().ByName("validator") - fd_ValidatorAlertIncentive_alert_signer = md_ValidatorAlertIncentive.Fields().ByName("alert_signer") - fd_ValidatorAlertIncentive_alert_height = md_ValidatorAlertIncentive.Fields().ByName("alert_height") -} - -var _ protoreflect.Message = (*fastReflection_ValidatorAlertIncentive)(nil) - -type fastReflection_ValidatorAlertIncentive ValidatorAlertIncentive - -func (x *ValidatorAlertIncentive) ProtoReflect() protoreflect.Message { - return (*fastReflection_ValidatorAlertIncentive)(x) -} - -func (x *ValidatorAlertIncentive) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_strategies_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ValidatorAlertIncentive_messageType fastReflection_ValidatorAlertIncentive_messageType -var _ protoreflect.MessageType = fastReflection_ValidatorAlertIncentive_messageType{} - -type fastReflection_ValidatorAlertIncentive_messageType struct{} - -func (x fastReflection_ValidatorAlertIncentive_messageType) Zero() protoreflect.Message { - return (*fastReflection_ValidatorAlertIncentive)(nil) -} -func (x fastReflection_ValidatorAlertIncentive_messageType) New() protoreflect.Message { - return new(fastReflection_ValidatorAlertIncentive) -} -func (x fastReflection_ValidatorAlertIncentive_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ValidatorAlertIncentive -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ValidatorAlertIncentive) Descriptor() protoreflect.MessageDescriptor { - return md_ValidatorAlertIncentive -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ValidatorAlertIncentive) Type() protoreflect.MessageType { - return _fastReflection_ValidatorAlertIncentive_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ValidatorAlertIncentive) New() protoreflect.Message { - return new(fastReflection_ValidatorAlertIncentive) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ValidatorAlertIncentive) Interface() protoreflect.ProtoMessage { - return (*ValidatorAlertIncentive)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ValidatorAlertIncentive) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Validator != nil { - value := protoreflect.ValueOfMessage(x.Validator.ProtoReflect()) - if !f(fd_ValidatorAlertIncentive_validator, value) { - return - } - } - if x.AlertSigner != "" { - value := protoreflect.ValueOfString(x.AlertSigner) - if !f(fd_ValidatorAlertIncentive_alert_signer, value) { - return - } - } - if x.AlertHeight != uint64(0) { - value := protoreflect.ValueOfUint64(x.AlertHeight) - if !f(fd_ValidatorAlertIncentive_alert_height, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ValidatorAlertIncentive) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.ValidatorAlertIncentive.validator": - return x.Validator != nil - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_signer": - return x.AlertSigner != "" - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_height": - return x.AlertHeight != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ValidatorAlertIncentive")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ValidatorAlertIncentive does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ValidatorAlertIncentive) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.ValidatorAlertIncentive.validator": - x.Validator = nil - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_signer": - x.AlertSigner = "" - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_height": - x.AlertHeight = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ValidatorAlertIncentive")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ValidatorAlertIncentive does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ValidatorAlertIncentive) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.ValidatorAlertIncentive.validator": - value := x.Validator - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_signer": - value := x.AlertSigner - return protoreflect.ValueOfString(value) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_height": - value := x.AlertHeight - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ValidatorAlertIncentive")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ValidatorAlertIncentive does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ValidatorAlertIncentive) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.ValidatorAlertIncentive.validator": - x.Validator = value.Message().Interface().(*abci.Validator) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_signer": - x.AlertSigner = value.Interface().(string) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_height": - x.AlertHeight = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ValidatorAlertIncentive")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ValidatorAlertIncentive does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ValidatorAlertIncentive) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.ValidatorAlertIncentive.validator": - if x.Validator == nil { - x.Validator = new(abci.Validator) - } - return protoreflect.ValueOfMessage(x.Validator.ProtoReflect()) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_signer": - panic(fmt.Errorf("field alert_signer of message slinky.alerts.v1.ValidatorAlertIncentive is not mutable")) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_height": - panic(fmt.Errorf("field alert_height of message slinky.alerts.v1.ValidatorAlertIncentive is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ValidatorAlertIncentive")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ValidatorAlertIncentive does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ValidatorAlertIncentive) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.ValidatorAlertIncentive.validator": - m := new(abci.Validator) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_signer": - return protoreflect.ValueOfString("") - case "slinky.alerts.v1.ValidatorAlertIncentive.alert_height": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.ValidatorAlertIncentive")) - } - panic(fmt.Errorf("message slinky.alerts.v1.ValidatorAlertIncentive does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ValidatorAlertIncentive) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.ValidatorAlertIncentive", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ValidatorAlertIncentive) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ValidatorAlertIncentive) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ValidatorAlertIncentive) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ValidatorAlertIncentive) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ValidatorAlertIncentive) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Validator != nil { - l = options.Size(x.Validator) - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.AlertSigner) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.AlertHeight != 0 { - n += 1 + runtime.Sov(uint64(x.AlertHeight)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ValidatorAlertIncentive) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.AlertHeight != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.AlertHeight)) - i-- - dAtA[i] = 0x18 - } - if len(x.AlertSigner) > 0 { - i -= len(x.AlertSigner) - copy(dAtA[i:], x.AlertSigner) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AlertSigner))) - i-- - dAtA[i] = 0x12 - } - if x.Validator != nil { - encoded, err := options.Marshal(x.Validator) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ValidatorAlertIncentive) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ValidatorAlertIncentive: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ValidatorAlertIncentive: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Validator == nil { - x.Validator = &abci.Validator{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Validator); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AlertSigner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.AlertSigner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AlertHeight", wireType) - } - x.AlertHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.AlertHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/alerts/v1/strategies.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// ValidatorAlertIncentive defines the incentive strategy to be executed for a -// validator that has been confirmed to have at fault for an x/alerts alert. -// This strategy is expected to slash half of the validator's stake. -type ValidatorAlertIncentive struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The validator that has been confirmed to have been at fault for an alert. - Validator *abci.Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` - // AlertSigner is the signer of the alert referenced by the conclusion that - // created this incentive. - AlertSigner string `protobuf:"bytes,2,opt,name=alert_signer,json=alertSigner,proto3" json:"alert_signer,omitempty"` - // AlertHeight is the height at which the infraction occurred - AlertHeight uint64 `protobuf:"varint,3,opt,name=alert_height,json=alertHeight,proto3" json:"alert_height,omitempty"` -} - -func (x *ValidatorAlertIncentive) Reset() { - *x = ValidatorAlertIncentive{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_strategies_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ValidatorAlertIncentive) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValidatorAlertIncentive) ProtoMessage() {} - -// Deprecated: Use ValidatorAlertIncentive.ProtoReflect.Descriptor instead. -func (*ValidatorAlertIncentive) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_strategies_proto_rawDescGZIP(), []int{0} -} - -func (x *ValidatorAlertIncentive) GetValidator() *abci.Validator { - if x != nil { - return x.Validator - } - return nil -} - -func (x *ValidatorAlertIncentive) GetAlertSigner() string { - if x != nil { - return x.AlertSigner - } - return "" -} - -func (x *ValidatorAlertIncentive) GetAlertHeight() uint64 { - if x != nil { - return x.AlertHeight - } - return 0 -} - -var File_slinky_alerts_v1_strategies_proto protoreflect.FileDescriptor - -var file_slinky_alerts_v1_strategies_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x73, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, - 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x74, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x61, 0x62, 0x63, 0x69, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x02, 0x0a, 0x17, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x6f, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, - 0x6e, 0x74, 0x2e, 0x61, 0x62, 0x63, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, - 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x0c, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x73, 0x69, 0x67, 0x6e, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x52, 0x0b, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, - 0x21, 0x0a, 0x0c, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x48, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x3a, 0x4e, 0xca, 0xb4, 0x2d, 0x1e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, - 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x8a, 0xe7, 0xb0, 0x2a, 0x27, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x6f, 0x72, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x42, 0xb5, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0f, 0x53, 0x74, 0x72, - 0x61, 0x74, 0x65, 0x67, 0x69, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, - 0x31, 0x3b, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, - 0xaa, 0x02, 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, - 0x2e, 0x56, 0x31, 0xca, 0x02, 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, - 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_slinky_alerts_v1_strategies_proto_rawDescOnce sync.Once - file_slinky_alerts_v1_strategies_proto_rawDescData = file_slinky_alerts_v1_strategies_proto_rawDesc -) - -func file_slinky_alerts_v1_strategies_proto_rawDescGZIP() []byte { - file_slinky_alerts_v1_strategies_proto_rawDescOnce.Do(func() { - file_slinky_alerts_v1_strategies_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_alerts_v1_strategies_proto_rawDescData) - }) - return file_slinky_alerts_v1_strategies_proto_rawDescData -} - -var file_slinky_alerts_v1_strategies_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_alerts_v1_strategies_proto_goTypes = []interface{}{ - (*ValidatorAlertIncentive)(nil), // 0: slinky.alerts.v1.ValidatorAlertIncentive - (*abci.Validator)(nil), // 1: tendermint.abci.Validator -} -var file_slinky_alerts_v1_strategies_proto_depIdxs = []int32{ - 1, // 0: slinky.alerts.v1.ValidatorAlertIncentive.validator:type_name -> tendermint.abci.Validator - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_slinky_alerts_v1_strategies_proto_init() } -func file_slinky_alerts_v1_strategies_proto_init() { - if File_slinky_alerts_v1_strategies_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_alerts_v1_strategies_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ValidatorAlertIncentive); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_alerts_v1_strategies_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_alerts_v1_strategies_proto_goTypes, - DependencyIndexes: file_slinky_alerts_v1_strategies_proto_depIdxs, - MessageInfos: file_slinky_alerts_v1_strategies_proto_msgTypes, - }.Build() - File_slinky_alerts_v1_strategies_proto = out.File - file_slinky_alerts_v1_strategies_proto_rawDesc = nil - file_slinky_alerts_v1_strategies_proto_goTypes = nil - file_slinky_alerts_v1_strategies_proto_depIdxs = nil -} diff --git a/api/slinky/alerts/v1/tx.pulsar.go b/api/slinky/alerts/v1/tx.pulsar.go deleted file mode 100644 index f50849a5a..000000000 --- a/api/slinky/alerts/v1/tx.pulsar.go +++ /dev/null @@ -1,2968 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package alertsv1 - -import ( - _ "cosmossdk.io/api/amino" - _ "cosmossdk.io/api/cosmos/msg/v1" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_MsgAlert protoreflect.MessageDescriptor - fd_MsgAlert_alert protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_tx_proto_init() - md_MsgAlert = File_slinky_alerts_v1_tx_proto.Messages().ByName("MsgAlert") - fd_MsgAlert_alert = md_MsgAlert.Fields().ByName("alert") -} - -var _ protoreflect.Message = (*fastReflection_MsgAlert)(nil) - -type fastReflection_MsgAlert MsgAlert - -func (x *MsgAlert) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgAlert)(x) -} - -func (x *MsgAlert) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgAlert_messageType fastReflection_MsgAlert_messageType -var _ protoreflect.MessageType = fastReflection_MsgAlert_messageType{} - -type fastReflection_MsgAlert_messageType struct{} - -func (x fastReflection_MsgAlert_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgAlert)(nil) -} -func (x fastReflection_MsgAlert_messageType) New() protoreflect.Message { - return new(fastReflection_MsgAlert) -} -func (x fastReflection_MsgAlert_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAlert -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgAlert) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAlert -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgAlert) Type() protoreflect.MessageType { - return _fastReflection_MsgAlert_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgAlert) New() protoreflect.Message { - return new(fastReflection_MsgAlert) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgAlert) Interface() protoreflect.ProtoMessage { - return (*MsgAlert)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgAlert) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Alert != nil { - value := protoreflect.ValueOfMessage(x.Alert.ProtoReflect()) - if !f(fd_MsgAlert_alert, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgAlert) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.MsgAlert.alert": - return x.Alert != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlert does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlert) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.MsgAlert.alert": - x.Alert = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlert does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgAlert) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.MsgAlert.alert": - value := x.Alert - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlert does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlert) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.MsgAlert.alert": - x.Alert = value.Message().Interface().(*Alert) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlert does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlert) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MsgAlert.alert": - if x.Alert == nil { - x.Alert = new(Alert) - } - return protoreflect.ValueOfMessage(x.Alert.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlert does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgAlert) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MsgAlert.alert": - m := new(Alert) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlert")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlert does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgAlert) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MsgAlert", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgAlert) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlert) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgAlert) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgAlert) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgAlert) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Alert != nil { - l = options.Size(x.Alert) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgAlert) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Alert != nil { - encoded, err := options.Marshal(x.Alert) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgAlert) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAlert: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAlert: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Alert == nil { - x.Alert = &Alert{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Alert); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgAlertResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_alerts_v1_tx_proto_init() - md_MsgAlertResponse = File_slinky_alerts_v1_tx_proto.Messages().ByName("MsgAlertResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgAlertResponse)(nil) - -type fastReflection_MsgAlertResponse MsgAlertResponse - -func (x *MsgAlertResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgAlertResponse)(x) -} - -func (x *MsgAlertResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgAlertResponse_messageType fastReflection_MsgAlertResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgAlertResponse_messageType{} - -type fastReflection_MsgAlertResponse_messageType struct{} - -func (x fastReflection_MsgAlertResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgAlertResponse)(nil) -} -func (x fastReflection_MsgAlertResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgAlertResponse) -} -func (x fastReflection_MsgAlertResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAlertResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgAlertResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAlertResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgAlertResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgAlertResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgAlertResponse) New() protoreflect.Message { - return new(fastReflection_MsgAlertResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgAlertResponse) Interface() protoreflect.ProtoMessage { - return (*MsgAlertResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgAlertResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgAlertResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlertResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlertResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlertResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlertResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlertResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgAlertResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlertResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlertResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlertResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlertResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlertResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlertResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlertResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlertResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgAlertResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgAlertResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgAlertResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgAlertResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MsgAlertResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgAlertResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAlertResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgAlertResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgAlertResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgAlertResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgAlertResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgAlertResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAlertResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAlertResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgConclusion protoreflect.MessageDescriptor - fd_MsgConclusion_signer protoreflect.FieldDescriptor - fd_MsgConclusion_conclusion protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_tx_proto_init() - md_MsgConclusion = File_slinky_alerts_v1_tx_proto.Messages().ByName("MsgConclusion") - fd_MsgConclusion_signer = md_MsgConclusion.Fields().ByName("signer") - fd_MsgConclusion_conclusion = md_MsgConclusion.Fields().ByName("conclusion") -} - -var _ protoreflect.Message = (*fastReflection_MsgConclusion)(nil) - -type fastReflection_MsgConclusion MsgConclusion - -func (x *MsgConclusion) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgConclusion)(x) -} - -func (x *MsgConclusion) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgConclusion_messageType fastReflection_MsgConclusion_messageType -var _ protoreflect.MessageType = fastReflection_MsgConclusion_messageType{} - -type fastReflection_MsgConclusion_messageType struct{} - -func (x fastReflection_MsgConclusion_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgConclusion)(nil) -} -func (x fastReflection_MsgConclusion_messageType) New() protoreflect.Message { - return new(fastReflection_MsgConclusion) -} -func (x fastReflection_MsgConclusion_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgConclusion -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgConclusion) Descriptor() protoreflect.MessageDescriptor { - return md_MsgConclusion -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgConclusion) Type() protoreflect.MessageType { - return _fastReflection_MsgConclusion_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgConclusion) New() protoreflect.Message { - return new(fastReflection_MsgConclusion) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgConclusion) Interface() protoreflect.ProtoMessage { - return (*MsgConclusion)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgConclusion) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Signer != "" { - value := protoreflect.ValueOfString(x.Signer) - if !f(fd_MsgConclusion_signer, value) { - return - } - } - if x.Conclusion != nil { - value := protoreflect.ValueOfMessage(x.Conclusion.ProtoReflect()) - if !f(fd_MsgConclusion_conclusion, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgConclusion) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.MsgConclusion.signer": - return x.Signer != "" - case "slinky.alerts.v1.MsgConclusion.conclusion": - return x.Conclusion != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusion does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusion) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.MsgConclusion.signer": - x.Signer = "" - case "slinky.alerts.v1.MsgConclusion.conclusion": - x.Conclusion = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusion does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgConclusion) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.MsgConclusion.signer": - value := x.Signer - return protoreflect.ValueOfString(value) - case "slinky.alerts.v1.MsgConclusion.conclusion": - value := x.Conclusion - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusion does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusion) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.MsgConclusion.signer": - x.Signer = value.Interface().(string) - case "slinky.alerts.v1.MsgConclusion.conclusion": - x.Conclusion = value.Message().Interface().(*anypb.Any) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusion does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusion) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MsgConclusion.conclusion": - if x.Conclusion == nil { - x.Conclusion = new(anypb.Any) - } - return protoreflect.ValueOfMessage(x.Conclusion.ProtoReflect()) - case "slinky.alerts.v1.MsgConclusion.signer": - panic(fmt.Errorf("field signer of message slinky.alerts.v1.MsgConclusion is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusion does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgConclusion) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MsgConclusion.signer": - return protoreflect.ValueOfString("") - case "slinky.alerts.v1.MsgConclusion.conclusion": - m := new(anypb.Any) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusion")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusion does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgConclusion) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MsgConclusion", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgConclusion) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusion) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgConclusion) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgConclusion) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgConclusion) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Signer) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Conclusion != nil { - l = options.Size(x.Conclusion) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgConclusion) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Conclusion != nil { - encoded, err := options.Marshal(x.Conclusion) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if len(x.Signer) > 0 { - i -= len(x.Signer) - copy(dAtA[i:], x.Signer) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgConclusion) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgConclusion: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgConclusion: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Conclusion", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Conclusion == nil { - x.Conclusion = &anypb.Any{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Conclusion); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgConclusionResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_alerts_v1_tx_proto_init() - md_MsgConclusionResponse = File_slinky_alerts_v1_tx_proto.Messages().ByName("MsgConclusionResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgConclusionResponse)(nil) - -type fastReflection_MsgConclusionResponse MsgConclusionResponse - -func (x *MsgConclusionResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgConclusionResponse)(x) -} - -func (x *MsgConclusionResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgConclusionResponse_messageType fastReflection_MsgConclusionResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgConclusionResponse_messageType{} - -type fastReflection_MsgConclusionResponse_messageType struct{} - -func (x fastReflection_MsgConclusionResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgConclusionResponse)(nil) -} -func (x fastReflection_MsgConclusionResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgConclusionResponse) -} -func (x fastReflection_MsgConclusionResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgConclusionResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgConclusionResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgConclusionResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgConclusionResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgConclusionResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgConclusionResponse) New() protoreflect.Message { - return new(fastReflection_MsgConclusionResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgConclusionResponse) Interface() protoreflect.ProtoMessage { - return (*MsgConclusionResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgConclusionResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgConclusionResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusionResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusionResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusionResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusionResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusionResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgConclusionResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusionResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusionResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusionResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusionResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusionResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusionResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusionResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusionResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgConclusionResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgConclusionResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgConclusionResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgConclusionResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MsgConclusionResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgConclusionResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgConclusionResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgConclusionResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgConclusionResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgConclusionResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgConclusionResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgConclusionResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgConclusionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgConclusionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgUpdateParams protoreflect.MessageDescriptor - fd_MsgUpdateParams_authority protoreflect.FieldDescriptor - fd_MsgUpdateParams_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_alerts_v1_tx_proto_init() - md_MsgUpdateParams = File_slinky_alerts_v1_tx_proto.Messages().ByName("MsgUpdateParams") - fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") - fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) - -type fastReflection_MsgUpdateParams MsgUpdateParams - -func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateParams)(x) -} - -func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} - -type fastReflection_MsgUpdateParams_messageType struct{} - -func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateParams)(nil) -} -func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateParams) -} -func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateParams -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateParams -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUpdateParams) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateParams_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { - return new(fastReflection_MsgUpdateParams) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateParams)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgUpdateParams_authority, value) { - return - } - } - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_MsgUpdateParams_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.alerts.v1.MsgUpdateParams.authority": - return x.Authority != "" - case "slinky.alerts.v1.MsgUpdateParams.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.alerts.v1.MsgUpdateParams.authority": - x.Authority = "" - case "slinky.alerts.v1.MsgUpdateParams.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.alerts.v1.MsgUpdateParams.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - case "slinky.alerts.v1.MsgUpdateParams.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParams does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.alerts.v1.MsgUpdateParams.authority": - x.Authority = value.Interface().(string) - case "slinky.alerts.v1.MsgUpdateParams.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MsgUpdateParams.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "slinky.alerts.v1.MsgUpdateParams.authority": - panic(fmt.Errorf("field authority of message slinky.alerts.v1.MsgUpdateParams is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.alerts.v1.MsgUpdateParams.authority": - return protoreflect.ValueOfString("") - case "slinky.alerts.v1.MsgUpdateParams.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParams")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParams does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MsgUpdateParams", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUpdateParams) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParams) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgUpdateParams) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUpdateParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateParams) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParams) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParams) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgUpdateParamsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_alerts_v1_tx_proto_init() - md_MsgUpdateParamsResponse = File_slinky_alerts_v1_tx_proto.Messages().ByName("MsgUpdateParamsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) - -type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse - -func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateParamsResponse)(x) -} - -func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} - -type fastReflection_MsgUpdateParamsResponse_messageType struct{} - -func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateParamsResponse)(nil) -} -func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateParamsResponse) -} -func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUpdateParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { - return new(fastReflection_MsgUpdateParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.alerts.v1.MsgUpdateParamsResponse")) - } - panic(fmt.Errorf("message slinky.alerts.v1.MsgUpdateParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.alerts.v1.MsgUpdateParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUpdateParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgUpdateParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/alerts/v1/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// MsgAlert defines a message to create an alert. -type MsgAlert struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // alert is the alert to be filed - Alert *Alert `protobuf:"bytes,1,opt,name=alert,proto3" json:"alert,omitempty"` -} - -func (x *MsgAlert) Reset() { - *x = MsgAlert{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgAlert) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgAlert) ProtoMessage() {} - -// Deprecated: Use MsgAlert.ProtoReflect.Descriptor instead. -func (*MsgAlert) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_tx_proto_rawDescGZIP(), []int{0} -} - -func (x *MsgAlert) GetAlert() *Alert { - if x != nil { - return x.Alert - } - return nil -} - -type MsgAlertResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgAlertResponse) Reset() { - *x = MsgAlertResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgAlertResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgAlertResponse) ProtoMessage() {} - -// Deprecated: Use MsgAlertResponse.ProtoReflect.Descriptor instead. -func (*MsgAlertResponse) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_tx_proto_rawDescGZIP(), []int{1} -} - -// MsgConclusion defines a message carrying a Conclusion made by the SecondTier, -// which will be used to close an alert. And trigger any ramifications of the -// conclusion. -type MsgConclusion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // signer is the signer of this transaction (notice, this may not always be a - // node from the SecondTier) - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // conclusion is the conclusion to be filed - Conclusion *anypb.Any `protobuf:"bytes,2,opt,name=conclusion,proto3" json:"conclusion,omitempty"` -} - -func (x *MsgConclusion) Reset() { - *x = MsgConclusion{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgConclusion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgConclusion) ProtoMessage() {} - -// Deprecated: Use MsgConclusion.ProtoReflect.Descriptor instead. -func (*MsgConclusion) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *MsgConclusion) GetSigner() string { - if x != nil { - return x.Signer - } - return "" -} - -func (x *MsgConclusion) GetConclusion() *anypb.Any { - if x != nil { - return x.Conclusion - } - return nil -} - -type MsgConclusionResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgConclusionResponse) Reset() { - *x = MsgConclusionResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgConclusionResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgConclusionResponse) ProtoMessage() {} - -// Deprecated: Use MsgConclusionResponse.ProtoReflect.Descriptor instead. -func (*MsgConclusionResponse) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_tx_proto_rawDescGZIP(), []int{3} -} - -// MsgUpdateParams defines the message type expected by the UpdateParams rpc. It -// contains an authority address, and the new Params for the x/alerts module. -type MsgUpdateParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // authority is the address of the authority that is submitting the update - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params is the new set of parameters for the x/alerts module - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *MsgUpdateParams) Reset() { - *x = MsgUpdateParams{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUpdateParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateParams) ProtoMessage() {} - -// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_tx_proto_rawDescGZIP(), []int{4} -} - -func (x *MsgUpdateParams) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *MsgUpdateParams) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -type MsgUpdateParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgUpdateParamsResponse) Reset() { - *x = MsgUpdateParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_alerts_v1_tx_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUpdateParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateParamsResponse) ProtoMessage() {} - -// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_alerts_v1_tx_proto_rawDescGZIP(), []int{5} -} - -var File_slinky_alerts_v1_tx_proto protoreflect.FileDescriptor - -var file_slinky_alerts_v1_tx_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1d, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x62, 0x0a, 0x08, 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x12, 0x33, 0x0a, 0x05, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x3a, 0x21, 0xe8, 0xa0, 0x1f, 0x00, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x4d, 0x73, 0x67, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x41, - 0x6c, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcb, 0x01, 0x0a, - 0x0d, 0x4d, 0x73, 0x67, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x30, - 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, - 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, - 0x12, 0x55, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x42, 0x1f, 0xca, 0xb4, 0x2d, 0x1b, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6e, - 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x31, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, - 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x4d, 0x73, 0x67, - 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, - 0x67, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, - 0x36, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x36, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, - 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, - 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8b, 0x02, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x47, 0x0a, 0x05, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x1a, 0x2e, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0a, 0x43, - 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x43, 0x6f, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, - 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xad, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x76, - 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, - 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, - 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x10, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, 0x65, 0x72, 0x74, - 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1c, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x41, 0x6c, - 0x65, 0x72, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_alerts_v1_tx_proto_rawDescOnce sync.Once - file_slinky_alerts_v1_tx_proto_rawDescData = file_slinky_alerts_v1_tx_proto_rawDesc -) - -func file_slinky_alerts_v1_tx_proto_rawDescGZIP() []byte { - file_slinky_alerts_v1_tx_proto_rawDescOnce.Do(func() { - file_slinky_alerts_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_alerts_v1_tx_proto_rawDescData) - }) - return file_slinky_alerts_v1_tx_proto_rawDescData -} - -var file_slinky_alerts_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_slinky_alerts_v1_tx_proto_goTypes = []interface{}{ - (*MsgAlert)(nil), // 0: slinky.alerts.v1.MsgAlert - (*MsgAlertResponse)(nil), // 1: slinky.alerts.v1.MsgAlertResponse - (*MsgConclusion)(nil), // 2: slinky.alerts.v1.MsgConclusion - (*MsgConclusionResponse)(nil), // 3: slinky.alerts.v1.MsgConclusionResponse - (*MsgUpdateParams)(nil), // 4: slinky.alerts.v1.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 5: slinky.alerts.v1.MsgUpdateParamsResponse - (*Alert)(nil), // 6: slinky.alerts.v1.Alert - (*anypb.Any)(nil), // 7: google.protobuf.Any - (*Params)(nil), // 8: slinky.alerts.v1.Params -} -var file_slinky_alerts_v1_tx_proto_depIdxs = []int32{ - 6, // 0: slinky.alerts.v1.MsgAlert.alert:type_name -> slinky.alerts.v1.Alert - 7, // 1: slinky.alerts.v1.MsgConclusion.conclusion:type_name -> google.protobuf.Any - 8, // 2: slinky.alerts.v1.MsgUpdateParams.params:type_name -> slinky.alerts.v1.Params - 0, // 3: slinky.alerts.v1.Msg.Alert:input_type -> slinky.alerts.v1.MsgAlert - 2, // 4: slinky.alerts.v1.Msg.Conclusion:input_type -> slinky.alerts.v1.MsgConclusion - 4, // 5: slinky.alerts.v1.Msg.UpdateParams:input_type -> slinky.alerts.v1.MsgUpdateParams - 1, // 6: slinky.alerts.v1.Msg.Alert:output_type -> slinky.alerts.v1.MsgAlertResponse - 3, // 7: slinky.alerts.v1.Msg.Conclusion:output_type -> slinky.alerts.v1.MsgConclusionResponse - 5, // 8: slinky.alerts.v1.Msg.UpdateParams:output_type -> slinky.alerts.v1.MsgUpdateParamsResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_slinky_alerts_v1_tx_proto_init() } -func file_slinky_alerts_v1_tx_proto_init() { - if File_slinky_alerts_v1_tx_proto != nil { - return - } - file_slinky_alerts_v1_alerts_proto_init() - file_slinky_alerts_v1_genesis_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_alerts_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAlert); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAlertResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgConclusion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgConclusionResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_alerts_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_alerts_v1_tx_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_alerts_v1_tx_proto_goTypes, - DependencyIndexes: file_slinky_alerts_v1_tx_proto_depIdxs, - MessageInfos: file_slinky_alerts_v1_tx_proto_msgTypes, - }.Build() - File_slinky_alerts_v1_tx_proto = out.File - file_slinky_alerts_v1_tx_proto_rawDesc = nil - file_slinky_alerts_v1_tx_proto_goTypes = nil - file_slinky_alerts_v1_tx_proto_depIdxs = nil -} diff --git a/api/slinky/alerts/v1/tx_grpc.pb.go b/api/slinky/alerts/v1/tx_grpc.pb.go deleted file mode 100644 index 2c36e611c..000000000 --- a/api/slinky/alerts/v1/tx_grpc.pb.go +++ /dev/null @@ -1,223 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc (unknown) -// source: slinky/alerts/v1/tx.proto - -package alertsv1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Msg_Alert_FullMethodName = "/slinky.alerts.v1.Msg/Alert" - Msg_Conclusion_FullMethodName = "/slinky.alerts.v1.Msg/Conclusion" - Msg_UpdateParams_FullMethodName = "/slinky.alerts.v1.Msg/UpdateParams" -) - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Msg is the message service for the x/alerts module. -type MsgClient interface { - // Alert creates a new alert. On alert creation (if valid), the alert will be - // saved to state, and its bond will be escrowed until a corresponding - // Conclusion is filed to close the alert. - Alert(ctx context.Context, in *MsgAlert, opts ...grpc.CallOption) (*MsgAlertResponse, error) - // Conclusion closes an alert. On alert conclusion (if valid), the alert will - // be marked as Concluded, the bond for the alert will either be burned or - // returned, and a set of incentives will be issued to the validators deemed - // malicious by the conclusion. - Conclusion(ctx context.Context, in *MsgConclusion, opts ...grpc.CallOption) (*MsgConclusionResponse, error) - // UpdateParams updates the parameters of the alerts module. Specifically, the - // only address that is capable of submitting this Msg is the - // module-authority, in general, the x/gov module-account. The process for - // executing this message will be via governance proposal - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) -} - -type msgClient struct { - cc grpc.ClientConnInterface -} - -func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) Alert(ctx context.Context, in *MsgAlert, opts ...grpc.CallOption) (*MsgAlertResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MsgAlertResponse) - err := c.cc.Invoke(ctx, Msg_Alert_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Conclusion(ctx context.Context, in *MsgConclusion, opts ...grpc.CallOption) (*MsgConclusionResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MsgConclusionResponse) - err := c.cc.Invoke(ctx, Msg_Conclusion_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -// All implementations must embed UnimplementedMsgServer -// for forward compatibility. -// -// Msg is the message service for the x/alerts module. -type MsgServer interface { - // Alert creates a new alert. On alert creation (if valid), the alert will be - // saved to state, and its bond will be escrowed until a corresponding - // Conclusion is filed to close the alert. - Alert(context.Context, *MsgAlert) (*MsgAlertResponse, error) - // Conclusion closes an alert. On alert conclusion (if valid), the alert will - // be marked as Concluded, the bond for the alert will either be burned or - // returned, and a set of incentives will be issued to the validators deemed - // malicious by the conclusion. - Conclusion(context.Context, *MsgConclusion) (*MsgConclusionResponse, error) - // UpdateParams updates the parameters of the alerts module. Specifically, the - // only address that is capable of submitting this Msg is the - // module-authority, in general, the x/gov module-account. The process for - // executing this message will be via governance proposal - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - mustEmbedUnimplementedMsgServer() -} - -// UnimplementedMsgServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedMsgServer struct{} - -func (UnimplementedMsgServer) Alert(context.Context, *MsgAlert) (*MsgAlertResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Alert not implemented") -} -func (UnimplementedMsgServer) Conclusion(context.Context, *MsgConclusion) (*MsgConclusionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Conclusion not implemented") -} -func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} -func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} -func (UnimplementedMsgServer) testEmbeddedByValue() {} - -// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MsgServer will -// result in compilation errors. -type UnsafeMsgServer interface { - mustEmbedUnimplementedMsgServer() -} - -func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { - // If the following call pancis, it indicates UnimplementedMsgServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Msg_ServiceDesc, srv) -} - -func _Msg_Alert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAlert) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Alert(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_Alert_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Alert(ctx, req.(*MsgAlert)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Conclusion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgConclusion) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Conclusion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_Conclusion_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Conclusion(ctx, req.(*MsgConclusion)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_UpdateParams_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Msg_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.alerts.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Alert", - Handler: _Msg_Alert_Handler, - }, - { - MethodName: "Conclusion", - Handler: _Msg_Conclusion_Handler, - }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/alerts/v1/tx.proto", -} diff --git a/api/slinky/incentives/module/v1/module.pulsar.go b/api/slinky/incentives/module/v1/module.pulsar.go deleted file mode 100644 index 029ce8da5..000000000 --- a/api/slinky/incentives/module/v1/module.pulsar.go +++ /dev/null @@ -1,505 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package modulev1 - -import ( - _ "cosmossdk.io/api/cosmos/app/v1alpha1" - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Module protoreflect.MessageDescriptor -) - -func init() { - file_slinky_incentives_module_v1_module_proto_init() - md_Module = File_slinky_incentives_module_v1_module_proto.Messages().ByName("Module") -} - -var _ protoreflect.Message = (*fastReflection_Module)(nil) - -type fastReflection_Module Module - -func (x *Module) ProtoReflect() protoreflect.Message { - return (*fastReflection_Module)(x) -} - -func (x *Module) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_module_v1_module_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Module_messageType fastReflection_Module_messageType -var _ protoreflect.MessageType = fastReflection_Module_messageType{} - -type fastReflection_Module_messageType struct{} - -func (x fastReflection_Module_messageType) Zero() protoreflect.Message { - return (*fastReflection_Module)(nil) -} -func (x fastReflection_Module_messageType) New() protoreflect.Message { - return new(fastReflection_Module) -} -func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Module) Type() protoreflect.MessageType { - return _fastReflection_Module_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Module) New() protoreflect.Message { - return new(fastReflection_Module) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { - return (*Module)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.incentives.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.incentives.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.incentives.module.v1.Module does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.incentives.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.incentives.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.incentives.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.module.v1.Module", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Module) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/incentives/module/v1/module.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Module is the config object of the incentives module. -type Module struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Module) Reset() { - *x = Module{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_module_v1_module_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Module) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Module) ProtoMessage() {} - -// Deprecated: Use Module.ProtoReflect.Descriptor instead. -func (*Module) Descriptor() ([]byte, []int) { - return file_slinky_incentives_module_v1_module_proto_rawDescGZIP(), []int{0} -} - -var File_slinky_incentives_module_v1_module_proto protoreflect.FileDescriptor - -var file_slinky_incentives_module_v1_module_proto_rawDesc = []byte{ - 0x0a, 0x28, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x6d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x06, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x3a, 0x2f, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x29, 0x0a, 0x27, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6b, 0x69, 0x70, 0x2d, 0x6d, 0x65, 0x76, - 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x42, 0xf4, 0x01, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x6d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x53, 0x49, 0x4d, 0xaa, 0x02, 0x1b, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x49, 0x6e, - 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, - 0x56, 0x31, 0xca, 0x02, 0x1b, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, - 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x27, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1e, 0x53, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x3a, - 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_incentives_module_v1_module_proto_rawDescOnce sync.Once - file_slinky_incentives_module_v1_module_proto_rawDescData = file_slinky_incentives_module_v1_module_proto_rawDesc -) - -func file_slinky_incentives_module_v1_module_proto_rawDescGZIP() []byte { - file_slinky_incentives_module_v1_module_proto_rawDescOnce.Do(func() { - file_slinky_incentives_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_incentives_module_v1_module_proto_rawDescData) - }) - return file_slinky_incentives_module_v1_module_proto_rawDescData -} - -var file_slinky_incentives_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_incentives_module_v1_module_proto_goTypes = []interface{}{ - (*Module)(nil), // 0: slinky.incentives.module.v1.Module -} -var file_slinky_incentives_module_v1_module_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_slinky_incentives_module_v1_module_proto_init() } -func file_slinky_incentives_module_v1_module_proto_init() { - if File_slinky_incentives_module_v1_module_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_incentives_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Module); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_incentives_module_v1_module_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_incentives_module_v1_module_proto_goTypes, - DependencyIndexes: file_slinky_incentives_module_v1_module_proto_depIdxs, - MessageInfos: file_slinky_incentives_module_v1_module_proto_msgTypes, - }.Build() - File_slinky_incentives_module_v1_module_proto = out.File - file_slinky_incentives_module_v1_module_proto_rawDesc = nil - file_slinky_incentives_module_v1_module_proto_goTypes = nil - file_slinky_incentives_module_v1_module_proto_depIdxs = nil -} diff --git a/api/slinky/incentives/v1/examples/badprice.pulsar.go b/api/slinky/incentives/v1/examples/badprice.pulsar.go deleted file mode 100644 index 6ffc67ab1..000000000 --- a/api/slinky/incentives/v1/examples/badprice.pulsar.go +++ /dev/null @@ -1,661 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package incentivesv1 - -import ( - _ "cosmossdk.io/api/amino" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_BadPriceIncentive protoreflect.MessageDescriptor - fd_BadPriceIncentive_validator protoreflect.FieldDescriptor - fd_BadPriceIncentive_amount protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_examples_badprice_proto_init() - md_BadPriceIncentive = File_slinky_incentives_v1_examples_badprice_proto.Messages().ByName("BadPriceIncentive") - fd_BadPriceIncentive_validator = md_BadPriceIncentive.Fields().ByName("validator") - fd_BadPriceIncentive_amount = md_BadPriceIncentive.Fields().ByName("amount") -} - -var _ protoreflect.Message = (*fastReflection_BadPriceIncentive)(nil) - -type fastReflection_BadPriceIncentive BadPriceIncentive - -func (x *BadPriceIncentive) ProtoReflect() protoreflect.Message { - return (*fastReflection_BadPriceIncentive)(x) -} - -func (x *BadPriceIncentive) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_examples_badprice_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_BadPriceIncentive_messageType fastReflection_BadPriceIncentive_messageType -var _ protoreflect.MessageType = fastReflection_BadPriceIncentive_messageType{} - -type fastReflection_BadPriceIncentive_messageType struct{} - -func (x fastReflection_BadPriceIncentive_messageType) Zero() protoreflect.Message { - return (*fastReflection_BadPriceIncentive)(nil) -} -func (x fastReflection_BadPriceIncentive_messageType) New() protoreflect.Message { - return new(fastReflection_BadPriceIncentive) -} -func (x fastReflection_BadPriceIncentive_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_BadPriceIncentive -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_BadPriceIncentive) Descriptor() protoreflect.MessageDescriptor { - return md_BadPriceIncentive -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_BadPriceIncentive) Type() protoreflect.MessageType { - return _fastReflection_BadPriceIncentive_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_BadPriceIncentive) New() protoreflect.Message { - return new(fastReflection_BadPriceIncentive) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_BadPriceIncentive) Interface() protoreflect.ProtoMessage { - return (*BadPriceIncentive)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_BadPriceIncentive) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Validator != "" { - value := protoreflect.ValueOfString(x.Validator) - if !f(fd_BadPriceIncentive_validator, value) { - return - } - } - if x.Amount != "" { - value := protoreflect.ValueOfString(x.Amount) - if !f(fd_BadPriceIncentive_amount, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_BadPriceIncentive) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.BadPriceIncentive.validator": - return x.Validator != "" - case "slinky.incentives.v1.BadPriceIncentive.amount": - return x.Amount != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.BadPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.BadPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_BadPriceIncentive) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.BadPriceIncentive.validator": - x.Validator = "" - case "slinky.incentives.v1.BadPriceIncentive.amount": - x.Amount = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.BadPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.BadPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_BadPriceIncentive) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.BadPriceIncentive.validator": - value := x.Validator - return protoreflect.ValueOfString(value) - case "slinky.incentives.v1.BadPriceIncentive.amount": - value := x.Amount - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.BadPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.BadPriceIncentive does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_BadPriceIncentive) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.BadPriceIncentive.validator": - x.Validator = value.Interface().(string) - case "slinky.incentives.v1.BadPriceIncentive.amount": - x.Amount = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.BadPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.BadPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_BadPriceIncentive) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.BadPriceIncentive.validator": - panic(fmt.Errorf("field validator of message slinky.incentives.v1.BadPriceIncentive is not mutable")) - case "slinky.incentives.v1.BadPriceIncentive.amount": - panic(fmt.Errorf("field amount of message slinky.incentives.v1.BadPriceIncentive is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.BadPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.BadPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_BadPriceIncentive) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.BadPriceIncentive.validator": - return protoreflect.ValueOfString("") - case "slinky.incentives.v1.BadPriceIncentive.amount": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.BadPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.BadPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_BadPriceIncentive) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.BadPriceIncentive", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_BadPriceIncentive) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_BadPriceIncentive) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_BadPriceIncentive) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_BadPriceIncentive) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*BadPriceIncentive) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Validator) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Amount) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*BadPriceIncentive) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Amount) > 0 { - i -= len(x.Amount) - copy(dAtA[i:], x.Amount) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) - i-- - dAtA[i] = 0x12 - } - if len(x.Validator) > 0 { - i -= len(x.Validator) - copy(dAtA[i:], x.Validator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Validator))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*BadPriceIncentive) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BadPriceIncentive: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: BadPriceIncentive: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Validator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/incentives/v1/examples/badprice.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// BadPriceIncentive is a message that contains the information about a bad -// price that was submitted by a validator. -// -// NOTE: This is an example of a bad price incentive. It is not used in -// production. -type BadPriceIncentive struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Validator is the address of the validator that submitted the bad price. - Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` - // Amount is the amount to slash. - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (x *BadPriceIncentive) Reset() { - *x = BadPriceIncentive{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_examples_badprice_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BadPriceIncentive) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BadPriceIncentive) ProtoMessage() {} - -// Deprecated: Use BadPriceIncentive.ProtoReflect.Descriptor instead. -func (*BadPriceIncentive) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_examples_badprice_proto_rawDescGZIP(), []int{0} -} - -func (x *BadPriceIncentive) GetValidator() string { - if x != nil { - return x.Validator - } - return "" -} - -func (x *BadPriceIncentive) GetAmount() string { - if x != nil { - return x.Amount - } - return "" -} - -var File_slinky_incentives_v1_examples_badprice_proto protoreflect.FileDescriptor - -var file_slinky_incentives_v1_examples_badprice_proto_rawDesc = []byte{ - 0x0a, 0x2c, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, - 0x62, 0x61, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x91, 0x01, 0x0a, 0x11, 0x42, 0x61, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x49, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x46, - 0xca, 0xb4, 0x2d, 0x1e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x42, 0x61, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x63, - 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x42, 0xd8, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x42, 0x61, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, - 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x73, 0x3b, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x53, 0x49, 0x58, 0xaa, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, - 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x53, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x3a, 0x3a, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_incentives_v1_examples_badprice_proto_rawDescOnce sync.Once - file_slinky_incentives_v1_examples_badprice_proto_rawDescData = file_slinky_incentives_v1_examples_badprice_proto_rawDesc -) - -func file_slinky_incentives_v1_examples_badprice_proto_rawDescGZIP() []byte { - file_slinky_incentives_v1_examples_badprice_proto_rawDescOnce.Do(func() { - file_slinky_incentives_v1_examples_badprice_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_incentives_v1_examples_badprice_proto_rawDescData) - }) - return file_slinky_incentives_v1_examples_badprice_proto_rawDescData -} - -var file_slinky_incentives_v1_examples_badprice_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_incentives_v1_examples_badprice_proto_goTypes = []interface{}{ - (*BadPriceIncentive)(nil), // 0: slinky.incentives.v1.BadPriceIncentive -} -var file_slinky_incentives_v1_examples_badprice_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_slinky_incentives_v1_examples_badprice_proto_init() } -func file_slinky_incentives_v1_examples_badprice_proto_init() { - if File_slinky_incentives_v1_examples_badprice_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_incentives_v1_examples_badprice_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BadPriceIncentive); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_incentives_v1_examples_badprice_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_incentives_v1_examples_badprice_proto_goTypes, - DependencyIndexes: file_slinky_incentives_v1_examples_badprice_proto_depIdxs, - MessageInfos: file_slinky_incentives_v1_examples_badprice_proto_msgTypes, - }.Build() - File_slinky_incentives_v1_examples_badprice_proto = out.File - file_slinky_incentives_v1_examples_badprice_proto_rawDesc = nil - file_slinky_incentives_v1_examples_badprice_proto_goTypes = nil - file_slinky_incentives_v1_examples_badprice_proto_depIdxs = nil -} diff --git a/api/slinky/incentives/v1/examples/goodprice.pulsar.go b/api/slinky/incentives/v1/examples/goodprice.pulsar.go deleted file mode 100644 index e2bd6762b..000000000 --- a/api/slinky/incentives/v1/examples/goodprice.pulsar.go +++ /dev/null @@ -1,661 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package incentivesv1 - -import ( - _ "cosmossdk.io/api/amino" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_GoodPriceIncentive protoreflect.MessageDescriptor - fd_GoodPriceIncentive_validator protoreflect.FieldDescriptor - fd_GoodPriceIncentive_amount protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_examples_goodprice_proto_init() - md_GoodPriceIncentive = File_slinky_incentives_v1_examples_goodprice_proto.Messages().ByName("GoodPriceIncentive") - fd_GoodPriceIncentive_validator = md_GoodPriceIncentive.Fields().ByName("validator") - fd_GoodPriceIncentive_amount = md_GoodPriceIncentive.Fields().ByName("amount") -} - -var _ protoreflect.Message = (*fastReflection_GoodPriceIncentive)(nil) - -type fastReflection_GoodPriceIncentive GoodPriceIncentive - -func (x *GoodPriceIncentive) ProtoReflect() protoreflect.Message { - return (*fastReflection_GoodPriceIncentive)(x) -} - -func (x *GoodPriceIncentive) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_examples_goodprice_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GoodPriceIncentive_messageType fastReflection_GoodPriceIncentive_messageType -var _ protoreflect.MessageType = fastReflection_GoodPriceIncentive_messageType{} - -type fastReflection_GoodPriceIncentive_messageType struct{} - -func (x fastReflection_GoodPriceIncentive_messageType) Zero() protoreflect.Message { - return (*fastReflection_GoodPriceIncentive)(nil) -} -func (x fastReflection_GoodPriceIncentive_messageType) New() protoreflect.Message { - return new(fastReflection_GoodPriceIncentive) -} -func (x fastReflection_GoodPriceIncentive_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GoodPriceIncentive -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GoodPriceIncentive) Descriptor() protoreflect.MessageDescriptor { - return md_GoodPriceIncentive -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GoodPriceIncentive) Type() protoreflect.MessageType { - return _fastReflection_GoodPriceIncentive_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GoodPriceIncentive) New() protoreflect.Message { - return new(fastReflection_GoodPriceIncentive) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GoodPriceIncentive) Interface() protoreflect.ProtoMessage { - return (*GoodPriceIncentive)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GoodPriceIncentive) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Validator != "" { - value := protoreflect.ValueOfString(x.Validator) - if !f(fd_GoodPriceIncentive_validator, value) { - return - } - } - if x.Amount != "" { - value := protoreflect.ValueOfString(x.Amount) - if !f(fd_GoodPriceIncentive_amount, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GoodPriceIncentive) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.GoodPriceIncentive.validator": - return x.Validator != "" - case "slinky.incentives.v1.GoodPriceIncentive.amount": - return x.Amount != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GoodPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GoodPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GoodPriceIncentive) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.GoodPriceIncentive.validator": - x.Validator = "" - case "slinky.incentives.v1.GoodPriceIncentive.amount": - x.Amount = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GoodPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GoodPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GoodPriceIncentive) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.GoodPriceIncentive.validator": - value := x.Validator - return protoreflect.ValueOfString(value) - case "slinky.incentives.v1.GoodPriceIncentive.amount": - value := x.Amount - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GoodPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GoodPriceIncentive does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GoodPriceIncentive) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.GoodPriceIncentive.validator": - x.Validator = value.Interface().(string) - case "slinky.incentives.v1.GoodPriceIncentive.amount": - x.Amount = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GoodPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GoodPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GoodPriceIncentive) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GoodPriceIncentive.validator": - panic(fmt.Errorf("field validator of message slinky.incentives.v1.GoodPriceIncentive is not mutable")) - case "slinky.incentives.v1.GoodPriceIncentive.amount": - panic(fmt.Errorf("field amount of message slinky.incentives.v1.GoodPriceIncentive is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GoodPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GoodPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GoodPriceIncentive) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GoodPriceIncentive.validator": - return protoreflect.ValueOfString("") - case "slinky.incentives.v1.GoodPriceIncentive.amount": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GoodPriceIncentive")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GoodPriceIncentive does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GoodPriceIncentive) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.GoodPriceIncentive", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GoodPriceIncentive) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GoodPriceIncentive) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GoodPriceIncentive) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GoodPriceIncentive) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GoodPriceIncentive) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Validator) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Amount) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GoodPriceIncentive) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Amount) > 0 { - i -= len(x.Amount) - copy(dAtA[i:], x.Amount) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) - i-- - dAtA[i] = 0x12 - } - if len(x.Validator) > 0 { - i -= len(x.Validator) - copy(dAtA[i:], x.Validator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Validator))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GoodPriceIncentive) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GoodPriceIncentive: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GoodPriceIncentive: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Validator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/incentives/v1/examples/goodprice.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GoodPriceIncentive is a message that contains the information about a good -// price that was submitted by a validator. -// -// NOTE: This is an example of a good price incentive. It is not used in -// production. -type GoodPriceIncentive struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Validator is the address of the validator that submitted the good price. - Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` - // Amount is the amount to reward. - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (x *GoodPriceIncentive) Reset() { - *x = GoodPriceIncentive{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_examples_goodprice_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GoodPriceIncentive) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GoodPriceIncentive) ProtoMessage() {} - -// Deprecated: Use GoodPriceIncentive.ProtoReflect.Descriptor instead. -func (*GoodPriceIncentive) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_examples_goodprice_proto_rawDescGZIP(), []int{0} -} - -func (x *GoodPriceIncentive) GetValidator() string { - if x != nil { - return x.Validator - } - return "" -} - -func (x *GoodPriceIncentive) GetAmount() string { - if x != nil { - return x.Amount - } - return "" -} - -var File_slinky_incentives_v1_examples_goodprice_proto protoreflect.FileDescriptor - -var file_slinky_incentives_v1_examples_goodprice_proto_rawDesc = []byte{ - 0x0a, 0x2d, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, - 0x67, 0x6f, 0x6f, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x14, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, - 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x01, 0x0a, 0x12, 0x47, 0x6f, 0x6f, 0x64, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x3a, 0x46, 0xca, 0xb4, 0x2d, 0x1e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, - 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, 0x65, 0x6e, - 0x74, 0x69, 0x76, 0x65, 0x8a, 0xe7, 0xb0, 0x2a, 0x1f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, - 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x42, 0x61, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x49, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x42, 0xd9, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x47, 0x6f, 0x6f, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x3b, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x49, 0x58, 0xaa, 0x02, 0x14, 0x53, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, 0x6e, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x53, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_incentives_v1_examples_goodprice_proto_rawDescOnce sync.Once - file_slinky_incentives_v1_examples_goodprice_proto_rawDescData = file_slinky_incentives_v1_examples_goodprice_proto_rawDesc -) - -func file_slinky_incentives_v1_examples_goodprice_proto_rawDescGZIP() []byte { - file_slinky_incentives_v1_examples_goodprice_proto_rawDescOnce.Do(func() { - file_slinky_incentives_v1_examples_goodprice_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_incentives_v1_examples_goodprice_proto_rawDescData) - }) - return file_slinky_incentives_v1_examples_goodprice_proto_rawDescData -} - -var file_slinky_incentives_v1_examples_goodprice_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_incentives_v1_examples_goodprice_proto_goTypes = []interface{}{ - (*GoodPriceIncentive)(nil), // 0: slinky.incentives.v1.GoodPriceIncentive -} -var file_slinky_incentives_v1_examples_goodprice_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_slinky_incentives_v1_examples_goodprice_proto_init() } -func file_slinky_incentives_v1_examples_goodprice_proto_init() { - if File_slinky_incentives_v1_examples_goodprice_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_incentives_v1_examples_goodprice_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GoodPriceIncentive); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_incentives_v1_examples_goodprice_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_incentives_v1_examples_goodprice_proto_goTypes, - DependencyIndexes: file_slinky_incentives_v1_examples_goodprice_proto_depIdxs, - MessageInfos: file_slinky_incentives_v1_examples_goodprice_proto_msgTypes, - }.Build() - File_slinky_incentives_v1_examples_goodprice_proto = out.File - file_slinky_incentives_v1_examples_goodprice_proto_rawDesc = nil - file_slinky_incentives_v1_examples_goodprice_proto_goTypes = nil - file_slinky_incentives_v1_examples_goodprice_proto_depIdxs = nil -} diff --git a/api/slinky/incentives/v1/genesis.pulsar.go b/api/slinky/incentives/v1/genesis.pulsar.go deleted file mode 100644 index 2194c7aea..000000000 --- a/api/slinky/incentives/v1/genesis.pulsar.go +++ /dev/null @@ -1,1264 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package incentivesv1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var _ protoreflect.List = (*_GenesisState_1_list)(nil) - -type _GenesisState_1_list struct { - list *[]*IncentivesByType -} - -func (x *_GenesisState_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GenesisState_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GenesisState_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*IncentivesByType) - (*x.list)[i] = concreteValue -} - -func (x *_GenesisState_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*IncentivesByType) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GenesisState_1_list) AppendMutable() protoreflect.Value { - v := new(IncentivesByType) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GenesisState_1_list) NewElement() protoreflect.Value { - v := new(IncentivesByType) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_registry protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_genesis_proto_init() - md_GenesisState = File_slinky_incentives_v1_genesis_proto.Messages().ByName("GenesisState") - fd_GenesisState_registry = md_GenesisState.Fields().ByName("registry") -} - -var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) - -type fastReflection_GenesisState GenesisState - -func (x *GenesisState) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisState)(x) -} - -func (x *GenesisState) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_genesis_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType -var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} - -type fastReflection_GenesisState_messageType struct{} - -func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisState)(nil) -} -func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} -func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { - return _fastReflection_GenesisState_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisState) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { - return (*GenesisState)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Registry) != 0 { - value := protoreflect.ValueOfList(&_GenesisState_1_list{list: &x.Registry}) - if !f(fd_GenesisState_registry, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.GenesisState.registry": - return len(x.Registry) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.GenesisState.registry": - x.Registry = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.GenesisState.registry": - if len(x.Registry) == 0 { - return protoreflect.ValueOfList(&_GenesisState_1_list{}) - } - listValue := &_GenesisState_1_list{list: &x.Registry} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GenesisState does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.GenesisState.registry": - lv := value.List() - clv := lv.(*_GenesisState_1_list) - x.Registry = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GenesisState.registry": - if x.Registry == nil { - x.Registry = []*IncentivesByType{} - } - value := &_GenesisState_1_list{list: &x.Registry} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GenesisState.registry": - list := []*IncentivesByType{} - return protoreflect.ValueOfList(&_GenesisState_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.GenesisState", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GenesisState) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Registry) > 0 { - for _, e := range x.Registry { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Registry) > 0 { - for iNdEx := len(x.Registry) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Registry[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Registry", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Registry = append(x.Registry, &IncentivesByType{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Registry[len(x.Registry)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_IncentivesByType_2_list)(nil) - -type _IncentivesByType_2_list struct { - list *[][]byte -} - -func (x *_IncentivesByType_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_IncentivesByType_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfBytes((*x.list)[i]) -} - -func (x *_IncentivesByType_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Bytes() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_IncentivesByType_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Bytes() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_IncentivesByType_2_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message IncentivesByType at list field Entries as it is not of Message kind")) -} - -func (x *_IncentivesByType_2_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_IncentivesByType_2_list) NewElement() protoreflect.Value { - var v []byte - return protoreflect.ValueOfBytes(v) -} - -func (x *_IncentivesByType_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_IncentivesByType protoreflect.MessageDescriptor - fd_IncentivesByType_incentive_type protoreflect.FieldDescriptor - fd_IncentivesByType_entries protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_genesis_proto_init() - md_IncentivesByType = File_slinky_incentives_v1_genesis_proto.Messages().ByName("IncentivesByType") - fd_IncentivesByType_incentive_type = md_IncentivesByType.Fields().ByName("incentive_type") - fd_IncentivesByType_entries = md_IncentivesByType.Fields().ByName("entries") -} - -var _ protoreflect.Message = (*fastReflection_IncentivesByType)(nil) - -type fastReflection_IncentivesByType IncentivesByType - -func (x *IncentivesByType) ProtoReflect() protoreflect.Message { - return (*fastReflection_IncentivesByType)(x) -} - -func (x *IncentivesByType) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_genesis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_IncentivesByType_messageType fastReflection_IncentivesByType_messageType -var _ protoreflect.MessageType = fastReflection_IncentivesByType_messageType{} - -type fastReflection_IncentivesByType_messageType struct{} - -func (x fastReflection_IncentivesByType_messageType) Zero() protoreflect.Message { - return (*fastReflection_IncentivesByType)(nil) -} -func (x fastReflection_IncentivesByType_messageType) New() protoreflect.Message { - return new(fastReflection_IncentivesByType) -} -func (x fastReflection_IncentivesByType_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_IncentivesByType -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_IncentivesByType) Descriptor() protoreflect.MessageDescriptor { - return md_IncentivesByType -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_IncentivesByType) Type() protoreflect.MessageType { - return _fastReflection_IncentivesByType_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_IncentivesByType) New() protoreflect.Message { - return new(fastReflection_IncentivesByType) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_IncentivesByType) Interface() protoreflect.ProtoMessage { - return (*IncentivesByType)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_IncentivesByType) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.IncentiveType != "" { - value := protoreflect.ValueOfString(x.IncentiveType) - if !f(fd_IncentivesByType_incentive_type, value) { - return - } - } - if len(x.Entries) != 0 { - value := protoreflect.ValueOfList(&_IncentivesByType_2_list{list: &x.Entries}) - if !f(fd_IncentivesByType_entries, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_IncentivesByType) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.IncentivesByType.incentive_type": - return x.IncentiveType != "" - case "slinky.incentives.v1.IncentivesByType.entries": - return len(x.Entries) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.IncentivesByType")) - } - panic(fmt.Errorf("message slinky.incentives.v1.IncentivesByType does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IncentivesByType) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.IncentivesByType.incentive_type": - x.IncentiveType = "" - case "slinky.incentives.v1.IncentivesByType.entries": - x.Entries = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.IncentivesByType")) - } - panic(fmt.Errorf("message slinky.incentives.v1.IncentivesByType does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_IncentivesByType) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.IncentivesByType.incentive_type": - value := x.IncentiveType - return protoreflect.ValueOfString(value) - case "slinky.incentives.v1.IncentivesByType.entries": - if len(x.Entries) == 0 { - return protoreflect.ValueOfList(&_IncentivesByType_2_list{}) - } - listValue := &_IncentivesByType_2_list{list: &x.Entries} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.IncentivesByType")) - } - panic(fmt.Errorf("message slinky.incentives.v1.IncentivesByType does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IncentivesByType) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.IncentivesByType.incentive_type": - x.IncentiveType = value.Interface().(string) - case "slinky.incentives.v1.IncentivesByType.entries": - lv := value.List() - clv := lv.(*_IncentivesByType_2_list) - x.Entries = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.IncentivesByType")) - } - panic(fmt.Errorf("message slinky.incentives.v1.IncentivesByType does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IncentivesByType) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.IncentivesByType.entries": - if x.Entries == nil { - x.Entries = [][]byte{} - } - value := &_IncentivesByType_2_list{list: &x.Entries} - return protoreflect.ValueOfList(value) - case "slinky.incentives.v1.IncentivesByType.incentive_type": - panic(fmt.Errorf("field incentive_type of message slinky.incentives.v1.IncentivesByType is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.IncentivesByType")) - } - panic(fmt.Errorf("message slinky.incentives.v1.IncentivesByType does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_IncentivesByType) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.IncentivesByType.incentive_type": - return protoreflect.ValueOfString("") - case "slinky.incentives.v1.IncentivesByType.entries": - list := [][]byte{} - return protoreflect.ValueOfList(&_IncentivesByType_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.IncentivesByType")) - } - panic(fmt.Errorf("message slinky.incentives.v1.IncentivesByType does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_IncentivesByType) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.IncentivesByType", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_IncentivesByType) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_IncentivesByType) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_IncentivesByType) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_IncentivesByType) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*IncentivesByType) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.IncentiveType) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.Entries) > 0 { - for _, b := range x.Entries { - l = len(b) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*IncentivesByType) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Entries) > 0 { - for iNdEx := len(x.Entries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Entries[iNdEx]) - copy(dAtA[i:], x.Entries[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Entries[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.IncentiveType) > 0 { - i -= len(x.IncentiveType) - copy(dAtA[i:], x.IncentiveType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.IncentiveType))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*IncentivesByType) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IncentivesByType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: IncentivesByType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IncentiveType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.IncentiveType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Entries = append(x.Entries, make([]byte, postIndex-iNdEx)) - copy(x.Entries[len(x.Entries)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/incentives/v1/genesis.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GenesisState is the genesis-state for the x/incentives module. -type GenesisState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Registry is a list of incentives by type. The registry defined here - // should be a subset of the incentive types defined in the incentive - // module (keeper). - Registry []*IncentivesByType `protobuf:"bytes,1,rep,name=registry,proto3" json:"registry,omitempty"` -} - -func (x *GenesisState) Reset() { - *x = GenesisState{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_genesis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisState) ProtoMessage() {} - -// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. -func (*GenesisState) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_genesis_proto_rawDescGZIP(), []int{0} -} - -func (x *GenesisState) GetRegistry() []*IncentivesByType { - if x != nil { - return x.Registry - } - return nil -} - -// IncentivesByType encapsulates a list of incentives by type. Each of the -// entries here must correspond to the same incentive type defined here. -type IncentivesByType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - // GoodPriceIncentiveType). - IncentiveType string `protobuf:"bytes,1,opt,name=incentive_type,json=incentiveType,proto3" json:"incentive_type,omitempty"` - // Entries is a list of incentive bytes. - Entries [][]byte `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (x *IncentivesByType) Reset() { - *x = IncentivesByType{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_genesis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IncentivesByType) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IncentivesByType) ProtoMessage() {} - -// Deprecated: Use IncentivesByType.ProtoReflect.Descriptor instead. -func (*IncentivesByType) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_genesis_proto_rawDescGZIP(), []int{1} -} - -func (x *IncentivesByType) GetIncentiveType() string { - if x != nil { - return x.IncentiveType - } - return "" -} - -func (x *IncentivesByType) GetEntries() [][]byte { - if x != nil { - return x.Entries - } - return nil -} - -var File_slinky_incentives_v1_genesis_proto protoreflect.FileDescriptor - -var file_slinky_incentives_v1_genesis_proto_rawDesc = []byte{ - 0x0a, 0x22, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, - 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x58, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x48, 0x0a, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, - 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x22, 0x53, 0x0a, 0x10, 0x49, 0x6e, - 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, - 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x42, - 0xce, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, - 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x76, 0x31, - 0xa2, 0x02, 0x03, 0x53, 0x49, 0x58, 0xaa, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, - 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, - 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, - 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x3a, 0x3a, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_incentives_v1_genesis_proto_rawDescOnce sync.Once - file_slinky_incentives_v1_genesis_proto_rawDescData = file_slinky_incentives_v1_genesis_proto_rawDesc -) - -func file_slinky_incentives_v1_genesis_proto_rawDescGZIP() []byte { - file_slinky_incentives_v1_genesis_proto_rawDescOnce.Do(func() { - file_slinky_incentives_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_incentives_v1_genesis_proto_rawDescData) - }) - return file_slinky_incentives_v1_genesis_proto_rawDescData -} - -var file_slinky_incentives_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_slinky_incentives_v1_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: slinky.incentives.v1.GenesisState - (*IncentivesByType)(nil), // 1: slinky.incentives.v1.IncentivesByType -} -var file_slinky_incentives_v1_genesis_proto_depIdxs = []int32{ - 1, // 0: slinky.incentives.v1.GenesisState.registry:type_name -> slinky.incentives.v1.IncentivesByType - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_slinky_incentives_v1_genesis_proto_init() } -func file_slinky_incentives_v1_genesis_proto_init() { - if File_slinky_incentives_v1_genesis_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_incentives_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_incentives_v1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IncentivesByType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_incentives_v1_genesis_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_incentives_v1_genesis_proto_goTypes, - DependencyIndexes: file_slinky_incentives_v1_genesis_proto_depIdxs, - MessageInfos: file_slinky_incentives_v1_genesis_proto_msgTypes, - }.Build() - File_slinky_incentives_v1_genesis_proto = out.File - file_slinky_incentives_v1_genesis_proto_rawDesc = nil - file_slinky_incentives_v1_genesis_proto_goTypes = nil - file_slinky_incentives_v1_genesis_proto_depIdxs = nil -} diff --git a/api/slinky/incentives/v1/query.pulsar.go b/api/slinky/incentives/v1/query.pulsar.go deleted file mode 100644 index e353508eb..000000000 --- a/api/slinky/incentives/v1/query.pulsar.go +++ /dev/null @@ -1,2097 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package incentivesv1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_GetIncentivesByTypeRequest protoreflect.MessageDescriptor - fd_GetIncentivesByTypeRequest_incentive_type protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_query_proto_init() - md_GetIncentivesByTypeRequest = File_slinky_incentives_v1_query_proto.Messages().ByName("GetIncentivesByTypeRequest") - fd_GetIncentivesByTypeRequest_incentive_type = md_GetIncentivesByTypeRequest.Fields().ByName("incentive_type") -} - -var _ protoreflect.Message = (*fastReflection_GetIncentivesByTypeRequest)(nil) - -type fastReflection_GetIncentivesByTypeRequest GetIncentivesByTypeRequest - -func (x *GetIncentivesByTypeRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetIncentivesByTypeRequest)(x) -} - -func (x *GetIncentivesByTypeRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetIncentivesByTypeRequest_messageType fastReflection_GetIncentivesByTypeRequest_messageType -var _ protoreflect.MessageType = fastReflection_GetIncentivesByTypeRequest_messageType{} - -type fastReflection_GetIncentivesByTypeRequest_messageType struct{} - -func (x fastReflection_GetIncentivesByTypeRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetIncentivesByTypeRequest)(nil) -} -func (x fastReflection_GetIncentivesByTypeRequest_messageType) New() protoreflect.Message { - return new(fastReflection_GetIncentivesByTypeRequest) -} -func (x fastReflection_GetIncentivesByTypeRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetIncentivesByTypeRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetIncentivesByTypeRequest) Descriptor() protoreflect.MessageDescriptor { - return md_GetIncentivesByTypeRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetIncentivesByTypeRequest) Type() protoreflect.MessageType { - return _fastReflection_GetIncentivesByTypeRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetIncentivesByTypeRequest) New() protoreflect.Message { - return new(fastReflection_GetIncentivesByTypeRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetIncentivesByTypeRequest) Interface() protoreflect.ProtoMessage { - return (*GetIncentivesByTypeRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetIncentivesByTypeRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.IncentiveType != "" { - value := protoreflect.ValueOfString(x.IncentiveType) - if !f(fd_GetIncentivesByTypeRequest_incentive_type, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetIncentivesByTypeRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeRequest.incentive_type": - return x.IncentiveType != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeRequest.incentive_type": - x.IncentiveType = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetIncentivesByTypeRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeRequest.incentive_type": - value := x.IncentiveType - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeRequest.incentive_type": - x.IncentiveType = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeRequest.incentive_type": - panic(fmt.Errorf("field incentive_type of message slinky.incentives.v1.GetIncentivesByTypeRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetIncentivesByTypeRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeRequest.incentive_type": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetIncentivesByTypeRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.GetIncentivesByTypeRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetIncentivesByTypeRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetIncentivesByTypeRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetIncentivesByTypeRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetIncentivesByTypeRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.IncentiveType) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetIncentivesByTypeRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.IncentiveType) > 0 { - i -= len(x.IncentiveType) - copy(dAtA[i:], x.IncentiveType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.IncentiveType))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetIncentivesByTypeRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetIncentivesByTypeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetIncentivesByTypeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IncentiveType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.IncentiveType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_GetIncentivesByTypeResponse_1_list)(nil) - -type _GetIncentivesByTypeResponse_1_list struct { - list *[][]byte -} - -func (x *_GetIncentivesByTypeResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GetIncentivesByTypeResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfBytes((*x.list)[i]) -} - -func (x *_GetIncentivesByTypeResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Bytes() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_GetIncentivesByTypeResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Bytes() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_GetIncentivesByTypeResponse_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message GetIncentivesByTypeResponse at list field Entries as it is not of Message kind")) -} - -func (x *_GetIncentivesByTypeResponse_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_GetIncentivesByTypeResponse_1_list) NewElement() protoreflect.Value { - var v []byte - return protoreflect.ValueOfBytes(v) -} - -func (x *_GetIncentivesByTypeResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GetIncentivesByTypeResponse protoreflect.MessageDescriptor - fd_GetIncentivesByTypeResponse_entries protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_query_proto_init() - md_GetIncentivesByTypeResponse = File_slinky_incentives_v1_query_proto.Messages().ByName("GetIncentivesByTypeResponse") - fd_GetIncentivesByTypeResponse_entries = md_GetIncentivesByTypeResponse.Fields().ByName("entries") -} - -var _ protoreflect.Message = (*fastReflection_GetIncentivesByTypeResponse)(nil) - -type fastReflection_GetIncentivesByTypeResponse GetIncentivesByTypeResponse - -func (x *GetIncentivesByTypeResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetIncentivesByTypeResponse)(x) -} - -func (x *GetIncentivesByTypeResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetIncentivesByTypeResponse_messageType fastReflection_GetIncentivesByTypeResponse_messageType -var _ protoreflect.MessageType = fastReflection_GetIncentivesByTypeResponse_messageType{} - -type fastReflection_GetIncentivesByTypeResponse_messageType struct{} - -func (x fastReflection_GetIncentivesByTypeResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetIncentivesByTypeResponse)(nil) -} -func (x fastReflection_GetIncentivesByTypeResponse_messageType) New() protoreflect.Message { - return new(fastReflection_GetIncentivesByTypeResponse) -} -func (x fastReflection_GetIncentivesByTypeResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetIncentivesByTypeResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetIncentivesByTypeResponse) Descriptor() protoreflect.MessageDescriptor { - return md_GetIncentivesByTypeResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetIncentivesByTypeResponse) Type() protoreflect.MessageType { - return _fastReflection_GetIncentivesByTypeResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetIncentivesByTypeResponse) New() protoreflect.Message { - return new(fastReflection_GetIncentivesByTypeResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetIncentivesByTypeResponse) Interface() protoreflect.ProtoMessage { - return (*GetIncentivesByTypeResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetIncentivesByTypeResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Entries) != 0 { - value := protoreflect.ValueOfList(&_GetIncentivesByTypeResponse_1_list{list: &x.Entries}) - if !f(fd_GetIncentivesByTypeResponse_entries, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetIncentivesByTypeResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeResponse.entries": - return len(x.Entries) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeResponse.entries": - x.Entries = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetIncentivesByTypeResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeResponse.entries": - if len(x.Entries) == 0 { - return protoreflect.ValueOfList(&_GetIncentivesByTypeResponse_1_list{}) - } - listValue := &_GetIncentivesByTypeResponse_1_list{list: &x.Entries} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeResponse.entries": - lv := value.List() - clv := lv.(*_GetIncentivesByTypeResponse_1_list) - x.Entries = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeResponse.entries": - if x.Entries == nil { - x.Entries = [][]byte{} - } - value := &_GetIncentivesByTypeResponse_1_list{list: &x.Entries} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetIncentivesByTypeResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GetIncentivesByTypeResponse.entries": - list := [][]byte{} - return protoreflect.ValueOfList(&_GetIncentivesByTypeResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetIncentivesByTypeResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetIncentivesByTypeResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetIncentivesByTypeResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.GetIncentivesByTypeResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetIncentivesByTypeResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetIncentivesByTypeResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetIncentivesByTypeResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetIncentivesByTypeResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetIncentivesByTypeResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Entries) > 0 { - for _, b := range x.Entries { - l = len(b) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetIncentivesByTypeResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Entries) > 0 { - for iNdEx := len(x.Entries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Entries[iNdEx]) - copy(dAtA[i:], x.Entries[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Entries[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetIncentivesByTypeResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetIncentivesByTypeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetIncentivesByTypeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Entries = append(x.Entries, make([]byte, postIndex-iNdEx)) - copy(x.Entries[len(x.Entries)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_GetAllIncentivesRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_incentives_v1_query_proto_init() - md_GetAllIncentivesRequest = File_slinky_incentives_v1_query_proto.Messages().ByName("GetAllIncentivesRequest") -} - -var _ protoreflect.Message = (*fastReflection_GetAllIncentivesRequest)(nil) - -type fastReflection_GetAllIncentivesRequest GetAllIncentivesRequest - -func (x *GetAllIncentivesRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetAllIncentivesRequest)(x) -} - -func (x *GetAllIncentivesRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetAllIncentivesRequest_messageType fastReflection_GetAllIncentivesRequest_messageType -var _ protoreflect.MessageType = fastReflection_GetAllIncentivesRequest_messageType{} - -type fastReflection_GetAllIncentivesRequest_messageType struct{} - -func (x fastReflection_GetAllIncentivesRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetAllIncentivesRequest)(nil) -} -func (x fastReflection_GetAllIncentivesRequest_messageType) New() protoreflect.Message { - return new(fastReflection_GetAllIncentivesRequest) -} -func (x fastReflection_GetAllIncentivesRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllIncentivesRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetAllIncentivesRequest) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllIncentivesRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetAllIncentivesRequest) Type() protoreflect.MessageType { - return _fastReflection_GetAllIncentivesRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetAllIncentivesRequest) New() protoreflect.Message { - return new(fastReflection_GetAllIncentivesRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetAllIncentivesRequest) Interface() protoreflect.ProtoMessage { - return (*GetAllIncentivesRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetAllIncentivesRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetAllIncentivesRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetAllIncentivesRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetAllIncentivesRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesRequest")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetAllIncentivesRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.GetAllIncentivesRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetAllIncentivesRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetAllIncentivesRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetAllIncentivesRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetAllIncentivesRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetAllIncentivesRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetAllIncentivesRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllIncentivesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllIncentivesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_GetAllIncentivesResponse_1_list)(nil) - -type _GetAllIncentivesResponse_1_list struct { - list *[]*IncentivesByType -} - -func (x *_GetAllIncentivesResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GetAllIncentivesResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GetAllIncentivesResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*IncentivesByType) - (*x.list)[i] = concreteValue -} - -func (x *_GetAllIncentivesResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*IncentivesByType) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GetAllIncentivesResponse_1_list) AppendMutable() protoreflect.Value { - v := new(IncentivesByType) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GetAllIncentivesResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GetAllIncentivesResponse_1_list) NewElement() protoreflect.Value { - v := new(IncentivesByType) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GetAllIncentivesResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GetAllIncentivesResponse protoreflect.MessageDescriptor - fd_GetAllIncentivesResponse_registry protoreflect.FieldDescriptor -) - -func init() { - file_slinky_incentives_v1_query_proto_init() - md_GetAllIncentivesResponse = File_slinky_incentives_v1_query_proto.Messages().ByName("GetAllIncentivesResponse") - fd_GetAllIncentivesResponse_registry = md_GetAllIncentivesResponse.Fields().ByName("registry") -} - -var _ protoreflect.Message = (*fastReflection_GetAllIncentivesResponse)(nil) - -type fastReflection_GetAllIncentivesResponse GetAllIncentivesResponse - -func (x *GetAllIncentivesResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetAllIncentivesResponse)(x) -} - -func (x *GetAllIncentivesResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetAllIncentivesResponse_messageType fastReflection_GetAllIncentivesResponse_messageType -var _ protoreflect.MessageType = fastReflection_GetAllIncentivesResponse_messageType{} - -type fastReflection_GetAllIncentivesResponse_messageType struct{} - -func (x fastReflection_GetAllIncentivesResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetAllIncentivesResponse)(nil) -} -func (x fastReflection_GetAllIncentivesResponse_messageType) New() protoreflect.Message { - return new(fastReflection_GetAllIncentivesResponse) -} -func (x fastReflection_GetAllIncentivesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllIncentivesResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetAllIncentivesResponse) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllIncentivesResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetAllIncentivesResponse) Type() protoreflect.MessageType { - return _fastReflection_GetAllIncentivesResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetAllIncentivesResponse) New() protoreflect.Message { - return new(fastReflection_GetAllIncentivesResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetAllIncentivesResponse) Interface() protoreflect.ProtoMessage { - return (*GetAllIncentivesResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetAllIncentivesResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Registry) != 0 { - value := protoreflect.ValueOfList(&_GetAllIncentivesResponse_1_list{list: &x.Registry}) - if !f(fd_GetAllIncentivesResponse_registry, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetAllIncentivesResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.incentives.v1.GetAllIncentivesResponse.registry": - return len(x.Registry) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.incentives.v1.GetAllIncentivesResponse.registry": - x.Registry = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetAllIncentivesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.incentives.v1.GetAllIncentivesResponse.registry": - if len(x.Registry) == 0 { - return protoreflect.ValueOfList(&_GetAllIncentivesResponse_1_list{}) - } - listValue := &_GetAllIncentivesResponse_1_list{list: &x.Registry} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.incentives.v1.GetAllIncentivesResponse.registry": - lv := value.List() - clv := lv.(*_GetAllIncentivesResponse_1_list) - x.Registry = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GetAllIncentivesResponse.registry": - if x.Registry == nil { - x.Registry = []*IncentivesByType{} - } - value := &_GetAllIncentivesResponse_1_list{list: &x.Registry} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetAllIncentivesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.incentives.v1.GetAllIncentivesResponse.registry": - list := []*IncentivesByType{} - return protoreflect.ValueOfList(&_GetAllIncentivesResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.incentives.v1.GetAllIncentivesResponse")) - } - panic(fmt.Errorf("message slinky.incentives.v1.GetAllIncentivesResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetAllIncentivesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.incentives.v1.GetAllIncentivesResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetAllIncentivesResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllIncentivesResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetAllIncentivesResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetAllIncentivesResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetAllIncentivesResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Registry) > 0 { - for _, e := range x.Registry { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetAllIncentivesResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Registry) > 0 { - for iNdEx := len(x.Registry) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Registry[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetAllIncentivesResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllIncentivesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllIncentivesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Registry", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Registry = append(x.Registry, &IncentivesByType{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Registry[len(x.Registry)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/incentives/v1/query.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GetIncentivesByTypeRequest is the request type for the -// Query/GetIncentivesByType RPC method. -type GetIncentivesByTypeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - // GoodPriceIncentiveType). - IncentiveType string `protobuf:"bytes,1,opt,name=incentive_type,json=incentiveType,proto3" json:"incentive_type,omitempty"` -} - -func (x *GetIncentivesByTypeRequest) Reset() { - *x = GetIncentivesByTypeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetIncentivesByTypeRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetIncentivesByTypeRequest) ProtoMessage() {} - -// Deprecated: Use GetIncentivesByTypeRequest.ProtoReflect.Descriptor instead. -func (*GetIncentivesByTypeRequest) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_query_proto_rawDescGZIP(), []int{0} -} - -func (x *GetIncentivesByTypeRequest) GetIncentiveType() string { - if x != nil { - return x.IncentiveType - } - return "" -} - -// GetIncentivesByTypeResponse is the response type for the -// Query/GetIncentivesByType RPC method. -type GetIncentivesByTypeResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Entries is the list of incentives of the given type. - Entries [][]byte `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (x *GetIncentivesByTypeResponse) Reset() { - *x = GetIncentivesByTypeResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetIncentivesByTypeResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetIncentivesByTypeResponse) ProtoMessage() {} - -// Deprecated: Use GetIncentivesByTypeResponse.ProtoReflect.Descriptor instead. -func (*GetIncentivesByTypeResponse) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_query_proto_rawDescGZIP(), []int{1} -} - -func (x *GetIncentivesByTypeResponse) GetEntries() [][]byte { - if x != nil { - return x.Entries - } - return nil -} - -// GetAllIncentivesRequest is the request type for the Query/GetAllIncentives -// RPC method. -type GetAllIncentivesRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetAllIncentivesRequest) Reset() { - *x = GetAllIncentivesRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetAllIncentivesRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAllIncentivesRequest) ProtoMessage() {} - -// Deprecated: Use GetAllIncentivesRequest.ProtoReflect.Descriptor instead. -func (*GetAllIncentivesRequest) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_query_proto_rawDescGZIP(), []int{2} -} - -// GetAllIncentivesResponse is the response type for the Query/GetAllIncentives -// RPC method. -type GetAllIncentivesResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Registry is the list of all incentives, grouped by type. - Registry []*IncentivesByType `protobuf:"bytes,1,rep,name=registry,proto3" json:"registry,omitempty"` -} - -func (x *GetAllIncentivesResponse) Reset() { - *x = GetAllIncentivesResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_incentives_v1_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetAllIncentivesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAllIncentivesResponse) ProtoMessage() {} - -// Deprecated: Use GetAllIncentivesResponse.ProtoReflect.Descriptor instead. -func (*GetAllIncentivesResponse) Descriptor() ([]byte, []int) { - return file_slinky_incentives_v1_query_proto_rawDescGZIP(), []int{3} -} - -func (x *GetAllIncentivesResponse) GetRegistry() []*IncentivesByType { - if x != nil { - return x.Registry - } - return nil -} - -var File_slinky_incentives_v1_query_proto protoreflect.FileDescriptor - -var file_slinky_incentives_v1_query_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x14, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x43, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, - 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, - 0x0a, 0x0e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x37, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x63, 0x65, - 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x22, 0x19, - 0x0a, 0x17, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x64, 0x0a, 0x18, 0x47, 0x65, 0x74, - 0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x49, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x32, - 0xf1, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0xc1, 0x01, 0x0a, 0x13, 0x47, 0x65, - 0x74, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x30, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x63, 0x65, - 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, - 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, - 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x42, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x45, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3f, 0x12, 0x3d, - 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x74, 0x5f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, - 0x69, 0x76, 0x65, 0x73, 0x5f, 0x62, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x7b, 0x69, 0x6e, - 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x7d, 0x12, 0xa3, 0x01, - 0x0a, 0x10, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x12, 0x2d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, - 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, - 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, - 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x49, - 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2f, 0x76, 0x31, - 0x2f, 0x67, 0x65, 0x74, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x42, 0xcc, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, - 0x65, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, - 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x49, 0x58, 0xaa, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x56, 0x31, 0xca, - 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, - 0x76, 0x65, 0x73, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x20, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, - 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x16, 0x53, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x3a, 0x3a, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x73, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_incentives_v1_query_proto_rawDescOnce sync.Once - file_slinky_incentives_v1_query_proto_rawDescData = file_slinky_incentives_v1_query_proto_rawDesc -) - -func file_slinky_incentives_v1_query_proto_rawDescGZIP() []byte { - file_slinky_incentives_v1_query_proto_rawDescOnce.Do(func() { - file_slinky_incentives_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_incentives_v1_query_proto_rawDescData) - }) - return file_slinky_incentives_v1_query_proto_rawDescData -} - -var file_slinky_incentives_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_slinky_incentives_v1_query_proto_goTypes = []interface{}{ - (*GetIncentivesByTypeRequest)(nil), // 0: slinky.incentives.v1.GetIncentivesByTypeRequest - (*GetIncentivesByTypeResponse)(nil), // 1: slinky.incentives.v1.GetIncentivesByTypeResponse - (*GetAllIncentivesRequest)(nil), // 2: slinky.incentives.v1.GetAllIncentivesRequest - (*GetAllIncentivesResponse)(nil), // 3: slinky.incentives.v1.GetAllIncentivesResponse - (*IncentivesByType)(nil), // 4: slinky.incentives.v1.IncentivesByType -} -var file_slinky_incentives_v1_query_proto_depIdxs = []int32{ - 4, // 0: slinky.incentives.v1.GetAllIncentivesResponse.registry:type_name -> slinky.incentives.v1.IncentivesByType - 0, // 1: slinky.incentives.v1.Query.GetIncentivesByType:input_type -> slinky.incentives.v1.GetIncentivesByTypeRequest - 2, // 2: slinky.incentives.v1.Query.GetAllIncentives:input_type -> slinky.incentives.v1.GetAllIncentivesRequest - 1, // 3: slinky.incentives.v1.Query.GetIncentivesByType:output_type -> slinky.incentives.v1.GetIncentivesByTypeResponse - 3, // 4: slinky.incentives.v1.Query.GetAllIncentives:output_type -> slinky.incentives.v1.GetAllIncentivesResponse - 3, // [3:5] is the sub-list for method output_type - 1, // [1:3] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_slinky_incentives_v1_query_proto_init() } -func file_slinky_incentives_v1_query_proto_init() { - if File_slinky_incentives_v1_query_proto != nil { - return - } - file_slinky_incentives_v1_genesis_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_incentives_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetIncentivesByTypeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_incentives_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetIncentivesByTypeResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_incentives_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAllIncentivesRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_incentives_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAllIncentivesResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_incentives_v1_query_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_incentives_v1_query_proto_goTypes, - DependencyIndexes: file_slinky_incentives_v1_query_proto_depIdxs, - MessageInfos: file_slinky_incentives_v1_query_proto_msgTypes, - }.Build() - File_slinky_incentives_v1_query_proto = out.File - file_slinky_incentives_v1_query_proto_rawDesc = nil - file_slinky_incentives_v1_query_proto_goTypes = nil - file_slinky_incentives_v1_query_proto_depIdxs = nil -} diff --git a/api/slinky/incentives/v1/query_grpc.pb.go b/api/slinky/incentives/v1/query_grpc.pb.go deleted file mode 100644 index f6760e7e5..000000000 --- a/api/slinky/incentives/v1/query_grpc.pb.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc (unknown) -// source: slinky/incentives/v1/query.proto - -package incentivesv1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Query_GetIncentivesByType_FullMethodName = "/slinky.incentives.v1.Query/GetIncentivesByType" - Query_GetAllIncentives_FullMethodName = "/slinky.incentives.v1.Query/GetAllIncentives" -) - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Query is the query service for the x/incentives module. -type QueryClient interface { - // GetIncentivesByType returns all incentives of a given type. If the type is - // not registered with the module, an error is returned. - GetIncentivesByType(ctx context.Context, in *GetIncentivesByTypeRequest, opts ...grpc.CallOption) (*GetIncentivesByTypeResponse, error) - // GetAllIncentives returns all incentives. - GetAllIncentives(ctx context.Context, in *GetAllIncentivesRequest, opts ...grpc.CallOption) (*GetAllIncentivesResponse, error) -} - -type queryClient struct { - cc grpc.ClientConnInterface -} - -func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) GetIncentivesByType(ctx context.Context, in *GetIncentivesByTypeRequest, opts ...grpc.CallOption) (*GetIncentivesByTypeResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetIncentivesByTypeResponse) - err := c.cc.Invoke(ctx, Query_GetIncentivesByType_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GetAllIncentives(ctx context.Context, in *GetAllIncentivesRequest, opts ...grpc.CallOption) (*GetAllIncentivesResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetAllIncentivesResponse) - err := c.cc.Invoke(ctx, Query_GetAllIncentives_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -// All implementations must embed UnimplementedQueryServer -// for forward compatibility. -// -// Query is the query service for the x/incentives module. -type QueryServer interface { - // GetIncentivesByType returns all incentives of a given type. If the type is - // not registered with the module, an error is returned. - GetIncentivesByType(context.Context, *GetIncentivesByTypeRequest) (*GetIncentivesByTypeResponse, error) - // GetAllIncentives returns all incentives. - GetAllIncentives(context.Context, *GetAllIncentivesRequest) (*GetAllIncentivesResponse, error) - mustEmbedUnimplementedQueryServer() -} - -// UnimplementedQueryServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedQueryServer struct{} - -func (UnimplementedQueryServer) GetIncentivesByType(context.Context, *GetIncentivesByTypeRequest) (*GetIncentivesByTypeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetIncentivesByType not implemented") -} -func (UnimplementedQueryServer) GetAllIncentives(context.Context, *GetAllIncentivesRequest) (*GetAllIncentivesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllIncentives not implemented") -} -func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} -func (UnimplementedQueryServer) testEmbeddedByValue() {} - -// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to QueryServer will -// result in compilation errors. -type UnsafeQueryServer interface { - mustEmbedUnimplementedQueryServer() -} - -func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { - // If the following call pancis, it indicates UnimplementedQueryServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Query_ServiceDesc, srv) -} - -func _Query_GetIncentivesByType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetIncentivesByTypeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetIncentivesByType(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_GetIncentivesByType_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetIncentivesByType(ctx, req.(*GetIncentivesByTypeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GetAllIncentives_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllIncentivesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetAllIncentives(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_GetAllIncentives_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllIncentives(ctx, req.(*GetAllIncentivesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Query_ServiceDesc is the grpc.ServiceDesc for Query service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Query_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.incentives.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetIncentivesByType", - Handler: _Query_GetIncentivesByType_Handler, - }, - { - MethodName: "GetAllIncentives", - Handler: _Query_GetAllIncentives_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/incentives/v1/query.proto", -} diff --git a/api/slinky/sla/module/v1/module.pulsar.go b/api/slinky/sla/module/v1/module.pulsar.go deleted file mode 100644 index 512dec1f9..000000000 --- a/api/slinky/sla/module/v1/module.pulsar.go +++ /dev/null @@ -1,582 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package modulev1 - -import ( - _ "cosmossdk.io/api/cosmos/app/v1alpha1" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_Module protoreflect.MessageDescriptor - fd_Module_authority protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_module_v1_module_proto_init() - md_Module = File_slinky_sla_module_v1_module_proto.Messages().ByName("Module") - fd_Module_authority = md_Module.Fields().ByName("authority") -} - -var _ protoreflect.Message = (*fastReflection_Module)(nil) - -type fastReflection_Module Module - -func (x *Module) ProtoReflect() protoreflect.Message { - return (*fastReflection_Module)(x) -} - -func (x *Module) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_module_v1_module_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Module_messageType fastReflection_Module_messageType -var _ protoreflect.MessageType = fastReflection_Module_messageType{} - -type fastReflection_Module_messageType struct{} - -func (x fastReflection_Module_messageType) Zero() protoreflect.Message { - return (*fastReflection_Module)(nil) -} -func (x fastReflection_Module_messageType) New() protoreflect.Message { - return new(fastReflection_Module) -} -func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Module) Type() protoreflect.MessageType { - return _fastReflection_Module_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Module) New() protoreflect.Message { - return new(fastReflection_Module) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { - return (*Module)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_Module_authority, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.module.v1.Module.authority": - return x.Authority != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.sla.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.module.v1.Module.authority": - x.Authority = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.sla.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.module.v1.Module.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.sla.module.v1.Module does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.module.v1.Module.authority": - x.Authority = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.sla.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.module.v1.Module.authority": - panic(fmt.Errorf("field authority of message slinky.sla.module.v1.Module is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.sla.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.module.v1.Module.authority": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.sla.module.v1.Module does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.module.v1.Module", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Module) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/sla/module/v1/module.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Module is the config object of the builder module. -type Module struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Authority defines the custom module authority. If not set, defaults to the - // governance module. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *Module) Reset() { - *x = Module{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_module_v1_module_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Module) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Module) ProtoMessage() {} - -// Deprecated: Use Module.ProtoReflect.Descriptor instead. -func (*Module) Descriptor() ([]byte, []int) { - return file_slinky_sla_module_v1_module_proto_rawDescGZIP(), []int{0} -} - -func (x *Module) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -var File_slinky_sla_module_v1_module_proto protoreflect.FileDescriptor - -var file_slinky_sla_module_v1_module_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x6d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, - 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x28, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x22, - 0x0a, 0x20, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6b, 0x69, - 0x70, 0x2d, 0x6d, 0x65, 0x76, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x73, - 0x6c, 0x61, 0x42, 0xca, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, - 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x6d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x53, 0x53, 0x4d, 0xaa, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x53, 0x6c, - 0x61, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x20, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x53, 0x6c, 0x61, 0x5c, - 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, - 0x53, 0x6c, 0x61, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_sla_module_v1_module_proto_rawDescOnce sync.Once - file_slinky_sla_module_v1_module_proto_rawDescData = file_slinky_sla_module_v1_module_proto_rawDesc -) - -func file_slinky_sla_module_v1_module_proto_rawDescGZIP() []byte { - file_slinky_sla_module_v1_module_proto_rawDescOnce.Do(func() { - file_slinky_sla_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_sla_module_v1_module_proto_rawDescData) - }) - return file_slinky_sla_module_v1_module_proto_rawDescData -} - -var file_slinky_sla_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_sla_module_v1_module_proto_goTypes = []interface{}{ - (*Module)(nil), // 0: slinky.sla.module.v1.Module -} -var file_slinky_sla_module_v1_module_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_slinky_sla_module_v1_module_proto_init() } -func file_slinky_sla_module_v1_module_proto_init() { - if File_slinky_sla_module_v1_module_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_sla_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Module); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_sla_module_v1_module_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_sla_module_v1_module_proto_goTypes, - DependencyIndexes: file_slinky_sla_module_v1_module_proto_depIdxs, - MessageInfos: file_slinky_sla_module_v1_module_proto_msgTypes, - }.Build() - File_slinky_sla_module_v1_module_proto = out.File - file_slinky_sla_module_v1_module_proto_rawDesc = nil - file_slinky_sla_module_v1_module_proto_goTypes = nil - file_slinky_sla_module_v1_module_proto_depIdxs = nil -} diff --git a/api/slinky/sla/v1/genesis.pulsar.go b/api/slinky/sla/v1/genesis.pulsar.go deleted file mode 100644 index 02770e736..000000000 --- a/api/slinky/sla/v1/genesis.pulsar.go +++ /dev/null @@ -1,3100 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package slav1 - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - _ "github.com/skip-mev/slinky/api/slinky/oracle/v1" - v1 "github.com/skip-mev/slinky/api/slinky/types/v1" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var _ protoreflect.List = (*_GenesisState_1_list)(nil) - -type _GenesisState_1_list struct { - list *[]*PriceFeedSLA -} - -func (x *_GenesisState_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GenesisState_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GenesisState_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeedSLA) - (*x.list)[i] = concreteValue -} - -func (x *_GenesisState_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeedSLA) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GenesisState_1_list) AppendMutable() protoreflect.Value { - v := new(PriceFeedSLA) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GenesisState_1_list) NewElement() protoreflect.Value { - v := new(PriceFeedSLA) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_1_list) IsValid() bool { - return x.list != nil -} - -var _ protoreflect.List = (*_GenesisState_2_list)(nil) - -type _GenesisState_2_list struct { - list *[]*PriceFeed -} - -func (x *_GenesisState_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeed) - (*x.list)[i] = concreteValue -} - -func (x *_GenesisState_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeed) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { - v := new(PriceFeed) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GenesisState_2_list) NewElement() protoreflect.Value { - v := new(PriceFeed) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GenesisState_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_slas protoreflect.FieldDescriptor - fd_GenesisState_price_feeds protoreflect.FieldDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_genesis_proto_init() - md_GenesisState = File_slinky_sla_v1_genesis_proto.Messages().ByName("GenesisState") - fd_GenesisState_slas = md_GenesisState.Fields().ByName("slas") - fd_GenesisState_price_feeds = md_GenesisState.Fields().ByName("price_feeds") - fd_GenesisState_params = md_GenesisState.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) - -type fastReflection_GenesisState GenesisState - -func (x *GenesisState) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisState)(x) -} - -func (x *GenesisState) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType -var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} - -type fastReflection_GenesisState_messageType struct{} - -func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisState)(nil) -} -func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} -func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GenesisState) Type() protoreflect.MessageType { - return _fastReflection_GenesisState_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisState) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { - return (*GenesisState)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Slas) != 0 { - value := protoreflect.ValueOfList(&_GenesisState_1_list{list: &x.Slas}) - if !f(fd_GenesisState_slas, value) { - return - } - } - if len(x.PriceFeeds) != 0 { - value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.PriceFeeds}) - if !f(fd_GenesisState_price_feeds, value) { - return - } - } - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_GenesisState_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.GenesisState.slas": - return len(x.Slas) != 0 - case "slinky.sla.v1.GenesisState.price_feeds": - return len(x.PriceFeeds) != 0 - case "slinky.sla.v1.GenesisState.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.sla.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.GenesisState.slas": - x.Slas = nil - case "slinky.sla.v1.GenesisState.price_feeds": - x.PriceFeeds = nil - case "slinky.sla.v1.GenesisState.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.sla.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.GenesisState.slas": - if len(x.Slas) == 0 { - return protoreflect.ValueOfList(&_GenesisState_1_list{}) - } - listValue := &_GenesisState_1_list{list: &x.Slas} - return protoreflect.ValueOfList(listValue) - case "slinky.sla.v1.GenesisState.price_feeds": - if len(x.PriceFeeds) == 0 { - return protoreflect.ValueOfList(&_GenesisState_2_list{}) - } - listValue := &_GenesisState_2_list{list: &x.PriceFeeds} - return protoreflect.ValueOfList(listValue) - case "slinky.sla.v1.GenesisState.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.sla.v1.GenesisState does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.GenesisState.slas": - lv := value.List() - clv := lv.(*_GenesisState_1_list) - x.Slas = *clv.list - case "slinky.sla.v1.GenesisState.price_feeds": - lv := value.List() - clv := lv.(*_GenesisState_2_list) - x.PriceFeeds = *clv.list - case "slinky.sla.v1.GenesisState.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.sla.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GenesisState.slas": - if x.Slas == nil { - x.Slas = []*PriceFeedSLA{} - } - value := &_GenesisState_1_list{list: &x.Slas} - return protoreflect.ValueOfList(value) - case "slinky.sla.v1.GenesisState.price_feeds": - if x.PriceFeeds == nil { - x.PriceFeeds = []*PriceFeed{} - } - value := &_GenesisState_2_list{list: &x.PriceFeeds} - return protoreflect.ValueOfList(value) - case "slinky.sla.v1.GenesisState.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.sla.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GenesisState.slas": - list := []*PriceFeedSLA{} - return protoreflect.ValueOfList(&_GenesisState_1_list{list: &list}) - case "slinky.sla.v1.GenesisState.price_feeds": - list := []*PriceFeed{} - return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) - case "slinky.sla.v1.GenesisState.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.sla.v1.GenesisState does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.GenesisState", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GenesisState) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Slas) > 0 { - for _, e := range x.Slas { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.PriceFeeds) > 0 { - for _, e := range x.PriceFeeds { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if len(x.PriceFeeds) > 0 { - for iNdEx := len(x.PriceFeeds) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.PriceFeeds[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.Slas) > 0 { - for iNdEx := len(x.Slas) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Slas[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Slas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Slas = append(x.Slas, &PriceFeedSLA{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Slas[len(x.Slas)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PriceFeeds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.PriceFeeds = append(x.PriceFeeds, &PriceFeed{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PriceFeeds[len(x.PriceFeeds)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_Params protoreflect.MessageDescriptor - fd_Params_enabled protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_genesis_proto_init() - md_Params = File_slinky_sla_v1_genesis_proto.Messages().ByName("Params") - fd_Params_enabled = md_Params.Fields().ByName("enabled") -} - -var _ protoreflect.Message = (*fastReflection_Params)(nil) - -type fastReflection_Params Params - -func (x *Params) ProtoReflect() protoreflect.Message { - return (*fastReflection_Params)(x) -} - -func (x *Params) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_Params_messageType fastReflection_Params_messageType -var _ protoreflect.MessageType = fastReflection_Params_messageType{} - -type fastReflection_Params_messageType struct{} - -func (x fastReflection_Params_messageType) Zero() protoreflect.Message { - return (*fastReflection_Params)(nil) -} -func (x fastReflection_Params_messageType) New() protoreflect.Message { - return new(fastReflection_Params) -} -func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_Params) Type() protoreflect.MessageType { - return _fastReflection_Params_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Params) New() protoreflect.Message { - return new(fastReflection_Params) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { - return (*Params)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Enabled != false { - value := protoreflect.ValueOfBool(x.Enabled) - if !f(fd_Params_enabled, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.Params.enabled": - return x.Enabled != false - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.Params")) - } - panic(fmt.Errorf("message slinky.sla.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.Params.enabled": - x.Enabled = false - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.Params")) - } - panic(fmt.Errorf("message slinky.sla.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.Params.enabled": - value := x.Enabled - return protoreflect.ValueOfBool(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.Params")) - } - panic(fmt.Errorf("message slinky.sla.v1.Params does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.Params.enabled": - x.Enabled = value.Bool() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.Params")) - } - panic(fmt.Errorf("message slinky.sla.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.Params.enabled": - panic(fmt.Errorf("field enabled of message slinky.sla.v1.Params is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.Params")) - } - panic(fmt.Errorf("message slinky.sla.v1.Params does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.Params.enabled": - return protoreflect.ValueOfBool(false) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.Params")) - } - panic(fmt.Errorf("message slinky.sla.v1.Params does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.Params", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Params) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Enabled { - n += 2 - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Enabled { - i-- - if x.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Enabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_PriceFeedSLA protoreflect.MessageDescriptor - fd_PriceFeedSLA_maximum_viable_window protoreflect.FieldDescriptor - fd_PriceFeedSLA_expected_uptime protoreflect.FieldDescriptor - fd_PriceFeedSLA_slash_constant protoreflect.FieldDescriptor - fd_PriceFeedSLA_minimum_block_updates protoreflect.FieldDescriptor - fd_PriceFeedSLA_frequency protoreflect.FieldDescriptor - fd_PriceFeedSLA_id protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_genesis_proto_init() - md_PriceFeedSLA = File_slinky_sla_v1_genesis_proto.Messages().ByName("PriceFeedSLA") - fd_PriceFeedSLA_maximum_viable_window = md_PriceFeedSLA.Fields().ByName("maximum_viable_window") - fd_PriceFeedSLA_expected_uptime = md_PriceFeedSLA.Fields().ByName("expected_uptime") - fd_PriceFeedSLA_slash_constant = md_PriceFeedSLA.Fields().ByName("slash_constant") - fd_PriceFeedSLA_minimum_block_updates = md_PriceFeedSLA.Fields().ByName("minimum_block_updates") - fd_PriceFeedSLA_frequency = md_PriceFeedSLA.Fields().ByName("frequency") - fd_PriceFeedSLA_id = md_PriceFeedSLA.Fields().ByName("id") -} - -var _ protoreflect.Message = (*fastReflection_PriceFeedSLA)(nil) - -type fastReflection_PriceFeedSLA PriceFeedSLA - -func (x *PriceFeedSLA) ProtoReflect() protoreflect.Message { - return (*fastReflection_PriceFeedSLA)(x) -} - -func (x *PriceFeedSLA) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_PriceFeedSLA_messageType fastReflection_PriceFeedSLA_messageType -var _ protoreflect.MessageType = fastReflection_PriceFeedSLA_messageType{} - -type fastReflection_PriceFeedSLA_messageType struct{} - -func (x fastReflection_PriceFeedSLA_messageType) Zero() protoreflect.Message { - return (*fastReflection_PriceFeedSLA)(nil) -} -func (x fastReflection_PriceFeedSLA_messageType) New() protoreflect.Message { - return new(fastReflection_PriceFeedSLA) -} -func (x fastReflection_PriceFeedSLA_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_PriceFeedSLA -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_PriceFeedSLA) Descriptor() protoreflect.MessageDescriptor { - return md_PriceFeedSLA -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_PriceFeedSLA) Type() protoreflect.MessageType { - return _fastReflection_PriceFeedSLA_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_PriceFeedSLA) New() protoreflect.Message { - return new(fastReflection_PriceFeedSLA) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_PriceFeedSLA) Interface() protoreflect.ProtoMessage { - return (*PriceFeedSLA)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_PriceFeedSLA) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.MaximumViableWindow != uint64(0) { - value := protoreflect.ValueOfUint64(x.MaximumViableWindow) - if !f(fd_PriceFeedSLA_maximum_viable_window, value) { - return - } - } - if x.ExpectedUptime != "" { - value := protoreflect.ValueOfString(x.ExpectedUptime) - if !f(fd_PriceFeedSLA_expected_uptime, value) { - return - } - } - if x.SlashConstant != "" { - value := protoreflect.ValueOfString(x.SlashConstant) - if !f(fd_PriceFeedSLA_slash_constant, value) { - return - } - } - if x.MinimumBlockUpdates != uint64(0) { - value := protoreflect.ValueOfUint64(x.MinimumBlockUpdates) - if !f(fd_PriceFeedSLA_minimum_block_updates, value) { - return - } - } - if x.Frequency != uint64(0) { - value := protoreflect.ValueOfUint64(x.Frequency) - if !f(fd_PriceFeedSLA_frequency, value) { - return - } - } - if x.Id != "" { - value := protoreflect.ValueOfString(x.Id) - if !f(fd_PriceFeedSLA_id, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_PriceFeedSLA) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeedSLA.maximum_viable_window": - return x.MaximumViableWindow != uint64(0) - case "slinky.sla.v1.PriceFeedSLA.expected_uptime": - return x.ExpectedUptime != "" - case "slinky.sla.v1.PriceFeedSLA.slash_constant": - return x.SlashConstant != "" - case "slinky.sla.v1.PriceFeedSLA.minimum_block_updates": - return x.MinimumBlockUpdates != uint64(0) - case "slinky.sla.v1.PriceFeedSLA.frequency": - return x.Frequency != uint64(0) - case "slinky.sla.v1.PriceFeedSLA.id": - return x.Id != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeedSLA")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeedSLA does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeedSLA) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeedSLA.maximum_viable_window": - x.MaximumViableWindow = uint64(0) - case "slinky.sla.v1.PriceFeedSLA.expected_uptime": - x.ExpectedUptime = "" - case "slinky.sla.v1.PriceFeedSLA.slash_constant": - x.SlashConstant = "" - case "slinky.sla.v1.PriceFeedSLA.minimum_block_updates": - x.MinimumBlockUpdates = uint64(0) - case "slinky.sla.v1.PriceFeedSLA.frequency": - x.Frequency = uint64(0) - case "slinky.sla.v1.PriceFeedSLA.id": - x.Id = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeedSLA")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeedSLA does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_PriceFeedSLA) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.PriceFeedSLA.maximum_viable_window": - value := x.MaximumViableWindow - return protoreflect.ValueOfUint64(value) - case "slinky.sla.v1.PriceFeedSLA.expected_uptime": - value := x.ExpectedUptime - return protoreflect.ValueOfString(value) - case "slinky.sla.v1.PriceFeedSLA.slash_constant": - value := x.SlashConstant - return protoreflect.ValueOfString(value) - case "slinky.sla.v1.PriceFeedSLA.minimum_block_updates": - value := x.MinimumBlockUpdates - return protoreflect.ValueOfUint64(value) - case "slinky.sla.v1.PriceFeedSLA.frequency": - value := x.Frequency - return protoreflect.ValueOfUint64(value) - case "slinky.sla.v1.PriceFeedSLA.id": - value := x.Id - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeedSLA")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeedSLA does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeedSLA) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeedSLA.maximum_viable_window": - x.MaximumViableWindow = value.Uint() - case "slinky.sla.v1.PriceFeedSLA.expected_uptime": - x.ExpectedUptime = value.Interface().(string) - case "slinky.sla.v1.PriceFeedSLA.slash_constant": - x.SlashConstant = value.Interface().(string) - case "slinky.sla.v1.PriceFeedSLA.minimum_block_updates": - x.MinimumBlockUpdates = value.Uint() - case "slinky.sla.v1.PriceFeedSLA.frequency": - x.Frequency = value.Uint() - case "slinky.sla.v1.PriceFeedSLA.id": - x.Id = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeedSLA")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeedSLA does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeedSLA) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeedSLA.maximum_viable_window": - panic(fmt.Errorf("field maximum_viable_window of message slinky.sla.v1.PriceFeedSLA is not mutable")) - case "slinky.sla.v1.PriceFeedSLA.expected_uptime": - panic(fmt.Errorf("field expected_uptime of message slinky.sla.v1.PriceFeedSLA is not mutable")) - case "slinky.sla.v1.PriceFeedSLA.slash_constant": - panic(fmt.Errorf("field slash_constant of message slinky.sla.v1.PriceFeedSLA is not mutable")) - case "slinky.sla.v1.PriceFeedSLA.minimum_block_updates": - panic(fmt.Errorf("field minimum_block_updates of message slinky.sla.v1.PriceFeedSLA is not mutable")) - case "slinky.sla.v1.PriceFeedSLA.frequency": - panic(fmt.Errorf("field frequency of message slinky.sla.v1.PriceFeedSLA is not mutable")) - case "slinky.sla.v1.PriceFeedSLA.id": - panic(fmt.Errorf("field id of message slinky.sla.v1.PriceFeedSLA is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeedSLA")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeedSLA does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_PriceFeedSLA) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeedSLA.maximum_viable_window": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.sla.v1.PriceFeedSLA.expected_uptime": - return protoreflect.ValueOfString("") - case "slinky.sla.v1.PriceFeedSLA.slash_constant": - return protoreflect.ValueOfString("") - case "slinky.sla.v1.PriceFeedSLA.minimum_block_updates": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.sla.v1.PriceFeedSLA.frequency": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.sla.v1.PriceFeedSLA.id": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeedSLA")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeedSLA does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_PriceFeedSLA) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.PriceFeedSLA", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_PriceFeedSLA) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeedSLA) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_PriceFeedSLA) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_PriceFeedSLA) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*PriceFeedSLA) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.MaximumViableWindow != 0 { - n += 1 + runtime.Sov(uint64(x.MaximumViableWindow)) - } - l = len(x.ExpectedUptime) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.SlashConstant) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.MinimumBlockUpdates != 0 { - n += 1 + runtime.Sov(uint64(x.MinimumBlockUpdates)) - } - if x.Frequency != 0 { - n += 1 + runtime.Sov(uint64(x.Frequency)) - } - l = len(x.Id) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*PriceFeedSLA) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Id) > 0 { - i -= len(x.Id) - copy(dAtA[i:], x.Id) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) - i-- - dAtA[i] = 0x32 - } - if x.Frequency != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Frequency)) - i-- - dAtA[i] = 0x28 - } - if x.MinimumBlockUpdates != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.MinimumBlockUpdates)) - i-- - dAtA[i] = 0x20 - } - if len(x.SlashConstant) > 0 { - i -= len(x.SlashConstant) - copy(dAtA[i:], x.SlashConstant) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SlashConstant))) - i-- - dAtA[i] = 0x1a - } - if len(x.ExpectedUptime) > 0 { - i -= len(x.ExpectedUptime) - copy(dAtA[i:], x.ExpectedUptime) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ExpectedUptime))) - i-- - dAtA[i] = 0x12 - } - if x.MaximumViableWindow != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.MaximumViableWindow)) - i-- - dAtA[i] = 0x8 - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*PriceFeedSLA) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PriceFeedSLA: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PriceFeedSLA: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaximumViableWindow", wireType) - } - x.MaximumViableWindow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.MaximumViableWindow |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExpectedUptime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.ExpectedUptime = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SlashConstant", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.SlashConstant = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinimumBlockUpdates", wireType) - } - x.MinimumBlockUpdates = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.MinimumBlockUpdates |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Frequency", wireType) - } - x.Frequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Frequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_PriceFeed protoreflect.MessageDescriptor - fd_PriceFeed_update_map protoreflect.FieldDescriptor - fd_PriceFeed_inclusion_map protoreflect.FieldDescriptor - fd_PriceFeed_index protoreflect.FieldDescriptor - fd_PriceFeed_validator protoreflect.FieldDescriptor - fd_PriceFeed_currency_pair protoreflect.FieldDescriptor - fd_PriceFeed_maximum_viable_window protoreflect.FieldDescriptor - fd_PriceFeed_id protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_genesis_proto_init() - md_PriceFeed = File_slinky_sla_v1_genesis_proto.Messages().ByName("PriceFeed") - fd_PriceFeed_update_map = md_PriceFeed.Fields().ByName("update_map") - fd_PriceFeed_inclusion_map = md_PriceFeed.Fields().ByName("inclusion_map") - fd_PriceFeed_index = md_PriceFeed.Fields().ByName("index") - fd_PriceFeed_validator = md_PriceFeed.Fields().ByName("validator") - fd_PriceFeed_currency_pair = md_PriceFeed.Fields().ByName("currency_pair") - fd_PriceFeed_maximum_viable_window = md_PriceFeed.Fields().ByName("maximum_viable_window") - fd_PriceFeed_id = md_PriceFeed.Fields().ByName("id") -} - -var _ protoreflect.Message = (*fastReflection_PriceFeed)(nil) - -type fastReflection_PriceFeed PriceFeed - -func (x *PriceFeed) ProtoReflect() protoreflect.Message { - return (*fastReflection_PriceFeed)(x) -} - -func (x *PriceFeed) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_PriceFeed_messageType fastReflection_PriceFeed_messageType -var _ protoreflect.MessageType = fastReflection_PriceFeed_messageType{} - -type fastReflection_PriceFeed_messageType struct{} - -func (x fastReflection_PriceFeed_messageType) Zero() protoreflect.Message { - return (*fastReflection_PriceFeed)(nil) -} -func (x fastReflection_PriceFeed_messageType) New() protoreflect.Message { - return new(fastReflection_PriceFeed) -} -func (x fastReflection_PriceFeed_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_PriceFeed -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_PriceFeed) Descriptor() protoreflect.MessageDescriptor { - return md_PriceFeed -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_PriceFeed) Type() protoreflect.MessageType { - return _fastReflection_PriceFeed_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_PriceFeed) New() protoreflect.Message { - return new(fastReflection_PriceFeed) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_PriceFeed) Interface() protoreflect.ProtoMessage { - return (*PriceFeed)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_PriceFeed) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.UpdateMap) != 0 { - value := protoreflect.ValueOfBytes(x.UpdateMap) - if !f(fd_PriceFeed_update_map, value) { - return - } - } - if len(x.InclusionMap) != 0 { - value := protoreflect.ValueOfBytes(x.InclusionMap) - if !f(fd_PriceFeed_inclusion_map, value) { - return - } - } - if x.Index != uint64(0) { - value := protoreflect.ValueOfUint64(x.Index) - if !f(fd_PriceFeed_index, value) { - return - } - } - if len(x.Validator) != 0 { - value := protoreflect.ValueOfBytes(x.Validator) - if !f(fd_PriceFeed_validator, value) { - return - } - } - if x.CurrencyPair != nil { - value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - if !f(fd_PriceFeed_currency_pair, value) { - return - } - } - if x.MaximumViableWindow != uint64(0) { - value := protoreflect.ValueOfUint64(x.MaximumViableWindow) - if !f(fd_PriceFeed_maximum_viable_window, value) { - return - } - } - if x.Id != "" { - value := protoreflect.ValueOfString(x.Id) - if !f(fd_PriceFeed_id, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_PriceFeed) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeed.update_map": - return len(x.UpdateMap) != 0 - case "slinky.sla.v1.PriceFeed.inclusion_map": - return len(x.InclusionMap) != 0 - case "slinky.sla.v1.PriceFeed.index": - return x.Index != uint64(0) - case "slinky.sla.v1.PriceFeed.validator": - return len(x.Validator) != 0 - case "slinky.sla.v1.PriceFeed.currency_pair": - return x.CurrencyPair != nil - case "slinky.sla.v1.PriceFeed.maximum_viable_window": - return x.MaximumViableWindow != uint64(0) - case "slinky.sla.v1.PriceFeed.id": - return x.Id != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeed")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeed does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeed) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeed.update_map": - x.UpdateMap = nil - case "slinky.sla.v1.PriceFeed.inclusion_map": - x.InclusionMap = nil - case "slinky.sla.v1.PriceFeed.index": - x.Index = uint64(0) - case "slinky.sla.v1.PriceFeed.validator": - x.Validator = nil - case "slinky.sla.v1.PriceFeed.currency_pair": - x.CurrencyPair = nil - case "slinky.sla.v1.PriceFeed.maximum_viable_window": - x.MaximumViableWindow = uint64(0) - case "slinky.sla.v1.PriceFeed.id": - x.Id = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeed")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeed does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_PriceFeed) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.PriceFeed.update_map": - value := x.UpdateMap - return protoreflect.ValueOfBytes(value) - case "slinky.sla.v1.PriceFeed.inclusion_map": - value := x.InclusionMap - return protoreflect.ValueOfBytes(value) - case "slinky.sla.v1.PriceFeed.index": - value := x.Index - return protoreflect.ValueOfUint64(value) - case "slinky.sla.v1.PriceFeed.validator": - value := x.Validator - return protoreflect.ValueOfBytes(value) - case "slinky.sla.v1.PriceFeed.currency_pair": - value := x.CurrencyPair - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.sla.v1.PriceFeed.maximum_viable_window": - value := x.MaximumViableWindow - return protoreflect.ValueOfUint64(value) - case "slinky.sla.v1.PriceFeed.id": - value := x.Id - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeed")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeed does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeed) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeed.update_map": - x.UpdateMap = value.Bytes() - case "slinky.sla.v1.PriceFeed.inclusion_map": - x.InclusionMap = value.Bytes() - case "slinky.sla.v1.PriceFeed.index": - x.Index = value.Uint() - case "slinky.sla.v1.PriceFeed.validator": - x.Validator = value.Bytes() - case "slinky.sla.v1.PriceFeed.currency_pair": - x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) - case "slinky.sla.v1.PriceFeed.maximum_viable_window": - x.MaximumViableWindow = value.Uint() - case "slinky.sla.v1.PriceFeed.id": - x.Id = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeed")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeed does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeed) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeed.currency_pair": - if x.CurrencyPair == nil { - x.CurrencyPair = new(v1.CurrencyPair) - } - return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - case "slinky.sla.v1.PriceFeed.update_map": - panic(fmt.Errorf("field update_map of message slinky.sla.v1.PriceFeed is not mutable")) - case "slinky.sla.v1.PriceFeed.inclusion_map": - panic(fmt.Errorf("field inclusion_map of message slinky.sla.v1.PriceFeed is not mutable")) - case "slinky.sla.v1.PriceFeed.index": - panic(fmt.Errorf("field index of message slinky.sla.v1.PriceFeed is not mutable")) - case "slinky.sla.v1.PriceFeed.validator": - panic(fmt.Errorf("field validator of message slinky.sla.v1.PriceFeed is not mutable")) - case "slinky.sla.v1.PriceFeed.maximum_viable_window": - panic(fmt.Errorf("field maximum_viable_window of message slinky.sla.v1.PriceFeed is not mutable")) - case "slinky.sla.v1.PriceFeed.id": - panic(fmt.Errorf("field id of message slinky.sla.v1.PriceFeed is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeed")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeed does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_PriceFeed) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.PriceFeed.update_map": - return protoreflect.ValueOfBytes(nil) - case "slinky.sla.v1.PriceFeed.inclusion_map": - return protoreflect.ValueOfBytes(nil) - case "slinky.sla.v1.PriceFeed.index": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.sla.v1.PriceFeed.validator": - return protoreflect.ValueOfBytes(nil) - case "slinky.sla.v1.PriceFeed.currency_pair": - m := new(v1.CurrencyPair) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.sla.v1.PriceFeed.maximum_viable_window": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.sla.v1.PriceFeed.id": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.PriceFeed")) - } - panic(fmt.Errorf("message slinky.sla.v1.PriceFeed does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_PriceFeed) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.PriceFeed", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_PriceFeed) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_PriceFeed) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_PriceFeed) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_PriceFeed) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*PriceFeed) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.UpdateMap) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.InclusionMap) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Index != 0 { - n += 1 + runtime.Sov(uint64(x.Index)) - } - l = len(x.Validator) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.CurrencyPair != nil { - l = options.Size(x.CurrencyPair) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.MaximumViableWindow != 0 { - n += 1 + runtime.Sov(uint64(x.MaximumViableWindow)) - } - l = len(x.Id) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*PriceFeed) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Id) > 0 { - i -= len(x.Id) - copy(dAtA[i:], x.Id) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) - i-- - dAtA[i] = 0x3a - } - if x.MaximumViableWindow != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.MaximumViableWindow)) - i-- - dAtA[i] = 0x30 - } - if x.CurrencyPair != nil { - encoded, err := options.Marshal(x.CurrencyPair) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x2a - } - if len(x.Validator) > 0 { - i -= len(x.Validator) - copy(dAtA[i:], x.Validator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Validator))) - i-- - dAtA[i] = 0x22 - } - if x.Index != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Index)) - i-- - dAtA[i] = 0x18 - } - if len(x.InclusionMap) > 0 { - i -= len(x.InclusionMap) - copy(dAtA[i:], x.InclusionMap) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.InclusionMap))) - i-- - dAtA[i] = 0x12 - } - if len(x.UpdateMap) > 0 { - i -= len(x.UpdateMap) - copy(dAtA[i:], x.UpdateMap) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.UpdateMap))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*PriceFeed) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PriceFeed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: PriceFeed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field UpdateMap", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.UpdateMap = append(x.UpdateMap[:0], dAtA[iNdEx:postIndex]...) - if x.UpdateMap == nil { - x.UpdateMap = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field InclusionMap", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.InclusionMap = append(x.InclusionMap[:0], dAtA[iNdEx:postIndex]...) - if x.InclusionMap == nil { - x.InclusionMap = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - x.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Validator = append(x.Validator[:0], dAtA[iNdEx:postIndex]...) - if x.Validator == nil { - x.Validator = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.CurrencyPair == nil { - x.CurrencyPair = &v1.CurrencyPair{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MaximumViableWindow", wireType) - } - x.MaximumViableWindow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.MaximumViableWindow |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/sla/v1/genesis.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GenesisState defines the sla module's genesis state. -type GenesisState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // SLAs are the SLAs that are currently active. - Slas []*PriceFeedSLA `protobuf:"bytes,1,rep,name=slas,proto3" json:"slas,omitempty"` - // PrceFeeds are the price feeds that are currently active. - PriceFeeds []*PriceFeed `protobuf:"bytes,2,rep,name=price_feeds,json=priceFeeds,proto3" json:"price_feeds,omitempty"` - // Params are the parameters for the sla module. - Params *Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *GenesisState) Reset() { - *x = GenesisState{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisState) ProtoMessage() {} - -// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. -func (*GenesisState) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_genesis_proto_rawDescGZIP(), []int{0} -} - -func (x *GenesisState) GetSlas() []*PriceFeedSLA { - if x != nil { - return x.Slas - } - return nil -} - -func (x *GenesisState) GetPriceFeeds() []*PriceFeed { - if x != nil { - return x.PriceFeeds - } - return nil -} - -func (x *GenesisState) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -// Params defines the parameters for the sla module. -type Params struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Enabled is a flag to enable or disable the sla module. - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` -} - -func (x *Params) Reset() { - *x = Params{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Params) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Params) ProtoMessage() {} - -// Deprecated: Use Params.ProtoReflect.Descriptor instead. -func (*Params) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_genesis_proto_rawDescGZIP(), []int{1} -} - -func (x *Params) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -// PriceFeedSLA defines the the desired SLA for a given set of price feeds. A -// price feed is defined to be a set of price prices for the same (currency -// pair, validator). -type PriceFeedSLA struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // MaximumViableWindow is the maximum time window that we are interested - // for the SLA. This is used to determine the moving window of blocks that - // we are interested in. - MaximumViableWindow uint64 `protobuf:"varint,1,opt,name=maximum_viable_window,json=maximumViableWindow,proto3" json:"maximum_viable_window,omitempty"` - // ExpectedUptime is the expected uptime for the given validator and price - // feed. - ExpectedUptime string `protobuf:"bytes,2,opt,name=expected_uptime,json=expectedUptime,proto3" json:"expected_uptime,omitempty"` - // SlashConstant is the constant by which we will multiply the deviation from - // the expected uptime. - SlashConstant string `protobuf:"bytes,3,opt,name=slash_constant,json=slashConstant,proto3" json:"slash_constant,omitempty"` - // MinimumBlockUpdates is the minimum number of blocks that the - // validator had to have voted on in the maximum viable window - // in order to be considered for the SLA. - MinimumBlockUpdates uint64 `protobuf:"varint,4,opt,name=minimum_block_updates,json=minimumBlockUpdates,proto3" json:"minimum_block_updates,omitempty"` - // Frequency is the frequency at which we will check the SLA. - Frequency uint64 `protobuf:"varint,5,opt,name=frequency,proto3" json:"frequency,omitempty"` - // ID is the unique identifier for the SLA. - Id string `protobuf:"bytes,6,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *PriceFeedSLA) Reset() { - *x = PriceFeedSLA{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PriceFeedSLA) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PriceFeedSLA) ProtoMessage() {} - -// Deprecated: Use PriceFeedSLA.ProtoReflect.Descriptor instead. -func (*PriceFeedSLA) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_genesis_proto_rawDescGZIP(), []int{2} -} - -func (x *PriceFeedSLA) GetMaximumViableWindow() uint64 { - if x != nil { - return x.MaximumViableWindow - } - return 0 -} - -func (x *PriceFeedSLA) GetExpectedUptime() string { - if x != nil { - return x.ExpectedUptime - } - return "" -} - -func (x *PriceFeedSLA) GetSlashConstant() string { - if x != nil { - return x.SlashConstant - } - return "" -} - -func (x *PriceFeedSLA) GetMinimumBlockUpdates() uint64 { - if x != nil { - return x.MinimumBlockUpdates - } - return 0 -} - -func (x *PriceFeedSLA) GetFrequency() uint64 { - if x != nil { - return x.Frequency - } - return 0 -} - -func (x *PriceFeedSLA) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -// PriceFeed defines the object type that will be utilized to monitor how -// frequently validators are voting with price updates across the network. -type PriceFeed struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // UpdateMap represents the relevant moving window of price feed updates. - UpdateMap []byte `protobuf:"bytes,1,opt,name=update_map,json=updateMap,proto3" json:"update_map,omitempty"` - // InclusionMap represents the relevant moving window of blocks that the - // validator has voted on. - InclusionMap []byte `protobuf:"bytes,2,opt,name=inclusion_map,json=inclusionMap,proto3" json:"inclusion_map,omitempty"` - // Index corresponds to the current index into the bitmap. - Index uint64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` - // Validator represents the validator that this SLA corresponds to. - Validator []byte `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty"` - // CurrencyPair represents the currency pair that this SLA corresponds to. - CurrencyPair *v1.CurrencyPair `protobuf:"bytes,5,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair,omitempty"` - // MaximumViableWindow represents the maximum number of blocks that can be - // represented by the bit map. - MaximumViableWindow uint64 `protobuf:"varint,6,opt,name=maximum_viable_window,json=maximumViableWindow,proto3" json:"maximum_viable_window,omitempty"` - // ID corresponds to the SLA ID that this price feed corresponds to. - Id string `protobuf:"bytes,7,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *PriceFeed) Reset() { - *x = PriceFeed{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_genesis_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PriceFeed) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PriceFeed) ProtoMessage() {} - -// Deprecated: Use PriceFeed.ProtoReflect.Descriptor instead. -func (*PriceFeed) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_genesis_proto_rawDescGZIP(), []int{3} -} - -func (x *PriceFeed) GetUpdateMap() []byte { - if x != nil { - return x.UpdateMap - } - return nil -} - -func (x *PriceFeed) GetInclusionMap() []byte { - if x != nil { - return x.InclusionMap - } - return nil -} - -func (x *PriceFeed) GetIndex() uint64 { - if x != nil { - return x.Index - } - return 0 -} - -func (x *PriceFeed) GetValidator() []byte { - if x != nil { - return x.Validator - } - return nil -} - -func (x *PriceFeed) GetCurrencyPair() *v1.CurrencyPair { - if x != nil { - return x.CurrencyPair - } - return nil -} - -func (x *PriceFeed) GetMaximumViableWindow() uint64 { - if x != nil { - return x.MaximumViableWindow - } - return 0 -} - -func (x *PriceFeed) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -var File_slinky_sla_v1_genesis_proto protoreflect.FileDescriptor - -var file_slinky_sla_v1_genesis_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, - 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, - 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, - 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x3d, 0x0a, 0x04, 0x73, 0x6c, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, - 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x53, 0x4c, 0x41, 0x42, 0x0c, - 0xc8, 0xde, 0x1f, 0x00, 0xe2, 0xde, 0x1f, 0x04, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x04, 0x73, 0x6c, - 0x61, 0x73, 0x12, 0x3f, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x64, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, - 0x64, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, - 0x65, 0x64, 0x73, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, - 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x22, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0xe2, 0x02, 0x0a, - 0x0c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x53, 0x4c, 0x41, 0x12, 0x32, 0x0a, - 0x15, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x76, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x6d, 0x61, - 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x56, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x57, 0x69, 0x6e, 0x64, 0x6f, - 0x77, 0x12, 0x5a, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x75, 0x70, - 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, - 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0e, 0x65, - 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x55, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x58, 0x0a, - 0x0e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0d, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x43, - 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x69, 0x6e, 0x69, 0x6d, - 0x75, 0x6d, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x13, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x66, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, - 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe2, 0xde, 0x1f, 0x02, 0x49, 0x44, 0x52, 0x02, 0x69, - 0x64, 0x22, 0x99, 0x02, 0x0a, 0x09, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x12, - 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x12, 0x23, - 0x0a, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, - 0x4d, 0x61, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x48, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, - 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, - 0x72, 0x12, 0x32, 0x0a, 0x15, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x5f, 0x76, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x13, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x56, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x57, - 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x12, 0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x06, 0xe2, 0xde, 0x1f, 0x02, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x42, 0x9d, 0x01, - 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, - 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, - 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x6c, 0x61, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, - 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x53, 0x6c, 0x61, 0x2e, 0x56, 0x31, 0xca, - 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x19, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x53, 0x6c, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_sla_v1_genesis_proto_rawDescOnce sync.Once - file_slinky_sla_v1_genesis_proto_rawDescData = file_slinky_sla_v1_genesis_proto_rawDesc -) - -func file_slinky_sla_v1_genesis_proto_rawDescGZIP() []byte { - file_slinky_sla_v1_genesis_proto_rawDescOnce.Do(func() { - file_slinky_sla_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_sla_v1_genesis_proto_rawDescData) - }) - return file_slinky_sla_v1_genesis_proto_rawDescData -} - -var file_slinky_sla_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_slinky_sla_v1_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: slinky.sla.v1.GenesisState - (*Params)(nil), // 1: slinky.sla.v1.Params - (*PriceFeedSLA)(nil), // 2: slinky.sla.v1.PriceFeedSLA - (*PriceFeed)(nil), // 3: slinky.sla.v1.PriceFeed - (*v1.CurrencyPair)(nil), // 4: slinky.types.v1.CurrencyPair -} -var file_slinky_sla_v1_genesis_proto_depIdxs = []int32{ - 2, // 0: slinky.sla.v1.GenesisState.slas:type_name -> slinky.sla.v1.PriceFeedSLA - 3, // 1: slinky.sla.v1.GenesisState.price_feeds:type_name -> slinky.sla.v1.PriceFeed - 1, // 2: slinky.sla.v1.GenesisState.params:type_name -> slinky.sla.v1.Params - 4, // 3: slinky.sla.v1.PriceFeed.currency_pair:type_name -> slinky.types.v1.CurrencyPair - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_slinky_sla_v1_genesis_proto_init() } -func file_slinky_sla_v1_genesis_proto_init() { - if File_slinky_sla_v1_genesis_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_sla_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_genesis_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Params); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_genesis_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PriceFeedSLA); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_genesis_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PriceFeed); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_sla_v1_genesis_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_sla_v1_genesis_proto_goTypes, - DependencyIndexes: file_slinky_sla_v1_genesis_proto_depIdxs, - MessageInfos: file_slinky_sla_v1_genesis_proto_msgTypes, - }.Build() - File_slinky_sla_v1_genesis_proto = out.File - file_slinky_sla_v1_genesis_proto_rawDesc = nil - file_slinky_sla_v1_genesis_proto_goTypes = nil - file_slinky_sla_v1_genesis_proto_depIdxs = nil -} diff --git a/api/slinky/sla/v1/query.pulsar.go b/api/slinky/sla/v1/query.pulsar.go deleted file mode 100644 index bab681de8..000000000 --- a/api/slinky/sla/v1/query.pulsar.go +++ /dev/null @@ -1,2993 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package slav1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var ( - md_GetAllSLAsRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_sla_v1_query_proto_init() - md_GetAllSLAsRequest = File_slinky_sla_v1_query_proto.Messages().ByName("GetAllSLAsRequest") -} - -var _ protoreflect.Message = (*fastReflection_GetAllSLAsRequest)(nil) - -type fastReflection_GetAllSLAsRequest GetAllSLAsRequest - -func (x *GetAllSLAsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetAllSLAsRequest)(x) -} - -func (x *GetAllSLAsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_query_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetAllSLAsRequest_messageType fastReflection_GetAllSLAsRequest_messageType -var _ protoreflect.MessageType = fastReflection_GetAllSLAsRequest_messageType{} - -type fastReflection_GetAllSLAsRequest_messageType struct{} - -func (x fastReflection_GetAllSLAsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetAllSLAsRequest)(nil) -} -func (x fastReflection_GetAllSLAsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_GetAllSLAsRequest) -} -func (x fastReflection_GetAllSLAsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllSLAsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetAllSLAsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllSLAsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetAllSLAsRequest) Type() protoreflect.MessageType { - return _fastReflection_GetAllSLAsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetAllSLAsRequest) New() protoreflect.Message { - return new(fastReflection_GetAllSLAsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetAllSLAsRequest) Interface() protoreflect.ProtoMessage { - return (*GetAllSLAsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetAllSLAsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetAllSLAsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetAllSLAsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetAllSLAsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetAllSLAsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.GetAllSLAsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetAllSLAsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetAllSLAsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetAllSLAsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetAllSLAsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetAllSLAsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetAllSLAsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllSLAsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllSLAsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_GetAllSLAsResponse_1_list)(nil) - -type _GetAllSLAsResponse_1_list struct { - list *[]*PriceFeedSLA -} - -func (x *_GetAllSLAsResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GetAllSLAsResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GetAllSLAsResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeedSLA) - (*x.list)[i] = concreteValue -} - -func (x *_GetAllSLAsResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeedSLA) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GetAllSLAsResponse_1_list) AppendMutable() protoreflect.Value { - v := new(PriceFeedSLA) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GetAllSLAsResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GetAllSLAsResponse_1_list) NewElement() protoreflect.Value { - v := new(PriceFeedSLA) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GetAllSLAsResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GetAllSLAsResponse protoreflect.MessageDescriptor - fd_GetAllSLAsResponse_slas protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_query_proto_init() - md_GetAllSLAsResponse = File_slinky_sla_v1_query_proto.Messages().ByName("GetAllSLAsResponse") - fd_GetAllSLAsResponse_slas = md_GetAllSLAsResponse.Fields().ByName("slas") -} - -var _ protoreflect.Message = (*fastReflection_GetAllSLAsResponse)(nil) - -type fastReflection_GetAllSLAsResponse GetAllSLAsResponse - -func (x *GetAllSLAsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetAllSLAsResponse)(x) -} - -func (x *GetAllSLAsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_query_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetAllSLAsResponse_messageType fastReflection_GetAllSLAsResponse_messageType -var _ protoreflect.MessageType = fastReflection_GetAllSLAsResponse_messageType{} - -type fastReflection_GetAllSLAsResponse_messageType struct{} - -func (x fastReflection_GetAllSLAsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetAllSLAsResponse)(nil) -} -func (x fastReflection_GetAllSLAsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_GetAllSLAsResponse) -} -func (x fastReflection_GetAllSLAsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllSLAsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetAllSLAsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_GetAllSLAsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetAllSLAsResponse) Type() protoreflect.MessageType { - return _fastReflection_GetAllSLAsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetAllSLAsResponse) New() protoreflect.Message { - return new(fastReflection_GetAllSLAsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetAllSLAsResponse) Interface() protoreflect.ProtoMessage { - return (*GetAllSLAsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetAllSLAsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Slas) != 0 { - value := protoreflect.ValueOfList(&_GetAllSLAsResponse_1_list{list: &x.Slas}) - if !f(fd_GetAllSLAsResponse_slas, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetAllSLAsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.GetAllSLAsResponse.slas": - return len(x.Slas) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.GetAllSLAsResponse.slas": - x.Slas = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetAllSLAsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.GetAllSLAsResponse.slas": - if len(x.Slas) == 0 { - return protoreflect.ValueOfList(&_GetAllSLAsResponse_1_list{}) - } - listValue := &_GetAllSLAsResponse_1_list{list: &x.Slas} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.GetAllSLAsResponse.slas": - lv := value.List() - clv := lv.(*_GetAllSLAsResponse_1_list) - x.Slas = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GetAllSLAsResponse.slas": - if x.Slas == nil { - x.Slas = []*PriceFeedSLA{} - } - value := &_GetAllSLAsResponse_1_list{list: &x.Slas} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetAllSLAsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GetAllSLAsResponse.slas": - list := []*PriceFeedSLA{} - return protoreflect.ValueOfList(&_GetAllSLAsResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetAllSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetAllSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetAllSLAsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.GetAllSLAsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetAllSLAsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetAllSLAsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetAllSLAsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetAllSLAsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetAllSLAsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Slas) > 0 { - for _, e := range x.Slas { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetAllSLAsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Slas) > 0 { - for iNdEx := len(x.Slas) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Slas[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetAllSLAsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllSLAsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetAllSLAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Slas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Slas = append(x.Slas, &PriceFeedSLA{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Slas[len(x.Slas)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_GetPriceFeedsRequest protoreflect.MessageDescriptor - fd_GetPriceFeedsRequest_id protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_query_proto_init() - md_GetPriceFeedsRequest = File_slinky_sla_v1_query_proto.Messages().ByName("GetPriceFeedsRequest") - fd_GetPriceFeedsRequest_id = md_GetPriceFeedsRequest.Fields().ByName("id") -} - -var _ protoreflect.Message = (*fastReflection_GetPriceFeedsRequest)(nil) - -type fastReflection_GetPriceFeedsRequest GetPriceFeedsRequest - -func (x *GetPriceFeedsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetPriceFeedsRequest)(x) -} - -func (x *GetPriceFeedsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_query_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetPriceFeedsRequest_messageType fastReflection_GetPriceFeedsRequest_messageType -var _ protoreflect.MessageType = fastReflection_GetPriceFeedsRequest_messageType{} - -type fastReflection_GetPriceFeedsRequest_messageType struct{} - -func (x fastReflection_GetPriceFeedsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetPriceFeedsRequest)(nil) -} -func (x fastReflection_GetPriceFeedsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_GetPriceFeedsRequest) -} -func (x fastReflection_GetPriceFeedsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetPriceFeedsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetPriceFeedsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_GetPriceFeedsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetPriceFeedsRequest) Type() protoreflect.MessageType { - return _fastReflection_GetPriceFeedsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetPriceFeedsRequest) New() protoreflect.Message { - return new(fastReflection_GetPriceFeedsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetPriceFeedsRequest) Interface() protoreflect.ProtoMessage { - return (*GetPriceFeedsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetPriceFeedsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Id != "" { - value := protoreflect.ValueOfString(x.Id) - if !f(fd_GetPriceFeedsRequest_id, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetPriceFeedsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsRequest.id": - return x.Id != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsRequest.id": - x.Id = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetPriceFeedsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.GetPriceFeedsRequest.id": - value := x.Id - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsRequest.id": - x.Id = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsRequest.id": - panic(fmt.Errorf("field id of message slinky.sla.v1.GetPriceFeedsRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetPriceFeedsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsRequest.id": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetPriceFeedsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.GetPriceFeedsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetPriceFeedsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetPriceFeedsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetPriceFeedsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetPriceFeedsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Id) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetPriceFeedsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Id) > 0 { - i -= len(x.Id) - copy(dAtA[i:], x.Id) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Id))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetPriceFeedsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetPriceFeedsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetPriceFeedsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_GetPriceFeedsResponse_1_list)(nil) - -type _GetPriceFeedsResponse_1_list struct { - list *[]*PriceFeed -} - -func (x *_GetPriceFeedsResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_GetPriceFeedsResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_GetPriceFeedsResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeed) - (*x.list)[i] = concreteValue -} - -func (x *_GetPriceFeedsResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeed) - *x.list = append(*x.list, concreteValue) -} - -func (x *_GetPriceFeedsResponse_1_list) AppendMutable() protoreflect.Value { - v := new(PriceFeed) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GetPriceFeedsResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_GetPriceFeedsResponse_1_list) NewElement() protoreflect.Value { - v := new(PriceFeed) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_GetPriceFeedsResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_GetPriceFeedsResponse protoreflect.MessageDescriptor - fd_GetPriceFeedsResponse_price_feeds protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_query_proto_init() - md_GetPriceFeedsResponse = File_slinky_sla_v1_query_proto.Messages().ByName("GetPriceFeedsResponse") - fd_GetPriceFeedsResponse_price_feeds = md_GetPriceFeedsResponse.Fields().ByName("price_feeds") -} - -var _ protoreflect.Message = (*fastReflection_GetPriceFeedsResponse)(nil) - -type fastReflection_GetPriceFeedsResponse GetPriceFeedsResponse - -func (x *GetPriceFeedsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetPriceFeedsResponse)(x) -} - -func (x *GetPriceFeedsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_query_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_GetPriceFeedsResponse_messageType fastReflection_GetPriceFeedsResponse_messageType -var _ protoreflect.MessageType = fastReflection_GetPriceFeedsResponse_messageType{} - -type fastReflection_GetPriceFeedsResponse_messageType struct{} - -func (x fastReflection_GetPriceFeedsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetPriceFeedsResponse)(nil) -} -func (x fastReflection_GetPriceFeedsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_GetPriceFeedsResponse) -} -func (x fastReflection_GetPriceFeedsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetPriceFeedsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GetPriceFeedsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_GetPriceFeedsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_GetPriceFeedsResponse) Type() protoreflect.MessageType { - return _fastReflection_GetPriceFeedsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetPriceFeedsResponse) New() protoreflect.Message { - return new(fastReflection_GetPriceFeedsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GetPriceFeedsResponse) Interface() protoreflect.ProtoMessage { - return (*GetPriceFeedsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_GetPriceFeedsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.PriceFeeds) != 0 { - value := protoreflect.ValueOfList(&_GetPriceFeedsResponse_1_list{list: &x.PriceFeeds}) - if !f(fd_GetPriceFeedsResponse_price_feeds, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_GetPriceFeedsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsResponse.price_feeds": - return len(x.PriceFeeds) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsResponse.price_feeds": - x.PriceFeeds = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_GetPriceFeedsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.GetPriceFeedsResponse.price_feeds": - if len(x.PriceFeeds) == 0 { - return protoreflect.ValueOfList(&_GetPriceFeedsResponse_1_list{}) - } - listValue := &_GetPriceFeedsResponse_1_list{list: &x.PriceFeeds} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsResponse.price_feeds": - lv := value.List() - clv := lv.(*_GetPriceFeedsResponse_1_list) - x.PriceFeeds = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsResponse.price_feeds": - if x.PriceFeeds == nil { - x.PriceFeeds = []*PriceFeed{} - } - value := &_GetPriceFeedsResponse_1_list{list: &x.PriceFeeds} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_GetPriceFeedsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.GetPriceFeedsResponse.price_feeds": - list := []*PriceFeed{} - return protoreflect.ValueOfList(&_GetPriceFeedsResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.GetPriceFeedsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.GetPriceFeedsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_GetPriceFeedsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.GetPriceFeedsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_GetPriceFeedsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetPriceFeedsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_GetPriceFeedsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_GetPriceFeedsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetPriceFeedsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.PriceFeeds) > 0 { - for _, e := range x.PriceFeeds { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetPriceFeedsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.PriceFeeds) > 0 { - for iNdEx := len(x.PriceFeeds) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.PriceFeeds[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetPriceFeedsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetPriceFeedsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetPriceFeedsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PriceFeeds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.PriceFeeds = append(x.PriceFeeds, &PriceFeed{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PriceFeeds[len(x.PriceFeeds)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_ParamsRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_sla_v1_query_proto_init() - md_ParamsRequest = File_slinky_sla_v1_query_proto.Messages().ByName("ParamsRequest") -} - -var _ protoreflect.Message = (*fastReflection_ParamsRequest)(nil) - -type fastReflection_ParamsRequest ParamsRequest - -func (x *ParamsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsRequest)(x) -} - -func (x *ParamsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_query_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ParamsRequest_messageType fastReflection_ParamsRequest_messageType -var _ protoreflect.MessageType = fastReflection_ParamsRequest_messageType{} - -type fastReflection_ParamsRequest_messageType struct{} - -func (x fastReflection_ParamsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsRequest)(nil) -} -func (x fastReflection_ParamsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} -func (x fastReflection_ParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ParamsRequest) Type() protoreflect.MessageType { - return _fastReflection_ParamsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsRequest) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsRequest) Interface() protoreflect.ProtoMessage { - return (*ParamsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.ParamsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ParamsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ParamsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ParamsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_ParamsResponse protoreflect.MessageDescriptor - fd_ParamsResponse_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_query_proto_init() - md_ParamsResponse = File_slinky_sla_v1_query_proto.Messages().ByName("ParamsResponse") - fd_ParamsResponse_params = md_ParamsResponse.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_ParamsResponse)(nil) - -type fastReflection_ParamsResponse ParamsResponse - -func (x *ParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsResponse)(x) -} - -func (x *ParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_query_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_ParamsResponse_messageType fastReflection_ParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_ParamsResponse_messageType{} - -type fastReflection_ParamsResponse_messageType struct{} - -func (x fastReflection_ParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsResponse)(nil) -} -func (x fastReflection_ParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} -func (x fastReflection_ParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_ParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_ParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsResponse) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsResponse) Interface() protoreflect.ProtoMessage { - return (*ParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_ParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_ParamsResponse_params, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_ParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.ParamsResponse.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.ParamsResponse.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_ParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.ParamsResponse.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.ParamsResponse.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.ParamsResponse.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_ParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.ParamsResponse.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.ParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_ParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.ParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_ParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_ParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_ParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/sla/v1/query.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// QueryAllSLAsRequest is the request type for the Query/GetAllSLAs RPC method. -type GetAllSLAsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetAllSLAsRequest) Reset() { - *x = GetAllSLAsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetAllSLAsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAllSLAsRequest) ProtoMessage() {} - -// Deprecated: Use GetAllSLAsRequest.ProtoReflect.Descriptor instead. -func (*GetAllSLAsRequest) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_query_proto_rawDescGZIP(), []int{0} -} - -// QueryAllSLAsResponse is the response type for the Query/GetAllSLAs RPC -// method. -type GetAllSLAsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Slas []*PriceFeedSLA `protobuf:"bytes,1,rep,name=slas,proto3" json:"slas,omitempty"` -} - -func (x *GetAllSLAsResponse) Reset() { - *x = GetAllSLAsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetAllSLAsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAllSLAsResponse) ProtoMessage() {} - -// Deprecated: Use GetAllSLAsResponse.ProtoReflect.Descriptor instead. -func (*GetAllSLAsResponse) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_query_proto_rawDescGZIP(), []int{1} -} - -func (x *GetAllSLAsResponse) GetSlas() []*PriceFeedSLA { - if x != nil { - return x.Slas - } - return nil -} - -// QueryGetPriceFeedsRequest is the request type for the Query/GetPriceFeeds RPC -// method. -type GetPriceFeedsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ID defines the SLA to query price feeds for. - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetPriceFeedsRequest) Reset() { - *x = GetPriceFeedsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPriceFeedsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPriceFeedsRequest) ProtoMessage() {} - -// Deprecated: Use GetPriceFeedsRequest.ProtoReflect.Descriptor instead. -func (*GetPriceFeedsRequest) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_query_proto_rawDescGZIP(), []int{2} -} - -func (x *GetPriceFeedsRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -// QueryGetPriceFeedsResponse is the response type for the Query/GetPriceFeeds -// RPC method. -type GetPriceFeedsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // PriceFeeds defines the price feeds for the given SLA. - PriceFeeds []*PriceFeed `protobuf:"bytes,1,rep,name=price_feeds,json=priceFeeds,proto3" json:"price_feeds,omitempty"` -} - -func (x *GetPriceFeedsResponse) Reset() { - *x = GetPriceFeedsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPriceFeedsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPriceFeedsResponse) ProtoMessage() {} - -// Deprecated: Use GetPriceFeedsResponse.ProtoReflect.Descriptor instead. -func (*GetPriceFeedsResponse) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_query_proto_rawDescGZIP(), []int{3} -} - -func (x *GetPriceFeedsResponse) GetPriceFeeds() []*PriceFeed { - if x != nil { - return x.PriceFeeds - } - return nil -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -type ParamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ParamsRequest) Reset() { - *x = ParamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_query_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsRequest) ProtoMessage() {} - -// Deprecated: Use ParamsRequest.ProtoReflect.Descriptor instead. -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_query_proto_rawDescGZIP(), []int{4} -} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type ParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *ParamsResponse) Reset() { - *x = ParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_query_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsResponse) ProtoMessage() {} - -// Deprecated: Use ParamsResponse.ProtoReflect.Descriptor instead. -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_query_proto_rawDescGZIP(), []int{5} -} - -func (x *ParamsResponse) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -var File_slinky_sla_v1_query_proto protoreflect.FileDescriptor - -var file_slinky_sla_v1_query_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, - 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x47, - 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x53, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x04, 0x73, 0x6c, 0x61, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, - 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x53, 0x4c, - 0x41, 0x42, 0x0c, 0xc8, 0xde, 0x1f, 0x00, 0xe2, 0xde, 0x1f, 0x04, 0x53, 0x4c, 0x41, 0x73, 0x52, - 0x04, 0x73, 0x6c, 0x61, 0x73, 0x22, 0x2e, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x46, 0x65, 0x65, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe2, 0xde, 0x1f, 0x02, 0x49, - 0x44, 0x52, 0x02, 0x69, 0x64, 0x22, 0x58, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x46, 0x65, 0x65, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, - 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x64, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, - 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x73, 0x22, - 0x0f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x45, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xdd, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x12, 0x6e, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x4c, 0x41, 0x73, 0x12, - 0x20, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, - 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x6c, 0x61, - 0x73, 0x12, 0x7e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, - 0x64, 0x73, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x46, 0x65, 0x65, 0x64, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, - 0x46, 0x65, 0x65, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, - 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x64, - 0x73, 0x12, 0x64, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1c, 0x2e, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, - 0x12, 0x15, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, - 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9b, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x6c, 0x61, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x53, 0x6c, 0x61, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x53, 0x6c, - 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_sla_v1_query_proto_rawDescOnce sync.Once - file_slinky_sla_v1_query_proto_rawDescData = file_slinky_sla_v1_query_proto_rawDesc -) - -func file_slinky_sla_v1_query_proto_rawDescGZIP() []byte { - file_slinky_sla_v1_query_proto_rawDescOnce.Do(func() { - file_slinky_sla_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_sla_v1_query_proto_rawDescData) - }) - return file_slinky_sla_v1_query_proto_rawDescData -} - -var file_slinky_sla_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_slinky_sla_v1_query_proto_goTypes = []interface{}{ - (*GetAllSLAsRequest)(nil), // 0: slinky.sla.v1.GetAllSLAsRequest - (*GetAllSLAsResponse)(nil), // 1: slinky.sla.v1.GetAllSLAsResponse - (*GetPriceFeedsRequest)(nil), // 2: slinky.sla.v1.GetPriceFeedsRequest - (*GetPriceFeedsResponse)(nil), // 3: slinky.sla.v1.GetPriceFeedsResponse - (*ParamsRequest)(nil), // 4: slinky.sla.v1.ParamsRequest - (*ParamsResponse)(nil), // 5: slinky.sla.v1.ParamsResponse - (*PriceFeedSLA)(nil), // 6: slinky.sla.v1.PriceFeedSLA - (*PriceFeed)(nil), // 7: slinky.sla.v1.PriceFeed - (*Params)(nil), // 8: slinky.sla.v1.Params -} -var file_slinky_sla_v1_query_proto_depIdxs = []int32{ - 6, // 0: slinky.sla.v1.GetAllSLAsResponse.slas:type_name -> slinky.sla.v1.PriceFeedSLA - 7, // 1: slinky.sla.v1.GetPriceFeedsResponse.price_feeds:type_name -> slinky.sla.v1.PriceFeed - 8, // 2: slinky.sla.v1.ParamsResponse.params:type_name -> slinky.sla.v1.Params - 0, // 3: slinky.sla.v1.Query.GetAllSLAs:input_type -> slinky.sla.v1.GetAllSLAsRequest - 2, // 4: slinky.sla.v1.Query.GetPriceFeeds:input_type -> slinky.sla.v1.GetPriceFeedsRequest - 4, // 5: slinky.sla.v1.Query.Params:input_type -> slinky.sla.v1.ParamsRequest - 1, // 6: slinky.sla.v1.Query.GetAllSLAs:output_type -> slinky.sla.v1.GetAllSLAsResponse - 3, // 7: slinky.sla.v1.Query.GetPriceFeeds:output_type -> slinky.sla.v1.GetPriceFeedsResponse - 5, // 8: slinky.sla.v1.Query.Params:output_type -> slinky.sla.v1.ParamsResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_slinky_sla_v1_query_proto_init() } -func file_slinky_sla_v1_query_proto_init() { - if File_slinky_sla_v1_query_proto != nil { - return - } - file_slinky_sla_v1_genesis_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_sla_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAllSLAsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAllSLAsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPriceFeedsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPriceFeedsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_sla_v1_query_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_sla_v1_query_proto_goTypes, - DependencyIndexes: file_slinky_sla_v1_query_proto_depIdxs, - MessageInfos: file_slinky_sla_v1_query_proto_msgTypes, - }.Build() - File_slinky_sla_v1_query_proto = out.File - file_slinky_sla_v1_query_proto_rawDesc = nil - file_slinky_sla_v1_query_proto_goTypes = nil - file_slinky_sla_v1_query_proto_depIdxs = nil -} diff --git a/api/slinky/sla/v1/query_grpc.pb.go b/api/slinky/sla/v1/query_grpc.pb.go deleted file mode 100644 index 099f45fa1..000000000 --- a/api/slinky/sla/v1/query_grpc.pb.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc (unknown) -// source: slinky/sla/v1/query.proto - -package slav1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Query_GetAllSLAs_FullMethodName = "/slinky.sla.v1.Query/GetAllSLAs" - Query_GetPriceFeeds_FullMethodName = "/slinky.sla.v1.Query/GetPriceFeeds" - Query_Params_FullMethodName = "/slinky.sla.v1.Query/Params" -) - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Query is the query service for the x/sla module. -type QueryClient interface { - // GetAllSLAs returns all SLAs that the module is currently enforcing. - GetAllSLAs(ctx context.Context, in *GetAllSLAsRequest, opts ...grpc.CallOption) (*GetAllSLAsResponse, error) - // GetPriceFeeds returns all price feeds that the module is currently - // tracking. This request type inputs the SLA ID to query price feeds for. - GetPriceFeeds(ctx context.Context, in *GetPriceFeedsRequest, opts ...grpc.CallOption) (*GetPriceFeedsResponse, error) - // Params returns the current SLA module parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryClient struct { - cc grpc.ClientConnInterface -} - -func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) GetAllSLAs(ctx context.Context, in *GetAllSLAsRequest, opts ...grpc.CallOption) (*GetAllSLAsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetAllSLAsResponse) - err := c.cc.Invoke(ctx, Query_GetAllSLAs_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GetPriceFeeds(ctx context.Context, in *GetPriceFeedsRequest, opts ...grpc.CallOption) (*GetPriceFeedsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetPriceFeedsResponse) - err := c.cc.Invoke(ctx, Query_GetPriceFeeds_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -// All implementations must embed UnimplementedQueryServer -// for forward compatibility. -// -// Query is the query service for the x/sla module. -type QueryServer interface { - // GetAllSLAs returns all SLAs that the module is currently enforcing. - GetAllSLAs(context.Context, *GetAllSLAsRequest) (*GetAllSLAsResponse, error) - // GetPriceFeeds returns all price feeds that the module is currently - // tracking. This request type inputs the SLA ID to query price feeds for. - GetPriceFeeds(context.Context, *GetPriceFeedsRequest) (*GetPriceFeedsResponse, error) - // Params returns the current SLA module parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) - mustEmbedUnimplementedQueryServer() -} - -// UnimplementedQueryServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedQueryServer struct{} - -func (UnimplementedQueryServer) GetAllSLAs(context.Context, *GetAllSLAsRequest) (*GetAllSLAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllSLAs not implemented") -} -func (UnimplementedQueryServer) GetPriceFeeds(context.Context, *GetPriceFeedsRequest) (*GetPriceFeedsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPriceFeeds not implemented") -} -func (UnimplementedQueryServer) Params(context.Context, *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} -func (UnimplementedQueryServer) testEmbeddedByValue() {} - -// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to QueryServer will -// result in compilation errors. -type UnsafeQueryServer interface { - mustEmbedUnimplementedQueryServer() -} - -func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { - // If the following call pancis, it indicates UnimplementedQueryServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Query_ServiceDesc, srv) -} - -func _Query_GetAllSLAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllSLAsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetAllSLAs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_GetAllSLAs_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllSLAs(ctx, req.(*GetAllSLAsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GetPriceFeeds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPriceFeedsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetPriceFeeds(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_GetPriceFeeds_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetPriceFeeds(ctx, req.(*GetPriceFeedsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_Params_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Query_ServiceDesc is the grpc.ServiceDesc for Query service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Query_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.sla.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetAllSLAs", - Handler: _Query_GetAllSLAs_Handler, - }, - { - MethodName: "GetPriceFeeds", - Handler: _Query_GetPriceFeeds_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/sla/v1/query.proto", -} diff --git a/api/slinky/sla/v1/tx.pulsar.go b/api/slinky/sla/v1/tx.pulsar.go deleted file mode 100644 index 907a5c1c5..000000000 --- a/api/slinky/sla/v1/tx.pulsar.go +++ /dev/null @@ -1,3129 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package slav1 - -import ( - _ "cosmossdk.io/api/cosmos/msg/v1" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - reflect "reflect" - sync "sync" -) - -var _ protoreflect.List = (*_MsgAddSLAs_1_list)(nil) - -type _MsgAddSLAs_1_list struct { - list *[]*PriceFeedSLA -} - -func (x *_MsgAddSLAs_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgAddSLAs_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgAddSLAs_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeedSLA) - (*x.list)[i] = concreteValue -} - -func (x *_MsgAddSLAs_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*PriceFeedSLA) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgAddSLAs_1_list) AppendMutable() protoreflect.Value { - v := new(PriceFeedSLA) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgAddSLAs_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgAddSLAs_1_list) NewElement() protoreflect.Value { - v := new(PriceFeedSLA) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgAddSLAs_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgAddSLAs protoreflect.MessageDescriptor - fd_MsgAddSLAs_slas protoreflect.FieldDescriptor - fd_MsgAddSLAs_authority protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_tx_proto_init() - md_MsgAddSLAs = File_slinky_sla_v1_tx_proto.Messages().ByName("MsgAddSLAs") - fd_MsgAddSLAs_slas = md_MsgAddSLAs.Fields().ByName("slas") - fd_MsgAddSLAs_authority = md_MsgAddSLAs.Fields().ByName("authority") -} - -var _ protoreflect.Message = (*fastReflection_MsgAddSLAs)(nil) - -type fastReflection_MsgAddSLAs MsgAddSLAs - -func (x *MsgAddSLAs) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgAddSLAs)(x) -} - -func (x *MsgAddSLAs) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgAddSLAs_messageType fastReflection_MsgAddSLAs_messageType -var _ protoreflect.MessageType = fastReflection_MsgAddSLAs_messageType{} - -type fastReflection_MsgAddSLAs_messageType struct{} - -func (x fastReflection_MsgAddSLAs_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgAddSLAs)(nil) -} -func (x fastReflection_MsgAddSLAs_messageType) New() protoreflect.Message { - return new(fastReflection_MsgAddSLAs) -} -func (x fastReflection_MsgAddSLAs_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAddSLAs -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgAddSLAs) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAddSLAs -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgAddSLAs) Type() protoreflect.MessageType { - return _fastReflection_MsgAddSLAs_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgAddSLAs) New() protoreflect.Message { - return new(fastReflection_MsgAddSLAs) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgAddSLAs) Interface() protoreflect.ProtoMessage { - return (*MsgAddSLAs)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgAddSLAs) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Slas) != 0 { - value := protoreflect.ValueOfList(&_MsgAddSLAs_1_list{list: &x.Slas}) - if !f(fd_MsgAddSLAs_slas, value) { - return - } - } - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgAddSLAs_authority, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgAddSLAs) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.MsgAddSLAs.slas": - return len(x.Slas) != 0 - case "slinky.sla.v1.MsgAddSLAs.authority": - return x.Authority != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAs does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAs) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.MsgAddSLAs.slas": - x.Slas = nil - case "slinky.sla.v1.MsgAddSLAs.authority": - x.Authority = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAs does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgAddSLAs) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.MsgAddSLAs.slas": - if len(x.Slas) == 0 { - return protoreflect.ValueOfList(&_MsgAddSLAs_1_list{}) - } - listValue := &_MsgAddSLAs_1_list{list: &x.Slas} - return protoreflect.ValueOfList(listValue) - case "slinky.sla.v1.MsgAddSLAs.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAs does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAs) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.MsgAddSLAs.slas": - lv := value.List() - clv := lv.(*_MsgAddSLAs_1_list) - x.Slas = *clv.list - case "slinky.sla.v1.MsgAddSLAs.authority": - x.Authority = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAs does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAs) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.MsgAddSLAs.slas": - if x.Slas == nil { - x.Slas = []*PriceFeedSLA{} - } - value := &_MsgAddSLAs_1_list{list: &x.Slas} - return protoreflect.ValueOfList(value) - case "slinky.sla.v1.MsgAddSLAs.authority": - panic(fmt.Errorf("field authority of message slinky.sla.v1.MsgAddSLAs is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAs does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgAddSLAs) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.MsgAddSLAs.slas": - list := []*PriceFeedSLA{} - return protoreflect.ValueOfList(&_MsgAddSLAs_1_list{list: &list}) - case "slinky.sla.v1.MsgAddSLAs.authority": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAs does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgAddSLAs) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.MsgAddSLAs", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgAddSLAs) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAs) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgAddSLAs) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgAddSLAs) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgAddSLAs) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Slas) > 0 { - for _, e := range x.Slas { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgAddSLAs) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0x12 - } - if len(x.Slas) > 0 { - for iNdEx := len(x.Slas) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Slas[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgAddSLAs) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddSLAs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddSLAs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Slas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Slas = append(x.Slas, &PriceFeedSLA{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Slas[len(x.Slas)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgAddSLAsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_sla_v1_tx_proto_init() - md_MsgAddSLAsResponse = File_slinky_sla_v1_tx_proto.Messages().ByName("MsgAddSLAsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgAddSLAsResponse)(nil) - -type fastReflection_MsgAddSLAsResponse MsgAddSLAsResponse - -func (x *MsgAddSLAsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgAddSLAsResponse)(x) -} - -func (x *MsgAddSLAsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgAddSLAsResponse_messageType fastReflection_MsgAddSLAsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgAddSLAsResponse_messageType{} - -type fastReflection_MsgAddSLAsResponse_messageType struct{} - -func (x fastReflection_MsgAddSLAsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgAddSLAsResponse)(nil) -} -func (x fastReflection_MsgAddSLAsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgAddSLAsResponse) -} -func (x fastReflection_MsgAddSLAsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAddSLAsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgAddSLAsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgAddSLAsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgAddSLAsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgAddSLAsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgAddSLAsResponse) New() protoreflect.Message { - return new(fastReflection_MsgAddSLAsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgAddSLAsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgAddSLAsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgAddSLAsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgAddSLAsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgAddSLAsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgAddSLAsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgAddSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgAddSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgAddSLAsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.MsgAddSLAsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgAddSLAsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgAddSLAsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgAddSLAsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgAddSLAsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgAddSLAsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgAddSLAsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgAddSLAsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddSLAsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddSLAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_MsgRemoveSLAs_1_list)(nil) - -type _MsgRemoveSLAs_1_list struct { - list *[]string -} - -func (x *_MsgRemoveSLAs_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgRemoveSLAs_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_MsgRemoveSLAs_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_MsgRemoveSLAs_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgRemoveSLAs_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveSLAs at list field Ids as it is not of Message kind")) -} - -func (x *_MsgRemoveSLAs_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_MsgRemoveSLAs_1_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_MsgRemoveSLAs_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgRemoveSLAs protoreflect.MessageDescriptor - fd_MsgRemoveSLAs_ids protoreflect.FieldDescriptor - fd_MsgRemoveSLAs_authority protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_tx_proto_init() - md_MsgRemoveSLAs = File_slinky_sla_v1_tx_proto.Messages().ByName("MsgRemoveSLAs") - fd_MsgRemoveSLAs_ids = md_MsgRemoveSLAs.Fields().ByName("ids") - fd_MsgRemoveSLAs_authority = md_MsgRemoveSLAs.Fields().ByName("authority") -} - -var _ protoreflect.Message = (*fastReflection_MsgRemoveSLAs)(nil) - -type fastReflection_MsgRemoveSLAs MsgRemoveSLAs - -func (x *MsgRemoveSLAs) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgRemoveSLAs)(x) -} - -func (x *MsgRemoveSLAs) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgRemoveSLAs_messageType fastReflection_MsgRemoveSLAs_messageType -var _ protoreflect.MessageType = fastReflection_MsgRemoveSLAs_messageType{} - -type fastReflection_MsgRemoveSLAs_messageType struct{} - -func (x fastReflection_MsgRemoveSLAs_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgRemoveSLAs)(nil) -} -func (x fastReflection_MsgRemoveSLAs_messageType) New() protoreflect.Message { - return new(fastReflection_MsgRemoveSLAs) -} -func (x fastReflection_MsgRemoveSLAs_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveSLAs -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgRemoveSLAs) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveSLAs -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgRemoveSLAs) Type() protoreflect.MessageType { - return _fastReflection_MsgRemoveSLAs_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgRemoveSLAs) New() protoreflect.Message { - return new(fastReflection_MsgRemoveSLAs) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgRemoveSLAs) Interface() protoreflect.ProtoMessage { - return (*MsgRemoveSLAs)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgRemoveSLAs) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Ids) != 0 { - value := protoreflect.ValueOfList(&_MsgRemoveSLAs_1_list{list: &x.Ids}) - if !f(fd_MsgRemoveSLAs_ids, value) { - return - } - } - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgRemoveSLAs_authority, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgRemoveSLAs) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.MsgRemoveSLAs.ids": - return len(x.Ids) != 0 - case "slinky.sla.v1.MsgRemoveSLAs.authority": - return x.Authority != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAs does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAs) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.MsgRemoveSLAs.ids": - x.Ids = nil - case "slinky.sla.v1.MsgRemoveSLAs.authority": - x.Authority = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAs does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgRemoveSLAs) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.MsgRemoveSLAs.ids": - if len(x.Ids) == 0 { - return protoreflect.ValueOfList(&_MsgRemoveSLAs_1_list{}) - } - listValue := &_MsgRemoveSLAs_1_list{list: &x.Ids} - return protoreflect.ValueOfList(listValue) - case "slinky.sla.v1.MsgRemoveSLAs.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAs does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAs) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.MsgRemoveSLAs.ids": - lv := value.List() - clv := lv.(*_MsgRemoveSLAs_1_list) - x.Ids = *clv.list - case "slinky.sla.v1.MsgRemoveSLAs.authority": - x.Authority = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAs does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAs) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.MsgRemoveSLAs.ids": - if x.Ids == nil { - x.Ids = []string{} - } - value := &_MsgRemoveSLAs_1_list{list: &x.Ids} - return protoreflect.ValueOfList(value) - case "slinky.sla.v1.MsgRemoveSLAs.authority": - panic(fmt.Errorf("field authority of message slinky.sla.v1.MsgRemoveSLAs is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAs does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgRemoveSLAs) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.MsgRemoveSLAs.ids": - list := []string{} - return protoreflect.ValueOfList(&_MsgRemoveSLAs_1_list{list: &list}) - case "slinky.sla.v1.MsgRemoveSLAs.authority": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAs")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAs does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgRemoveSLAs) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.MsgRemoveSLAs", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgRemoveSLAs) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAs) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgRemoveSLAs) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgRemoveSLAs) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgRemoveSLAs) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Ids) > 0 { - for _, s := range x.Ids { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgRemoveSLAs) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0x12 - } - if len(x.Ids) > 0 { - for iNdEx := len(x.Ids) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Ids[iNdEx]) - copy(dAtA[i:], x.Ids[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Ids[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgRemoveSLAs) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveSLAs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveSLAs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Ids = append(x.Ids, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgRemoveSLAsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_sla_v1_tx_proto_init() - md_MsgRemoveSLAsResponse = File_slinky_sla_v1_tx_proto.Messages().ByName("MsgRemoveSLAsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgRemoveSLAsResponse)(nil) - -type fastReflection_MsgRemoveSLAsResponse MsgRemoveSLAsResponse - -func (x *MsgRemoveSLAsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgRemoveSLAsResponse)(x) -} - -func (x *MsgRemoveSLAsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgRemoveSLAsResponse_messageType fastReflection_MsgRemoveSLAsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgRemoveSLAsResponse_messageType{} - -type fastReflection_MsgRemoveSLAsResponse_messageType struct{} - -func (x fastReflection_MsgRemoveSLAsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgRemoveSLAsResponse)(nil) -} -func (x fastReflection_MsgRemoveSLAsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgRemoveSLAsResponse) -} -func (x fastReflection_MsgRemoveSLAsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveSLAsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgRemoveSLAsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveSLAsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgRemoveSLAsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgRemoveSLAsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgRemoveSLAsResponse) New() protoreflect.Message { - return new(fastReflection_MsgRemoveSLAsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgRemoveSLAsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgRemoveSLAsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgRemoveSLAsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgRemoveSLAsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgRemoveSLAsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgRemoveSLAsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgRemoveSLAsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgRemoveSLAsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgRemoveSLAsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.MsgRemoveSLAsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgRemoveSLAsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgRemoveSLAsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgRemoveSLAsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgRemoveSLAsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgRemoveSLAsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgRemoveSLAsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgRemoveSLAsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveSLAsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveSLAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgParams protoreflect.MessageDescriptor - fd_MsgParams_params protoreflect.FieldDescriptor - fd_MsgParams_authority protoreflect.FieldDescriptor -) - -func init() { - file_slinky_sla_v1_tx_proto_init() - md_MsgParams = File_slinky_sla_v1_tx_proto.Messages().ByName("MsgParams") - fd_MsgParams_params = md_MsgParams.Fields().ByName("params") - fd_MsgParams_authority = md_MsgParams.Fields().ByName("authority") -} - -var _ protoreflect.Message = (*fastReflection_MsgParams)(nil) - -type fastReflection_MsgParams MsgParams - -func (x *MsgParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgParams)(x) -} - -func (x *MsgParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgParams_messageType fastReflection_MsgParams_messageType -var _ protoreflect.MessageType = fastReflection_MsgParams_messageType{} - -type fastReflection_MsgParams_messageType struct{} - -func (x fastReflection_MsgParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgParams)(nil) -} -func (x fastReflection_MsgParams_messageType) New() protoreflect.Message { - return new(fastReflection_MsgParams) -} -func (x fastReflection_MsgParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParams -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgParams) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParams -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgParams) Type() protoreflect.MessageType { - return _fastReflection_MsgParams_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgParams) New() protoreflect.Message { - return new(fastReflection_MsgParams) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgParams) Interface() protoreflect.ProtoMessage { - return (*MsgParams)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_MsgParams_params, value) { - return - } - } - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgParams_authority, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.sla.v1.MsgParams.params": - return x.Params != nil - case "slinky.sla.v1.MsgParams.authority": - return x.Authority != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParams does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.sla.v1.MsgParams.params": - x.Params = nil - case "slinky.sla.v1.MsgParams.authority": - x.Authority = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParams does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.sla.v1.MsgParams.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.sla.v1.MsgParams.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParams does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.sla.v1.MsgParams.params": - x.Params = value.Message().Interface().(*Params) - case "slinky.sla.v1.MsgParams.authority": - x.Authority = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParams does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.MsgParams.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "slinky.sla.v1.MsgParams.authority": - panic(fmt.Errorf("field authority of message slinky.sla.v1.MsgParams is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParams does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.sla.v1.MsgParams.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.sla.v1.MsgParams.authority": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParams does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.MsgParams", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgParams) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgParams) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgParams) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgParams) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0x12 - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgParams) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgParamsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_sla_v1_tx_proto_init() - md_MsgParamsResponse = File_slinky_sla_v1_tx_proto.Messages().ByName("MsgParamsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgParamsResponse)(nil) - -type fastReflection_MsgParamsResponse MsgParamsResponse - -func (x *MsgParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgParamsResponse)(x) -} - -func (x *MsgParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgParamsResponse_messageType fastReflection_MsgParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgParamsResponse_messageType{} - -type fastReflection_MsgParamsResponse_messageType struct{} - -func (x fastReflection_MsgParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgParamsResponse)(nil) -} -func (x fastReflection_MsgParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgParamsResponse) -} -func (x fastReflection_MsgParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParamsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgParamsResponse) New() protoreflect.Message { - return new(fastReflection_MsgParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgParamsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgParamsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParamsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParamsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParamsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.sla.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.sla.v1.MsgParamsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.sla.v1.MsgParamsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgParamsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgParamsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgParamsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgParamsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgParamsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/sla/v1/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// MsgAddSLAs defines the Msg/AddSLAs request type. It contains the -// SLAs to be added to the store. -type MsgAddSLAs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // SLAs defines the SLAs to be added to the store. - Slas []*PriceFeedSLA `protobuf:"bytes,1,rep,name=slas,proto3" json:"slas,omitempty"` - // Authority defines the authority that is adding the SLAs. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *MsgAddSLAs) Reset() { - *x = MsgAddSLAs{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgAddSLAs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgAddSLAs) ProtoMessage() {} - -// Deprecated: Use MsgAddSLAs.ProtoReflect.Descriptor instead. -func (*MsgAddSLAs) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_tx_proto_rawDescGZIP(), []int{0} -} - -func (x *MsgAddSLAs) GetSlas() []*PriceFeedSLA { - if x != nil { - return x.Slas - } - return nil -} - -func (x *MsgAddSLAs) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -// MsgAddSLAsResponse defines the Msg/AddSLAs response type. -type MsgAddSLAsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgAddSLAsResponse) Reset() { - *x = MsgAddSLAsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgAddSLAsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgAddSLAsResponse) ProtoMessage() {} - -// Deprecated: Use MsgAddSLAsResponse.ProtoReflect.Descriptor instead. -func (*MsgAddSLAsResponse) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_tx_proto_rawDescGZIP(), []int{1} -} - -// MsgRemoveSLAs defines the Msg/RemoveSLAs request type. It contains the -// IDs of the SLAs to be removed from the store. -type MsgRemoveSLAs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // IDs defines the IDs of the SLAs to be removed from the store. - Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` - // Authority defines the authority that is removing the SLAs. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *MsgRemoveSLAs) Reset() { - *x = MsgRemoveSLAs{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgRemoveSLAs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgRemoveSLAs) ProtoMessage() {} - -// Deprecated: Use MsgRemoveSLAs.ProtoReflect.Descriptor instead. -func (*MsgRemoveSLAs) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *MsgRemoveSLAs) GetIds() []string { - if x != nil { - return x.Ids - } - return nil -} - -func (x *MsgRemoveSLAs) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -// MsgRemoveSLAsResponse defines the Msg/RemoveSLAs response type. -type MsgRemoveSLAsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgRemoveSLAsResponse) Reset() { - *x = MsgRemoveSLAsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgRemoveSLAsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgRemoveSLAsResponse) ProtoMessage() {} - -// Deprecated: Use MsgRemoveSLAsResponse.ProtoReflect.Descriptor instead. -func (*MsgRemoveSLAsResponse) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_tx_proto_rawDescGZIP(), []int{3} -} - -// MsgParams defines the Msg/Params request type. It contains the -// new parameters for the SLA module. -type MsgParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Params defines the new parameters for the SLA module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - // Authority defines the authority that is updating the SLA module parameters. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *MsgParams) Reset() { - *x = MsgParams{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgParams) ProtoMessage() {} - -// Deprecated: Use MsgParams.ProtoReflect.Descriptor instead. -func (*MsgParams) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_tx_proto_rawDescGZIP(), []int{4} -} - -func (x *MsgParams) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -func (x *MsgParams) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -// MsgParamsResponse defines the Msg/Params response type. -type MsgParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgParamsResponse) Reset() { - *x = MsgParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_sla_v1_tx_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgParamsResponse) ProtoMessage() {} - -// Deprecated: Use MsgParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_sla_v1_tx_proto_rawDescGZIP(), []int{5} -} - -var File_slinky_sla_v1_tx_proto protoreflect.FileDescriptor - -var file_slinky_sla_v1_tx_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, - 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, - 0x73, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, - 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, - 0x01, 0x0a, 0x0a, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x4c, 0x41, 0x73, 0x12, 0x3d, 0x0a, - 0x04, 0x73, 0x6c, 0x61, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x46, 0x65, 0x65, 0x64, 0x53, 0x4c, 0x41, 0x42, 0x0c, 0xc8, 0xde, 0x1f, 0x00, 0xe2, 0xde, - 0x1f, 0x04, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x04, 0x73, 0x6c, 0x61, 0x73, 0x12, 0x36, 0x0a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x3a, 0x11, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x14, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x41, 0x64, - 0x64, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x0a, - 0x0d, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x4c, 0x41, 0x73, 0x12, 0x19, - 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x07, 0xe2, 0xde, 0x1f, - 0x03, 0x49, 0x44, 0x73, 0x52, 0x03, 0x69, 0x64, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x3a, 0x11, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8b, 0x01, - 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x33, 0x0a, 0x06, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x11, 0x82, 0xe7, 0xb0, 0x2a, 0x0c, 0x66, - 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x4d, - 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xed, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x47, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x53, - 0x4c, 0x41, 0x73, 0x12, 0x19, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x4c, 0x41, 0x73, 0x1a, 0x21, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x41, 0x64, 0x64, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x4c, 0x41, 0x73, 0x12, - 0x1c, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x4c, 0x41, 0x73, 0x1a, 0x24, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x4c, 0x41, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x20, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0x98, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, - 0x73, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x73, 0x6c, 0x61, 0x2f, 0x76, - 0x31, 0x3b, 0x73, 0x6c, 0x61, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0d, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x53, 0x6c, 0x61, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x53, 0x6c, 0x61, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x3a, 0x3a, 0x53, 0x6c, 0x61, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_sla_v1_tx_proto_rawDescOnce sync.Once - file_slinky_sla_v1_tx_proto_rawDescData = file_slinky_sla_v1_tx_proto_rawDesc -) - -func file_slinky_sla_v1_tx_proto_rawDescGZIP() []byte { - file_slinky_sla_v1_tx_proto_rawDescOnce.Do(func() { - file_slinky_sla_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_sla_v1_tx_proto_rawDescData) - }) - return file_slinky_sla_v1_tx_proto_rawDescData -} - -var file_slinky_sla_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_slinky_sla_v1_tx_proto_goTypes = []interface{}{ - (*MsgAddSLAs)(nil), // 0: slinky.sla.v1.MsgAddSLAs - (*MsgAddSLAsResponse)(nil), // 1: slinky.sla.v1.MsgAddSLAsResponse - (*MsgRemoveSLAs)(nil), // 2: slinky.sla.v1.MsgRemoveSLAs - (*MsgRemoveSLAsResponse)(nil), // 3: slinky.sla.v1.MsgRemoveSLAsResponse - (*MsgParams)(nil), // 4: slinky.sla.v1.MsgParams - (*MsgParamsResponse)(nil), // 5: slinky.sla.v1.MsgParamsResponse - (*PriceFeedSLA)(nil), // 6: slinky.sla.v1.PriceFeedSLA - (*Params)(nil), // 7: slinky.sla.v1.Params -} -var file_slinky_sla_v1_tx_proto_depIdxs = []int32{ - 6, // 0: slinky.sla.v1.MsgAddSLAs.slas:type_name -> slinky.sla.v1.PriceFeedSLA - 7, // 1: slinky.sla.v1.MsgParams.params:type_name -> slinky.sla.v1.Params - 0, // 2: slinky.sla.v1.Msg.AddSLAs:input_type -> slinky.sla.v1.MsgAddSLAs - 2, // 3: slinky.sla.v1.Msg.RemoveSLAs:input_type -> slinky.sla.v1.MsgRemoveSLAs - 4, // 4: slinky.sla.v1.Msg.Params:input_type -> slinky.sla.v1.MsgParams - 1, // 5: slinky.sla.v1.Msg.AddSLAs:output_type -> slinky.sla.v1.MsgAddSLAsResponse - 3, // 6: slinky.sla.v1.Msg.RemoveSLAs:output_type -> slinky.sla.v1.MsgRemoveSLAsResponse - 5, // 7: slinky.sla.v1.Msg.Params:output_type -> slinky.sla.v1.MsgParamsResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_slinky_sla_v1_tx_proto_init() } -func file_slinky_sla_v1_tx_proto_init() { - if File_slinky_sla_v1_tx_proto != nil { - return - } - file_slinky_sla_v1_genesis_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_sla_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAddSLAs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgAddSLAsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgRemoveSLAs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgRemoveSLAsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_sla_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_slinky_sla_v1_tx_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_sla_v1_tx_proto_goTypes, - DependencyIndexes: file_slinky_sla_v1_tx_proto_depIdxs, - MessageInfos: file_slinky_sla_v1_tx_proto_msgTypes, - }.Build() - File_slinky_sla_v1_tx_proto = out.File - file_slinky_sla_v1_tx_proto_rawDesc = nil - file_slinky_sla_v1_tx_proto_goTypes = nil - file_slinky_sla_v1_tx_proto_depIdxs = nil -} diff --git a/api/slinky/sla/v1/tx_grpc.pb.go b/api/slinky/sla/v1/tx_grpc.pb.go deleted file mode 100644 index fef5375ca..000000000 --- a/api/slinky/sla/v1/tx_grpc.pb.go +++ /dev/null @@ -1,211 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc (unknown) -// source: slinky/sla/v1/tx.proto - -package slav1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Msg_AddSLAs_FullMethodName = "/slinky.sla.v1.Msg/AddSLAs" - Msg_RemoveSLAs_FullMethodName = "/slinky.sla.v1.Msg/RemoveSLAs" - Msg_Params_FullMethodName = "/slinky.sla.v1.Msg/Params" -) - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Msg is the message service for the x/sla module. -type MsgClient interface { - // AddSLA defines a method for adding a new SLAs to the store. Note, this will - // overwrite any existing SLA with the same ID. - AddSLAs(ctx context.Context, in *MsgAddSLAs, opts ...grpc.CallOption) (*MsgAddSLAsResponse, error) - // RemoveSLA defines a method for removing existing SLAs from the store. Note, - // this will not panic if the SLA does not exist. - RemoveSLAs(ctx context.Context, in *MsgRemoveSLAs, opts ...grpc.CallOption) (*MsgRemoveSLAsResponse, error) - // Params defines a method for updating the SLA module parameters. - Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) -} - -type msgClient struct { - cc grpc.ClientConnInterface -} - -func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) AddSLAs(ctx context.Context, in *MsgAddSLAs, opts ...grpc.CallOption) (*MsgAddSLAsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MsgAddSLAsResponse) - err := c.cc.Invoke(ctx, Msg_AddSLAs_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RemoveSLAs(ctx context.Context, in *MsgRemoveSLAs, opts ...grpc.CallOption) (*MsgRemoveSLAsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MsgRemoveSLAsResponse) - err := c.cc.Invoke(ctx, Msg_RemoveSLAs_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(MsgParamsResponse) - err := c.cc.Invoke(ctx, Msg_Params_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -// All implementations must embed UnimplementedMsgServer -// for forward compatibility. -// -// Msg is the message service for the x/sla module. -type MsgServer interface { - // AddSLA defines a method for adding a new SLAs to the store. Note, this will - // overwrite any existing SLA with the same ID. - AddSLAs(context.Context, *MsgAddSLAs) (*MsgAddSLAsResponse, error) - // RemoveSLA defines a method for removing existing SLAs from the store. Note, - // this will not panic if the SLA does not exist. - RemoveSLAs(context.Context, *MsgRemoveSLAs) (*MsgRemoveSLAsResponse, error) - // Params defines a method for updating the SLA module parameters. - Params(context.Context, *MsgParams) (*MsgParamsResponse, error) - mustEmbedUnimplementedMsgServer() -} - -// UnimplementedMsgServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedMsgServer struct{} - -func (UnimplementedMsgServer) AddSLAs(context.Context, *MsgAddSLAs) (*MsgAddSLAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddSLAs not implemented") -} -func (UnimplementedMsgServer) RemoveSLAs(context.Context, *MsgRemoveSLAs) (*MsgRemoveSLAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveSLAs not implemented") -} -func (UnimplementedMsgServer) Params(context.Context, *MsgParams) (*MsgParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} -func (UnimplementedMsgServer) testEmbeddedByValue() {} - -// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MsgServer will -// result in compilation errors. -type UnsafeMsgServer interface { - mustEmbedUnimplementedMsgServer() -} - -func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { - // If the following call pancis, it indicates UnimplementedMsgServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Msg_ServiceDesc, srv) -} - -func _Msg_AddSLAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddSLAs) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddSLAs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_AddSLAs_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddSLAs(ctx, req.(*MsgAddSLAs)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RemoveSLAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveSLAs) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RemoveSLAs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_RemoveSLAs_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveSLAs(ctx, req.(*MsgRemoveSLAs)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_Params_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Params(ctx, req.(*MsgParams)) - } - return interceptor(ctx, in, info, handler) -} - -// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Msg_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.sla.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddSLAs", - Handler: _Msg_AddSLAs_Handler, - }, - { - MethodName: "RemoveSLAs", - Handler: _Msg_RemoveSLAs_Handler, - }, - { - MethodName: "Params", - Handler: _Msg_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/sla/v1/tx.proto", -} diff --git a/go.mod b/go.mod index 35e020b8c..1ff5989df 100644 --- a/go.mod +++ b/go.mod @@ -92,7 +92,7 @@ require ( 4d63.com/gochecknoglobals v0.2.1 // indirect cloud.google.com/go/iam v1.2.0 // indirect cosmossdk.io/errors v1.0.1 // indirect - cosmossdk.io/x/tx v0.13.5 + cosmossdk.io/x/tx v0.13.5 // indirect cosmossdk.io/x/upgrade v0.1.4 filippo.io/edwards25519 v1.1.0 // indirect github.com/4meepo/tagalign v1.3.4 // indirect @@ -121,7 +121,7 @@ require ( github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/bits-and-blooms/bitset v1.14.2 + github.com/bits-and-blooms/bitset v1.14.2 // indirect github.com/bkielbasa/cyclop v1.2.3 // indirect github.com/blendle/zapdriver v1.3.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect @@ -203,7 +203,7 @@ require ( github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/protobuf v1.3.2 + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect diff --git a/oracle/update.go b/oracle/update.go index afd388b08..d645f58a5 100644 --- a/oracle/update.go +++ b/oracle/update.go @@ -19,14 +19,19 @@ func (o *OracleImpl) UpdateMarketMap(marketMap mmtypes.MarketMap) error { o.mut.Lock() defer o.mut.Unlock() - if err := marketMap.ValidateBasic(); err != nil { + validSubset, err := marketMap.GetValidSubset() + if err != nil { o.logger.Error("failed to validate market map", zap.Error(err)) return err } + if len(validSubset.Markets) == 0 { + o.logger.Warn("market map update produced no valid markets to fetch") + } + // Iterate over all existing price providers and update their market maps. for name, state := range o.priceProviders { - providerTickers, err := types.ProviderTickersFromMarketMap(name, marketMap) + providerTickers, err := types.ProviderTickersFromMarketMap(name, validSubset) if err != nil { o.logger.Error("failed to create provider market map", zap.String("provider", name), zap.Error(err)) return err @@ -42,7 +47,7 @@ func (o *OracleImpl) UpdateMarketMap(marketMap mmtypes.MarketMap) error { o.priceProviders[name] = updatedState } - o.marketMap = marketMap + o.marketMap = validSubset if o.aggregator != nil { o.aggregator.UpdateMarketMap(o.marketMap) } diff --git a/oracle/update_test.go b/oracle/update_test.go index 351fd3993..d9aa7d137 100644 --- a/oracle/update_test.go +++ b/oracle/update_test.go @@ -18,7 +18,7 @@ import ( ) func TestUpdateWithMarketMap(t *testing.T) { - t.Run("bad market map is rejected", func(t *testing.T) { + t.Run("bad market map is not rejected", func(t *testing.T) { orc, err := oracle.New( oracleCfg, noOpPriceAggregator{}, @@ -35,7 +35,7 @@ func TestUpdateWithMarketMap(t *testing.T) { "bad": {}, }, }) - require.Error(t, err) + require.NoError(t, err) o.Stop() }) @@ -626,4 +626,60 @@ func TestUpdateProviderState(t *testing.T) { 500*time.Millisecond, ) }) + + t.Run("can update the market map with partial failure on NormalizeBy", func(t *testing.T) { + orc, err := oracle.New( + oracleCfg, + noOpPriceAggregator{}, + oracle.WithLogger(logger), + oracle.WithPriceAPIQueryHandlerFactory(oraclefactory.APIQueryHandlerFactory), + oracle.WithPriceWebSocketQueryHandlerFactory(oraclefactory.WebSocketQueryHandlerFactory), + ) + require.NoError(t, err) + o := orc.(*oracle.OracleImpl) + require.NoError(t, o.Init(context.TODO())) + + providers := o.GetProviderState() + require.Len(t, providers, 3) + + // Update the oracle's market map. + require.NoError(t, o.UpdateMarketMap(partialInvalidMarketMap)) + + providers = o.GetProviderState() + + cbTickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, validMarketMapSubset) + require.NoError(t, err) + + // Check the state after the update. + coinbaseState, ok := providers[coinbase.Name] + require.True(t, ok) + checkProviderState( + t, + cbTickers, + coinbase.Name, + providertypes.API, + false, + coinbaseState, + ) + + okxTickers, err := types.ProviderTickersFromMarketMap(okx.Name, validMarketMapSubset) + require.NoError(t, err) + + okxState, ok := providers[okx.Name] + require.True(t, ok) + checkProviderState( + t, + okxTickers, + okx.Name, + providertypes.WebSockets, + false, + okxState, + ) + + binanceState, ok := providers[binance.Name] + require.True(t, ok) + checkProviderState(t, nil, binance.Name, providertypes.API, false, binanceState) + + o.Stop() + }) } diff --git a/pkg/math/math.go b/pkg/math/math.go index f5a798e4f..b035aaf8b 100644 --- a/pkg/math/math.go +++ b/pkg/math/math.go @@ -68,7 +68,7 @@ func Float64ToBigInt(val float64, decimals uint64) *big.Int { // BigFloatToBigInt converts a big.Float to a big.Int. func BigFloatToBigInt(f *big.Float, decimals uint64) *big.Int { bigFloat := new(big.Float) - factor := big.NewInt(1).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) + factor := big.NewInt(1).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) //nolint:gosec bigFloat.SetInt(factor) f.Mul(f, bigFloat) @@ -92,7 +92,7 @@ func Float64StringToBigFloat(s string) (*big.Float, error) { // ScaleBigFloat scales a big.Float by the given decimals. func ScaleBigFloat(f *big.Float, decimals uint64) *big.Float { bigFloat := new(big.Float) - factor := big.NewInt(1).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) + factor := big.NewInt(1).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) //nolint:gosec bigFloat.SetInt(factor) f.Mul(f, bigFloat) diff --git a/pkg/math/oracle/aggregator.go b/pkg/math/oracle/aggregator.go index 4930af8ed..7dd072439 100644 --- a/pkg/math/oracle/aggregator.go +++ b/pkg/math/oracle/aggregator.go @@ -91,13 +91,13 @@ func (m *IndexPriceAggregator) AggregatePrices() { m.metrics.AddProviderCountForMarket(target.String(), len(convertedPrices)) // We need to have at least the minimum number of providers to calculate the median. - if len(convertedPrices) < int(target.MinProviderCount) { + if len(convertedPrices) < int(target.MinProviderCount) { //nolint:gosec m.logger.Error( "insufficient amount of converted prices", zap.String("target_ticker", ticker), zap.Int("num_converted_prices", len(convertedPrices)), zap.Any("converted_prices", convertedPrices), - zap.Int("min_provider_count", int(target.MinProviderCount)), + zap.Int("min_provider_count", int(target.MinProviderCount)), //nolint:gosec ) continue diff --git a/proto/slinky/alerts/module/v1/module.proto b/proto/slinky/alerts/module/v1/module.proto deleted file mode 100644 index bc36ad023..000000000 --- a/proto/slinky/alerts/module/v1/module.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package slinky.alerts.module.v1; - -import "cosmos/app/v1alpha1/module.proto"; -import "cosmos_proto/cosmos.proto"; - -// Module is the config object of the alerts module. -message Module { - option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/skip-mev/slinky/x/alerts" - }; - - // Authority defines the custom module authority. The authority will default - // to the governance module account if not set. If the authority is set, the - // address provided must be a valid bech-32 address - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} diff --git a/proto/slinky/alerts/v1/alerts.proto b/proto/slinky/alerts/v1/alerts.proto deleted file mode 100644 index 0cfb9d5b9..000000000 --- a/proto/slinky/alerts/v1/alerts.proto +++ /dev/null @@ -1,123 +0,0 @@ -syntax = "proto3"; -package slinky.alerts.v1; - -import "slinky/oracle/v1/genesis.proto"; -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "tendermint/abci/types.proto"; -import "google/protobuf/any.proto"; -import "slinky/types/v1/currency_pair.proto"; - -option go_package = "github.com/skip-mev/slinky/x/alerts/types"; - -// Alert defines the basic meta-data necessary for the alerts module to resolve -// a claim that the price of a CurrencyPair on-chain is deviating from the price -// off-chain. -message Alert { - option (amino.name) = "slinky/x/alerts/Alert"; - - // height represents the height for which the alert is filed. - uint64 height = 1; - - // signer is the signer of this alert, this is the address that will receive - // the reward in the case of a positive conclusion, or whose bond will get - // slashed in the event of a negative conclusion. - string signer = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // currency_pair is the currency-pair that this claim asserts is deviating - // from the price off-chain. - slinky.types.v1.CurrencyPair currency_pair = 3 - [ (gogoproto.nullable) = false ]; -} - -// AlertStatus contains the module specific state for an alert: Has the alert -// been concluded? What height was the alert submitted, what height should the -// alert be purged? -message AlertStatus { - option (amino.name) = "slinky/x/alerts/AlertStatus"; - - // ConclusionStatus determines whether the alert has been concluded. - uint64 conclusion_status = 1; - - // SubmissionHeight is the height that the alert was submitted in. - uint64 submission_height = 2; - - // SubmissionTimestamp is the block-timestamp of the block that the alert was - // submitted in (as a UTC value in Unix time). - uint64 submission_timestamp = 3; - - // PurgeHeight is the height at which the alert should be purged. - uint64 purge_height = 4; -} - -// AlertWithStatus represents a wrapper around the Alert and AlertStatus -// objects, this is so that the module specific information about Alerts can be -// packaged together. -message AlertWithStatus { - option (amino.name) = "slinky/x/alerts/AlertWithStatus"; - - // alert is the alert that this status corresponds to. - Alert alert = 1 [ (gogoproto.nullable) = false ]; - - // status is the status of the alert. - AlertStatus status = 2 [ (gogoproto.nullable) = false ]; -} - -// Signature is a container for a signer address mapped to a signature. -message Signature { - string signer = 1; - bytes signature = 2; -} - -// MultiSigConcluson defines a conclusion that is accompanied by a set of -// signatures. The signature is defined over the alert UID, status, OracleData, -// and PriceBound. The signatures are used to verify that the conclusion is -// valid. -message MultiSigConclusion { - option (amino.name) = "slinky/x/alerts/Conclusion"; - option (cosmos_proto.implements_interface) = "slinky.alerts.v1.Conclusion"; - - // alert is the alert that this conclusion corresponds to. - Alert alert = 1 [ (gogoproto.nullable) = false ]; - - // oracle_data is the oracle data that this conclusion references. - tendermint.abci.ExtendedCommitInfo extended_commit_info = 2 - [ (gogoproto.nullable) = false ]; - - // signatures is a map of signer -> signature. Where the signature is over - // Alert.UID, PriceBound, the marshalled ExtendedCommitInfo, and status. - repeated Signature signatures = 3 [ (gogoproto.nullable) = false ]; - - // price-bound is the price bound of the currency-pair off-chain for the - // designated time-range. - PriceBound price_bound = 4 [ (gogoproto.nullable) = false ]; - - // status is the status of the conclusion. - bool status = 5; - - // CurrencyPairID is the ID of the currency-pair that this conclusion - // corresponds to. - uint64 currency_pair_i_d = 6; -} - -// MultiSigConclusionVerificationParams defines the parameters necessary to -// verify a MultiSigConclusion. It contains a map between signer and public key. -// Notice, the public-key (value) are the base-64 encoded bytes of the public -// key. And the signer (key) is the bech32 encoded address of the signer. -// Notice, all public keys must be secp256 keys. -message MultiSigConclusionVerificationParams { - option (amino.name) = "slinky/x/alerts/ConclusionVerificationParams"; - option (cosmos_proto.implements_interface) = - "slinky.alerts.v1.ConclusionVerificationParams"; - - // signers is a map of signer -> public key. - repeated google.protobuf.Any signers = 1; -} - -// PriceBound represents the bounds of the price of a currency-pair off chain -// for a designated time-range -message PriceBound { - string high = 1; - string low = 2; -} diff --git a/proto/slinky/alerts/v1/genesis.proto b/proto/slinky/alerts/v1/genesis.proto deleted file mode 100644 index e86d4ffa6..000000000 --- a/proto/slinky/alerts/v1/genesis.proto +++ /dev/null @@ -1,68 +0,0 @@ - -syntax = "proto3"; -package slinky.alerts.v1; - -import "cosmos/base/v1beta1/coin.proto"; -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "slinky/alerts/v1/alerts.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/skip-mev/slinky/x/alerts/types"; - -// AlertParams is the set of parameters for the x/Alerts module's Alerting. It -// defines whether or not Alerts can be submitted, and if so, the minimum -// bond amount required to submit an Alert. -message AlertParams { - // Enabled is a boolean defining whether or not Alerts can be submitted - // to the module - bool enabled = 1; - - // BondAmount is the minimum amount of bond required to submit an - // Alert - cosmos.base.v1beta1.Coin bond_amount = 2 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - - // MaxBlockAge defines the maximum age of an Alert before it is pruned, notice - // this is defined wrt. the height that the Alert references, i.e Alerts are - // only relevant until Alert.Height + MaxBlockAge is reached. - uint64 max_block_age = 3; -} - -// PruningParams defines the criterion for pruning Alerts from the state. -message PruningParams { - // Enabled defines whether Alerts are to be pruned - bool enabled = 1; - - // BlocksToPrune defines the number of blocks until an Alert will be pruned - // from state, notice this is defined wrt. the current block height, i.e - // Alerts will be stored in state until current_height + BlocksToPrune is - // reached. - uint64 blocks_to_prune = 2; -} - -// Params is the set of parameters for the x/Alerts module. -message Params { - // AlertParams is the set of parameters for the x/Alerts module's Alerting. - AlertParams alert_params = 1 [ (gogoproto.nullable) = false ]; - - // ConclusionVerificationParams is the set of parameters for the x/Alerts - // module's conclusion verification. - google.protobuf.Any conclusion_verification_params = 2 - [ (cosmos_proto.accepts_interface) = - "slinky.alerts.v1.ConclusionVerificationParams" ]; - - // PruningParams is the set of parameters for the x/Alerts module's pruning. - PruningParams pruning_params = 3 [ (gogoproto.nullable) = false ]; -} - -// GenesisState is the state that must be provided at genesis. It contains -// params for the module, and the set initial Alerts. -message GenesisState { - // Params is the set of x/Alerts parameters - Params params = 1 [ (gogoproto.nullable) = false ]; - - // Alerts is the set of Alerts that have been submitted to the module - repeated AlertWithStatus alerts = 2 [ (gogoproto.nullable) = false ]; -} diff --git a/proto/slinky/alerts/v1/query.proto b/proto/slinky/alerts/v1/query.proto deleted file mode 100644 index b6f0aff74..000000000 --- a/proto/slinky/alerts/v1/query.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; -package slinky.alerts.v1; - -import "google/api/annotations.proto"; -import "slinky/alerts/v1/alerts.proto"; -import "slinky/alerts/v1/genesis.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/skip-mev/slinky/x/alerts/types"; - -// Query is the query service for the x/alerts module. -service Query { - // Alerts gets all alerts in state under the given status. If no status is - // given, all Alerts are returned - rpc Alerts(AlertsRequest) returns (AlertsResponse) { - option (google.api.http) = { - get : "/slinky/alerts/v1/alerts" - }; - } - - rpc Params(ParamsRequest) returns (ParamsResponse) { - option (google.api.http) = { - get : "/slinky/alerts/v1/params" - }; - } -} - -// AlertStatus is the type for the status of an Alert, it can be Unconcluded or -// Concluded. -enum AlertStatusID { - CONCLUSION_STATUS_UNSPECIFIED = 0; - CONCLUSION_STATUS_UNCONCLUDED = 1; - CONCLUSION_STATUS_CONCLUDED = 2; -} - -// AlertsRequest is the request type for the Query.Alerts RPC method, the status -// field indicates whether the request should return only Unconcluded / -// Concluded Alerts, or all Alerts. -message AlertsRequest { AlertStatusID status = 1; } - -// AlertsResponse is the response type for the Query.Alerts RPC method, it -// contains the list of Alerts that are being tracked by the alerts module. -message AlertsResponse { - repeated Alert alerts = 1 [ (gogoproto.nullable) = false ]; -} - -// ParamsRequest is the request type for the Query.Params RPC method. -message ParamsRequest {} - -// ParamsResponse is the response type for the Query.Params RPC method, it -// contains the Params of the module. -message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/slinky/alerts/v1/strategies.proto b/proto/slinky/alerts/v1/strategies.proto deleted file mode 100644 index 5822454cc..000000000 --- a/proto/slinky/alerts/v1/strategies.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -package slinky.alerts.v1; - -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "tendermint/abci/types.proto"; - -option go_package = "github.com/skip-mev/slinky/x/alerts/types/strategies"; - -// ValidatorAlertIncentive defines the incentive strategy to be executed for a -// validator that has been confirmed to have at fault for an x/alerts alert. -// This strategy is expected to slash half of the validator's stake. -message ValidatorAlertIncentive { - option (cosmos_proto.implements_interface) = "slinky.incentives.v1.Incentive"; - option (amino.name) = "slinky/x/alerts/ValidatorAlertIncentive"; - - // The validator that has been confirmed to have been at fault for an alert. - tendermint.abci.Validator validator = 1 [ (gogoproto.nullable) = false ]; - - // AlertSigner is the signer of the alert referenced by the conclusion that - // created this incentive. - string alert_signer = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // AlertHeight is the height at which the infraction occurred - uint64 alert_height = 3; -} diff --git a/proto/slinky/alerts/v1/tx.proto b/proto/slinky/alerts/v1/tx.proto deleted file mode 100644 index 066ce75ab..000000000 --- a/proto/slinky/alerts/v1/tx.proto +++ /dev/null @@ -1,83 +0,0 @@ -syntax = "proto3"; -package slinky.alerts.v1; - -import "slinky/alerts/v1/alerts.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/msg/v1/msg.proto"; -import "amino/amino.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "slinky/alerts/v1/genesis.proto"; - -option go_package = "github.com/skip-mev/slinky/x/alerts/types"; - -// Msg is the message service for the x/alerts module. -service Msg { - option (cosmos.msg.v1.service) = true; - - // Alert creates a new alert. On alert creation (if valid), the alert will be - // saved to state, and its bond will be escrowed until a corresponding - // Conclusion is filed to close the alert. - rpc Alert(MsgAlert) returns (MsgAlertResponse); - - // Conclusion closes an alert. On alert conclusion (if valid), the alert will - // be marked as Concluded, the bond for the alert will either be burned or - // returned, and a set of incentives will be issued to the validators deemed - // malicious by the conclusion. - rpc Conclusion(MsgConclusion) returns (MsgConclusionResponse); - - // UpdateParams updates the parameters of the alerts module. Specifically, the - // only address that is capable of submitting this Msg is the - // module-authority, in general, the x/gov module-account. The process for - // executing this message will be via governance proposal - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); -} - -// MsgAlert defines a message to create an alert. -message MsgAlert { - option (amino.name) = "slinky/x/alerts/MsgAlert"; - - option (gogoproto.equal) = false; - - // alert is the alert to be filed - Alert alert = 1 [ (gogoproto.nullable) = false ]; -} - -message MsgAlertResponse {} - -// MsgConclusion defines a message carrying a Conclusion made by the SecondTier, -// which will be used to close an alert. And trigger any ramifications of the -// conclusion. -message MsgConclusion { - option (cosmos.msg.v1.signer) = "signer"; - option (amino.name) = "slinky/x/alerts/MsgConclusion"; - - option (gogoproto.equal) = false; - - // signer is the signer of this transaction (notice, this may not always be a - // node from the SecondTier) - string signer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // conclusion is the conclusion to be filed - google.protobuf.Any conclusion = 2 - [ (cosmos_proto.accepts_interface) = "slinky.alerts.v1.Conclusion" ]; -} - -message MsgConclusionResponse {} - -// MsgUpdateParams defines the message type expected by the UpdateParams rpc. It -// contains an authority address, and the new Params for the x/alerts module. -message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "slinky/x/alerts/MsgUpdateParams"; - - option (gogoproto.equal) = false; - - // authority is the address of the authority that is submitting the update - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // params is the new set of parameters for the x/alerts module - Params params = 2 [ (gogoproto.nullable) = false ]; -} - -message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/slinky/incentives/module/v1/module.proto b/proto/slinky/incentives/module/v1/module.proto deleted file mode 100644 index 4d61dc2f9..000000000 --- a/proto/slinky/incentives/module/v1/module.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; - -package slinky.incentives.module.v1; - -import "cosmos/app/v1alpha1/module.proto"; - -// Module is the config object of the incentives module. -message Module { - option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/skip-mev/slinky/x/incentives" - }; -} \ No newline at end of file diff --git a/proto/slinky/incentives/v1/examples/badprice.proto b/proto/slinky/incentives/v1/examples/badprice.proto deleted file mode 100644 index 3487e3b2f..000000000 --- a/proto/slinky/incentives/v1/examples/badprice.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package slinky.incentives.v1; - -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/skip-mev/slinky/x/incentives/types/examples/badprice"; - -// BadPriceIncentive is a message that contains the information about a bad -// price that was submitted by a validator. -// -// NOTE: This is an example of a bad price incentive. It is not used in -// production. -message BadPriceIncentive { - option (cosmos_proto.implements_interface) = "slinky.incentives.v1.Incentive"; - option (amino.name) = "slinky/oracle/BadPriceIncentive"; - - // Validator is the address of the validator that submitted the bad price. - string validator = 1; - // Amount is the amount to slash. - string amount = 2; -} \ No newline at end of file diff --git a/proto/slinky/incentives/v1/examples/goodprice.proto b/proto/slinky/incentives/v1/examples/goodprice.proto deleted file mode 100644 index 0dcf0a91c..000000000 --- a/proto/slinky/incentives/v1/examples/goodprice.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package slinky.incentives.v1; - -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice"; - -// GoodPriceIncentive is a message that contains the information about a good -// price that was submitted by a validator. -// -// NOTE: This is an example of a good price incentive. It is not used in -// production. -message GoodPriceIncentive { - option (cosmos_proto.implements_interface) = "slinky.incentives.v1.Incentive"; - option (amino.name) = "slinky/oracle/BadPriceIncentive"; - - // Validator is the address of the validator that submitted the good price. - string validator = 1; - // Amount is the amount to reward. - string amount = 2; -} \ No newline at end of file diff --git a/proto/slinky/incentives/v1/genesis.proto b/proto/slinky/incentives/v1/genesis.proto deleted file mode 100644 index 9b2790e56..000000000 --- a/proto/slinky/incentives/v1/genesis.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package slinky.incentives.v1; - -option go_package = "github.com/skip-mev/slinky/x/incentives/types"; - -import "gogoproto/gogo.proto"; - -// GenesisState is the genesis-state for the x/incentives module. -message GenesisState { - // Registry is a list of incentives by type. The registry defined here - // should be a subset of the incentive types defined in the incentive - // module (keeper). - repeated IncentivesByType registry = 1 [ (gogoproto.nullable) = false ]; -} - -// IncentivesByType encapsulates a list of incentives by type. Each of the -// entries here must correspond to the same incentive type defined here. -message IncentivesByType { - // IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - // GoodPriceIncentiveType). - string incentive_type = 1; - // Entries is a list of incentive bytes. - repeated bytes entries = 2; -} diff --git a/proto/slinky/incentives/v1/query.proto b/proto/slinky/incentives/v1/query.proto deleted file mode 100644 index d40b2874b..000000000 --- a/proto/slinky/incentives/v1/query.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; -package slinky.incentives.v1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "slinky/incentives/v1/genesis.proto"; - -option go_package = "github.com/skip-mev/slinky/x/incentives/types"; - -// Query is the query service for the x/incentives module. -service Query { - // GetIncentivesByType returns all incentives of a given type. If the type is - // not registered with the module, an error is returned. - rpc GetIncentivesByType(GetIncentivesByTypeRequest) - returns (GetIncentivesByTypeResponse) { - option (google.api.http).get = - "/slinky/incentives/v1/get_incentives_by_type/{incentive_type}"; - } - - // GetAllIncentives returns all incentives. - rpc GetAllIncentives(GetAllIncentivesRequest) - returns (GetAllIncentivesResponse) { - option (google.api.http).get = "/slinky/incentives/v1/get_all_incentives"; - } -} - -// GetIncentivesByTypeRequest is the request type for the -// Query/GetIncentivesByType RPC method. -message GetIncentivesByTypeRequest { - // IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - // GoodPriceIncentiveType). - string incentive_type = 1; -} - -// GetIncentivesByTypeResponse is the response type for the -// Query/GetIncentivesByType RPC method. -message GetIncentivesByTypeResponse { - // Entries is the list of incentives of the given type. - repeated bytes entries = 1; -} - -// GetAllIncentivesRequest is the request type for the Query/GetAllIncentives -// RPC method. -message GetAllIncentivesRequest {} - -// GetAllIncentivesResponse is the response type for the Query/GetAllIncentives -// RPC method. -message GetAllIncentivesResponse { - // Registry is the list of all incentives, grouped by type. - repeated IncentivesByType registry = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file diff --git a/proto/slinky/sla/module/v1/module.proto b/proto/slinky/sla/module/v1/module.proto deleted file mode 100644 index f6db78e2c..000000000 --- a/proto/slinky/sla/module/v1/module.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; - -package slinky.sla.module.v1; - -import "cosmos/app/v1alpha1/module.proto"; -import "cosmos_proto/cosmos.proto"; - -// Module is the config object of the builder module. -message Module { - option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/skip-mev/slinky/x/sla" - }; - - // Authority defines the custom module authority. If not set, defaults to the - // governance module. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} \ No newline at end of file diff --git a/proto/slinky/sla/v1/genesis.proto b/proto/slinky/sla/v1/genesis.proto deleted file mode 100644 index d4f9ae7c7..000000000 --- a/proto/slinky/sla/v1/genesis.proto +++ /dev/null @@ -1,87 +0,0 @@ -syntax = "proto3"; -package slinky.sla.v1; - -option go_package = "github.com/skip-mev/slinky/x/sla/types"; - -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; -import "slinky/oracle/v1/genesis.proto"; -import "slinky/types/v1/currency_pair.proto"; - -// GenesisState defines the sla module's genesis state. -message GenesisState { - // SLAs are the SLAs that are currently active. - repeated PriceFeedSLA slas = 1 - [ (gogoproto.nullable) = false, (gogoproto.customname) = "SLAs" ]; - - // PrceFeeds are the price feeds that are currently active. - repeated PriceFeed price_feeds = 2 [ (gogoproto.nullable) = false ]; - - // Params are the parameters for the sla module. - Params params = 3 [ (gogoproto.nullable) = false ]; -} - -// Params defines the parameters for the sla module. -message Params { - // Enabled is a flag to enable or disable the sla module. - bool enabled = 1; -} - -// PriceFeedSLA defines the the desired SLA for a given set of price feeds. A -// price feed is defined to be a set of price prices for the same (currency -// pair, validator). -message PriceFeedSLA { - // MaximumViableWindow is the maximum time window that we are interested - // for the SLA. This is used to determine the moving window of blocks that - // we are interested in. - uint64 maximum_viable_window = 1; - - // ExpectedUptime is the expected uptime for the given validator and price - // feed. - string expected_uptime = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - - // SlashConstant is the constant by which we will multiply the deviation from - // the expected uptime. - string slash_constant = 3 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - - // MinimumBlockUpdates is the minimum number of blocks that the - // validator had to have voted on in the maximum viable window - // in order to be considered for the SLA. - uint64 minimum_block_updates = 4; - - // Frequency is the frequency at which we will check the SLA. - uint64 frequency = 5; - - // ID is the unique identifier for the SLA. - string id = 6 [ (gogoproto.customname) = "ID" ]; -} - -// PriceFeed defines the object type that will be utilized to monitor how -// frequently validators are voting with price updates across the network. -message PriceFeed { - // UpdateMap represents the relevant moving window of price feed updates. - bytes update_map = 1; - // InclusionMap represents the relevant moving window of blocks that the - // validator has voted on. - bytes inclusion_map = 2; - // Index corresponds to the current index into the bitmap. - uint64 index = 3; - // Validator represents the validator that this SLA corresponds to. - bytes validator = 4; - // CurrencyPair represents the currency pair that this SLA corresponds to. - slinky.types.v1.CurrencyPair currency_pair = 5 - [ (gogoproto.nullable) = false ]; - // MaximumViableWindow represents the maximum number of blocks that can be - // represented by the bit map. - uint64 maximum_viable_window = 6; - // ID corresponds to the SLA ID that this price feed corresponds to. - string id = 7 [ (gogoproto.customname) = "ID" ]; -} \ No newline at end of file diff --git a/proto/slinky/sla/v1/query.proto b/proto/slinky/sla/v1/query.proto deleted file mode 100644 index ae0ba2a2a..000000000 --- a/proto/slinky/sla/v1/query.proto +++ /dev/null @@ -1,63 +0,0 @@ -syntax = "proto3"; -package slinky.sla.v1; - -option go_package = "github.com/skip-mev/slinky/x/sla/types"; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "slinky/sla/v1/genesis.proto"; - -// Query is the query service for the x/sla module. -service Query { - // GetAllSLAs returns all SLAs that the module is currently enforcing. - rpc GetAllSLAs(GetAllSLAsRequest) returns (GetAllSLAsResponse) { - option (google.api.http) = { - get : "/slinky/sla/v1/slas" - }; - }; - - // GetPriceFeeds returns all price feeds that the module is currently - // tracking. This request type inputs the SLA ID to query price feeds for. - rpc GetPriceFeeds(GetPriceFeedsRequest) returns (GetPriceFeedsResponse) { - option (google.api.http) = { - get : "/slinky/sla/v1/price_feeds" - }; - }; - - // Params returns the current SLA module parameters. - rpc Params(ParamsRequest) returns (ParamsResponse) { - option (google.api.http) = { - get : "/slinky/sla/v1/params" - }; - }; -} - -// QueryAllSLAsRequest is the request type for the Query/GetAllSLAs RPC method. -message GetAllSLAsRequest {} - -// QueryAllSLAsResponse is the response type for the Query/GetAllSLAs RPC -// method. -message GetAllSLAsResponse { - repeated PriceFeedSLA slas = 1 - [ (gogoproto.nullable) = false, (gogoproto.customname) = "SLAs" ]; -} - -// QueryGetPriceFeedsRequest is the request type for the Query/GetPriceFeeds RPC -// method. -message GetPriceFeedsRequest { - // ID defines the SLA to query price feeds for. - string id = 1 [ (gogoproto.customname) = "ID" ]; -} - -// QueryGetPriceFeedsResponse is the response type for the Query/GetPriceFeeds -// RPC method. -message GetPriceFeedsResponse { - // PriceFeeds defines the price feeds for the given SLA. - repeated PriceFeed price_feeds = 1 [ (gogoproto.nullable) = false ]; -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -message ParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/proto/slinky/sla/v1/tx.proto b/proto/slinky/sla/v1/tx.proto deleted file mode 100644 index a0144f8fd..000000000 --- a/proto/slinky/sla/v1/tx.proto +++ /dev/null @@ -1,68 +0,0 @@ -syntax = "proto3"; -package slinky.sla.v1; - -import "slinky/sla/v1/genesis.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/msg/v1/msg.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/skip-mev/slinky/x/sla/types"; - -// Msg is the message service for the x/sla module. -service Msg { - option (cosmos.msg.v1.service) = true; - - // AddSLA defines a method for adding a new SLAs to the store. Note, this will - // overwrite any existing SLA with the same ID. - rpc AddSLAs(MsgAddSLAs) returns (MsgAddSLAsResponse); - - // RemoveSLA defines a method for removing existing SLAs from the store. Note, - // this will not panic if the SLA does not exist. - rpc RemoveSLAs(MsgRemoveSLAs) returns (MsgRemoveSLAsResponse); - - // Params defines a method for updating the SLA module parameters. - rpc Params(MsgParams) returns (MsgParamsResponse); -} - -// MsgAddSLAs defines the Msg/AddSLAs request type. It contains the -// SLAs to be added to the store. -message MsgAddSLAs { - option (cosmos.msg.v1.signer) = "from_address"; - - // SLAs defines the SLAs to be added to the store. - repeated PriceFeedSLA slas = 1 - [ (gogoproto.nullable) = false, (gogoproto.customname) = "SLAs" ]; - // Authority defines the authority that is adding the SLAs. - string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} - -// MsgAddSLAsResponse defines the Msg/AddSLAs response type. -message MsgAddSLAsResponse {} - -// MsgRemoveSLAs defines the Msg/RemoveSLAs request type. It contains the -// IDs of the SLAs to be removed from the store. -message MsgRemoveSLAs { - option (cosmos.msg.v1.signer) = "from_address"; - - // IDs defines the IDs of the SLAs to be removed from the store. - repeated string ids = 1 [ (gogoproto.customname) = "IDs" ]; - // Authority defines the authority that is removing the SLAs. - string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} - -// MsgRemoveSLAsResponse defines the Msg/RemoveSLAs response type. -message MsgRemoveSLAsResponse {} - -// MsgParams defines the Msg/Params request type. It contains the -// new parameters for the SLA module. -message MsgParams { - option (cosmos.msg.v1.signer) = "from_address"; - - // Params defines the new parameters for the SLA module. - Params params = 1 [ (gogoproto.nullable) = false ]; - // Authority defines the authority that is updating the SLA module parameters. - string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} - -// MsgParamsResponse defines the Msg/Params response type. -message MsgParamsResponse {} \ No newline at end of file diff --git a/providers/apis/defi/raydium/price_fetcher.go b/providers/apis/defi/raydium/price_fetcher.go index b388baa77..00212e374 100644 --- a/providers/apis/defi/raydium/price_fetcher.go +++ b/providers/apis/defi/raydium/price_fetcher.go @@ -399,7 +399,7 @@ func calculatePrice( baseTokenBalance, quoteTokenBalance *big.Int, baseTokenDecimals, quoteTokenDecimals uint64, ) *big.Float { - scalingFactor := math.GetScalingFactor(int64(baseTokenDecimals), int64(quoteTokenDecimals)) + scalingFactor := math.GetScalingFactor(int64(baseTokenDecimals), int64(quoteTokenDecimals)) //nolint:gosec // calculate the price as quote / base quo := new(big.Float).Quo( diff --git a/providers/apis/dydx/parse.go b/providers/apis/dydx/parse.go index bc8d50dea..3530b77bd 100644 --- a/providers/apis/dydx/parse.go +++ b/providers/apis/dydx/parse.go @@ -96,7 +96,7 @@ func CreateTickerFromMarket(market dydxtypes.MarketParam) (mmtypes.Ticker, error t := mmtypes.Ticker{ CurrencyPair: cp, - Decimals: uint64(market.Exponent * -1), + Decimals: uint64(market.Exponent * -1), //nolint:gosec MinProviderCount: uint64(market.MinExchanges), Enabled: true, } diff --git a/scripts/protocgen-pulsar.sh b/scripts/protocgen-pulsar.sh index 702ad5f36..072c93891 100644 --- a/scripts/protocgen-pulsar.sh +++ b/scripts/protocgen-pulsar.sh @@ -15,14 +15,6 @@ echo "Cleaning API directory" echo "Generating API module" (cd proto; buf generate --template buf.gen.pulsar.yaml --exclude-path slinky/service) -echo "fixing alerts.pulsar.go" -sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/alerts/v1/alerts.pulsar.go && rm ./api/slinky/alerts/v1/alerts.pulsar.go.bak -sed -i.bak 's|cosmossdk.io/api/slinky/oracle/v1|github.com/skip-mev/slinky/api/slinky/oracle/v1|g' ./api/slinky/alerts/v1/alerts.pulsar.go && rm ./api/slinky/alerts/v1/alerts.pulsar.go.bak - -echo "fixing sla.pulsar.go" -sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/sla/v1/genesis.pulsar.go && rm ./api/slinky/sla/v1/genesis.pulsar.go.bak -sed -i.bak 's|cosmossdk.io/api/slinky/oracle/v1|github.com/skip-mev/slinky/api/slinky/oracle/v1|g' ./api/slinky/sla/v1/genesis.pulsar.go && rm ./api/slinky/sla/v1/genesis.pulsar.go.bak - echo "fixing types.pulsar.go" sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/types/v1/currency_pair.pulsar.go && rm ./api/slinky/types/v1/currency_pair.pulsar.go.bak sed -i.bak 's|cosmossdk.io/api/slinky/oracle/v1|github.com/skip-mev/slinky/api/slinky/oracle/v1|g' ./api/slinky/types/v1/currency_pair.pulsar.go && rm ./api/slinky/types/v1/currency_pair.pulsar.go.bak diff --git a/tests/integration/slinky_integration_test.go b/tests/integration/slinky_integration_test.go deleted file mode 100644 index 7aad16b56..000000000 --- a/tests/integration/slinky_integration_test.go +++ /dev/null @@ -1,145 +0,0 @@ -package integration_test - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/cosmos/cosmos-sdk/x/auth" - "github.com/cosmos/cosmos-sdk/x/bank" - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/strangelove-ventures/interchaintest/v8" - "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" - "github.com/strangelove-ventures/interchaintest/v8/ibc" - "github.com/stretchr/testify/suite" - - "github.com/skip-mev/slinky/tests/integration" - "github.com/skip-mev/slinky/x/alerts" - "github.com/skip-mev/slinky/x/incentives" - marketmapmodule "github.com/skip-mev/slinky/x/marketmap" - "github.com/skip-mev/slinky/x/oracle" - "github.com/skip-mev/slinky/x/sla" -) - -var ( - image = ibc.DockerImage{ - Repository: "skip-mev/slinky-e2e", - Version: "latest", - UidGid: "1000:1000", - } - - numValidators = 4 - numFullNodes = 0 - noHostMount = false - gasAdjustment = 1.5 - - oracleImage = ibc.DockerImage{ - Repository: "skip-mev/slinky-e2e-oracle", - Version: "latest", - UidGid: "1000:1000", - } - encodingConfig = testutil.MakeTestEncodingConfig( - bank.AppModuleBasic{}, - oracle.AppModuleBasic{}, - gov.AppModuleBasic{}, - alerts.AppModuleBasic{}, - auth.AppModuleBasic{}, - marketmapmodule.AppModuleBasic{}, - incentives.AppModuleBasic{}, - sla.AppModuleBasic{}, - ) - - VotingPeriod = "10s" - MaxDepositPeriod = "1s" - UnbondingTime = "10s" - - defaultGenesisKV = []cosmos.GenesisKV{ - { - Key: "app_state.gov.params.voting_period", - Value: VotingPeriod, - }, - { - Key: "app_state.gov.params.max_deposit_period", - Value: MaxDepositPeriod, - }, - { - Key: "app_state.gov.params.min_deposit.0.denom", - Value: denom, - }, - { - Key: "app_state.gov.params.min_deposit.0.amount", - Value: "0", - }, - { - Key: "app_state.gov.params.threshold", - Value: "0.1", - }, - { - Key: "app_state.gov.params.quorum", - Value: "0", - }, - { - Key: "consensus.params.abci.vote_extensions_enable_height", - Value: "2", - }, - { - Key: "app_state.staking.params.unbonding_time", - Value: UnbondingTime, - }, - } - - denom = "stake" - spec = &interchaintest.ChainSpec{ - ChainName: "slinky", - Name: "slinky", - NumValidators: &numValidators, - NumFullNodes: &numFullNodes, - Version: "latest", - NoHostMount: &noHostMount, - ChainConfig: ibc.ChainConfig{ - EncodingConfig: &encodingConfig, - Images: []ibc.DockerImage{ - image, - }, - Type: "cosmos", - Name: "slinky", - Denom: denom, - ChainID: "chain-id-0", - Bin: "slinkyd", - Bech32Prefix: "cosmos", - CoinType: "118", - GasAdjustment: gasAdjustment, - GasPrices: fmt.Sprintf("0%s", denom), - TrustingPeriod: "48h", - NoHostMount: noHostMount, - ModifyGenesis: cosmos.ModifyGenesis(defaultGenesisKV), - }, - } -) - -func TestSlinkyOracleIntegration(t *testing.T) { - baseSuite := integration.NewSlinkyIntegrationSuite( - spec, - oracleImage, - ) - - suite.Run(t, integration.NewSlinkyOracleIntegrationSuite(baseSuite)) -} - -func TestSlinkySlashingIntegration(t *testing.T) { - baseSuite := integration.NewSlinkyIntegrationSuite( - spec, - oracleImage, - ) - - suite.Run(t, integration.NewSlinkySlashingIntegrationSuite(baseSuite)) -} - -func TestSlinkyOracleValidatorIntegration(t *testing.T) { - baseSuite := integration.NewSlinkyIntegrationSuite( - spec, - oracleImage, - ) - - suite.Run(t, integration.NewSlinkyOracleValidatorIntegrationSuite(baseSuite)) -} diff --git a/tests/integration/slinky_slashing_setup.go b/tests/integration/slinky_slashing_setup.go deleted file mode 100644 index da9807aeb..000000000 --- a/tests/integration/slinky_slashing_setup.go +++ /dev/null @@ -1,257 +0,0 @@ -package integration - -import ( - "context" - "testing" - "time" - - "cosmossdk.io/math" - cmtabci "github.com/cometbft/cometbft/abci/types" - coretypes "github.com/cometbft/cometbft/rpc/core/types" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" - "github.com/strangelove-ventures/interchaintest/v8/testutil" - "github.com/stretchr/testify/require" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - - "github.com/skip-mev/slinky/abci/strategies/codec" - slinkyabci "github.com/skip-mev/slinky/abci/ve/types" - alerttypes "github.com/skip-mev/slinky/x/alerts/types" -) - -const gasPrice = 100 - -// UpdateAlertParams creates + submits the proposal to update the alert params, votes for the prop w/ all nodes, -// and waits for the proposal to pass. -func UpdateAlertParams(chain *cosmos.CosmosChain, authority, denom string, deposit int64, timeout time.Duration, user cosmos.User, params alerttypes.Params) (string, error) { - propId, err := SubmitProposal(chain, sdk.NewCoin(denom, math.NewInt(deposit)), user.KeyName(), []sdk.Msg{&alerttypes.MsgUpdateParams{ - Authority: authority, - Params: params, - }}...) - if err != nil { - return "", err - } - - return propId, PassProposal(chain, propId, timeout) -} - -// SubmitAlert submits an alert to the chain, submitted by the given address -func (s *SlinkySlashingIntegrationSuite) SubmitAlert(user cosmos.User, alert alerttypes.Alert) (*coretypes.ResultBroadcastTxCommit, error) { - tx := CreateTx(s.T(), s.chain, user, gasPrice, alerttypes.NewMsgAlert( - alert, - )) - - // get an rpc endpoint for the chain - client := s.chain.Nodes()[0].Client - - // broadcast the tx - return client.BroadcastTxCommit(context.Background(), tx) -} - -// SubmitConclusion submits the provided conclusion to the chain -func (s *SlinkySlashingIntegrationSuite) SubmitConclusion(user cosmos.User, conclusion alerttypes.Conclusion) (*coretypes.ResultBroadcastTxCommit, error) { - addr, err := sdk.AccAddressFromBech32(user.FormattedAddress()) - s.Require().NoError(err) - - tx := CreateTx(s.T(), s.chain, user, gasPrice, alerttypes.NewMsgConclusion( - conclusion, - addr, - )) - - // get an rpc endpoint for the chain - client := s.chain.Nodes()[0].Client - return client.BroadcastTxCommit(context.Background(), tx) -} - -// Delegate sends a delegation tx from the given user to the given validator -func (s *SlinkySlashingIntegrationSuite) Delegate(user cosmos.User, validatorOperator string, tokens sdk.Coin) (*coretypes.ResultBroadcastTxCommit, error) { - msg := stakingtypes.NewMsgDelegate(user.FormattedAddress(), validatorOperator, tokens) - - tx := CreateTx(s.T(), s.chain, user, gasPrice, msg) - - // get an rpc endpoint for the chain - client := s.chain.Nodes()[0].Client - return client.BroadcastTxCommit(context.Background(), tx) -} - -// CreateTx creates a new transaction to be signed by the given user, including a provided set of messages -func CreateTx(t *testing.T, chain *cosmos.CosmosChain, user cosmos.User, GasPrice int64, msgs ...sdk.Msg) []byte { - bc := cosmos.NewBroadcaster(t, chain) - - ctx := context.Background() - // create tx factory + Client Context - txf, err := bc.GetFactory(ctx, user) - require.NoError(t, err) - - cc, err := bc.GetClientContext(ctx, user) - require.NoError(t, err) - - txf = txf.WithSimulateAndExecute(true) - - txf, err = txf.Prepare(cc) - require.NoError(t, err) - - // get gas for tx - txf.WithGas(25000000) - - // update sequence number - txf = txf.WithSequence(txf.Sequence()) - txf = txf.WithGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(chain.Config().Denom, math.NewInt(GasPrice))).String()) - - // sign the tx - txBuilder, err := txf.BuildUnsignedTx(msgs...) - require.NoError(t, err) - - require.NoError(t, tx.Sign(cc.CmdContext, txf, cc.GetFromName(), txBuilder, true)) - - // encode and return - bz, err := cc.TxConfig.TxEncoder()(txBuilder.GetTx()) - require.NoError(t, err) - return bz -} - -type PrivKeyType uint64 - -const ( - Secp256k1 PrivKeyType = iota - Ed25519 -) - -// CreateKey creates a private key wrt. the given private-key type -func CreateKey(typ PrivKeyType) cryptotypes.PrivKey { - switch typ { - case Secp256k1: - return secp256k1.GenPrivKey() - case Ed25519: - return ed25519.GenPrivKey() - default: - panic("unknown private key type") - } -} - -// QueryValidators queries for all network's validators -func QueryValidators(chain *cosmos.CosmosChain) ([]stakingtypes.Validator, error) { - // get grpc client of the node - grpcAddr := chain.GetHostGRPCAddress() - cc, err := grpc.Dial(grpcAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - return nil, err - } - - client := stakingtypes.NewQueryClient(cc) - - // query validators - resp, err := client.Validators(context.Background(), &stakingtypes.QueryValidatorsRequest{}) - if err != nil { - return nil, err - } - - return resp.Validators, nil -} - -// GetExtendedCommit gets the extended commit from a block for a designated height -func GetExtendedCommit(chain *cosmos.CosmosChain, height int64) (cmtabci.ExtendedCommitInfo, error) { - // get a client from the chain - client := chain.Nodes()[0].Client - - // query the block - block, err := client.Block(context.Background(), &height) - if err != nil { - return cmtabci.ExtendedCommitInfo{}, err - } - - // get the extended commit - eci, err := extCommitCodec.Decode(block.Block.Txs[0]) - if err != nil { - return cmtabci.ExtendedCommitInfo{}, err - } - - // unmarshal votes - voteEncoder := codec.NewDefaultVoteExtensionCodec() - for i, vote := range eci.Votes { - // unmarshal compressed ve - voteInfo, err := veCodec.Decode(vote.VoteExtension) - if err != nil { - return cmtabci.ExtendedCommitInfo{}, err - } - - eci.Votes[i].VoteExtension, err = voteEncoder.Encode(voteInfo) - if err != nil { - return cmtabci.ExtendedCommitInfo{}, err - } - } - - return eci, nil -} - -// GetOracleDataFromVote gets the oracle-data from a vote included in a last commit info -func GetOracleDataFromVote(vote cmtabci.ExtendedVoteInfo) (slinkyabci.OracleVoteExtension, error) { - var ve slinkyabci.OracleVoteExtension - if err := ve.Unmarshal(vote.VoteExtension); err != nil { - return slinkyabci.OracleVoteExtension{}, err - } - - return ve, nil -} - -// ExpectAlerts waits until the provided alerts are in module state or until timeout. This method returns an error if it times-out. Otherwise, -// it returns the height for which the condition was satisfied. -// -// Notice: the height returned is safe for querying -func ExpectAlerts(chain *cosmos.CosmosChain, timeout time.Duration, alerts []alerttypes.Alert) (uint64, error) { - cc, close, err := GetChainGRPC(chain) - if err != nil { - return 0, err - } - defer close() - - alertsClient := alerttypes.NewQueryClient(cc) - - var height int64 - - if err := testutil.WaitForCondition(timeout, 100*time.Millisecond, func() (bool, error) { - height, err = chain.Height(context.Background()) - - resp, err := alertsClient.Alerts(context.Background(), &alerttypes.AlertsRequest{}) - if err != nil { - return false, err - } - - if len(resp.Alerts) != len(alerts) { - return false, nil - } - - expectedAlerts := mapAlerts(alerts) - for _, alert := range alerts { - if _, ok := expectedAlerts[alertKey(alert)]; !ok { - return false, nil - } - } - - return true, nil - }); err != nil { - return 0, err - } - - return uint64(height), WaitForHeight(chain, uint64(height+1), timeout) -} - -func mapAlerts(alerts []alerttypes.Alert) map[string]struct{} { - m := make(map[string]struct{}) - - for _, alert := range alerts { - m[alertKey(alert)] = struct{}{} - } - - return m -} - -func alertKey(alert alerttypes.Alert) string { - return string(alert.UID()) -} diff --git a/tests/integration/slinky_slashing_suite.go b/tests/integration/slinky_slashing_suite.go deleted file mode 100644 index 9cf167fc1..000000000 --- a/tests/integration/slinky_slashing_suite.go +++ /dev/null @@ -1,1419 +0,0 @@ -package integration - -import ( - "context" - "fmt" - "strings" - - "cosmossdk.io/math" - cmtabci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/strangelove-ventures/interchaintest/v8" - "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - alerttypes "github.com/skip-mev/slinky/x/alerts/types" - oracletypes "github.com/skip-mev/slinky/x/oracle/types" -) - -const validatorStake = 5000000000000 - -type SlinkySlashingIntegrationSuite struct { - *SlinkyIntegrationSuite - - multiSigUser1 cosmos.User - multiSigUser2 cosmos.User - - multiSigPk1 cryptotypes.PrivKey - multiSigPk2 cryptotypes.PrivKey -} - -func NewSlinkySlashingIntegrationSuite(ss *SlinkyIntegrationSuite) *SlinkySlashingIntegrationSuite { - return &SlinkySlashingIntegrationSuite{ - SlinkyIntegrationSuite: ss, - } -} - -func (s *SlinkySlashingIntegrationSuite) SetupSuite() { - s.SlinkyIntegrationSuite.TearDownSuite() - - s.SlinkyIntegrationSuite.SetupSuite() - - // initialize multiSigUsers - users := interchaintest.GetAndFundTestUsers(s.T(), context.Background(), s.T().Name(), math.NewInt(genesisAmount), s.chain, s.chain) - s.multiSigUser1 = users[0] - s.multiSigUser2 = users[1] - - s.multiSigPk1 = CreateKey(Secp256k1) - s.multiSigPk2 = CreateKey(Ed25519) -} - -func (s *SlinkySlashingIntegrationSuite) SetupTest() { - // get the validators after the slashing - validators, err := QueryValidators(s.chain) - s.Require().NoError(err) - - // for any validators that do not have correct stake, delegate to them - for _, validator := range validators { - if validator.Tokens.Int64() < validatorStake { - toStake := sdk.NewCoin(s.denom, math.NewInt(validatorStake-validator.Tokens.Int64())) - - // delegate to the validator - resp, err := s.Delegate(s.multiSigUser1, validator.OperatorAddress, toStake) - s.Require().NoError(err) - - s.Require().Equal(uint32(0), resp.CheckTx.Code) - s.Require().Equal(uint32(0), resp.TxResult.Code) - } - } - - // get the validators after the slashing - validators, err = QueryValidators(s.chain) - s.Require().NoError(err) - - // ensure all validators have the correct stake - for _, validator := range validators { - s.Require().Equal(validator.Tokens.Int64(), int64(validatorStake)) - } -} - -func (s *SlinkySlashingIntegrationSuite) Height(ctx context.Context) (uint64, error) { - height, err := s.chain.Height(ctx) - if err != nil { - return 0, err - } - - return uint64(height), nil -} - -func (s *SlinkySlashingIntegrationSuite) TestAlerts() { - // test getting / setting params - s.Run("test get params", func() { - cc, close, err := GetChainGRPC(s.chain) - s.Require().NoError(err) - defer close() - - expectedParams := alerttypes.DefaultParams("stake", nil) - - // set default params for the module - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, expectedParams) - s.Require().NoError(err) - - // create an alerts client - alertsClient := alerttypes.NewQueryClient(cc) - - // get the params - params, err := alertsClient.Params(context.Background(), &alerttypes.ParamsRequest{}) - s.Require().NoError(err) - - s.Require().Equal(expectedParams, params.Params) - }) - - s.Run("test setting new params", func() { - cc, close, err := GetChainGRPC(s.chain) - s.Require().NoError(err) - defer close() - - // create an alerts client - alertsClient := alerttypes.NewQueryClient(cc) - - s.Run("test setting params", func() { - // update the alert Params - expect := alerttypes.Params{ - PruningParams: alerttypes.PruningParams{ - Enabled: true, - BlocksToPrune: 100, - }, - } - - // update the module's alert-params - _, err := UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, expect) - s.Require().NoError(err) - - // get the params - got, err := alertsClient.Params(context.Background(), &alerttypes.ParamsRequest{}) - s.Require().NoError(err) - - // expect the params to be updated - s.Require().True(compareParams(expect, got.Params)) - }) - }) -} - -func compareParams(a, b alerttypes.Params) bool { - return a.PruningParams == b.PruningParams && - a.AlertParams.Enabled == b.AlertParams.Enabled && - a.AlertParams.MaxBlockAge == b.AlertParams.MaxBlockAge -} - -// TestSubmittingAlerts will test the alert-submission process, specifically -// - submitting an alert when alerts are disabled, and expect that the alert is not submitted -// - submitting an alert when alerts are enabled, but the alert is too old, and expect that the alert is not submitted -// - submitting an alert when alerts are enabled, and the alert references a non-existent currency-pair, and expect that the alert is not submitted -// - submitting an alert when alerts are enabled, and the alert is valid, and expect that the alert is submitted. On submission check that the -// -// alert's bond is escrowed at the alert module -// - submitting an alert when alerts are enabled, and the alert is valid, but the alert has already been submitted, and expect that the alert is not submitted -func (s *SlinkySlashingIntegrationSuite) TestSubmittingAlerts() { - s.Run("test submitting an alert when alerts are disabled - fail", func() { - // set params to have alerts disabled - _, err := UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, alerttypes.Params{ - AlertParams: alerttypes.AlertParams{ - Enabled: false, - }, - }) - s.Require().NoError(err) - - alertSubmitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - // submit an alert - resp, err := s.SubmitAlert( - s.multiSigUser1, - alerttypes.NewAlert( - 1, - alertSubmitter, - slinkytypes.NewCurrencyPair("BTC", "USD"), - ), - ) - s.Require().NoError(err) - - // check the response from the chain - s.Require().Equal(resp.TxResult.Code, uint32(1)) - s.Require().True(strings.Contains(resp.TxResult.Log, "alerts are not enabled")) - }) - - s.Run("test submitting an alert with a block-age > max-block-age - fail", func() { - // update the max-block-age so that it's feasible for us to submit an alert with a block-age (ctx.Height() - alert.Height) > max-block-age - _, err := UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, alerttypes.Params{ - AlertParams: alerttypes.AlertParams{ - MaxBlockAge: 1, - Enabled: true, - BondAmount: sdk.NewCoin(s.denom, alerttypes.DefaultBondAmount), - }, - }) - s.Require().NoError(err) - - alertSubmitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - // get the current height, and submit an alert with a height that is too old - height, err := s.Height(context.Background()) - s.Require().NoError(err) - - // submit an alert - resp, err := s.SubmitAlert( - s.multiSigUser1, - alerttypes.NewAlert( - uint64(height-5), - alertSubmitter, - slinkytypes.NewCurrencyPair("BTC", "USD"), - ), - ) - s.Require().NoError(err) - - // check the response from the chain - s.Require().Equal(resp.TxResult.Code, uint32(1)) - s.Require().True(strings.Contains(resp.TxResult.Log, "alert is too old")) - }) - - s.Run("test submitting an alert for a non-existent currency-pair - fail", func() { - cc, close, err := GetChainGRPC(s.chain) - s.Require().NoError(err) - defer close() - - // update the max-block-age - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, alerttypes.Params{ - AlertParams: alerttypes.AlertParams{ - MaxBlockAge: 20, - Enabled: true, - BondAmount: sdk.NewCoin(s.denom, alerttypes.DefaultBondAmount), - }, - }) - s.Require().NoError(err) - - // check if the BTC/USD currency pair exists - oraclesClient := oracletypes.NewQueryClient(cc) - _, err = oraclesClient.GetPrice(context.Background(), &oracletypes.GetPriceRequest{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BTC", - Quote: "USD", - }, - }) - s.Require().NoError(err) - - // get the current height - height, err := s.Height(context.Background()) - s.Require().NoError(err) - - alertSubmitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - // the currency-pair does not exist - resp, err := s.SubmitAlert( - s.multiSigUser1, - alerttypes.NewAlert( - uint64(height-1), - alertSubmitter, - slinkytypes.CurrencyPair{ - Base: "MOG", - Quote: "GOM", - }, - ), - ) - s.Require().NoError(err) - - // check the response from the chain - s.Require().Equal(resp.TxResult.Code, uint32(1)) - s.Require().True(strings.Contains(resp.TxResult.Log, fmt.Sprint("currency pair MOG/GOM does not exist")), resp.TxResult.Log) - }) - - // submit the alert (the max block-age set previously will suffice) - height, err := s.Height(context.Background()) - s.Require().NoError(err) - - s.Run("test submitting an alert and check for bond deposit - pass", func() { - // add the BTC/USD currency pair - cc, close, err := GetChainGRPC(s.chain) - s.Require().NoError(err) - defer close() - - cp := slinkytypes.NewCurrencyPair("BTC", "USD") - - // check if the BTC/USD currency pair exists - oraclesClient := oracletypes.NewQueryClient(cc) - _, err = oraclesClient.GetPrice(context.Background(), &oracletypes.GetPriceRequest{ - CurrencyPair: cp, - }) - if err != nil { - // add if there was an error - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, enabledTicker(cp))) - } - - alertSubmitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - // get the balance of the alert submitter, so that we can check if the bond was deposited after the alert was submitted - balance, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - modAcct := authtypes.NewModuleAddress(alerttypes.ModuleName) - - // do the same for the module account balance - modAcctBalance, err := s.chain.GetBalance(context.Background(), modAcct.String(), s.denom) - s.Require().NoError(err) - - // submit the alerts - alert := alerttypes.NewAlert( - height-1, - alertSubmitter, - cp, - ) - - resp, err := s.SubmitAlert( - s.multiSigUser1, - alert, - ) - - // check the response from the chain - s.Require().NoError(err) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - alertClient := alerttypes.NewQueryClient(cc) - - // query for the alert - alertResp, err := alertClient.Alerts(context.Background(), &alerttypes.AlertsRequest{ - Status: alerttypes.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, - }) - s.Require().NoError(err) - - // check the alert - s.Require().Len(alertResp.Alerts, 1) - s.Require().Equal(alertResp.Alerts[0], alert) - - // expect submitters balance to be in escrow - params, err := alertClient.Params(context.Background(), &alerttypes.ParamsRequest{}) - s.Require().NoError(err) - - bondAmt := params.Params.AlertParams.BondAmount.Amount - - // check the balance of the alert submitter - newBalance, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - s.Require().Equal(balance.Sub(bondAmt).Int64()-(resp.TxResult.GasWanted*gasPrice), newBalance.Int64()) - - // check the balance of the module account - newModAcctBalance, err := s.chain.GetBalance(context.Background(), modAcct.String(), s.denom) - s.Require().NoError(err) - - // diff shld be the bond amount - s.Require().Equal(modAcctBalance.Add(bondAmt).Int64(), newModAcctBalance.Int64()) - }) - - s.Run("test submitting an alert after it has already been submitted - fail", func() { - // file a duplicate alert - cp := slinkytypes.NewCurrencyPair("BTC", "USD") - - alertSubmitter, err := sdk.AccAddressFromBech32(s.multiSigUser2.FormattedAddress()) - s.Require().NoError(err) - - alert := alerttypes.NewAlert( - height-1, - alertSubmitter, - cp, - ) - - resp, err := s.SubmitAlert( - s.multiSigUser2, - alert, - ) - - // check the response from the chain - s.Require().NoError(err) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, fmt.Sprintf("alert with UID %X already exists", alert.UID()))) - }) -} - -// TestAlertPruning tests the pruning of alerts, specifically we submit 2 alerts, wait for some period of time between them, -// and expect that they are pruned after BlocksToPrune has passed. Also test that after an alert is concluded, it's BlocksToPrune -// is updated to alert.Height + MaxBlockAge, so that the same alert cannot be submitted + concluded twice. -func (s *SlinkySlashingIntegrationSuite) TestAlertPruning() { - // check if the BTC/USD currency pair exists - cc, close, err := GetChainGRPC(s.chain) - s.Require().NoError(err) - - defer close() - - cp := slinkytypes.NewCurrencyPair("BTC", "USD") // arbitrary - - // expect that the above currency-pair is in state, so we can submit alerts that reference it - oraclesClient := oracletypes.NewQueryClient(cc) - _, err = oraclesClient.GetPrice(context.Background(), &oracletypes.GetPriceRequest{ - CurrencyPair: cp, - }) - if err != nil { - // remove the currency-pair - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, enabledTicker(cp))) - } - // add pruning params with updated max-block-age - - var ( - maxBlockAge = uint64(20) - blocksToPrune = uint64(10) - ) - - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, alerttypes.Params{ - AlertParams: alerttypes.AlertParams{ - MaxBlockAge: maxBlockAge, - Enabled: true, - BondAmount: sdk.NewCoin(s.denom, alerttypes.DefaultBondAmount), - }, - PruningParams: alerttypes.PruningParams{ - Enabled: true, - BlocksToPrune: blocksToPrune, - }, - }) - s.Require().NoError(err) - - s.Run("expect all alerts to have been pruned", func() { - _, err := ExpectAlerts(s.chain, 3*s.blockTime, nil) - s.Require().NoError(err) - }) - - s.Run("test that an alert is pruned after no conclusion is submitted, and the alert deposit is returned", func() { - submitter1, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - height, err := s.Height(context.Background()) - s.Require().NoError(err) - - submitter2, err := sdk.AccAddressFromBech32(s.multiSigUser2.FormattedAddress()) - s.Require().NoError(err) - - // submit two alerts for different heights from different accounts - alert1 := alerttypes.NewAlert( - height, - submitter1, - cp, - ) - - alert2 := alerttypes.NewAlert( - height+1, - submitter2, - cp, - ) - - // get the balances of the accounts before alert submission, so that we can compare after submission whether the bond - // is in escrow. - balance1Before, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - balance2Before, err := s.chain.GetBalance(context.Background(), s.multiSigUser2.FormattedAddress(), s.denom) - s.Require().NoError(err) - - var ( - commitHeight, commitHeight2 uint64 - balance2After, balance1After math.Int - ) - s.Run("submit the first alert, from the first multi-sig address", func() { - // submit the first alert - resp, err := s.SubmitAlert( - s.multiSigUser1, - alert1, - ) - s.Require().NoError(err) - - // check the response from the chain - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - // expect the alert to have been committed in state - commitHeight = uint64(resp.Height) - - // query for the alert, - alertClient := alerttypes.NewQueryClient(cc) - alertResp, err := alertClient.Alerts(context.Background(), &alerttypes.AlertsRequest{ - Status: alerttypes.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, - }) - - s.Require().NoError(err) - - // check the alerts - s.Require().Len(alertResp.Alerts, 1) - s.Require().Equal(alertResp.Alerts[0], alert1) - - // check the bond was escrowed - balance1After, err = s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - // check the balance, expect the bond to be in escrow - s.Require().Equal(balance1Before.Sub(balance1After).Int64()-resp.TxResult.GasWanted*gasPrice, alerttypes.DefaultBondAmount.Int64()) - }) - - s.Run("submit the second alert, from the second multi-sig", func() { - // submit the second alert - resp, err := s.SubmitAlert( - s.multiSigUser2, - alert2, - ) - s.Require().NoError(err) - - commitHeight2 = uint64(resp.Height) - // check the response from the chain - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - // expect the alerts to have been committed in state - alertClient := alerttypes.NewQueryClient(cc) - alertResp, err := alertClient.Alerts(context.Background(), &alerttypes.AlertsRequest{ - Status: alerttypes.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, - }) - - s.Require().NoError(err) - - // check the alerts - s.Require().Len(alertResp.Alerts, 2) - - // check the bond was escrowed - balance2After, err = s.chain.GetBalance(context.Background(), s.multiSigUser2.FormattedAddress(), s.denom) - s.Require().NoError(err) - - // check the balance - s.Require().Equal(balance2Before.Sub(balance2After).Int64()-resp.TxResult.GasWanted*gasPrice, alerttypes.DefaultBondAmount.Int64()) - }) - - s.Run("wait for 10 blocks after commit height of first alert, and expect it to be pruned", func() { - // wait for commitheight + 10 - height, err = ExpectAlerts(s.chain, s.blockTime*3, []alerttypes.Alert{alert2}) - s.Require().NoError(err) - - // check that height > commitHeight + 10 - s.Require().True(height >= commitHeight+10) - - // check the bond was returned - balance1Final, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - // check the balance - s.Require().Equal(balance1Final.Sub(balance1After).Int64(), alerttypes.DefaultBondAmount.Int64()) - }) - - s.Run("wait for blocksToPrune blocks after commit height of second alert, and expect it to be pruned", func() { - // wait for commitheight + 10 - height, err = ExpectAlerts(s.chain, s.blockTime*3, []alerttypes.Alert{}) - s.Require().NoError(err) - - // check that height > commitHeight + 10 - s.Require().True(height >= commitHeight2+10) - - // check the bond was returned - balance2Final, err := s.chain.GetBalance(context.Background(), s.multiSigUser2.FormattedAddress(), s.denom) - s.Require().NoError(err) - - // check the balance - s.Require().Equal(balance2Final.Sub(balance2After).Int64(), alerttypes.DefaultBondAmount.Int64()) - }) - }) - - s.Run("test that after an alert is concluded, the alerts pruning height is updated", func() { - cc, close, err = GetChainGRPC(s.chain) - s.Require().NoError(err) - - defer close() - - alertClient := alerttypes.NewQueryClient(cc) - - var ( - moduleBalanceBefore math.Int - alertHeight uint64 - maxBlockAge uint64 = 20 - alert alerttypes.Alert - ) - - s.Run("update the params to have multiSigAddress1 / 2 as signers", func() { - cvp, err := alerttypes.NewMultiSigVerificationParams( - []cryptotypes.PubKey{ - s.multiSigPk1.PubKey(), - s.multiSigPk2.PubKey(), - }, - ) - s.Require().NoError(err) - - any, err := codectypes.NewAnyWithValue(cvp) - s.Require().NoError(err) - - // update the params - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, alerttypes.Params{ - AlertParams: alerttypes.AlertParams{ - MaxBlockAge: maxBlockAge, - Enabled: true, - BondAmount: sdk.NewCoin(s.denom, alerttypes.DefaultBondAmount), - }, - PruningParams: alerttypes.PruningParams{ - Enabled: true, - BlocksToPrune: blocksToPrune, - }, - ConclusionVerificationParams: any, - }) - s.Require().NoError(err) - - // get the params - params, err := alertClient.Params(context.Background(), &alerttypes.ParamsRequest{}) - s.Require().NoError(err) - - // check the params - cdc := s.chain.Config().EncodingConfig.Codec - - var expectedCVP alerttypes.ConclusionVerificationParams - s.Require().NoError(cdc.UnpackAny(params.Params.ConclusionVerificationParams, &expectedCVP)) - cvpGot, ok := expectedCVP.(*alerttypes.MultiSigConclusionVerificationParams) - s.Require().True(ok) - - for i, pk := range cvpGot.Signers { - var pk1 cryptotypes.PubKey - s.Require().NoError(cdc.UnpackAny(pk, &pk1)) - - var pk2 cryptotypes.PubKey - s.Require().NoError(cdc.UnpackAny(cvp.(*alerttypes.MultiSigConclusionVerificationParams).Signers[i], &pk2)) - s.Require().True(pk1.Equals(pk2)) - } - }) - - alertHeight, err = s.Height(context.Background()) - s.Require().NoError(err) - - s.Run("submit an alert from multiSigAddress1", func() { - submitAddr, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - - alert = alerttypes.NewAlert( - alertHeight, - submitAddr, - slinkytypes.NewCurrencyPair( - "BTC", - "USD", - ), - ) - s.Require().NoError(err) - - balance1Before, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - // get balance of module account - moduleBalanceBefore, err = s.chain.GetBalance(context.Background(), authtypes.NewModuleAddress(alerttypes.ModuleName).String(), s.denom) - s.Require().NoError(err) - - // submit the alert - resp, err := s.SubmitAlert( - s.multiSigUser1, - alert, - ) - s.Require().NoError(err) - - s.T().Log() - - // check the response (it was committed) - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - // query for the alert - alertResp, err := alertClient.Alerts(context.Background(), &alerttypes.AlertsRequest{ - Status: alerttypes.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, - }) - s.Require().NoError(err) - - // check the alerts - s.Require().Len(alertResp.Alerts, 1) - s.Require().Equal(alertResp.Alerts[0], alert) - - // expect the bond to be escrowed - balance1, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - // check the balance - s.Require().Equal(balance1Before.Sub(balance1).Int64(), alerttypes.DefaultBondAmount.Int64()+resp.TxResult.GasWanted*gasPrice) - - // check the balance of the module account after alert submission - moduleBalanceAfter, err := s.chain.GetBalance(context.Background(), authtypes.NewModuleAddress(alerttypes.ModuleName).String(), s.denom) - s.Require().NoError(err) - - // check the balance - s.Require().Equal(moduleBalanceBefore.Add(alerttypes.DefaultBondAmount).Int64(), moduleBalanceAfter.Int64()) - }) - - s.Run("submit a conclusion from the multi-sig", func() { - // get the alert - alertResp, err := alertClient.Alerts(context.Background(), &alerttypes.AlertsRequest{ - Status: alerttypes.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, - }) - s.Require().NoError(err) - alert := alertResp.Alerts[0] - - conclusion := alerttypes.MultiSigConclusion{ - Alert: alert, - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Status: false, - PriceBound: alerttypes.PriceBound{ - High: "1", - Low: "0", - }, - Signatures: make([]alerttypes.Signature, 0), - } - - // sign the conclusion - sigBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign the conclusions - sig1, err := s.multiSigPk1.Sign(sigBytes) - s.Require().NoError(err) - - sig2, err := s.multiSigPk2.Sign(sigBytes) - s.Require().NoError(err) - - conclusion.Signatures = append(conclusion.Signatures, alerttypes.Signature{ - Signer: sdk.AccAddress(s.multiSigPk1.PubKey().Address()).String(), - Signature: sig1, - }) - conclusion.Signatures = append(conclusion.Signatures, alerttypes.Signature{ - Signer: sdk.AccAddress(s.multiSigPk2.PubKey().Address()).String(), - Signature: sig2, - }) - - // submit the conclusion - resp, err := s.SubmitConclusion(s.multiSigUser1, &conclusion) - s.Require().NoError(err) - - // expect conclusion submission to be successful - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - s.Run("expect that the bond is burned", func() { - // get the final module account balance - moduleBalanceAfter, err := s.chain.GetBalance(context.Background(), authtypes.NewModuleAddress(alerttypes.ModuleName).String(), s.denom) - s.Require().NoError(err) - - // check the balance, should be returned to before alert submission (alert bond is burned) - s.Require().Equal(moduleBalanceBefore.Int64(), moduleBalanceAfter.Int64()) - }) - }) - - s.Run("expect that the alert still exists, even after commitHeight + purge-height", func() { - s.Run("alert exists", func() { - // query the current height, if less than max-block-age + alert.Height, check for alert's existence, and expect status to be concluded - currentHeight, err := s.Height(context.Background()) - s.Require().NoError(err) - - // query for the alert (if it still should exist) - if alertHeight+maxBlockAge > currentHeight { - s.T().Log("alert should still exist", "alertHeight", alertHeight, "max-block-age", maxBlockAge, "currentHeight", currentHeight) - alertResp, err := alertClient.Alerts(context.Background(), &alerttypes.AlertsRequest{ - Status: alerttypes.AlertStatusID_CONCLUSION_STATUS_CONCLUDED, - }) - s.Require().NoError(err) - - // check the alerts - s.Require().Len(alertResp.Alerts, 1) - gotAlert := alertResp.Alerts[0] - - // expect equality (this was the only alert available) - s.Require().Equal(alert, gotAlert) - } - }) - - s.Run("submission of alert fails", func() { - // query the current height, if less than max-block-age + alert.Height, attempt to submit an alert for the same height - currentHeight, err := s.Height(context.Background()) - s.Require().NoError(err) - - // submit the same alert again - if alertHeight+maxBlockAge > currentHeight { - s.T().Log("alert should still exist", "alertHeight", alertHeight, "max-block-age", maxBlockAge, "currentHeight", currentHeight) - - alertSigner, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - badAlert := alerttypes.NewAlert( - alert.Height, - alertSigner, - alert.CurrencyPair, - ) - - // submit the alert - resp, err := s.SubmitAlert(s.multiSigUser1, badAlert) - s.Require().NoError(err) - - // expect the alert submission to fail - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, fmt.Sprintf("alert with UID %X already exists", alert.UID()))) - } - }) - - s.Run("submitting same alert now fails (alert is too old)", func() { - // wait for original alert to be pruned - ExpectAlerts(s.chain, s.blockTime*3, nil) - - // wait for the alert's height to pass max block-age - WaitForHeight(s.chain, alertHeight+maxBlockAge, s.blockTime*10) - - // attempt to resubmit the alert, and expect it to fail - resp, err := s.SubmitAlert(s.multiSigUser1, alert) - s.Require().NoError(err) - - // expect the alert submission to fail - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, "alert is too old")) - }) - }) - }) -} - -// TestConclusionSubmission tests the conclusion submission process, specifically, this method tests -// the following: -// - conclusion submission fails if alerts are disabled -// - conclusion submission fails if the alert does not exist -// - conclusion submission fails if conclusion verification fails -// - conclusion submission fails if the alert has already been concluded -// - For negative conclusions -// - conclusion submission passes, and there are no slashing events, and the alert signer is refunded -// -// - For positive conclusions -// - conclusion submission passes, and there are slashing events, and the alert signer is rewarded the amount slashed -func (s *SlinkySlashingIntegrationSuite) TestConclusionSubmission() { - // check if the BTC/USD currency pair exists - cc, close, err := GetChainGRPC(s.chain) - s.Require().NoError(err) - defer close() - - cp := slinkytypes.NewCurrencyPair("BTC", "USD") - - // check if the currency pair exists, if not, add it - oraclesClient := oracletypes.NewQueryClient(cc) - ctx := context.Background() - _, err = oraclesClient.GetPrice(ctx, &oracletypes.GetPriceRequest{ - CurrencyPair: cp, - }) - if err != nil { - // add the currency-pair - s.Require().NoError(s.AddCurrencyPairs(s.chain, s.user, 1.1, enabledTicker(cp))) - } - - // get the id for the currency-pair - _, err = getIDForCurrencyPair(ctx, oraclesClient, cp) - s.Require().NoError(err) - - s.Run("test Conclusion failures", func() { - s.Run("fails when alerts are disabled", func() { - // update the params to disable alerts - _, err := UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, alerttypes.Params{ - ConclusionVerificationParams: nil, - AlertParams: alerttypes.AlertParams{ - Enabled: false, - }, - }) - s.Require().NoError(err) - - submitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - // submit a conclusion - conclusion := &alerttypes.MultiSigConclusion{ - Alert: alerttypes.NewAlert(1, submitter, slinkytypes.NewCurrencyPair("BASE", "USDC")), - PriceBound: alerttypes.PriceBound{ - High: "1", - Low: "0", - }, - Signatures: []alerttypes.Signature{ - { - Signer: submitter.String(), - }, - }, - } - - resp, err := s.SubmitConclusion(s.multiSigUser1, conclusion) - s.Require().NoError(err) - - // expect the alert submission to fail - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, "alerts are not enabled")) - }) - - s.Run("fails when the conclusion verification fails", func() { - cvp, err := alerttypes.NewMultiSigVerificationParams( - []cryptotypes.PubKey{ - s.multiSigPk1.PubKey(), - s.multiSigPk2.PubKey(), - }, - ) - s.Require().NoError(err) - - params := alerttypes.DefaultParams(s.denom, cvp) - - // update the params to enable alerts - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, params) - s.Require().NoError(err) - - submitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - // submit a conclusion - conclusion := &alerttypes.MultiSigConclusion{ - Alert: alerttypes.NewAlert(1, submitter, slinkytypes.NewCurrencyPair("BASE", "USDC")), - PriceBound: alerttypes.PriceBound{ - High: "1", - Low: "0", - }, - } - - // set only one signature - sigBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign the bytes with multiSigPk1 - sig, err := s.multiSigPk1.Sign(sigBytes) - s.Require().NoError(err) - - // set the signature - conclusion.Signatures = []alerttypes.Signature{ - { - Signer: sdk.AccAddress(s.multiSigPk1.PubKey().Address()).String(), - Signature: sig, - }, - } - - resp, err := s.SubmitConclusion(s.multiSigUser1, conclusion) - s.Require().NoError(err) - - // expect the alert submission to fail - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, fmt.Sprintf("no signature provided for signer: %s", sdk.AccAddress(s.multiSigPk2.PubKey().Address()).String()))) - }) - - s.Run("fails when the conclusion references a non-existent alert", func() { - cvp, err := alerttypes.NewMultiSigVerificationParams( - []cryptotypes.PubKey{ - s.multiSigPk1.PubKey(), - s.multiSigPk2.PubKey(), - }, - ) - s.Require().NoError(err) - - params := alerttypes.DefaultParams(s.denom, cvp) - - // update the params to enable alerts - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, params) - s.Require().NoError(err) - - submitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - alert := alerttypes.NewAlert(1, submitter, slinkytypes.NewCurrencyPair("BASE", "USDC")) - // submit a conclusion - conclusion := &alerttypes.MultiSigConclusion{ - Alert: alert, - PriceBound: alerttypes.PriceBound{ - High: "1", - Low: "0", - }, - } - - // set only one signature - sigBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign the bytes with multiSigPk1 - sig, err := s.multiSigPk1.Sign(sigBytes) - s.Require().NoError(err) - - // set the signature - conclusion.Signatures = []alerttypes.Signature{ - { - Signer: sdk.AccAddress(s.multiSigPk1.PubKey().Address()).String(), - Signature: sig, - }, - } - - // set the second signature - sig, err = s.multiSigPk2.Sign(sigBytes) - s.Require().NoError(err) - conclusion.Signatures = append(conclusion.Signatures, alerttypes.Signature{ - Signer: sdk.AccAddress(s.multiSigPk2.PubKey().Address()).String(), - Signature: sig, - }) - - resp, err := s.SubmitConclusion(s.multiSigUser1, conclusion) - s.Require().NoError(err) - - // expect the alert submission to fail - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, fmt.Sprintf("alert not found: %v", alert))) - }) - - s.Run("test negatively concluded alert", func() { - cvp, err := alerttypes.NewMultiSigVerificationParams( - []cryptotypes.PubKey{ - s.multiSigPk1.PubKey(), - s.multiSigPk2.PubKey(), - }, - ) - s.Require().NoError(err) - - params := alerttypes.DefaultParams(s.denom, cvp) - - // update the params to enable alerts - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, params) - s.Require().NoError(err) - - submitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - alert := alerttypes.NewAlert(1, submitter, slinkytypes.NewCurrencyPair("BTC", "USD")) - - // get the balance of the sender / module to check balance differences for escrow - senderBalanceBeforeAlert, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - moduleBalanceBeforeAlert, err := s.chain.GetBalance(context.Background(), authtypes.NewModuleAddress(alerttypes.ModuleName).String(), s.denom) - s.Require().NoError(err) - - // submit the alert - resp, err := s.SubmitAlert(s.multiSigUser1, alert) - s.Require().NoError(err) - - // expect the alert submission to succeed - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - // expect bond to be escrowed - senderBalanceAfterAlert, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - moduleBalanceAfterAlert, err := s.chain.GetBalance(context.Background(), authtypes.NewModuleAddress(alerttypes.ModuleName).String(), s.denom) - s.Require().NoError(err) - - s.Require().Equal(senderBalanceBeforeAlert.Sub(senderBalanceAfterAlert).Int64(), alerttypes.DefaultBondAmount.Int64()+resp.TxResult.GasWanted*gasPrice) - s.Require().Equal(moduleBalanceAfterAlert.Sub(moduleBalanceBeforeAlert).Int64(), alerttypes.DefaultBondAmount.Int64()) - - validatorsBeforeConclusion, err := QueryValidators(s.chain) - s.Require().NoError(err) - - conclusion := &alerttypes.MultiSigConclusion{ - Alert: alert, - PriceBound: alerttypes.PriceBound{ - High: "1", - Low: "0", - }, - } - - // set only one signature - sigBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign the bytes with multiSigPk1 - sig, err := s.multiSigPk1.Sign(sigBytes) - s.Require().NoError(err) - - // set the signature - conclusion.Signatures = []alerttypes.Signature{ - { - Signer: sdk.AccAddress(s.multiSigPk1.PubKey().Address()).String(), - Signature: sig, - }, - } - - // set the second signature - sig, err = s.multiSigPk2.Sign(sigBytes) - s.Require().NoError(err) - conclusion.Signatures = append(conclusion.Signatures, alerttypes.Signature{ - Signer: sdk.AccAddress(s.multiSigPk2.PubKey().Address()).String(), - Signature: sig, - }) - - resp, err = s.SubmitConclusion(s.multiSigUser2, conclusion) - s.Require().NoError(err) - - // expect the conclusion submission to succeed - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - // expect bond to have been burned - senderBalanceFinal, err := s.chain.GetBalance(context.Background(), s.multiSigUser1.FormattedAddress(), s.denom) - s.Require().NoError(err) - - moduleBalanceFinal, err := s.chain.GetBalance(context.Background(), authtypes.NewModuleAddress(alerttypes.ModuleName).String(), s.denom) - s.Require().NoError(err) - - // sender balance is the same - s.Require().Equal(senderBalanceAfterAlert.Uint64(), senderBalanceFinal.Uint64()) - - // module balance is decremented by the bond amount - s.Require().Equal(moduleBalanceFinal.Int64(), moduleBalanceAfterAlert.Sub(alerttypes.DefaultBondAmount).Int64()) - - // validators after conclusion - validatorsAfterConclusion, err := QueryValidators(s.chain) - s.Require().NoError(err) - - // expect the validator's bond to not have changed - for i, val := range validatorsBeforeConclusion { - s.Require().True(val.Tokens.Equal(validatorsAfterConclusion[i].Tokens)) - } - }) - - s.Run("fails when the alert is alr concluded", func() { - submitter, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - alert := alerttypes.NewAlert(1, submitter, slinkytypes.NewCurrencyPair("BTC", "USD")) - - // submit a conclusion - conclusion := &alerttypes.MultiSigConclusion{ - Alert: alert, - PriceBound: alerttypes.PriceBound{ - High: "1", - Low: "0", - }, - } - - // set only one signature - sigBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign the bytes with multiSigPk1 - sig, err := s.multiSigPk1.Sign(sigBytes) - s.Require().NoError(err) - - // set the signature - conclusion.Signatures = []alerttypes.Signature{ - { - Signer: sdk.AccAddress(s.multiSigPk1.PubKey().Address()).String(), - Signature: sig, - }, - } - - // set the second signature - sig, err = s.multiSigPk2.Sign(sigBytes) - s.Require().NoError(err) - conclusion.Signatures = append(conclusion.Signatures, alerttypes.Signature{ - Signer: sdk.AccAddress(s.multiSigPk2.PubKey().Address()).String(), - Signature: sig, - }) - - resp, err := s.SubmitConclusion(s.multiSigUser1, conclusion) - s.Require().NoError(err) - - // expect the conclusion submission to succeed - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(1)) - - s.Require().True(strings.Contains(resp.TxResult.Log, "alert already concluded")) - }) - }) - - s.Run("valid conclusion submissions", func() { - // TODO restore once slashing is more finalized - - /* - var honestPrice int64 = 150 - - s.Run("update validator oracles", func() { - // update first validator's oracle to submit incorrect Prices - nodes := s.chain.Nodes() - - btcusdTicker := mmtypes.Ticker{ - CurrencyPair: cp, - Decimals: 8, - MinProviderCount: 1, - Enabled: true, - } - - // update the first node to report incorrect Prices (too high) - s.Require().NoError(UpdateNodePrices(nodes[0], btcusdTicker, 152)) - - // update the second node to report incorrect Prices (too low) - s.Require().NoError(UpdateNodePrices(nodes[1], btcusdTicker, 148)) - - // update the third node to report correct Prices - s.Require().NoError(UpdateNodePrices(nodes[2], btcusdTicker, float64(honestPrice))) - - // update the fourth node to report correct Prices - s.Require().NoError(UpdateNodePrices(nodes[3], btcusdTicker, float64(honestPrice))) - }) - - validatorsPreSlash, err := QueryValidators(s.chain) - s.Require().NoError(err) - - cdc := s.chain.Config().EncodingConfig.Codec - validatorPreSlashMap := mapValidators(validatorsPreSlash, cdc) - - zero := big.NewInt(0) - two := big.NewInt(2) - negativeTwo := big.NewInt(-2) - - zeroBz, err := zero.GobEncode() - s.Require().NoError(err) - - twoBz, err := two.GobEncode() - s.Require().NoError(err) - - negativeTwoBz, err := negativeTwo.GobEncode() - s.Require().NoError(err) - - infractionHeight, err := ExpectVoteExtensions(s.chain, s.blockTime*10, []slinkyabci.OracleVoteExtension{ - { - Prices: map[uint64][]byte{ - id: negativeTwoBz, // 148 - }, - }, - { - Prices: map[uint64][]byte{ - id: zeroBz, // 150 - }, - }, - { - Prices: map[uint64][]byte{ - id: zeroBz, // 150 - }, - }, - { - Prices: map[uint64][]byte{ - id: twoBz, // 152 - }, - }, - }) - s.Require().NoError(err) - - // get the latest extended commit info - extendedCommit, err := GetExtendedCommit(s.chain, int64(infractionHeight)) - s.Require().NoError(err) - - valsToOracleReport := make(map[string]int64) - - s.Run("map validators to their oracle responses", func() { - // map validators to their oracle responses - for _, vote := range extendedCommit.Votes { - oracleData, err := GetOracleDataFromVote(vote) - s.Require().NoError(err) - - key := sdk.ConsAddress(vote.Validator.Address).String() - - // get the price from the oracle data - priceBz, ok := oracleData.Prices[id] - s.Require().True(ok) - - // get the big from string value - var price big.Int - price.SetBytes(priceBz) - - // convert the big to int64 - valsToOracleReport[key] = int64(price.Uint64()) - } - }) - - alertSigner, err := sdk.AccAddressFromBech32(s.multiSigUser1.FormattedAddress()) - s.Require().NoError(err) - - s.Run("update params to enable alerts + conclusion-verification-params", func() { - cvp, err := alerttypes.NewMultiSigVerificationParams( - []cryptotypes.PubKey{ - s.multiSigPk1.PubKey(), - s.multiSigPk2.PubKey(), - }, - ) - s.Require().NoError(err) - - params := alerttypes.DefaultParams(s.denom, cvp) - - // update the params to enable alerts - _, err = UpdateAlertParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.multiSigUser1, params) - s.Require().NoError(err) - }) - - var alertSignerBalance math.Int - - s.Run("submit alert + conclusion", func() { - // submit an alert for the infraction height - alert := alerttypes.NewAlert(infractionHeight, alertSigner, cp) - - // submit the alert - resp, err := s.SubmitAlert(s.multiSigUser1, alert) - s.Require().NoError(err) - - // expect the alert submission to succeed - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - alertSignerBalance, err = s.chain.GetBalance(context.Background(), alertSigner.String(), s.denom) - s.Require().NoError(err) - - // create the conclusion - conclusion := &alerttypes.MultiSigConclusion{ - Alert: alert, - ExtendedCommitInfo: extendedCommit, - PriceBound: alerttypes.PriceBound{ - High: "151", - Low: "149", - }, - Status: true, - CurrencyPairID: id, - } - - sigBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign from the first multi-sig key - sig, err := s.multiSigPk1.Sign(sigBytes) - s.Require().NoError(err) - - conclusion.Signatures = []alerttypes.Signature{ - { - Signer: sdk.AccAddress(s.multiSigPk1.PubKey().Address()).String(), - Signature: sig, - }, - } - - // sign from second multi-sig key - sig, err = s.multiSigPk2.Sign(sigBytes) - s.Require().NoError(err) - - conclusion.Signatures = append(conclusion.Signatures, alerttypes.Signature{ - Signer: sdk.AccAddress(s.multiSigPk2.PubKey().Address()).String(), - Signature: sig, - }) - - // submit the conclusion - resp, err = s.SubmitConclusion(s.multiSigUser2, conclusion) - s.Require().NoError(err) - - // expect the conclusion submission to succeed - s.Require().Equal(resp.CheckTx.Code, uint32(0)) - s.Require().Equal(resp.TxResult.Code, uint32(0)) - - // wait for a block for the incentive to be executed - WaitForHeight(s.chain, uint64(resp.Height)+2, 4*s.blockTime) - }) - - s.Run("expect that slashing / rewarding is executed", func() { - // get the validators after the slashing - validatorsPostSlash, err := QueryValidators(s.chain) - s.Require().NoError(err) - - cdc := s.chain.Config().EncodingConfig.Codec - validatorPostSlashMap := mapValidators(validatorsPostSlash, cdc) - - reward := math.NewInt(0) - // check that the validators are slashed / rewarded correctly - for consAddr, priceReport := range valsToOracleReport { - // if the validator's report was honest, expect no slash - if priceReport == honestPrice { - preSlashValidator, ok := validatorPreSlashMap[consAddr] - s.Require().True(ok) - - postSlashValidator, ok := validatorPostSlashMap[consAddr] - s.Require().True(ok) - - s.Require().True(preSlashValidator.Tokens.Equal(postSlashValidator.Tokens)) - continue - } - - // otherwise expect a slash - preSlashValidator, ok := validatorPreSlashMap[consAddr] - s.Require().True(ok) - - postSlashValidator, ok := validatorPostSlashMap[consAddr] - s.Require().True(ok) - - s.Require().True(postSlashValidator.Tokens.LT(preSlashValidator.Tokens)) - reward = reward.Add(preSlashValidator.Tokens.Sub(postSlashValidator.Tokens)) - } - - // check that the alert signer is rewarded correctly - alertSignerBalanceAfter, err := s.chain.GetBalance(context.Background(), alertSigner.String(), s.denom) - s.Require().NoError(err) - - s.Require().True(alertSignerBalanceAfter.Equal(alertSignerBalance.Add(reward).Add(alerttypes.DefaultBondAmount))) - }) - */ - }) -} - -func mapValidators(vals []stakingtypes.Validator, cdc codec.Codec) map[string]stakingtypes.Validator { - m := make(map[string]stakingtypes.Validator) - for _, v := range vals { - key, err := pkToKey(v.ConsensusPubkey, cdc) - if err != nil { - continue - } - m[key] = v - } - return m -} - -func pkToKey(pkAny *codectypes.Any, cdc codec.Codec) (string, error) { - protoCodec, ok := cdc.(*codec.ProtoCodec) - if !ok { - return "", fmt.Errorf("expected codec to be a proto codec") - } - - var pk cryptotypes.PubKey - - if err := protoCodec.UnpackAny(pkAny, &pk); err != nil { - return "", err - } - - return sdk.ConsAddress(pk.Address()).String(), nil -} diff --git a/tests/integration/slinky_suite.go b/tests/integration/slinky_suite.go index c7590b43c..0741c544f 100644 --- a/tests/integration/slinky_suite.go +++ b/tests/integration/slinky_suite.go @@ -3,13 +3,16 @@ package integration import ( "context" "encoding/hex" + "math/big" "os" "os/signal" "syscall" + "testing" "time" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/bech32" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -17,6 +20,7 @@ import ( "github.com/strangelove-ventures/interchaintest/v8" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/ibc" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" slinkyabci "github.com/skip-mev/slinky/abci/ve/types" @@ -37,6 +41,7 @@ const ( yes = "yes" userMnemonic = "foster poverty abstract scorpion short shrimp tilt edge romance adapt only benefit moral another where host egg echo ability wisdom lizard lazy pool roast" userAccountAddressHex = "877E307618AB73E009A978AC32E0264791F6D40A" + gasPrice = 100 ) func DefaultOracleSidecar(image ibc.DockerImage) ibc.SidecarConfig { @@ -162,6 +167,42 @@ func WithChainConstructor(cc ChainConstructor) Option { } } +// CreateTx creates a new transaction to be signed by the given user, including a provided set of messages +func CreateTx(t *testing.T, chain *cosmos.CosmosChain, user cosmos.User, GasPrice int64, msgs ...sdk.Msg) []byte { + bc := cosmos.NewBroadcaster(t, chain) + + ctx := context.Background() + // create tx factory + Client Context + txf, err := bc.GetFactory(ctx, user) + require.NoError(t, err) + + cc, err := bc.GetClientContext(ctx, user) + require.NoError(t, err) + + txf = txf.WithSimulateAndExecute(true) + + txf, err = txf.Prepare(cc) + require.NoError(t, err) + + // get gas for tx + txf.WithGas(25000000) + + // update sequence number + txf = txf.WithSequence(txf.Sequence()) + txf = txf.WithGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(chain.Config().Denom, math.NewInt(GasPrice))).String()) + + // sign the tx + txBuilder, err := txf.BuildUnsignedTx(msgs...) + require.NoError(t, err) + + require.NoError(t, tx.Sign(cc.CmdContext, txf, cc.GetFromName(), txBuilder, true)) + + // encode and return + bz, err := cc.TxConfig.TxEncoder()(txBuilder.GetTx()) + require.NoError(t, err) + return bz +} + func NewSlinkyIntegrationSuite(spec *interchaintest.ChainSpec, oracleImage ibc.DockerImage, opts ...Option) *SlinkyIntegrationSuite { suite := &SlinkyIntegrationSuite{ spec: spec, diff --git a/tests/simapp/app.go b/tests/simapp/app.go index 11d1da3fc..933bb0c7d 100644 --- a/tests/simapp/app.go +++ b/tests/simapp/app.go @@ -67,10 +67,6 @@ import ( "github.com/skip-mev/slinky/pkg/math/voteweighted" oracleclient "github.com/skip-mev/slinky/service/clients/oracle" servicemetrics "github.com/skip-mev/slinky/service/metrics" - "github.com/skip-mev/slinky/x/alerts" - alertskeeper "github.com/skip-mev/slinky/x/alerts/keeper" - "github.com/skip-mev/slinky/x/incentives" - incentiveskeeper "github.com/skip-mev/slinky/x/incentives/keeper" marketmapmodule "github.com/skip-mev/slinky/x/marketmap" marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper" "github.com/skip-mev/slinky/x/oracle" @@ -110,8 +106,6 @@ var ( vesting.AppModuleBasic{}, consensus.AppModuleBasic{}, oracle.AppModuleBasic{}, - incentives.AppModuleBasic{}, - alerts.AppModuleBasic{}, marketmapmodule.AppModuleBasic{}, ) ) @@ -146,8 +140,6 @@ type SimApp struct { ConsensusParamsKeeper consensuskeeper.Keeper CircuitBreakerKeeper circuitkeeper.Keeper OracleKeeper *oraclekeeper.Keeper - IncentivesKeeper incentiveskeeper.Keeper - AlertsKeeper alertskeeper.Keeper MarketMapKeeper *marketmapkeeper.Keeper // simulation manager @@ -235,8 +227,6 @@ func NewSimApp( &app.CircuitBreakerKeeper, &app.MarketMapKeeper, &app.OracleKeeper, - &app.IncentivesKeeper, - &app.AlertsKeeper, ); err != nil { panic(err) } diff --git a/tests/simapp/config.go b/tests/simapp/config.go index 73efe9b49..4ed7acfb6 100644 --- a/tests/simapp/config.go +++ b/tests/simapp/config.go @@ -24,10 +24,6 @@ import ( "cosmossdk.io/depinject" "google.golang.org/protobuf/types/known/durationpb" - alertmodulev1 "github.com/skip-mev/slinky/api/slinky/alerts/module/v1" - incentivesmodulev1 "github.com/skip-mev/slinky/api/slinky/incentives/module/v1" - oraclemodulev1 "github.com/skip-mev/slinky/api/slinky/oracle/module/v1" - _ "cosmossdk.io/x/circuit" // import for side-effects _ "cosmossdk.io/x/upgrade" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects @@ -44,9 +40,8 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects - _ "github.com/skip-mev/slinky/x/incentives" // import for side-effects - _ "github.com/skip-mev/slinky/x/marketmap" // import for side-effects - _ "github.com/skip-mev/slinky/x/oracle" // import for side-effects + _ "github.com/skip-mev/slinky/x/marketmap" // import for side-effects + _ "github.com/skip-mev/slinky/x/oracle" // import for side-effects "cosmossdk.io/core/appconfig" circuittypes "cosmossdk.io/x/circuit/types" @@ -70,21 +65,11 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" marketmapmodulev1 "github.com/skip-mev/slinky/api/slinky/marketmap/module/v1" - alerttypes "github.com/skip-mev/slinky/x/alerts/types" - "github.com/skip-mev/slinky/x/alerts/types/strategies" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" + oraclemodulev1 "github.com/skip-mev/slinky/api/slinky/oracle/module/v1" marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types" oracletypes "github.com/skip-mev/slinky/x/oracle/types" ) -// ProvideIncentives provides the incentive strategies for the incentive module, wrt the expected Keeper dependencies for -// incentive handler. -func ProvideIncentives(bk alerttypes.BankKeeper, sk alerttypes.StakingKeeper) map[incentivetypes.Incentive]incentivetypes.Strategy { - return map[incentivetypes.Incentive]incentivetypes.Strategy{ - &strategies.ValidatorAlertIncentive{}: strategies.DefaultValidatorAlertIncentiveStrategy(sk, bk), - } -} - var ( // module account permissions. moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ @@ -95,8 +80,6 @@ var ( {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, {Account: oracletypes.ModuleName, Permissions: []string{}}, - {Account: incentivetypes.ModuleName, Permissions: []string{}}, - {Account: alerttypes.ModuleName, Permissions: []string{authtypes.Burner, authtypes.Minter}}, } // blocked account addresses. @@ -130,8 +113,6 @@ var ( genutiltypes.ModuleName, authz.ModuleName, oracletypes.ModuleName, - incentivetypes.ModuleName, - alerttypes.ModuleName, marketmaptypes.ModuleName, }, EndBlockers: []string{ @@ -140,9 +121,6 @@ var ( genutiltypes.ModuleName, group.ModuleName, oracletypes.ModuleName, - // alert Endblock must precede incentives types EndBlocker (issued incentives should be executed same block) - alerttypes.ModuleName, - incentivetypes.ModuleName, marketmaptypes.ModuleName, }, OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ @@ -171,8 +149,6 @@ var ( consensustypes.ModuleName, circuittypes.ModuleName, oracletypes.ModuleName, - incentivetypes.ModuleName, - alerttypes.ModuleName, // market map genesis must be called AFTER all consuming modules (i.e. x/oracle, etc.) marketmaptypes.ModuleName, }, @@ -223,10 +199,6 @@ var ( Name: oracletypes.ModuleName, Config: appconfig.WrapAny(&oraclemodulev1.Module{}), }, - { - Name: incentivetypes.ModuleName, - Config: appconfig.WrapAny(&incentivesmodulev1.Module{}), - }, { Name: genutiltypes.ModuleName, Config: appconfig.WrapAny(&genutilmodulev1.Module{}), @@ -267,12 +239,6 @@ var ( Name: circuittypes.ModuleName, Config: appconfig.WrapAny(&circuitmodulev1.Module{}), }, - { - Name: alerttypes.ModuleName, - Config: appconfig.WrapAny(&alertmodulev1.Module{ - Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), - }), - }, { Name: marketmaptypes.ModuleName, Config: appconfig.WrapAny(&marketmapmodulev1.Module{ @@ -281,8 +247,6 @@ var ( }, }, }), - depinject.Provide(alerttypes.ProvideMsgAlertGetSigners), - depinject.Provide(ProvideIncentives), depinject.Supply( // supply custom module basics map[string]module.AppModuleBasic{ @@ -293,8 +257,5 @@ var ( }, ), }, - - // Supply the Incentive Handler for the Alerts module's ProvideModule Inputs - strategies.DefaultHandleValidatorIncentive(), )) ) diff --git a/x/alerts/client/query.go b/x/alerts/client/query.go deleted file mode 100644 index 78ffe8c8c..000000000 --- a/x/alerts/client/query.go +++ /dev/null @@ -1,119 +0,0 @@ -package client - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -const ( - flagAlertStatusID = "alert-status" -) - -// GetQueryCmd returns the parent command for all x/alerts cli query commands. -func GetQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Querying commands for the alerts module", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - CmdQueryParams(), - CmdQueryAlerts(), - ) - - return cmd -} - -// CmdQueryParams returns the command for querying the module's parameters. -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Query the current alerts module parameters", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Params(clientCtx.CmdContext, &types.ParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -// CmdQueryAlerts returns the command for querying alerts. -func CmdQueryAlerts() *cobra.Command { - cmd := &cobra.Command{ - Use: "alerts", - Short: "Query alerts by status (concluded, open, or all). See --help for more info", - Long: ` -The query is expected to look as follows: - query alerts alerts --status -> returns all queries with the given status - query alerts alerts -> returns all alerts - `, - Example: "alerts alerts --alert-status concluded", - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // get the alert status from flags if it exists - alertStatusID, err := cmd.Flags().GetString(flagAlertStatusID) - if err != nil { - return err - } - - // convert the alert status to an alert status id - status, err := stringToAlertStatusID(alertStatusID) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Alerts(clientCtx.CmdContext, &types.AlertsRequest{ - Status: status, - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - cmd.Flags().String(flagAlertStatusID, "", "filter alerts by status") - - return cmd -} - -func stringToAlertStatusID(status string) (types.AlertStatusID, error) { - switch status { - case "open": - return types.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, nil - case "concluded": - return types.AlertStatusID_CONCLUSION_STATUS_CONCLUDED, nil - case "": - return types.AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED, nil - default: - return types.AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED, fmt.Errorf("invalid alert status: %s", status) - } -} diff --git a/x/alerts/client/tx.go b/x/alerts/client/tx.go deleted file mode 100644 index d7a9f43b7..000000000 --- a/x/alerts/client/tx.go +++ /dev/null @@ -1,70 +0,0 @@ -package client - -import ( - "strconv" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/spf13/cobra" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -// GetTxCmd returns the parent command for all x/alerts cli transaction commands. -func GetTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "alerts", - Short: "Alerts transactions subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - return cmd -} - -func AlertTxCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "alert", - Short: "Create a new alert", - Long: ` -Create a new alert with the specified height, sender, and currency-pair. - Example: "slinkyd tx alerts alert cosmos... 1 BTC/USD" - Structure: "slinkyd tx alerts alert -`, - Example: "slinkyd tx alerts alert cosmos... 1 BTC/USD", - Args: cobra.ExactArgs(3), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - if err := cmd.Flags().Set(flags.FlagFrom, args[0]); err != nil { - return err - } - - // get the height - height, err := strconv.ParseUint(args[1], 10, 64) - if err != nil { - return err - } - - // get the currency-pair - cp, err := slinkytypes.CurrencyPairFromString(args[2]) - if err != nil { - return err - } - - alert := types.NewAlert(height, clientCtx.FromAddress, cp) - alertMsg := types.NewMsgAlert(alert) - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), alertMsg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} diff --git a/x/alerts/keeper/abci.go b/x/alerts/keeper/abci.go deleted file mode 100644 index c3c7ab674..000000000 --- a/x/alerts/keeper/abci.go +++ /dev/null @@ -1,58 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -// EndBlocker is called at the end of every block. This function is a no-op if pruning is disabled -// -// It is used to determine which Alerts are to be purged, and if they should be purged, the alerts will be removed from state. -// -// If the AlertStatus of the Alert is concluded, nothing will be done. If the AlertStatus -// is Unconcluded, the alert will be Concluded positively (i.e, the bond will be returned to the bond-address). -func (k *Keeper) EndBlocker(goCtx context.Context) error { - // unwrap the context - ctx := sdk.UnwrapSDKContext(goCtx) - - // check if Pruning is enabled, if not this is a no-op - if params := k.GetParams(ctx); !params.PruningParams.Enabled { - return nil - } - - // get the current block height - height := uint64(ctx.BlockHeight()) - - // get all alerts - alerts, err := k.GetAllAlerts(ctx) - if err != nil { - return err - } - - // iterate through all alerts - for _, alert := range alerts { - // check what the pruning height of the alert is, only prune if - // the current block height is greater than or equal to the pruning height - if alert.Status.PurgeHeight > height { - continue - } - - // check status of the alert, if it is to be pruned - if status := alert.Status.ConclusionStatus; status != uint64(types.Concluded) { - // conclude the alert positively - if err := k.ConcludeAlert(ctx, alert.Alert, Positive); err != nil { - return err - } - } - - // finally delete the alert - if err := k.RemoveAlert(ctx, alert.Alert); err != nil { - return err - } - } - - return nil -} diff --git a/x/alerts/keeper/abci_test.go b/x/alerts/keeper/abci_test.go deleted file mode 100644 index 3ae4aa76c..000000000 --- a/x/alerts/keeper/abci_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package keeper_test - -import ( - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/mock" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func (s *KeeperTestSuite) TestEndBlocker() { - // set context - s.ctx = s.ctx.WithBlockHeight(10) - - // set three alerts (this should be purged first) - alert1 := types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc1"), slinkytypes.NewCurrencyPair("BTC", "USD")), - types.NewAlertStatus(10, 10, time.Time{}, types.Concluded), - ) - - // this will be purged next - alert2 := types.NewAlertWithStatus( - types.NewAlert(2, sdk.AccAddress("abc2"), slinkytypes.NewCurrencyPair("BTC", "USD")), - types.NewAlertStatus(10, 11, time.Time{}, types.Concluded), - ) - - // this will be purged last - alert3 := types.NewAlertWithStatus( - types.NewAlert(3, sdk.AccAddress("abc3"), slinkytypes.NewCurrencyPair("BTC", "USD")), - types.NewAlertStatus(10, 12, time.Time{}, types.Unconcluded), - ) - - // set alerts in the store - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert1)) - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert2)) - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert3)) - - s.Run("expect no alerts are pruned at endblock if pruning is disabled in end-block", func() { - err := s.alertKeeper.SetParams( - s.ctx, - types.NewParams( - types.AlertParams{}, - nil, - types.PruningParams{ - Enabled: false, - }, - ), - ) - s.Require().NoError(err) - - // run endblocker - s.Require().NoError(s.alertKeeper.EndBlocker(s.ctx)) - - // assert that all alerts are still in the store - alerts, err := s.alertKeeper.GetAllAlerts(s.ctx) - s.Require().NoError(err) - s.Require().Len(alerts, 3) - }) - - // enable pruning - err := s.alertKeeper.SetParams( - s.ctx, - types.NewParams( - types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewCoin("test", math.NewInt(100)), - MaxBlockAge: 1, - }, - nil, - types.PruningParams{ - Enabled: true, - }, - ), - ) - s.Require().NoError(err) - - s.Run("expect first alert is pruned at the end of endblock", func() { - s.Require().NoError(s.alertKeeper.EndBlocker(s.ctx)) - - // assert that the first alert is pruned - alerts, err := s.alertKeeper.GetAllAlerts(s.ctx) - s.Require().NoError(err) - - s.Require().Len(alerts, 2) - - // query the first alert - _, ok := s.alertKeeper.GetAlert(s.ctx, alert1.Alert) - s.Require().False(ok) - - // query the second alert - _, ok = s.alertKeeper.GetAlert(s.ctx, alert2.Alert) - s.Require().True(ok) - - // query the third alert - _, ok = s.alertKeeper.GetAlert(s.ctx, alert3.Alert) - s.Require().True(ok) - }) - - // increment block height - s.ctx = s.ctx.WithBlockHeight(11) - s.Run("expect second alert is pruned at the end of endblock", func() { - s.Require().NoError(s.alertKeeper.EndBlocker(s.ctx)) - - // assert that the second alert is pruned - _, ok := s.alertKeeper.GetAlert(s.ctx, alert2.Alert) - s.Require().False(ok) - - // assert that the third alert is still in the store - _, ok = s.alertKeeper.GetAlert(s.ctx, alert3.Alert) - s.Require().True(ok) - }) - - // increment block height - s.ctx = s.ctx.WithBlockHeight(12) - s.Run("expect third alert is pruned at the end of endblock", func() { - s.bk.On("SendCoinsFromModuleToAccount", - mock.Anything, - types.ModuleName, - sdk.AccAddress("abc3"), - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(nil) - - s.Require().NoError(s.alertKeeper.EndBlocker(s.ctx)) - - // assert that the third alert is pruned - _, ok := s.alertKeeper.GetAlert(s.ctx, alert3.Alert) - s.Require().False(ok) - }) -} diff --git a/x/alerts/keeper/conclusions.go b/x/alerts/keeper/conclusions.go deleted file mode 100644 index 9c9c106d3..000000000 --- a/x/alerts/keeper/conclusions.go +++ /dev/null @@ -1,87 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -type ConclusionStatus uint64 - -const ( - Positive ConclusionStatus = iota - Negative -) - -// ConcludeAlert takes an Alert and status. This method returns the Alert's bond to the Alert's owner if the Alert -// is concluded with positive status, if the alert is concluded with negative status, the bond is burned. -// Finally, the alert's status is set to Concluded, and it's purge height is set to alert.Height + AlertParams.MaxBlockAge. -func (k *Keeper) ConcludeAlert(ctx sdk.Context, alertToConclude types.Alert, status ConclusionStatus) error { - // check that the alert is valid - if err := alertToConclude.ValidateBasic(); err != nil { - return err - } - - // get the alert from state - alert, ok := k.GetAlert(ctx, alertToConclude) - if !ok { - return fmt.Errorf("alert not found: %v", alertToConclude) - } - - // check if the alert is already concluded - if alert.Status.ConclusionStatus != uint64(types.Unconcluded) { - return fmt.Errorf("alert already concluded") - } - - params := k.GetParams(ctx) - - switch status { - case Positive: - if err := k.unescrowBond(ctx, alert.Alert, params.AlertParams.BondAmount); err != nil { - return err - } - case Negative: - if err := k.burnBond(ctx, params.AlertParams.BondAmount); err != nil { - return err - } - default: - return fmt.Errorf("invalid status: %v", status) - } - - // update the status of the alert - alert.Status.ConclusionStatus = uint64(types.Concluded) - - // set the purge height of the alert - alert.Status.PurgeHeight = alert.Alert.Height + params.AlertParams.MaxBlockAge - - // set the alert - return k.SetAlert(ctx, alert) -} - -// unescrowBond sends the bond at the module account back to the alert's signer. -func (k *Keeper) unescrowBond(ctx sdk.Context, a types.Alert, bond sdk.Coin) error { - alertSigner, err := sdk.AccAddressFromBech32(a.Signer) - if err != nil { - return err - } - - // send the coins from the module account to the signer - return k.bankKeeper.SendCoinsFromModuleToAccount( - ctx, - types.ModuleName, - alertSigner, - sdk.NewCoins(bond), - ) -} - -// burnBond burns the bond stored at the module account's address. -func (k *Keeper) burnBond(ctx sdk.Context, bond sdk.Coin) error { - // burn the coins - return k.bankKeeper.BurnCoins( - ctx, - types.ModuleName, - sdk.NewCoins(bond), - ) -} diff --git a/x/alerts/keeper/conclusions_test.go b/x/alerts/keeper/conclusions_test.go deleted file mode 100644 index acd041187..000000000 --- a/x/alerts/keeper/conclusions_test.go +++ /dev/null @@ -1,170 +0,0 @@ -package keeper_test - -import ( - "fmt" - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/keeper" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func (s *KeeperTestSuite) TestConcludeAlert() { - // set the params - err := s.alertKeeper.SetParams(s.ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - MaxBlockAge: 10, - BondAmount: sdk.NewCoin( - "stake", - math.NewInt(100), - ), - }, - }) - require.NoError(s.T(), err) - - cases := []struct { - name string - alert types.Alert - status keeper.ConclusionStatus - setup func(ctx sdk.Context) - err error - expectedAlert types.AlertWithStatus - }{ - { - "invalid alert - fail", - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("base", "")), - keeper.Negative, - func(_ sdk.Context) {}, - fmt.Errorf("invalid alert: quote asset cannot be empty"), - types.AlertWithStatus{}, - }, - { - "alert not found - fail", - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - keeper.Negative, - func(_ sdk.Context) {}, - fmt.Errorf("alert not found: %v", types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE"))), - types.AlertWithStatus{}, - }, - { - "alert already concluded", - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - keeper.Negative, - func(ctx sdk.Context) { - // set the alert with concluded AlertStatus - s.Require().NoError(s.alertKeeper.SetAlert( - ctx, - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 1, time.Now(), types.Concluded), - ), - )) - }, - fmt.Errorf("alert already concluded"), - types.AlertWithStatus{}, - }, - { - "alert status unknown", - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - keeper.ConclusionStatus(3), - func(ctx sdk.Context) { - // set the alert with concluded AlertStatus - s.Require().NoError(s.alertKeeper.SetAlert( - ctx, - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 1, time.Now(), types.Unconcluded), - ), - )) - }, - fmt.Errorf("invalid status: 3"), - types.AlertWithStatus{}, - }, - { - "negative alert - bond is burned", - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - keeper.Negative, - func(ctx sdk.Context) { - alert := types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(10, 11, time.Time{}, types.Unconcluded), - ) - // set the unconcluded alert - err := s.alertKeeper.SetAlert( - ctx, - alert, - ) - s.Require().NoError(err) - - s.bk.On("BurnCoins", - mock.Anything, - types.ModuleName, - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(nil) - }, - nil, - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(10, 11, time.Time{}, types.Concluded), - ), - }, - { - "positive alert - bond is returned", - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - keeper.Positive, - func(ctx sdk.Context) { - alert := types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(10, 11, time.Time{}, types.Unconcluded), - ) - // set the unconcluded alert - s.Require().NoError(s.alertKeeper.SetAlert( - ctx, - alert, - )) - - s.bk.On("SendCoinsFromModuleToAccount", - mock.Anything, - types.ModuleName, - sdk.AccAddress("abc"), - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(nil) - }, - nil, - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(10, 11, time.Time{}, types.Concluded), - ), - }, - } - - for _, tc := range cases { - s.Run(tc.name, func() { - // setup - tc.setup(s.ctx) - - // when - err := s.alertKeeper.ConcludeAlert(s.ctx, tc.alert, tc.status) - - // then - if tc.err != nil { - s.Require().Error(err) - s.Require().Equal(tc.err.Error(), err.Error()) - return - } - - s.Require().NoError(err) - - // assert equality of saved alerts - alert, found := s.alertKeeper.GetAlert(s.ctx, tc.alert) - s.Require().True(found) - s.Require().Equal(tc.expectedAlert, alert) - }) - } -} diff --git a/x/alerts/keeper/genesis.go b/x/alerts/keeper/genesis.go deleted file mode 100644 index 1a6548e02..000000000 --- a/x/alerts/keeper/genesis.go +++ /dev/null @@ -1,48 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -// InitGenesis initializes the module state from a GenesisState object. Specifically, this method sets the -// params to state and adds all alerts from the genesis state to state. -func (k *Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { - // validate the genesis state - if err := gs.ValidateBasic(); err != nil { - panic(err) - } - - // set the params - if err := k.SetParams(ctx, gs.Params); err != nil { - panic(err) - } - - // add all alerts - for _, alert := range gs.Alerts { - if err := k.SetAlert(ctx, alert); err != nil { - panic(err) - } - } -} - -// ExportGenesis returns a GenesisState object containing the current module state. Specifically, this method -// returns the current params and all alerts in state. -func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - // get the params - params := k.GetParams(ctx) - - // get all alerts - alerts, err := k.GetAllAlerts(ctx) - if err != nil { - panic(err) - } - - gs := types.NewGenesisState(params, alerts) - if err := gs.ValidateBasic(); err != nil { - panic(err) - } - - return &gs -} diff --git a/x/alerts/keeper/genesis_test.go b/x/alerts/keeper/genesis_test.go deleted file mode 100644 index b0a570550..000000000 --- a/x/alerts/keeper/genesis_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package keeper_test - -import ( - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func (s *KeeperTestSuite) TestInitGenesisInvalidGenesis() { - s.Run("test that init genesis with invalid genesis fails", func() { - // create a fake genesis state - gs := types.GenesisState{ - Params: types.NewParams(types.AlertParams{ - Enabled: false, - BondAmount: sdk.NewCoin("test", math.NewInt(100)), - MaxBlockAge: 1, - }, nil, types.PruningParams{}), - } - - // assert that InitGenesis panics - s.Require().Panics(func() { - s.alertKeeper.InitGenesis(s.ctx, gs) - }) - }) -} - -func (s *KeeperTestSuite) TestInitGenesisValidGenesis() { - // create genesis - params := types.NewParams(types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewCoin("test", math.NewInt(100)), - MaxBlockAge: 1, - }, nil, types.PruningParams{}) - alert2 := types.NewAlertWithStatus( - types.NewAlert(2, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - alert1 := types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - alert3 := types.NewAlertWithStatus( - types.NewAlert(3, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - gs := types.GenesisState{ - Params: params, - Alerts: []types.AlertWithStatus{alert1, alert2, alert3}, - } - - s.Run("initialize with valid genesis", func() { - // assert that InitGenesis does not panic - s.Require().NotPanics(func() { - s.alertKeeper.InitGenesis(s.ctx, gs) - }) - }) - - // check that all alerts are added - s.Run("check that all alerts are added", func() { - // check that alert1 was added to state - alertInState, ok := s.alertKeeper.GetAlert(s.ctx, alert1.Alert) - s.Require().True(ok) - s.Require().Equal(alert1, alertInState) - - // check that alert2 was added to state - alertInState, ok = s.alertKeeper.GetAlert(s.ctx, alert2.Alert) - s.Require().True(ok) - s.Require().Equal(alert2, alertInState) - - // check that alert3 was added to state - alertInState, ok = s.alertKeeper.GetAlert(s.ctx, alert3.Alert) - s.Require().True(ok) - s.Require().Equal(alert3, alertInState) - }) - - s.Run("check that the params are set correctly", func() { - // check that the params are set correctly - s.Require().Equal(params, s.alertKeeper.GetParams(s.ctx)) - }) -} - -func (s *KeeperTestSuite) TestExportGenesis() { - // create values + genesis-state - params := types.NewParams(types.AlertParams{ - Enabled: false, - BondAmount: sdk.NewCoin("test", math.NewInt(0)), - MaxBlockAge: 0, - }, nil, types.PruningParams{}) - alert2 := types.NewAlertWithStatus( - types.NewAlert(2, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - alert1 := types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - alert3 := types.NewAlertWithStatus( - types.NewAlert(3, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - alert4 := types.NewAlertWithStatus( - types.NewAlert(4, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ) - - gs := types.GenesisState{ - Params: params, - Alerts: []types.AlertWithStatus{alert1, alert2, alert3}, - } - var exportedGenesis types.GenesisState - s.Run("test that init-genesis is successful", func() { - // assert that InitGenesis does not panic - s.Require().NotPanics(func() { - s.alertKeeper.InitGenesis(s.ctx, gs) - }) - }) - - s.Run("test that additional alerts can be added to state", func() { - s.Require().Nil(s.alertKeeper.SetAlert(s.ctx, alert4)) - }) - - s.Run("test that genesis is exported as expected", func() { - // assert that ExportGenesis does not panic - s.Require().NotPanics(func() { - gsTemp := s.alertKeeper.ExportGenesis(s.ctx) - exportedGenesis = *gsTemp - }) - - s.Run("check that params is correct", func() { - s.Require().Equal(params, exportedGenesis.Params) - }) - - s.Run("check that alerts are correct", func() { - expectedAlerts := map[string]struct{}{ - string(alert1.Alert.UID()): {}, - string(alert2.Alert.UID()): {}, - string(alert3.Alert.UID()): {}, - string(alert4.Alert.UID()): {}, - } - - for _, alert := range exportedGenesis.Alerts { - _, ok := expectedAlerts[string(alert.Alert.UID())] - s.Require().True(ok) - } - }) - }) - - s.Run("test that genesis exported is valid", func() { - // validate the exported genesis - s.Require().Nil(exportedGenesis.ValidateBasic()) - }) -} diff --git a/x/alerts/keeper/grpc_query.go b/x/alerts/keeper/grpc_query.go deleted file mode 100644 index 6e045681e..000000000 --- a/x/alerts/keeper/grpc_query.go +++ /dev/null @@ -1,80 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -type queryServerImpl struct { - k Keeper -} - -// NewQueryServer returns an implementation of the x/alerts QueryServer. -func NewQueryServer(k Keeper) types.QueryServer { - return &queryServerImpl{k} -} - -// Alerts returns all Alerts that match the provided alert status, if no alert-status is given, all alerts -// in module state will be returned. -func (q queryServerImpl) Alerts(srvCtx context.Context, req *types.AlertsRequest) (*types.AlertsResponse, error) { - // if the request is nil, error - if req == nil { - return nil, fmt.Errorf("request cannot be nil") - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(srvCtx) - - // get all alerts from state - alerts, err := q.k.GetAllAlertsWithCondition(ctx, func(a types.AlertWithStatus) bool { - switch req.Status { - case types.AlertStatusID_CONCLUSION_STATUS_CONCLUDED: - return a.Status.ConclusionStatus == uint64(types.Concluded) - case types.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED: - return a.Status.ConclusionStatus == uint64(types.Unconcluded) - case types.AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED: - return true - default: - return false - } - }) - if err != nil { - return nil, err - } - - // convert to alerts - res := &types.AlertsResponse{} - res.Alerts = alertWithStatusToAlerts(alerts) - return res, nil -} - -func alertWithStatusToAlerts(as []types.AlertWithStatus) []types.Alert { - alerts := make([]types.Alert, len(as)) - for i, a := range as { - alerts[i] = a.Alert - } - return alerts -} - -// Params returns the current module params for x/alerts. -func (q queryServerImpl) Params(srvCtx context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error) { - // if the request is nil, error - if req == nil { - return nil, fmt.Errorf("request cannot be nil") - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(srvCtx) - - // get the params from state - params := q.k.GetParams(ctx) - - // convert to response - return &types.ParamsResponse{ - Params: params, - }, nil -} diff --git a/x/alerts/keeper/grpc_query_test.go b/x/alerts/keeper/grpc_query_test.go deleted file mode 100644 index 18a375b33..000000000 --- a/x/alerts/keeper/grpc_query_test.go +++ /dev/null @@ -1,90 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/keeper" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func (s *KeeperTestSuite) TestQueryServer() { - s.Run("Alerts", func() { - // add a concluded alert to state - concludedAlert := types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("abc1"), slinkytypes.NewCurrencyPair("BTC", "USD")), - types.NewAlertStatus(1, 1, s.ctx.BlockTime(), types.Concluded), - ) - - // add an unconcluded alert to state - unconcludedAlert := types.NewAlertWithStatus( - types.NewAlert(2, sdk.AccAddress("abc2"), slinkytypes.NewCurrencyPair("BTC", "USD")), - types.NewAlertStatus(1, 1, s.ctx.BlockTime(), types.Unconcluded), - ) - - // add alerts to state - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, concludedAlert)) - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, unconcludedAlert)) - - qs := keeper.NewQueryServer(*s.alertKeeper) - - s.Run("nil request - fail", func() { - _, err := qs.Alerts(s.ctx, nil) - s.Require().Error(err) - }) - - s.Run("AlertStatusID Concluded - pass", func() { - res, err := qs.Alerts(s.ctx, &types.AlertsRequest{ - Status: types.AlertStatusID_CONCLUSION_STATUS_CONCLUDED, - }) - s.Require().NoError(err) - - s.Require().Len(res.Alerts, 1) - s.Require().Equal(concludedAlert.Alert, res.Alerts[0]) - }) - - s.Run("AlertStatusID Unconcluded - pass", func() { - res, err := qs.Alerts(s.ctx, &types.AlertsRequest{ - Status: types.AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED, - }) - s.Require().NoError(err) - - s.Require().Len(res.Alerts, 1) - s.Require().Equal(unconcludedAlert.Alert, res.Alerts[0]) - }) - - s.Run("AlertStatusID All - pass", func() { - res, err := qs.Alerts(s.ctx, &types.AlertsRequest{ - Status: types.AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED, - }) - s.Require().NoError(err) - - s.Require().Len(res.Alerts, 2) - expectedAlerts := map[string]struct{}{ - string(concludedAlert.Alert.UID()): {}, - string(unconcludedAlert.Alert.UID()): {}, - } - - for _, a := range res.Alerts { - _, ok := expectedAlerts[string(a.UID())] - s.Require().True(ok) - } - }) - }) -} - -func (s *KeeperTestSuite) TestParams() { - params := s.alertKeeper.GetParams(s.ctx) - - qs := keeper.NewQueryServer(*s.alertKeeper) - s.Run("nil request", func() { - _, err := qs.Params(s.ctx, nil) - s.Require().Error(err) - }) - - s.Run("valid request", func() { - res, err := qs.Params(s.ctx, &types.ParamsRequest{}) - s.Require().NoError(err) - s.Require().Equal(params, res.Params) - }) -} diff --git a/x/alerts/keeper/keeper.go b/x/alerts/keeper/keeper.go deleted file mode 100644 index e739187c2..000000000 --- a/x/alerts/keeper/keeper.go +++ /dev/null @@ -1,142 +0,0 @@ -package keeper - -import ( - "fmt" - - "cosmossdk.io/collections" - "cosmossdk.io/core/store" - "cosmossdk.io/log" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/alerts/types" - "github.com/skip-mev/slinky/x/alerts/types/strategies" -) - -type Condition func(types.AlertWithStatus) bool - -type Keeper struct { - storeService store.KVStoreService - cdc codec.BinaryCodec - // Expected keepers - bankKeeper types.BankKeeper - oracleKeeper types.OracleKeeper - incentiveKeeper types.IncentiveKeeper - - // module authority - authority sdk.AccAddress - - // ValidatorIncentiveHandler - validatorIncentiveHandler strategies.ValidatorIncentiveHandler - - // State - schema collections.Schema - // alerts are stored under (height, currency-pair) -> Alert - alerts collections.Map[collections.Pair[uint64, string], types.AlertWithStatus] - params collections.Item[types.Params] -} - -func NewKeeper( - storeService store.KVStoreService, - cdc codec.BinaryCodec, - ok types.OracleKeeper, - bk types.BankKeeper, - ik types.IncentiveKeeper, - vih strategies.ValidatorIncentiveHandler, - authority sdk.AccAddress, -) *Keeper { - // create schema builder - sb := collections.NewSchemaBuilder(storeService) - - k := &Keeper{ - storeService: storeService, - cdc: cdc, - bankKeeper: bk, - oracleKeeper: ok, - incentiveKeeper: ik, - validatorIncentiveHandler: vih, - alerts: collections.NewMap(sb, types.AlertStoreKeyPrefix, "alerts", collections.PairKeyCodec(collections.Uint64Key, collections.StringKey), codec.CollValue[types.AlertWithStatus](cdc)), - params: collections.NewItem(sb, types.ParamsStoreKeyPrefix, "params", codec.CollValue[types.Params](cdc)), - authority: authority, - } - - // build schema - schema, err := sb.Build() - if err != nil { - panic(err) - } - - k.schema = schema - return k -} - -func (k *Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger() -} - -// GetAlert returns the alert for the given UID. This method returns false if no alert exists, and true -// if an alert exists. -func (k *Keeper) GetAlert(ctx sdk.Context, alert types.Alert) (types.AlertWithStatus, bool) { - alertWithStatus, err := k.alerts.Get(ctx, collections.Join(alert.Height, alert.CurrencyPair.String())) - if err != nil { - return types.AlertWithStatus{}, false - } - return alertWithStatus, true -} - -// SetAlert sets the alert to state, under the (height, currency-pair) key. -func (k *Keeper) SetAlert(ctx sdk.Context, alert types.AlertWithStatus) error { - return k.alerts.Set(ctx, collections.Join(alert.Alert.Height, alert.Alert.CurrencyPair.String()), alert) -} - -// RemoveAlert removes the alert from state, under the (height, currency-pair) key. -func (k *Keeper) RemoveAlert(ctx sdk.Context, alert types.Alert) error { - return k.alerts.Remove(ctx, collections.Join(alert.Height, alert.CurrencyPair.String())) -} - -// GetAllAlerts returns all alerts in state, it does so via an iterator over the alerts table. -func (k *Keeper) GetAllAlerts(ctx sdk.Context) ([]types.AlertWithStatus, error) { - return k.GetAllAlertsWithCondition(ctx, func(_ types.AlertWithStatus) bool { return true }) -} - -// GetAllAlertsWithCondition returns all alerts for which the Condition evaluates to true. -func (k *Keeper) GetAllAlertsWithCondition(ctx sdk.Context, c Condition) ([]types.AlertWithStatus, error) { - if c == nil { - return nil, fmt.Errorf("condition cannot be nil") - } - - var alerts []types.AlertWithStatus - iter, err := k.alerts.Iterate(ctx, nil) - if err != nil { - return nil, err - } - - // expect to close the iterator - defer iter.Close() - - for ; iter.Valid(); iter.Next() { - alert, err := iter.Value() - if err != nil { - return nil, err - } - if c(alert) { - alerts = append(alerts, alert) - } - } - - return alerts, nil -} - -// SetParams sets the params to state. -func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) error { - return k.params.Set(ctx, params) -} - -// GetParams returns the params from state. -func (k *Keeper) GetParams(ctx sdk.Context) types.Params { - params, err := k.params.Get(ctx) - if err != nil { - return types.Params{} - } - return params -} diff --git a/x/alerts/keeper/keeper_test.go b/x/alerts/keeper/keeper_test.go deleted file mode 100644 index a0b685c76..000000000 --- a/x/alerts/keeper/keeper_test.go +++ /dev/null @@ -1,155 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - storetypes "cosmossdk.io/store/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - cmttime "github.com/cometbft/cometbft/types/time" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/stretchr/testify/suite" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/keeper" - alerttypes "github.com/skip-mev/slinky/x/alerts/types" - "github.com/skip-mev/slinky/x/alerts/types/mocks" - "github.com/skip-mev/slinky/x/alerts/types/strategies" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - - // alert keeper - alertKeeper *keeper.Keeper - // bank-keeper - bk *mocks.BankKeeper - // oracle-keeper - ok *mocks.OracleKeeper - // incentive-keeper - ik *mocks.IncentiveKeeper - // private-key - privateKey cryptotypes.PrivKey - // authority - authority sdk.AccAddress -} - -func (s *KeeperTestSuite) SetupTest() { - key := storetypes.NewKVStoreKey(alerttypes.StoreKey) - ss := runtime.NewKVStoreService(key) - testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) - s.ctx = testCtx.Ctx.WithBlockHeader(cmtproto.Header{Time: cmttime.Now()}) - encCfg := moduletestutil.MakeTestEncodingConfig() - - // register strategies interfaces to the encoding config - strategies.RegisterInterfaces(encCfg.InterfaceRegistry) - alerttypes.RegisterInterfaces(encCfg.InterfaceRegistry) - - s.bk = mocks.NewBankKeeper(s.T()) - s.ok = mocks.NewOracleKeeper(s.T()) - s.ik = mocks.NewIncentiveKeeper(s.T()) - - s.authority = sdk.AccAddress("authority") - s.alertKeeper = keeper.NewKeeper(ss, encCfg.Codec, s.ok, s.bk, s.ik, strategies.DefaultHandleValidatorIncentive(), s.authority) - - // create a private key - s.privateKey = secp256k1.GenPrivKey() -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -// test that we can set / remove / get alerts from the keeper. -func (s *KeeperTestSuite) TestAlerts() { - alert := alerttypes.NewAlertWithStatus( - alerttypes.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BTC", "USD")), - alerttypes.NewAlertStatus(1, 2, time.Now(), alerttypes.Unconcluded), - ) - alert2 := alerttypes.NewAlertWithStatus( - alerttypes.NewAlert(2, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BTC", "USD")), - alerttypes.NewAlertStatus(2, 3, time.Now(), alerttypes.Unconcluded), - ) - // set an alert in the keeper - s.Run("set alerts", func() { - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert)) - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert2)) - - // check that both alerts are in the keeper - alertInState, ok := s.alertKeeper.GetAlert(s.ctx, alert.Alert) - s.Require().True(ok) - s.Require().Equal(alert, alertInState) - - alertInState, ok = s.alertKeeper.GetAlert(s.ctx, alert2.Alert) - s.Require().True(ok) - s.Require().Equal(alert2, alertInState) - }) - - // remove alert from the keeper - s.Run("remove alert", func() { - // remove a single alert, and check that alert2 exists, but alert1 does not - s.Require().NoError(s.alertKeeper.RemoveAlert(s.ctx, alert.Alert)) - - _, ok := s.alertKeeper.GetAlert(s.ctx, alert.Alert) - - s.Require().False(ok) - - alertInState, ok := s.alertKeeper.GetAlert(s.ctx, alert2.Alert) - s.Require().Equal(alert2, alertInState) - s.Require().True(ok) - }) - - // remove all alerts from the keeper - s.Run("remove all alerts", func() { - s.Require().NoError(s.alertKeeper.RemoveAlert(s.ctx, alert2.Alert)) - _, ok := s.alertKeeper.GetAlert(s.ctx, alert.Alert) - s.Require().False(ok) - - _, ok = s.alertKeeper.GetAlert(s.ctx, alert2.Alert) - s.Require().False(ok) - }) -} - -func (s *KeeperTestSuite) TestGetAllAlerts() { - // set some alerts in the keeper - alert := alerttypes.NewAlertWithStatus( - alerttypes.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BTC", "USD")), - alerttypes.NewAlertStatus(1, 2, time.Now(), alerttypes.Unconcluded), - ) - alert2 := alerttypes.NewAlertWithStatus( - alerttypes.NewAlert(2, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BTC", "USD")), - alerttypes.NewAlertStatus(2, 3, time.Now(), alerttypes.Unconcluded), - ) - alert3 := alerttypes.NewAlertWithStatus( - alerttypes.NewAlert(2, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BTC", "USD")), - alerttypes.NewAlertStatus(2, 3, time.Now(), alerttypes.Unconcluded), - ) - - // set alerts - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert)) - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert2)) - s.Require().NoError(s.alertKeeper.SetAlert(s.ctx, alert3)) - - // get all alerts - expectedAlerts := make(map[string]struct{}) - - for _, alert := range []alerttypes.AlertWithStatus{alert, alert2, alert3} { - expectedAlerts[string(alert.Alert.UID())] = struct{}{} - } - - alerts, err := s.alertKeeper.GetAllAlerts(s.ctx) - s.Require().NoError(err) - - for _, alert := range alerts { - _, ok := expectedAlerts[string(alert.Alert.UID())] - s.Require().True(ok) - delete(expectedAlerts, string(alert.Alert.UID())) - } -} diff --git a/x/alerts/keeper/msg_server.go b/x/alerts/keeper/msg_server.go deleted file mode 100644 index 0263ab175..000000000 --- a/x/alerts/keeper/msg_server.go +++ /dev/null @@ -1,224 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - "github.com/skip-mev/slinky/x/alerts/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -// msgServer is the default implementation of the x/alerts MsgService. -type msgServer struct { - k Keeper -} - -// NewMsgServer returns an implementation of the x/alerts MsgServer interface -// for the provided Keeper. -func NewMsgServer(k Keeper) types.MsgServer { - return &msgServer{k} -} - -var _ types.MsgServer = msgServer{} - -// Alert implements the MsgServer.Alerts method, which is used to create a new alert. This method -// will check that the referenced alert does not already exist, that the currency-pair referenced in the alert -// exists, that the alert's age is less than max-block-age, and that the alert itself is valid. If any of these -// checks fail, the method will return an error. If the alert is valid, and Alerts are enabled, then params.BondAmount -// will be escrowed at the module account, and the alert will be added to the module's state. -func (m msgServer) Alert(goCtx context.Context, req *types.MsgAlert) (*types.MsgAlertResponse, error) { - // request should not be nil - if req == nil { - return nil, fmt.Errorf("message cannot be empty") - } - - // check that the message is valid - if err := req.ValidateBasic(); err != nil { - return nil, fmt.Errorf("message validation failed: %w", err) - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(goCtx) - - // check that alerts are enabled - params := m.k.GetParams(ctx) - if !params.AlertParams.Enabled { - return nil, fmt.Errorf("alerts are not enabled") - } - - // check that the alert's age < MaxBlockAge - height := uint64(ctx.BlockHeight()) - if alertBlockAge := height - req.Alert.Height; alertBlockAge > params.AlertParams.MaxBlockAge { - return nil, fmt.Errorf("alert is too old: %d > %d", alertBlockAge, params.AlertParams.MaxBlockAge) - } - - // check that the referenced alert does not already exist - if alert, ok := m.k.GetAlert(ctx, req.Alert); ok { - return nil, fmt.Errorf("alert with UID %X already exists: %v", req.Alert.UID(), alert) - } - - // check that the referenced currency-pair exists - if !m.k.oracleKeeper.HasCurrencyPair(ctx, req.Alert.CurrencyPair) { - return nil, fmt.Errorf("currency pair %s does not exist", req.Alert.CurrencyPair) - } - - // escrow the bond amount - if err := m.k.escrowBondAmount(ctx, req.Alert.Signer, params.AlertParams.BondAmount); err != nil { - return nil, fmt.Errorf("failed to escrow bond amount: %w", err) - } - - // add the alert + alert-status to the module's state - if err := m.k.SetAlert(ctx, types.NewAlertWithStatus( - req.Alert, - types.NewAlertStatus( - height, - height+params.PruningParams.BlocksToPrune, // keep the alert in state until height + blocksToPrune - ctx.BlockTime(), // this alert can be safely concluded until ctx.BlockTime() + unbondingTime - types.Unconcluded, - ), - )); err != nil { - return nil, fmt.Errorf("failed to set alert: %w", err) - } - - // return the response - return &types.MsgAlertResponse{}, nil -} - -// escrowBondAmount is a helper function that will escrow the bond amount at the module address. -func (k *Keeper) escrowBondAmount(ctx sdk.Context, signer string, bondAmount sdk.Coin) error { - // get the sdk address for the signer - addr, err := sdk.AccAddressFromBech32(signer) - if err != nil { - return fmt.Errorf("failed to get sdk address for signer: %w", err) - } - - // send coins to the module account - if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, sdk.NewCoins(bondAmount)); err != nil { - return fmt.Errorf("failed to escrow bond amount: %w", err) - } - - return nil -} - -// Conclusion is a no-op if alerts are not enabled, or if the conclusion is not valid (according to MsgConclusion.ValidateBasic()). The conclusion -// must be verifiable in accordance w/ the registered Conclusions / ConclusionVerificationParams for this module. If the above criteria -// are met, then depending on the status of the conclusion, incentives will be issued to the parties deemed at fault, and the referenced -// alert will be marked as concluded. -func (m msgServer) Conclusion(goCtx context.Context, req *types.MsgConclusion) (*types.MsgConclusionResponse, error) { - // check if the msg is nil - if req == nil { - return nil, fmt.Errorf("message cannot be empty") - } - - // check that the message is valid - if err := req.ValidateBasic(); err != nil { - return nil, fmt.Errorf("message validation failed: %w", err) - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(goCtx) - - // check that alerts are enabled - params := m.k.GetParams(ctx) - if !params.AlertParams.Enabled { - return nil, fmt.Errorf("alerts are not enabled") - } - - // unmarshal the conclusion - conclusion, ok := req.Conclusion.GetCachedValue().(types.Conclusion) - if !ok { - return nil, fmt.Errorf("failed to unmarshal conclusion") - } - - // unmarshal the conclusion verification params, this should never error - var verificationParams types.ConclusionVerificationParams - if err := m.k.cdc.UnpackAny(params.ConclusionVerificationParams, &verificationParams); err != nil { - return nil, fmt.Errorf("failed to unmarshal conclusion verification params: %w", err) - } - - // verify the conclusion in accordance with the ConclusionVerificationParams - if err := conclusion.Verify(verificationParams); err != nil { - return nil, fmt.Errorf("failed to verify conclusion: %w", err) - } - - m.k.Logger(ctx).Info("conclusion verified", "conclusion", conclusion.String(), "params", verificationParams.String()) - - // conclusion has been verified, mark the alert as concluded - if err := m.k.ConcludeAlert(ctx, conclusion.GetAlert(), boolToConclusionStatus(conclusion.GetStatus())); err != nil { - return nil, fmt.Errorf("failed to conclude alert: %w", err) - } - - // finally, if the conclusion was positive, issue incentives to all validators referenced in the conclusion - if conclusion.GetStatus() { - extCommit := conclusion.GetExtendedCommitInfo() - - incentives := make([]incentivetypes.Incentive, 0) - - // determine whether to issue an incentive to each validator who signed a vote in the Commit referenced - for _, vote := range extCommit.Votes { - alert := conclusion.GetAlert() - m.k.Logger(ctx).Info("issuing incentive to validator", "validator", sdk.ConsAddress(vote.Validator.Address).String(), "alert", fmt.Sprintf("%X", alert.UID())) - - // execute the ValidatorIncentiveHandler to determine if validator should be issued an incentive - incentive, err := m.k.validatorIncentiveHandler(vote, conclusion.GetPriceBound(), conclusion.GetAlert(), conclusion.GetCurrencyPairID()) - if err != nil { - return nil, fmt.Errorf("failed to determine incentive: %w", err) - } - - // if the incentive is non-nil, then add it to the list of incentives to issue - if incentive != nil { - getAlert := conclusion.GetAlert() - m.k.Logger(ctx).Info("incentive issued to validator", "validator", vote.Validator.Address, "incentive", incentive.String(), "alert", fmt.Sprintf("%X", getAlert.UID())) - incentives = append(incentives, incentive) - } - } - - // finally, issue the incentives - if err := m.k.incentiveKeeper.AddIncentives(ctx, incentives); err != nil { - return nil, fmt.Errorf("failed to issue incentives: %w", err) - } - } - - return nil, nil -} - -func boolToConclusionStatus(status bool) ConclusionStatus { - if status { - return Positive - } - return Negative -} - -// UpdateParams is the handler for the UpdateParams RPC. This method expects a MsgUpdateParams message. This method fails if the msg fails validation -// or if the provided signer is not the authority of this module. Otherwise, the given params are set to state. -func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - // fail for nil requests - if req == nil { - return nil, fmt.Errorf("message cannot be empty") - } - - // validate the message - if err := req.ValidateBasic(); err != nil { - return nil, fmt.Errorf("message validation failed: %w", err) - } - - // check that the signer (authority) of the message is the authority of this module - if authority, err := sdk.AccAddressFromBech32(req.Authority); err == nil { - // get the sdk address for the signer - if !authority.Equals(m.k.authority) { - return nil, fmt.Errorf("signer is not the authority of this module: signer %v, authority %v", req.Authority, m.k.authority.String()) - } - } else { - return nil, fmt.Errorf("failed to get sdk address for authority: %w", err) - } - - // signer is the authority of the module, update params - if err := m.k.SetParams(sdk.UnwrapSDKContext(goCtx), req.Params); err != nil { - return nil, fmt.Errorf("failed to set params: %w", err) - } - - return &types.MsgUpdateParamsResponse{}, nil -} diff --git a/x/alerts/keeper/msg_server_test.go b/x/alerts/keeper/msg_server_test.go deleted file mode 100644 index 5fde8fe5b..000000000 --- a/x/alerts/keeper/msg_server_test.go +++ /dev/null @@ -1,665 +0,0 @@ -package keeper_test - -import ( - "fmt" - "math/big" - "time" - - "github.com/stretchr/testify/mock" - - "cosmossdk.io/math" - cmtabci "github.com/cometbft/cometbft/abci/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkyabci "github.com/skip-mev/slinky/abci/ve/types" - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/keeper" - "github.com/skip-mev/slinky/x/alerts/types" - "github.com/skip-mev/slinky/x/alerts/types/strategies" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -func (s *KeeperTestSuite) TestMsgAlert() { - type testCase struct { - setup func(sdk.Context) - name string - msg *types.MsgAlert - valid bool - } - - validAlert := types.NewAlert(8, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BTC", "USD")) - - s.ctx = s.ctx.WithBlockHeight(10) - s.ctx = s.ctx.WithBlockTime(time.Now()) - - testCases := []testCase{ - { - name: "nil message - fail", - setup: func(_ sdk.Context) {}, - msg: nil, - valid: false, - }, - { - name: "invalid message - fail", - setup: func(_ sdk.Context) {}, - msg: &types.MsgAlert{ - Alert: types.Alert{ - Height: 1, - Signer: "", - CurrencyPair: slinkytypes.NewCurrencyPair("base", "quote"), - }, - }, - valid: false, - }, - { - name: "alerts disabled - fail", - setup: func(ctx sdk.Context) { - err := s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: false, - }, - }) - s.Require().NoError(err) - }, - msg: &types.MsgAlert{ - Alert: types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("base", "quote")), - }, - valid: false, - }, - { - name: "alert is too old", - setup: func(ctx sdk.Context) { - // ensure that alerts are enabled - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewInt64Coin("test", 100), - MaxBlockAge: 2, - }, - })) - }, - msg: &types.MsgAlert{ - Alert: types.NewAlert(7, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - }, - valid: false, - }, - { - name: "alert already exists - fail", - setup: func(ctx sdk.Context) { - // ensure that alerts are enabled - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewInt64Coin("test", 100), - MaxBlockAge: 2, - }, - })) - - // set the alert to state - alert := types.NewAlertWithStatus( - types.NewAlert(9, sdk.AccAddress("abc1"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(9, 11, s.ctx.BlockTime(), types.Unconcluded), - ) - s.Require().NoError(s.alertKeeper.SetAlert(ctx, alert)) - }, - msg: &types.MsgAlert{ - Alert: types.NewAlert(9, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - }, - valid: false, - }, - { - name: "currency pair does not exist - fail", - setup: func(ctx sdk.Context) { - // ensure that alerts are enabled - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewInt64Coin("test", 100), - MaxBlockAge: 2, - }, - })) - - // expect a failed response from the oracle keeper (no currency pair) - s.ok.On("HasCurrencyPair", mock.Anything, slinkytypes.NewCurrencyPair("BTC", "USD")).Return(false).Once() - }, - msg: &types.MsgAlert{ - Alert: types.NewAlert(8, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BTC", "USD")), - }, - valid: false, - }, - { - name: "bond amount cannot be escrowed - fail", - setup: func(ctx sdk.Context) { - // ensure that alerts are enabled - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewInt64Coin("test", 100), - MaxBlockAge: 2, - }, - })) - - // expect a correct response from the oracle keeper - s.ok.On("HasCurrencyPair", mock.Anything, slinkytypes.NewCurrencyPair("BTC", "USD")).Return(true).Once() - - // expect a failed response from the bank keeper - s.bk.On("SendCoinsFromAccountToModule", - mock.Anything, - sdk.AccAddress("abc"), - types.ModuleName, - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(fmt.Errorf("bank error")).Once() - }, - msg: &types.MsgAlert{ - Alert: types.NewAlert(8, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("BTC", "USD")), - }, - valid: false, - }, - { - name: "valid message - success", - setup: func(ctx sdk.Context) { - // ensure that alerts are enabled - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewInt64Coin("test", 100), - MaxBlockAge: 2, - }, - PruningParams: types.PruningParams{ - BlocksToPrune: 10, - }, - })) - - // expect a correct response from the oracle keeper - s.ok.On("HasCurrencyPair", - mock.Anything, - slinkytypes.NewCurrencyPair("BTC", "USD"), - ).Return(true).Once() - - // expect a correct response from the bank keeper - s.bk.On("SendCoinsFromAccountToModule", - mock.Anything, - sdk.AccAddress("abc"), - types.ModuleName, - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(nil).Once() - }, - msg: &types.MsgAlert{ - Alert: validAlert, - }, - valid: true, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - // perform setup for test-case - tc.setup(s.ctx) - ms := keeper.NewMsgServer(*s.alertKeeper) - - // run the message server - _, err := ms.Alert(s.ctx, tc.msg) - if tc.valid { - s.Require().NoError(err) - - // check that the alert was added to the state - alert, ok := s.alertKeeper.GetAlert(s.ctx, tc.msg.Alert) - s.Require().Equal(tc.msg.Alert, alert.Alert) - s.Require().Equal(alert.Status, types.AlertStatus{ - PurgeHeight: uint64(20), - SubmissionHeight: 10, - ConclusionStatus: uint64(types.Unconcluded), - SubmissionTimestamp: uint64(time.Now().UTC().Unix()), - }) - s.Require().True(ok) - } else { - s.Require().Error(err) - } - }) - } -} - -func (s *KeeperTestSuite) TestConclusion() { - msgServer := keeper.NewMsgServer(*s.alertKeeper) - ctx := s.ctx - - alert := types.Alert{ - Height: 1, - Signer: sdk.AccAddress("cosmos1").String(), - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - } - - conclusion := &types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: types.PriceBound{ - High: big.NewInt(1).String(), - Low: big.NewInt(0).String(), - }, - Signatures: make([]types.Signature, 0), - Status: false, - } - - // sign the conclusion - signBytes, err := conclusion.SignBytes() - s.Require().NoError(err) - - // set the signature - sig, err := s.privateKey.Sign(signBytes) - conclusion.Signatures = append(conclusion.Signatures, types.Signature{ - Signer: sdk.AccAddress(s.privateKey.PubKey().Address()).String(), - Signature: sig, - }) - s.Require().NoError(err) - - validConclusionAny, err := codectypes.NewAnyWithValue(conclusion) - s.Require().NoError(err) - - conclusionVerificationParams, err := types.NewMultiSigVerificationParams([]cryptotypes.PubKey{s.privateKey.PubKey()}) - s.Require().NoError(err) - - // set as any - verificationParams, err := codectypes.NewAnyWithValue(conclusionVerificationParams) - s.Require().NoError(err) - - s.Run("if the msg is nil - Conclusion fails", func() { - _, err := msgServer.Conclusion(ctx, nil) - s.Require().Error(err) - s.Require().Equal("message cannot be empty", err.Error()) - }) - - s.Run("if the conclusion fails validate basic", func() { - msg := &types.MsgConclusion{ - Signer: "", - } - _, err := msgServer.Conclusion(ctx, msg) - - s.Require().Error(err) - s.Require().Equal(fmt.Errorf("message validation failed: %w", msg.ValidateBasic()).Error(), err.Error()) - }) - - s.Run("if alerts are not enabled", func() { - // set Alerts as disabled in Params - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: false, - }, - })) - - // msg should pass validate basic - msg := &types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: validConclusionAny, - } - - // Conclusion should fail - _, err := msgServer.Conclusion(ctx, msg) - s.Require().Error(err) - s.Require().Equal("alerts are not enabled", err.Error()) - }) - - s.Run("if the conclusion fails in verification", func() { - pk := secp256k1.GenPrivKey().PubKey() - pkany, err := codectypes.NewAnyWithValue(pk) - s.Require().NoError(err) - - invalidVerificationParams, err := codectypes.NewAnyWithValue(&types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{pkany}, - }) - s.Require().NoError(err) - - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - }, - ConclusionVerificationParams: invalidVerificationParams, - })) - - // msg should pass validate basic - msg := &types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: validConclusionAny, - } - - // Conclusion should fail - _, err = msgServer.Conclusion(ctx, msg) - s.Require().Error(err) - - s.Require().Equal(fmt.Errorf("failed to verify conclusion: %w", conclusion.Verify(&types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{pkany}, - })).Error(), err.Error()) - }) - - s.Run("if the alert is not in state - fail", func() { - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - }, - ConclusionVerificationParams: verificationParams, - })) - - // msg should pass validate basic - msg := &types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: validConclusionAny, - } - - // Conclusion should fail - _, err = msgServer.Conclusion(ctx, msg) - s.Require().Error(err) - - s.Require().Equal(fmt.Errorf("failed to conclude alert: alert not found: %v", alert).Error(), err.Error()) - }) - - s.Run("if the alert has already been concluded", func() { - s.Require().NoError(s.alertKeeper.SetAlert( - ctx, - types.NewAlertWithStatus( - alert, - types.AlertStatus{ - PurgeHeight: uint64(20), - SubmissionHeight: 10, - ConclusionStatus: uint64(types.Concluded), - }, - ), - )) - - // msg should pass validate basic - msg := &types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: validConclusionAny, - } - - // Conclusion should fail - _, err = msgServer.Conclusion(ctx, msg) - s.Require().Error(err) - - s.Require().Equal( - fmt.Errorf("failed to conclude alert: alert already concluded").Error(), - err.Error(), - ) - }) - - s.Run("if the alert is concluded negatively - expect the bond to be burned", func() { - s.Require().NoError(s.alertKeeper.SetParams(ctx, types.Params{ - AlertParams: types.AlertParams{ - Enabled: true, - MaxBlockAge: 10, - BondAmount: sdk.NewCoin( - sdk.DefaultBondDenom, - math.NewInt(100), - ), - }, - ConclusionVerificationParams: verificationParams, - })) - - s.Require().NoError(s.alertKeeper.SetAlert( - ctx, - types.NewAlertWithStatus( - alert, - types.AlertStatus{ - PurgeHeight: uint64(11), - SubmissionHeight: 10, - ConclusionStatus: uint64(types.Unconcluded), - }, - ), - )) - - s.bk.On("BurnCoins", - mock.Anything, - types.ModuleName, - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(nil) - - // msg should pass validate basic - msg := &types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: validConclusionAny, - } - - // Conclusion should fail - _, err = msgServer.Conclusion(ctx, msg) - s.Require().NoError(err) - - // get the alert - alert, found := s.alertKeeper.GetAlert(ctx, alert) - s.Require().True(found) - - // check the alert status - s.Require().Equal( - types.AlertStatus{ - PurgeHeight: uint64(11), - SubmissionHeight: 10, - ConclusionStatus: uint64(types.Concluded), - }, - alert.Status, - ) - }) - - s.Run("if the alert is concluded positively - expect the bond to be returned, and issue incentives", func() { - s.Require().NoError(s.alertKeeper.SetAlert( - ctx, - types.NewAlertWithStatus( - alert, - types.AlertStatus{ - PurgeHeight: uint64(11), - SubmissionHeight: 10, - ConclusionStatus: uint64(types.Unconcluded), - }, - ), - )) - - pb := types.PriceBound{ - High: big.NewInt(100).String(), - Low: big.NewInt(90).String(), - } - - // create 3 validators - val1 := cmtabci.Validator{ - Address: sdk.ConsAddress("val1"), - Power: 10, - } - val2 := cmtabci.Validator{ - Address: sdk.ConsAddress("val2"), - Power: 10, - } - val3 := cmtabci.Validator{ - Address: sdk.ConsAddress("val3"), - Power: 10, - } - - // val1 is not within the price-bound - val1VE := slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: big.NewInt(101).Bytes(), - }, - } - val1VEbz, err := val1VE.Marshal() - s.Require().NoError(err) - - // val2 is within the price-bound - val2VE := slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: big.NewInt(99).Bytes(), - }, - } - val2VEbz, err := val2VE.Marshal() - s.Require().NoError(err) - - // val3 is not within the price-bound - val3VE := slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: big.NewInt(89).Bytes(), - }, - } - val3VEbz, err := val3VE.Marshal() - s.Require().NoError(err) - - // construct extended commit - commit := cmtabci.ExtendedCommitInfo{ - Votes: []cmtabci.ExtendedVoteInfo{ - { - Validator: val1, - VoteExtension: val1VEbz, - }, - { - Validator: val2, - VoteExtension: val2VEbz, - }, - { - Validator: val3, - VoteExtension: val3VEbz, - }, - }, - } - - // create conclusion - conclusion := types.MultiSigConclusion{ - ExtendedCommitInfo: commit, - PriceBound: pb, - Alert: alert, - Signatures: make([]types.Signature, 0), - Status: true, - CurrencyPairID: 0, - } - signBz, err := conclusion.SignBytes() - s.Require().NoError(err) - - // sign the conclusion - signature, err := s.privateKey.Sign(signBz) - s.Require().NoError(err) - - // add the signature - conclusion.Signatures = append(conclusion.Signatures, types.Signature{ - Signer: sdk.AccAddress(s.privateKey.PubKey().Address()).String(), - Signature: signature, - }) - - conclusionAny, err := codectypes.NewAnyWithValue(&conclusion) - s.Require().NoError(err) - - s.bk.On("SendCoinsFromModuleToAccount", - mock.Anything, - types.ModuleName, - sdk.AccAddress("cosmos1"), - sdk.NewCoins(s.alertKeeper.GetParams(s.ctx).AlertParams.BondAmount), - ).Return(nil) - - s.ik.On("AddIncentives", - mock.Anything, - []incentivetypes.Incentive{ - &strategies.ValidatorAlertIncentive{ - Validator: val1, - AlertSigner: sdk.AccAddress("cosmos1").String(), - AlertHeight: uint64(1), - }, - &strategies.ValidatorAlertIncentive{ - Validator: val3, - AlertSigner: sdk.AccAddress("cosmos1").String(), - AlertHeight: uint64(1), - }, - }, - ).Return(nil) - - // msg should pass validate basic - msg := &types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: conclusionAny, - } - - // Conclusion should fail - _, err = msgServer.Conclusion(ctx, msg) - s.Require().NoError(err) - - // get the alert - alert, found := s.alertKeeper.GetAlert(ctx, alert) - s.Require().True(found) - - // check the alert status - s.Require().Equal( - types.AlertStatus{ - PurgeHeight: uint64(11), - SubmissionHeight: 10, - ConclusionStatus: uint64(types.Concluded), - }, - alert.Status, - ) - }) -} - -func (s *KeeperTestSuite) TestUpdateParams() { - invalidParams := types.MsgUpdateParams{ - Authority: "invalid", - } - - cases := []struct { - name string - msg *types.MsgUpdateParams - expectErr error - }{ - { - "nil request - fail", - nil, - fmt.Errorf("message cannot be empty"), - }, - { - "invalid message - fail", - &types.MsgUpdateParams{ - Authority: "invalid", - }, - fmt.Errorf("message validation failed: %w", invalidParams.ValidateBasic()), - }, - { - "signer is not the authority - fail", - &types.MsgUpdateParams{ - Authority: sdk.AccAddress("cosmos1").String(), - Params: types.DefaultParams("new_denom", nil), - }, - fmt.Errorf("signer is not the authority of this module: signer %v, authority %v", sdk.AccAddress("cosmos1").String(), s.authority.String()), - }, - { - "valid message - success", - &types.MsgUpdateParams{ - Authority: s.authority.String(), - Params: types.NewParams( - types.AlertParams{ - Enabled: true, - BondAmount: sdk.NewCoin("denom", math.NewInt(100)), - MaxBlockAge: 10, - }, - nil, - types.PruningParams{ - Enabled: true, - BlocksToPrune: 10, - }, - ), - }, - nil, - }, - } - - msgServer := keeper.NewMsgServer(*s.alertKeeper) - - for _, tc := range cases { - params := types.DefaultParams("denom", nil) - s.Require().NoError(s.alertKeeper.SetParams(s.ctx, params)) - _, err := msgServer.UpdateParams(s.ctx, tc.msg) - if tc.expectErr == nil { - s.Require().NoError(err) - - // check params in module - params := s.alertKeeper.GetParams(s.ctx) - s.Require().Equal(tc.msg.Params, params) - } else { - s.Require().Error(err) - s.Require().Equal(tc.expectErr.Error(), err.Error()) - - // check params in module - moduleParams := s.alertKeeper.GetParams(s.ctx) - s.Require().Equal(params, moduleParams) - } - } -} diff --git a/x/alerts/module.go b/x/alerts/module.go deleted file mode 100644 index 56aa1eeec..000000000 --- a/x/alerts/module.go +++ /dev/null @@ -1,239 +0,0 @@ -package alerts - -import ( - "context" - "encoding/json" - - "cosmossdk.io/core/appmodule" - "cosmossdk.io/depinject" - - "cosmossdk.io/core/store" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - alertsmodulev1 "github.com/skip-mev/slinky/api/slinky/alerts/module/v1" - alertclient "github.com/skip-mev/slinky/x/alerts/client" - "github.com/skip-mev/slinky/x/alerts/keeper" - "github.com/skip-mev/slinky/x/alerts/types" - "github.com/skip-mev/slinky/x/alerts/types/strategies" -) - -// ConsensusVersion is the x/alerts module's current version, as modules integrate and -// updates are made, this value determines what version of the module is being run by the chain. -const ConsensusVersion = 1 - -var ( - _ module.HasName = AppModule{} - _ module.HasGenesis = AppModule{} - _ module.AppModuleBasic = AppModule{} - _ module.HasServices = AppModule{} - - _ appmodule.AppModule = AppModule{} - _ appmodule.HasBeginBlocker = AppModule{} - _ appmodule.HasEndBlocker = AppModule{} -) - -// AppModuleBasic defines the base interface that the x/alerts module exposes to the -// application. -type AppModuleBasic struct { - cdc codec.Codec -} - -// Name returns the name of this module. -func (AppModuleBasic) Name() string { return types.ModuleName } - -// RegisterLegacyAminoCodec registers the necessary types from the x/alerts module -// for amino serialization. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // register strategies legacy amino codec - strategies.RegisterLegacyAminoCodec(cdc) - - // register alerts legacy amino codec - types.RegisterLegacyAminoCodec(cdc) -} - -// RegisterInterfaces registers the necessary implementations / interfaces in the -// x/alerts module w/ the interface-registry. -func (AppModuleBasic) RegisterInterfaces(ir codectypes.InterfaceRegistry) { - // register the msgs / interfaces for the alerts module - types.RegisterInterfaces(ir) - - // register the strategies - strategies.RegisterInterfaces(ir) -} - -// RegisterGRPCGatewayRoutes registers the necessary REST routes for the GRPC-gateway to -// the x/alerts module QueryService on mux. This method panics on failure. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(cliCtx client.Context, mux *runtime.ServeMux) { - // Register the gate-way routes w/ the provided mux. - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(cliCtx)); err != nil { - panic(err) - } -} - -// GetTxCmd is a no-op, as no txs are registered for submission. -func (AppModuleBasic) GetTxCmd() *cobra.Command { - return alertclient.GetTxCmd() -} - -// GetQueryCmd returns the x/alerts module base query cli-command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return alertclient.GetQueryCmd() -} - -// DefaultGenesis returns default genesis state as raw bytes for the alerts -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - gs := types.DefaultGenesisState() - return cdc.MustMarshalJSON(&gs) -} - -// ValidateGenesis performs genesis state validation for the x/alerts module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var gs types.GenesisState - if err := cdc.UnmarshalJSON(bz, &gs); err != nil { - return err - } - - return gs.ValidateBasic() -} - -// AppModule represents an application module for the x/alerts module. -type AppModule struct { - AppModuleBasic - - k keeper.Keeper -} - -// BeginBlock is a no-op for x/alerts. -func (am AppModule) BeginBlock(_ context.Context) error { - return nil -} - -// NewAppModule returns an application module for the x/alerts module. -func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{ - cdc: cdc, - }, - k: k, - } -} - -// EndBlock returns the end blocker for the staking module. It returns no validator -// updates. -func (am AppModule) EndBlock(ctx context.Context) error { - return am.k.EndBlocker(ctx) -} - -// IsAppModule implements the appmodule.AppModule interface. -func (AppModule) IsAppModule() {} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (AppModule) IsOnePerModuleType() {} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } - -// RegisterServices registers the module's services with the app's module configurator. -func (am AppModule) RegisterServices(cfc module.Configurator) { - // Register the query service. - types.RegisterQueryServer(cfc.QueryServer(), keeper.NewQueryServer(am.k)) - - // Register the message service. - types.RegisterMsgServer(cfc.MsgServer(), keeper.NewMsgServer(am.k)) -} - -// RegisterInvariants registers the invariants of the alerts module. If an invariant -// deviates from its predicted value, the InvariantRegistry triggers appropriate -// logic (most often the chain will be halted). No invariants exist for the alerts module. -func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the genesis initialization for the x/alerts module. It determines the -// genesis state to initialize from via a json-encoded genesis-state. This method returns no validator set updates. -// This method panics on any errors. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) { - var gs types.GenesisState - cdc.MustUnmarshalJSON(bz, &gs) - - am.k.InitGenesis(ctx, gs) -} - -// ExportGenesis returns the alerts module's exported genesis state as raw -// JSON bytes. This method panics on any error. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.k.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -func init() { - appmodule.Register( - &alertsmodulev1.Module{}, - appmodule.Provide(ProvideModule), - ) -} - -type Inputs struct { - depinject.In - - // module-dependencies - Config *alertsmodulev1.Module - Cdc codec.Codec - StoreService store.KVStoreService - - // Keepers - IncentiveKeeper types.IncentiveKeeper - OracleKeeper types.OracleKeeper - BankKeeper types.BankKeeper - - // HandleValidatorIncentive function - ValidatorIncentiveHandler strategies.ValidatorIncentiveHandler `optional:"true"` -} - -type Outputs struct { - depinject.Out - - AlertsKeeper keeper.Keeper - Module appmodule.AppModule -} - -func ProvideModule(in Inputs) Outputs { - var authority sdk.AccAddress - - // if an authority is given, attempt to parse it, and panic if this fails - if in.Config.Authority != "" { - var err error - authority, err = sdk.AccAddressFromBech32(in.Config.Authority) - if err != nil { - panic(err) - } - } else { - // otherwise, default to the governance module account - authority = authtypes.NewModuleAddress(govtypes.ModuleName) - } - - if in.ValidatorIncentiveHandler == nil { - in.ValidatorIncentiveHandler = strategies.DefaultHandleValidatorIncentive() - } - - alertsKeeper := keeper.NewKeeper( - in.StoreService, - in.Cdc, - in.OracleKeeper, - in.BankKeeper, - in.IncentiveKeeper, - in.ValidatorIncentiveHandler, - authority, - ) - - m := NewAppModule(in.Cdc, *alertsKeeper) - - return Outputs{AlertsKeeper: *alertsKeeper, Module: m} -} diff --git a/x/alerts/types/alert.go b/x/alerts/types/alert.go deleted file mode 100644 index 3b628a1e7..000000000 --- a/x/alerts/types/alert.go +++ /dev/null @@ -1,111 +0,0 @@ -package types - -import ( - "fmt" - "time" - - "github.com/cometbft/cometbft/crypto/tmhash" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" -) - -const AlertUIDLen = 20 - -// ConclusionStatus wraps the status of an alert. -type ConclusionStatus uint64 - -const ( - // Unconcluded is the default status of an alert (no conclusion has been submitted for it yet). - Unconcluded ConclusionStatus = iota - // Concluded is the status of an alert that has been concluded. - Concluded -) - -// String implements fmt.Stringer. -func (cs ConclusionStatus) String() string { - switch cs { - case Unconcluded: - return "Unconcluded" - case Concluded: - return "Concluded" - default: - return "unknown" - } -} - -// NewAlert returns a new Alert. -func NewAlert(height uint64, signer sdk.AccAddress, cp slinkytypes.CurrencyPair) Alert { - return Alert{ - Height: height, - Signer: signer.String(), - CurrencyPair: cp, - } -} - -// ValidateBasic performs stateless validation on the Claim, i.e. checks that the signer and the currency-pair are valid. -func (a *Alert) ValidateBasic() error { - // validate the currency-pair - if err := a.CurrencyPair.ValidateBasic(); err != nil { - return fmt.Errorf("invalid alert: %w", err) - } - - // validate the signer - if _, err := sdk.AccAddressFromBech32(a.Signer); err != nil { - return fmt.Errorf("invalid alert: %w", err) - } - - return nil -} - -// UID returns the Unique Identifier of this Claim, this is how the BondAddress is defined and -// this will be used to derive the key under which this Claim will be stored. This method appends -// the Height, signer, currency-pair strings into a byte-array, and returns the first 20-bytes of -// the hash of that array. -func (a *Alert) UID() []byte { - heightBz := []byte(fmt.Sprintf("%d", a.Height)) - signerBz := []byte(a.Signer) - currencyPairBz := []byte(a.CurrencyPair.String()) - return tmhash.SumTruncated(append(append(heightBz, signerBz...), currencyPairBz...)) -} - -// NewAlertStatus returns a new AlertStatus. -func NewAlertStatus(submissionHeight uint64, purgeHeight uint64, blockTimestamp time.Time, status ConclusionStatus) AlertStatus { - return AlertStatus{ - SubmissionHeight: submissionHeight, - PurgeHeight: purgeHeight, - ConclusionStatus: uint64(status), - SubmissionTimestamp: uint64(blockTimestamp.UTC().Unix()), - } -} - -// ValidateBasic performs a basic validation of the ConclusionStatus, i.e. that the submissionHeight -// is before the purgeHeight, and that the status is either Unconcluded or Concluded. -func (a *AlertStatus) ValidateBasic() error { - if a.SubmissionHeight >= a.PurgeHeight { - return fmt.Errorf("invalid alert status: submission height must be before purge height") - } - - if ConclusionStatus(a.ConclusionStatus) != Unconcluded && ConclusionStatus(a.ConclusionStatus) != Concluded { - return fmt.Errorf("invalid alert status: status must be either Unconcluded or Concluded") - } - - return nil -} - -// NewAlertWithStatus returns a new AlertWithStatus. -func NewAlertWithStatus(alert Alert, status AlertStatus) AlertWithStatus { - return AlertWithStatus{ - Alert: alert, - Status: status, - } -} - -// ValidateBasic validates that both the alert status and the alert are valid. -func (aws *AlertWithStatus) ValidateBasic() error { - if err := aws.Alert.ValidateBasic(); err != nil { - return err - } - - return aws.Status.ValidateBasic() -} diff --git a/x/alerts/types/alert_test.go b/x/alerts/types/alert_test.go deleted file mode 100644 index 57980d6d4..000000000 --- a/x/alerts/types/alert_test.go +++ /dev/null @@ -1,239 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func TestAlertUnmarshal(t *testing.T) { - // create an interface registry - ir := codectypes.NewInterfaceRegistry() - - // create a codec - cdc := codec.NewProtoCodec(ir) - - // create an alert - alert := types.Alert{ - Height: 1, - Signer: "signer", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "base", - Quote: "quote", - }, - } - - // marshal the alert - bz, err := cdc.Marshal(&alert) - require.NoError(t, err) - - // unmarshal the alert - alert2 := types.Alert{} - require.NoError(t, alert2.Unmarshal(bz)) - - // assert that the two alerts are equal - require.Equal(t, alert, alert2) -} - -func TestAlertValidateBasic(t *testing.T) { - type testCase struct { - name string - alert types.Alert - valid bool - } - - cases := []testCase{ - { - "invalid signer - fail", - types.Alert{ - Height: 1, - Signer: "", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - }, - false, - }, - { - "invalid currency-pair - fail", - types.Alert{ - Height: 1, - Signer: sdk.AccAddress("signer").String(), - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "", - Quote: "", - }, - }, - false, - }, - { - name: "valid alert - pass", - alert: types.Alert{ - Height: 1, - Signer: sdk.AccAddress("signer").String(), - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - }, - valid: true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.alert.ValidateBasic() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} - -func TestAlertUID(t *testing.T) { - // create two alerts - alert1 := types.Alert{ - Height: 1, - Signer: "signer", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "base", - Quote: "quote", - }, - } - - alert2 := types.Alert{ - Height: 2, - Signer: "signer", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "base", - Quote: "quote", - }, - } - t.Run("test Alert UID uniqueness", func(t *testing.T) { - // check that the alerts have different UIDs - require.NotEqual(t, alert1.UID(), alert2.UID()) - }) -} - -func TestAlertStatus(t *testing.T) { - t.Run("test String", func(t *testing.T) { - cs := types.ConclusionStatus(0) - require.Equal(t, "Unconcluded", cs.String()) - - cs = types.ConclusionStatus(1) - require.Equal(t, "Concluded", cs.String()) - - cs = types.ConclusionStatus(2) - require.Equal(t, "unknown", cs.String()) - }) - - t.Run("test validate basic", func(t *testing.T) { - cases := []struct { - name string - alertStatus types.AlertStatus - valid bool - }{ - { - "invalid submission height", - types.AlertStatus{ - SubmissionHeight: 3, - PurgeHeight: 2, - }, - false, - }, - { - "invalid conclusion status", - types.AlertStatus{ - SubmissionHeight: 1, - PurgeHeight: 2, - ConclusionStatus: 2, - }, - false, - }, - { - "valid alert status", - types.AlertStatus{ - SubmissionHeight: 1, - PurgeHeight: 2, - ConclusionStatus: 1, - }, - true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.alertStatus.ValidateBasic() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } - }) -} - -func TestAlertWithStatus(t *testing.T) { - cases := []struct { - name string - alert types.AlertWithStatus - valid bool - }{ - { - "invalid alert", - types.AlertWithStatus{ - Alert: types.Alert{ - Height: 1, - Signer: "", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - }, - Status: types.NewAlertStatus(1, 2, time.Now(), 1), - }, - false, - }, - { - "invalid alert-status", - types.AlertWithStatus{ - Alert: types.NewAlert(1, sdk.AccAddress("signer"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - Status: types.AlertStatus{ - SubmissionHeight: 3, - PurgeHeight: 2, - }, - }, - false, - }, - { - "valid alert with status", - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("signer"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ), - true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.alert.ValidateBasic() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/alerts/types/alerts.pb.go b/x/alerts/types/alerts.pb.go deleted file mode 100644 index c9e4c17e8..000000000 --- a/x/alerts/types/alerts.pb.go +++ /dev/null @@ -1,2018 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/alerts/v1/alerts.proto - -package types - -import ( - fmt "fmt" - types1 "github.com/cometbft/cometbft/abci/types" - _ "github.com/cosmos/cosmos-proto" - types2 "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - types "github.com/skip-mev/slinky/pkg/types" - _ "github.com/skip-mev/slinky/x/oracle/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Alert defines the basic meta-data necessary for the alerts module to resolve -// a claim that the price of a CurrencyPair on-chain is deviating from the price -// off-chain. -type Alert struct { - // height represents the height for which the alert is filed. - Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - // signer is the signer of this alert, this is the address that will receive - // the reward in the case of a positive conclusion, or whose bond will get - // slashed in the event of a negative conclusion. - Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` - // currency_pair is the currency-pair that this claim asserts is deviating - // from the price off-chain. - CurrencyPair types.CurrencyPair `protobuf:"bytes,3,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair"` -} - -func (m *Alert) Reset() { *m = Alert{} } -func (m *Alert) String() string { return proto.CompactTextString(m) } -func (*Alert) ProtoMessage() {} -func (*Alert) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{0} -} -func (m *Alert) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Alert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Alert.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 *Alert) XXX_Merge(src proto.Message) { - xxx_messageInfo_Alert.Merge(m, src) -} -func (m *Alert) XXX_Size() int { - return m.Size() -} -func (m *Alert) XXX_DiscardUnknown() { - xxx_messageInfo_Alert.DiscardUnknown(m) -} - -var xxx_messageInfo_Alert proto.InternalMessageInfo - -func (m *Alert) GetHeight() uint64 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *Alert) GetSigner() string { - if m != nil { - return m.Signer - } - return "" -} - -func (m *Alert) GetCurrencyPair() types.CurrencyPair { - if m != nil { - return m.CurrencyPair - } - return types.CurrencyPair{} -} - -// AlertStatus contains the module specific state for an alert: Has the alert -// been concluded? What height was the alert submitted, what height should the -// alert be purged? -type AlertStatus struct { - // ConclusionStatus determines whether the alert has been concluded. - ConclusionStatus uint64 `protobuf:"varint,1,opt,name=conclusion_status,json=conclusionStatus,proto3" json:"conclusion_status,omitempty"` - // SubmissionHeight is the height that the alert was submitted in. - SubmissionHeight uint64 `protobuf:"varint,2,opt,name=submission_height,json=submissionHeight,proto3" json:"submission_height,omitempty"` - // SubmissionTimestamp is the block-timestamp of the block that the alert was - // submitted in (as a UTC value in Unix time). - SubmissionTimestamp uint64 `protobuf:"varint,3,opt,name=submission_timestamp,json=submissionTimestamp,proto3" json:"submission_timestamp,omitempty"` - // PurgeHeight is the height at which the alert should be purged. - PurgeHeight uint64 `protobuf:"varint,4,opt,name=purge_height,json=purgeHeight,proto3" json:"purge_height,omitempty"` -} - -func (m *AlertStatus) Reset() { *m = AlertStatus{} } -func (m *AlertStatus) String() string { return proto.CompactTextString(m) } -func (*AlertStatus) ProtoMessage() {} -func (*AlertStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{1} -} -func (m *AlertStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlertStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlertStatus.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 *AlertStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlertStatus.Merge(m, src) -} -func (m *AlertStatus) XXX_Size() int { - return m.Size() -} -func (m *AlertStatus) XXX_DiscardUnknown() { - xxx_messageInfo_AlertStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_AlertStatus proto.InternalMessageInfo - -func (m *AlertStatus) GetConclusionStatus() uint64 { - if m != nil { - return m.ConclusionStatus - } - return 0 -} - -func (m *AlertStatus) GetSubmissionHeight() uint64 { - if m != nil { - return m.SubmissionHeight - } - return 0 -} - -func (m *AlertStatus) GetSubmissionTimestamp() uint64 { - if m != nil { - return m.SubmissionTimestamp - } - return 0 -} - -func (m *AlertStatus) GetPurgeHeight() uint64 { - if m != nil { - return m.PurgeHeight - } - return 0 -} - -// AlertWithStatus represents a wrapper around the Alert and AlertStatus -// objects, this is so that the module specific information about Alerts can be -// packaged together. -type AlertWithStatus struct { - // alert is the alert that this status corresponds to. - Alert Alert `protobuf:"bytes,1,opt,name=alert,proto3" json:"alert"` - // status is the status of the alert. - Status AlertStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` -} - -func (m *AlertWithStatus) Reset() { *m = AlertWithStatus{} } -func (m *AlertWithStatus) String() string { return proto.CompactTextString(m) } -func (*AlertWithStatus) ProtoMessage() {} -func (*AlertWithStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{2} -} -func (m *AlertWithStatus) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlertWithStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlertWithStatus.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 *AlertWithStatus) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlertWithStatus.Merge(m, src) -} -func (m *AlertWithStatus) XXX_Size() int { - return m.Size() -} -func (m *AlertWithStatus) XXX_DiscardUnknown() { - xxx_messageInfo_AlertWithStatus.DiscardUnknown(m) -} - -var xxx_messageInfo_AlertWithStatus proto.InternalMessageInfo - -func (m *AlertWithStatus) GetAlert() Alert { - if m != nil { - return m.Alert - } - return Alert{} -} - -func (m *AlertWithStatus) GetStatus() AlertStatus { - if m != nil { - return m.Status - } - return AlertStatus{} -} - -// Signature is a container for a signer address mapped to a signature. -type Signature struct { - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (m *Signature) Reset() { *m = Signature{} } -func (m *Signature) String() string { return proto.CompactTextString(m) } -func (*Signature) ProtoMessage() {} -func (*Signature) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{3} -} -func (m *Signature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Signature.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 *Signature) XXX_Merge(src proto.Message) { - xxx_messageInfo_Signature.Merge(m, src) -} -func (m *Signature) XXX_Size() int { - return m.Size() -} -func (m *Signature) XXX_DiscardUnknown() { - xxx_messageInfo_Signature.DiscardUnknown(m) -} - -var xxx_messageInfo_Signature proto.InternalMessageInfo - -func (m *Signature) GetSigner() string { - if m != nil { - return m.Signer - } - return "" -} - -func (m *Signature) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -// MultiSigConcluson defines a conclusion that is accompanied by a set of -// signatures. The signature is defined over the alert UID, status, OracleData, -// and PriceBound. The signatures are used to verify that the conclusion is -// valid. -type MultiSigConclusion struct { - // alert is the alert that this conclusion corresponds to. - Alert Alert `protobuf:"bytes,1,opt,name=alert,proto3" json:"alert"` - // oracle_data is the oracle data that this conclusion references. - ExtendedCommitInfo types1.ExtendedCommitInfo `protobuf:"bytes,2,opt,name=extended_commit_info,json=extendedCommitInfo,proto3" json:"extended_commit_info"` - // signatures is a map of signer -> signature. Where the signature is over - // Alert.UID, PriceBound, the marshalled ExtendedCommitInfo, and status. - Signatures []Signature `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures"` - // price-bound is the price bound of the currency-pair off-chain for the - // designated time-range. - PriceBound PriceBound `protobuf:"bytes,4,opt,name=price_bound,json=priceBound,proto3" json:"price_bound"` - // status is the status of the conclusion. - Status bool `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` - // CurrencyPairID is the ID of the currency-pair that this conclusion - // corresponds to. - CurrencyPairID uint64 `protobuf:"varint,6,opt,name=currency_pair_i_d,json=currencyPairID,proto3" json:"currency_pair_i_d,omitempty"` -} - -func (m *MultiSigConclusion) Reset() { *m = MultiSigConclusion{} } -func (m *MultiSigConclusion) String() string { return proto.CompactTextString(m) } -func (*MultiSigConclusion) ProtoMessage() {} -func (*MultiSigConclusion) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{4} -} -func (m *MultiSigConclusion) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MultiSigConclusion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MultiSigConclusion.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 *MultiSigConclusion) XXX_Merge(src proto.Message) { - xxx_messageInfo_MultiSigConclusion.Merge(m, src) -} -func (m *MultiSigConclusion) XXX_Size() int { - return m.Size() -} -func (m *MultiSigConclusion) XXX_DiscardUnknown() { - xxx_messageInfo_MultiSigConclusion.DiscardUnknown(m) -} - -var xxx_messageInfo_MultiSigConclusion proto.InternalMessageInfo - -func (m *MultiSigConclusion) GetAlert() Alert { - if m != nil { - return m.Alert - } - return Alert{} -} - -func (m *MultiSigConclusion) GetExtendedCommitInfo() types1.ExtendedCommitInfo { - if m != nil { - return m.ExtendedCommitInfo - } - return types1.ExtendedCommitInfo{} -} - -func (m *MultiSigConclusion) GetSignatures() []Signature { - if m != nil { - return m.Signatures - } - return nil -} - -func (m *MultiSigConclusion) GetPriceBound() PriceBound { - if m != nil { - return m.PriceBound - } - return PriceBound{} -} - -func (m *MultiSigConclusion) GetStatus() bool { - if m != nil { - return m.Status - } - return false -} - -func (m *MultiSigConclusion) GetCurrencyPairID() uint64 { - if m != nil { - return m.CurrencyPairID - } - return 0 -} - -// MultiSigConclusionVerificationParams defines the parameters necessary to -// verify a MultiSigConclusion. It contains a map between signer and public key. -// Notice, the public-key (value) are the base-64 encoded bytes of the public -// key. And the signer (key) is the bech32 encoded address of the signer. -// Notice, all public keys must be secp256 keys. -type MultiSigConclusionVerificationParams struct { - // signers is a map of signer -> public key. - Signers []*types2.Any `protobuf:"bytes,1,rep,name=signers,proto3" json:"signers,omitempty"` -} - -func (m *MultiSigConclusionVerificationParams) Reset() { *m = MultiSigConclusionVerificationParams{} } -func (m *MultiSigConclusionVerificationParams) String() string { return proto.CompactTextString(m) } -func (*MultiSigConclusionVerificationParams) ProtoMessage() {} -func (*MultiSigConclusionVerificationParams) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{5} -} -func (m *MultiSigConclusionVerificationParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MultiSigConclusionVerificationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MultiSigConclusionVerificationParams.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 *MultiSigConclusionVerificationParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MultiSigConclusionVerificationParams.Merge(m, src) -} -func (m *MultiSigConclusionVerificationParams) XXX_Size() int { - return m.Size() -} -func (m *MultiSigConclusionVerificationParams) XXX_DiscardUnknown() { - xxx_messageInfo_MultiSigConclusionVerificationParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MultiSigConclusionVerificationParams proto.InternalMessageInfo - -func (m *MultiSigConclusionVerificationParams) GetSigners() []*types2.Any { - if m != nil { - return m.Signers - } - return nil -} - -// PriceBound represents the bounds of the price of a currency-pair off chain -// for a designated time-range -type PriceBound struct { - High string `protobuf:"bytes,1,opt,name=high,proto3" json:"high,omitempty"` - Low string `protobuf:"bytes,2,opt,name=low,proto3" json:"low,omitempty"` -} - -func (m *PriceBound) Reset() { *m = PriceBound{} } -func (m *PriceBound) String() string { return proto.CompactTextString(m) } -func (*PriceBound) ProtoMessage() {} -func (*PriceBound) Descriptor() ([]byte, []int) { - return fileDescriptor_dfa72dab4ea7298e, []int{6} -} -func (m *PriceBound) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PriceBound) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PriceBound.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 *PriceBound) XXX_Merge(src proto.Message) { - xxx_messageInfo_PriceBound.Merge(m, src) -} -func (m *PriceBound) XXX_Size() int { - return m.Size() -} -func (m *PriceBound) XXX_DiscardUnknown() { - xxx_messageInfo_PriceBound.DiscardUnknown(m) -} - -var xxx_messageInfo_PriceBound proto.InternalMessageInfo - -func (m *PriceBound) GetHigh() string { - if m != nil { - return m.High - } - return "" -} - -func (m *PriceBound) GetLow() string { - if m != nil { - return m.Low - } - return "" -} - -func init() { - proto.RegisterType((*Alert)(nil), "slinky.alerts.v1.Alert") - proto.RegisterType((*AlertStatus)(nil), "slinky.alerts.v1.AlertStatus") - proto.RegisterType((*AlertWithStatus)(nil), "slinky.alerts.v1.AlertWithStatus") - proto.RegisterType((*Signature)(nil), "slinky.alerts.v1.Signature") - proto.RegisterType((*MultiSigConclusion)(nil), "slinky.alerts.v1.MultiSigConclusion") - proto.RegisterType((*MultiSigConclusionVerificationParams)(nil), "slinky.alerts.v1.MultiSigConclusionVerificationParams") - proto.RegisterType((*PriceBound)(nil), "slinky.alerts.v1.PriceBound") -} - -func init() { proto.RegisterFile("slinky/alerts/v1/alerts.proto", fileDescriptor_dfa72dab4ea7298e) } - -var fileDescriptor_dfa72dab4ea7298e = []byte{ - // 792 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6f, 0xe2, 0x46, - 0x14, 0xc7, 0x81, 0xd0, 0x32, 0xa4, 0x6d, 0x32, 0xa5, 0x2d, 0x81, 0x84, 0x50, 0x92, 0x03, 0x69, - 0x8b, 0x5d, 0xc8, 0x8d, 0x4a, 0x95, 0x80, 0x56, 0x4a, 0x0e, 0x95, 0x22, 0xa8, 0x5a, 0xa9, 0x3d, - 0x58, 0xc6, 0x0c, 0x66, 0x14, 0x3c, 0x63, 0xcd, 0x8c, 0x69, 0xf8, 0x0a, 0x3d, 0xf5, 0x6b, 0xf4, - 0xb6, 0x2b, 0x45, 0x5a, 0x69, 0x3f, 0x41, 0x94, 0x53, 0xb4, 0xa7, 0x3d, 0xed, 0xae, 0x92, 0xc3, - 0x7e, 0x8d, 0xd5, 0x8c, 0xc7, 0x98, 0x40, 0x76, 0x0f, 0x7b, 0xb1, 0x66, 0xde, 0xfb, 0xbd, 0xe7, - 0xdf, 0xef, 0xfd, 0x19, 0xb0, 0xcf, 0xa7, 0x98, 0x5c, 0xcc, 0x2d, 0x67, 0x8a, 0x98, 0xe0, 0xd6, - 0xac, 0xa9, 0x4f, 0x66, 0xc0, 0xa8, 0xa0, 0x70, 0x3b, 0x72, 0x9b, 0xda, 0x38, 0x6b, 0x96, 0x2a, - 0x3a, 0x80, 0x32, 0xc7, 0x9d, 0x22, 0x19, 0xe0, 0x21, 0x82, 0x38, 0xd6, 0x11, 0xa5, 0x1d, 0xc7, - 0xc7, 0x84, 0x5a, 0xea, 0xab, 0x4d, 0xbb, 0x2e, 0xe5, 0x3e, 0xe5, 0xb6, 0xba, 0x59, 0xd1, 0x45, - 0xbb, 0x0a, 0x1e, 0xf5, 0x68, 0x64, 0x97, 0x27, 0x6d, 0x2d, 0x0b, 0x44, 0x46, 0x88, 0xf9, 0x98, - 0x08, 0xcb, 0x19, 0xba, 0xd8, 0x12, 0xf3, 0x00, 0xc5, 0x21, 0xbb, 0x1e, 0xa5, 0xde, 0x14, 0x59, - 0xea, 0x36, 0x0c, 0xc7, 0x96, 0x43, 0xe6, 0xda, 0x75, 0xa8, 0xb9, 0x29, 0xb8, 0xa4, 0xe6, 0x86, - 0x8c, 0x21, 0xe2, 0xce, 0xed, 0xc0, 0xc1, 0x2c, 0x02, 0xd5, 0x9e, 0x19, 0x60, 0xb3, 0x23, 0xe5, - 0xc0, 0xaf, 0x41, 0x76, 0x82, 0xb0, 0x37, 0x11, 0x45, 0xa3, 0x6a, 0xd4, 0x33, 0x7d, 0x7d, 0x83, - 0x3f, 0x82, 0x2c, 0xc7, 0x1e, 0x41, 0xac, 0xb8, 0x51, 0x35, 0xea, 0xb9, 0x6e, 0xf1, 0xc5, 0x55, - 0xa3, 0xa0, 0x69, 0x77, 0x46, 0x23, 0x86, 0x38, 0x1f, 0x08, 0x86, 0x89, 0xd7, 0xd7, 0x38, 0x78, - 0x0a, 0x3e, 0x7b, 0xf0, 0xab, 0x62, 0xba, 0x6a, 0xd4, 0xf3, 0xad, 0x7d, 0x53, 0x97, 0x2f, 0xe2, - 0x3f, 0x6b, 0x9a, 0x3d, 0x8d, 0x3a, 0x77, 0x30, 0xeb, 0x66, 0xae, 0x5f, 0x1d, 0xa4, 0xfa, 0x5b, - 0xee, 0x92, 0xad, 0x5d, 0xfa, 0xf7, 0xed, 0x93, 0xef, 0xbe, 0xd2, 0x3a, 0x2e, 0xe3, 0xb6, 0x28, - 0xbe, 0xb5, 0xd7, 0x06, 0xc8, 0xab, 0xd3, 0x40, 0x38, 0x22, 0xe4, 0xf0, 0x7b, 0xb0, 0xe3, 0x52, - 0xe2, 0x4e, 0x43, 0x8e, 0x29, 0xb1, 0xb9, 0x32, 0x6a, 0x29, 0xdb, 0x89, 0x23, 0x01, 0xf3, 0x70, - 0xe8, 0x63, 0xae, 0xc0, 0x5a, 0xf7, 0x46, 0x04, 0x4e, 0x1c, 0xa7, 0x51, 0x05, 0x9a, 0xa0, 0xb0, - 0x04, 0x16, 0xd8, 0x47, 0x5c, 0x38, 0x7e, 0xa0, 0x64, 0x65, 0xfa, 0x5f, 0x26, 0xbe, 0xdf, 0x63, - 0x17, 0xfc, 0x16, 0x6c, 0x05, 0x21, 0xf3, 0x50, 0x9c, 0x3a, 0xa3, 0xa0, 0x79, 0x65, 0x8b, 0xb2, - 0xb6, 0xab, 0x52, 0x5b, 0xf9, 0x51, 0x6d, 0x11, 0xc9, 0xda, 0xff, 0x06, 0xf8, 0x42, 0xdd, 0xff, - 0xc4, 0x62, 0xa2, 0x89, 0x9f, 0x80, 0x4d, 0x85, 0x54, 0xca, 0xf2, 0xad, 0x6f, 0xcc, 0xd5, 0x91, - 0x34, 0x55, 0x84, 0xae, 0x66, 0x84, 0x85, 0x3f, 0x81, 0xac, 0xae, 0xc7, 0xc6, 0xc3, 0x4e, 0xac, - 0x44, 0x45, 0xff, 0xd0, 0xb1, 0x3a, 0xa4, 0x7d, 0x24, 0x79, 0x1e, 0x3c, 0xca, 0x33, 0xe1, 0x55, - 0xeb, 0x80, 0xdc, 0x00, 0x7b, 0xc4, 0x11, 0x21, 0x43, 0x72, 0x94, 0xf4, 0xc8, 0x48, 0x96, 0xb9, - 0xc5, 0x60, 0xec, 0x81, 0x1c, 0x8f, 0x41, 0x8a, 0xca, 0x56, 0x3f, 0x31, 0xd4, 0x9e, 0xa6, 0x01, - 0xfc, 0x2d, 0x9c, 0x0a, 0x3c, 0xc0, 0x5e, 0x6f, 0xd1, 0xb0, 0x8f, 0x53, 0xfc, 0x37, 0x28, 0xa0, - 0x4b, 0xb5, 0x37, 0x23, 0xdb, 0xa5, 0xbe, 0x8f, 0x85, 0x8d, 0xc9, 0x98, 0x6a, 0xfd, 0x87, 0x66, - 0xb2, 0x52, 0xa6, 0x5c, 0x29, 0xf3, 0x57, 0x0d, 0xee, 0x29, 0xec, 0x19, 0x19, 0x53, 0x9d, 0x0f, - 0xa2, 0x35, 0x0f, 0xec, 0x00, 0xb0, 0x60, 0xcd, 0x8b, 0xe9, 0x6a, 0xba, 0x9e, 0x6f, 0x95, 0xd7, - 0x69, 0x2d, 0xea, 0xa1, 0x53, 0x2d, 0x05, 0xc1, 0x1e, 0xc8, 0x07, 0x0c, 0xbb, 0xc8, 0x1e, 0xd2, - 0x90, 0x8c, 0xd4, 0x78, 0xe4, 0x5b, 0x7b, 0xeb, 0x39, 0xce, 0x25, 0xa8, 0x2b, 0x31, 0x71, 0x92, - 0x60, 0x61, 0x51, 0x65, 0x8e, 0xda, 0xba, 0x59, 0x35, 0xea, 0x9f, 0xc6, 0x1d, 0x83, 0xc7, 0x60, - 0xe7, 0xc1, 0xfe, 0xd9, 0xd8, 0x1e, 0x15, 0xb3, 0x6a, 0x02, 0x3f, 0x5f, 0x5e, 0xaf, 0xb3, 0x5f, - 0xda, 0x3f, 0xdf, 0x5c, 0x35, 0xca, 0x6b, 0x7f, 0x4d, 0xaa, 0x2f, 0x7b, 0x5f, 0x5a, 0xed, 0x7d, - 0xe2, 0xae, 0x3d, 0x37, 0xc0, 0xd1, 0x7a, 0xcf, 0xfe, 0x40, 0x0c, 0x8f, 0xb1, 0xeb, 0x08, 0x4c, - 0xc9, 0xb9, 0xc3, 0x1c, 0x9f, 0x43, 0x13, 0x7c, 0x12, 0x0d, 0x81, 0xdc, 0x49, 0x59, 0xb0, 0x82, - 0x19, 0xbd, 0x5c, 0x66, 0xfc, 0x72, 0x99, 0x1d, 0x32, 0xef, 0xc7, 0xa0, 0xf6, 0xf0, 0xe6, 0xaa, - 0xd1, 0xf8, 0x00, 0xb1, 0xf5, 0x5f, 0x48, 0xaa, 0x3f, 0xbc, 0x9f, 0xea, 0x7a, 0x40, 0xad, 0x05, - 0x40, 0x52, 0x5f, 0x08, 0x41, 0x66, 0x82, 0xbd, 0x89, 0x1e, 0x59, 0x75, 0x86, 0xdb, 0x20, 0x3d, - 0xa5, 0xff, 0x44, 0x0f, 0x5f, 0x5f, 0x1e, 0xbb, 0xbd, 0xeb, 0xbb, 0x8a, 0x71, 0x7b, 0x57, 0x31, - 0xde, 0xdc, 0x55, 0x8c, 0xff, 0xee, 0x2b, 0xa9, 0xdb, 0xfb, 0x4a, 0xea, 0xe5, 0x7d, 0x25, 0xf5, - 0xd7, 0xb1, 0x87, 0xc5, 0x24, 0x1c, 0x9a, 0x2e, 0xf5, 0x2d, 0x7e, 0x81, 0x83, 0x86, 0x8f, 0x66, - 0xd6, 0x2a, 0x1f, 0xf5, 0xf4, 0x0d, 0xb3, 0x4a, 0xf3, 0xc9, 0xbb, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x62, 0x4c, 0xb7, 0x7f, 0x6f, 0x06, 0x00, 0x00, -} - -func (m *Alert) 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 *Alert) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Alert) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.CurrencyPair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintAlerts(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0x12 - } - if m.Height != 0 { - i = encodeVarintAlerts(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AlertStatus) 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 *AlertStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlertStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.PurgeHeight != 0 { - i = encodeVarintAlerts(dAtA, i, uint64(m.PurgeHeight)) - i-- - dAtA[i] = 0x20 - } - if m.SubmissionTimestamp != 0 { - i = encodeVarintAlerts(dAtA, i, uint64(m.SubmissionTimestamp)) - i-- - dAtA[i] = 0x18 - } - if m.SubmissionHeight != 0 { - i = encodeVarintAlerts(dAtA, i, uint64(m.SubmissionHeight)) - i-- - dAtA[i] = 0x10 - } - if m.ConclusionStatus != 0 { - i = encodeVarintAlerts(dAtA, i, uint64(m.ConclusionStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AlertWithStatus) 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 *AlertWithStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlertWithStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Alert.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Signature) 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 *Signature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Signature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintAlerts(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintAlerts(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MultiSigConclusion) 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 *MultiSigConclusion) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MultiSigConclusion) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CurrencyPairID != 0 { - i = encodeVarintAlerts(dAtA, i, uint64(m.CurrencyPairID)) - i-- - dAtA[i] = 0x30 - } - if m.Status { - i-- - if m.Status { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - { - size, err := m.PriceBound.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - { - size, err := m.ExtendedCommitInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Alert.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MultiSigConclusionVerificationParams) 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 *MultiSigConclusionVerificationParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MultiSigConclusionVerificationParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signers) > 0 { - for iNdEx := len(m.Signers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAlerts(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *PriceBound) 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 *PriceBound) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PriceBound) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Low) > 0 { - i -= len(m.Low) - copy(dAtA[i:], m.Low) - i = encodeVarintAlerts(dAtA, i, uint64(len(m.Low))) - i-- - dAtA[i] = 0x12 - } - if len(m.High) > 0 { - i -= len(m.High) - copy(dAtA[i:], m.High) - i = encodeVarintAlerts(dAtA, i, uint64(len(m.High))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintAlerts(dAtA []byte, offset int, v uint64) int { - offset -= sovAlerts(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Alert) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovAlerts(uint64(m.Height)) - } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovAlerts(uint64(l)) - } - l = m.CurrencyPair.Size() - n += 1 + l + sovAlerts(uint64(l)) - return n -} - -func (m *AlertStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ConclusionStatus != 0 { - n += 1 + sovAlerts(uint64(m.ConclusionStatus)) - } - if m.SubmissionHeight != 0 { - n += 1 + sovAlerts(uint64(m.SubmissionHeight)) - } - if m.SubmissionTimestamp != 0 { - n += 1 + sovAlerts(uint64(m.SubmissionTimestamp)) - } - if m.PurgeHeight != 0 { - n += 1 + sovAlerts(uint64(m.PurgeHeight)) - } - return n -} - -func (m *AlertWithStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Alert.Size() - n += 1 + l + sovAlerts(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovAlerts(uint64(l)) - return n -} - -func (m *Signature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovAlerts(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovAlerts(uint64(l)) - } - return n -} - -func (m *MultiSigConclusion) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Alert.Size() - n += 1 + l + sovAlerts(uint64(l)) - l = m.ExtendedCommitInfo.Size() - n += 1 + l + sovAlerts(uint64(l)) - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovAlerts(uint64(l)) - } - } - l = m.PriceBound.Size() - n += 1 + l + sovAlerts(uint64(l)) - if m.Status { - n += 2 - } - if m.CurrencyPairID != 0 { - n += 1 + sovAlerts(uint64(m.CurrencyPairID)) - } - return n -} - -func (m *MultiSigConclusionVerificationParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Signers) > 0 { - for _, e := range m.Signers { - l = e.Size() - n += 1 + l + sovAlerts(uint64(l)) - } - } - return n -} - -func (m *PriceBound) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.High) - if l > 0 { - n += 1 + l + sovAlerts(uint64(l)) - } - l = len(m.Low) - if l > 0 { - n += 1 + l + sovAlerts(uint64(l)) - } - return n -} - -func sovAlerts(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAlerts(x uint64) (n int) { - return sovAlerts(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Alert) 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 ErrIntOverflowAlerts - } - 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: Alert: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Alert: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - 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 ErrInvalidLengthAlerts - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AlertStatus) 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 ErrIntOverflowAlerts - } - 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: AlertStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlertStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ConclusionStatus", wireType) - } - m.ConclusionStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ConclusionStatus |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmissionHeight", wireType) - } - m.SubmissionHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SubmissionHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmissionTimestamp", wireType) - } - m.SubmissionTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SubmissionTimestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PurgeHeight", wireType) - } - m.PurgeHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PurgeHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AlertWithStatus) 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 ErrIntOverflowAlerts - } - 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: AlertWithStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlertWithStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Alert.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Signature) 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 ErrIntOverflowAlerts - } - 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: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - 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 ErrInvalidLengthAlerts - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MultiSigConclusion) 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 ErrIntOverflowAlerts - } - 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: MultiSigConclusion: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MultiSigConclusion: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Alert.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtendedCommitInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExtendedCommitInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, Signature{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PriceBound", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.PriceBound.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Status = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPairID", wireType) - } - m.CurrencyPairID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CurrencyPairID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MultiSigConclusionVerificationParams) 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 ErrIntOverflowAlerts - } - 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: MultiSigConclusionVerificationParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MultiSigConclusionVerificationParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAlerts - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signers = append(m.Signers, &types2.Any{}) - if err := m.Signers[len(m.Signers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PriceBound) 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 ErrIntOverflowAlerts - } - 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: PriceBound: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PriceBound: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field High", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - 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 ErrInvalidLengthAlerts - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.High = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Low", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAlerts - } - 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 ErrInvalidLengthAlerts - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAlerts - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Low = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAlerts(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAlerts - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAlerts(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAlerts - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAlerts - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowAlerts - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthAlerts - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAlerts - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAlerts - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAlerts = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAlerts = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAlerts = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/alerts/types/codec.go b/x/alerts/types/codec.go deleted file mode 100644 index 76cbec370..000000000 --- a/x/alerts/types/codec.go +++ /dev/null @@ -1,67 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var pc *codec.ProtoCodec - -func init() { - ir := codectypes.NewInterfaceRegistry() - pc = codec.NewProtoCodec(ir) - - // register crypto types - cryptocodec.RegisterInterfaces(ir) -} - -// RegisterLegacyAminoCodec registers the necessary x/alerts interfaces and concrete types -// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // register the conclusion interfaces / MultiSigConclusion implementation - cdc.RegisterInterface((*Conclusion)(nil), nil) - cdc.RegisterConcrete(&MultiSigConclusion{}, "slinky/x/alerts/Conclusion", nil) - - // register the conclusion verification params interfaces / MultiSigConclusionVerificationParams implementation - cdc.RegisterInterface((*ConclusionVerificationParams)(nil), nil) - cdc.RegisterConcrete(&MultiSigConclusionVerificationParams{}, "slinky/x/alerts/ConclusionVerificationParams", nil) - - // register the msg-types - legacy.RegisterAminoMsg(cdc, &MsgAlert{}, "slinky/x/alerts/MsgAlert") - legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "slinky/x/alerts/MsgUpdateParams") - legacy.RegisterAminoMsg(cdc, &MsgConclusion{}, "slinky/x/alerts/MsgConclusion") -} - -// RegisterInterfaces registers the x/alerts messages + message service w/ the InterfaceRegistry (registry). -// -// This method will also update the internal package's codec so that any subsequent attempts in the package to unmarshal -// anys will reference the registry passed here. -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - // register the ConclusionVerificationParams interface + implementations - registry.RegisterInterface( - "slinky.alerts.v1.ConclusionVerificationParams", - (*ConclusionVerificationParams)(nil), - &MultiSigConclusionVerificationParams{}, - ) - - // register the Conclusion interface + implementations - registry.RegisterInterface( - "slinky.alerts.v1.Conclusion", - (*Conclusion)(nil), - &MultiSigConclusion{}, - ) - - // register the alert Msg-type - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgAlert{}, - &MsgUpdateParams{}, - &MsgConclusion{}, - ) - - // update the package's codec - pc = codec.NewProtoCodec(registry) -} diff --git a/x/alerts/types/conclusion.go b/x/alerts/types/conclusion.go deleted file mode 100644 index 11259913a..000000000 --- a/x/alerts/types/conclusion.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - cmtabci "github.com/cometbft/cometbft/abci/types" - "github.com/gogo/protobuf/proto" -) - -// Conclusion defines the basic meta-data necessary for the alerts module to resolve an alert. At a minimum, this -// message must contain the OracleData referenced in the conclusion, the Alert that the Conclusion corresponds to, -// metadata necessary for verification (i.e. signatures), and the status of the conclusion itself. -type Conclusion interface { - proto.Message - - // ValidateBasic performs stateless validation on the Claim - ValidateBasic() error - - // Marshal the Claim to bytes (this is what will be stored in state) - Marshal() ([]byte, error) - - // Unmarshal unmarshals the claim bytes into the receiver - Unmarshal([]byte) error - - // Verify verifies the conclusion, given a ConclusionVerificationParams - Verify(ConclusionVerificationParams) error - - // GetExtendedCommitInfo returns the ExtendedCommitInfo referenced in the conclusion. - GetExtendedCommitInfo() cmtabci.ExtendedCommitInfo - - // GetAlert returns the Alert that the Conclusion corresponds to. - GetAlert() Alert - - // GetStatus returns the status of the conclusion. - GetStatus() bool - - // GetPriceBound returns the price-bounds of the conclusion. - GetPriceBound() PriceBound - - // GetCurrencyPairID returns the ID of the CurrencyPair for which the alert is filed - GetCurrencyPairID() uint64 -} - -// ConclusionVerificationParams defines the parameters necessary to verify a conclusion. -type ConclusionVerificationParams interface { - proto.Message - - // ValidateBasic performs stateless validation on the Claim - ValidateBasic() error - - // Marshal the Claim to bytes (this is what will be stored in state) - Marshal() ([]byte, error) - - // Unmarshal unmarshals the claim bytes into the receiver - Unmarshal([]byte) error -} diff --git a/x/alerts/types/expected_keepers.go b/x/alerts/types/expected_keepers.go deleted file mode 100644 index 6b937eda9..000000000 --- a/x/alerts/types/expected_keepers.go +++ /dev/null @@ -1,45 +0,0 @@ -package types - -import ( - "context" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -// BankKeeper defines the expected interface that the bank-keeper dependency must implement. -// -//go:generate mockery --name BankKeeper --output ./mocks/ --case underscore -type BankKeeper interface { - SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error -} - -// OracleKeeper defines the expected interface that the oracle-keeper dependency must implement. -// -//go:generate mockery --name OracleKeeper --output ./mocks/ --case underscore -type OracleKeeper interface { - HasCurrencyPair(ctx sdk.Context, cp slinkytypes.CurrencyPair) bool -} - -// StakingKeeper defines the expected interface that the staking-keeper dependency must implement. -// -//go:generate mockery --name StakingKeeper --output ./mocks/ --case underscore -type StakingKeeper interface { - Slash(ctx context.Context, consAddr sdk.ConsAddress, infractionHeight, power int64, slashFactor math.LegacyDec) (math.Int, error) - GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, err error) - BondDenom(ctx context.Context) (string, error) -} - -// IncentiveKeeper defines the expected interface that the incentive-keeper dependency must implement. -// -//go:generate mockery --name IncentiveKeeper --output ./mocks/ --case underscore -type IncentiveKeeper interface { - AddIncentives(ctx sdk.Context, incentives []incentivetypes.Incentive) error -} diff --git a/x/alerts/types/genesis.go b/x/alerts/types/genesis.go deleted file mode 100644 index f43275449..000000000 --- a/x/alerts/types/genesis.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultGenesisState returns a default genesis state, with default params. -func DefaultGenesisState() GenesisState { - return NewGenesisState(DefaultParams(sdk.DefaultBondDenom, nil), nil) -} - -// NewGenesisState creates a new GenesisState object given the params for the module. -func NewGenesisState(params Params, alerts []AlertWithStatus) GenesisState { - gs := GenesisState{ - Params: params, - Alerts: alerts, - } - - return gs -} - -// ValidateBasic performs stateless validation on the GenesisState, specifically it -// validates that the Params are valid, and that each of the alerts is also valid. -func (gs *GenesisState) ValidateBasic() error { - // validate the genesis-state - if err := gs.Params.Validate(); err != nil { - return err - } - - // alerts - alerts := make(map[string]struct{}) - - // validate each alert - for _, alert := range gs.Alerts { - if err := alert.ValidateBasic(); err != nil { - return err - } - - // check for uniqueness on the alert.height + currency-pair - if _, ok := alerts[alertKey(alert)]; ok { - return fmt.Errorf("duplicate alert in genesis state: %v", alert.Alert) - } - - alerts[alertKey(alert)] = struct{}{} - } - - return nil -} - -func alertKey(a AlertWithStatus) string { - return fmt.Sprint(a.Alert.Height) + a.Alert.CurrencyPair.String() -} diff --git a/x/alerts/types/genesis.pb.go b/x/alerts/types/genesis.pb.go deleted file mode 100644 index 714e8b96c..000000000 --- a/x/alerts/types/genesis.pb.go +++ /dev/null @@ -1,1160 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/alerts/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types1 "github.com/cosmos/cosmos-sdk/codec/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// AlertParams is the set of parameters for the x/Alerts module's Alerting. It -// defines whether or not Alerts can be submitted, and if so, the minimum -// bond amount required to submit an Alert. -type AlertParams struct { - // Enabled is a boolean defining whether or not Alerts can be submitted - // to the module - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - // BondAmount is the minimum amount of bond required to submit an - // Alert - BondAmount types.Coin `protobuf:"bytes,2,opt,name=bond_amount,json=bondAmount,proto3" json:"bond_amount"` - // MaxBlockAge defines the maximum age of an Alert before it is pruned, notice - // this is defined wrt. the height that the Alert references, i.e Alerts are - // only relevant until Alert.Height + MaxBlockAge is reached. - MaxBlockAge uint64 `protobuf:"varint,3,opt,name=max_block_age,json=maxBlockAge,proto3" json:"max_block_age,omitempty"` -} - -func (m *AlertParams) Reset() { *m = AlertParams{} } -func (m *AlertParams) String() string { return proto.CompactTextString(m) } -func (*AlertParams) ProtoMessage() {} -func (*AlertParams) Descriptor() ([]byte, []int) { - return fileDescriptor_7b18f585e730177c, []int{0} -} -func (m *AlertParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlertParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlertParams.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 *AlertParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlertParams.Merge(m, src) -} -func (m *AlertParams) XXX_Size() int { - return m.Size() -} -func (m *AlertParams) XXX_DiscardUnknown() { - xxx_messageInfo_AlertParams.DiscardUnknown(m) -} - -var xxx_messageInfo_AlertParams proto.InternalMessageInfo - -func (m *AlertParams) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -func (m *AlertParams) GetBondAmount() types.Coin { - if m != nil { - return m.BondAmount - } - return types.Coin{} -} - -func (m *AlertParams) GetMaxBlockAge() uint64 { - if m != nil { - return m.MaxBlockAge - } - return 0 -} - -// PruningParams defines the criterion for pruning Alerts from the state. -type PruningParams struct { - // Enabled defines whether Alerts are to be pruned - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - // BlocksToPrune defines the number of blocks until an Alert will be pruned - // from state, notice this is defined wrt. the current block height, i.e - // Alerts will be stored in state until current_height + BlocksToPrune is - // reached. - BlocksToPrune uint64 `protobuf:"varint,2,opt,name=blocks_to_prune,json=blocksToPrune,proto3" json:"blocks_to_prune,omitempty"` -} - -func (m *PruningParams) Reset() { *m = PruningParams{} } -func (m *PruningParams) String() string { return proto.CompactTextString(m) } -func (*PruningParams) ProtoMessage() {} -func (*PruningParams) Descriptor() ([]byte, []int) { - return fileDescriptor_7b18f585e730177c, []int{1} -} -func (m *PruningParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PruningParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PruningParams.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 *PruningParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_PruningParams.Merge(m, src) -} -func (m *PruningParams) XXX_Size() int { - return m.Size() -} -func (m *PruningParams) XXX_DiscardUnknown() { - xxx_messageInfo_PruningParams.DiscardUnknown(m) -} - -var xxx_messageInfo_PruningParams proto.InternalMessageInfo - -func (m *PruningParams) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -func (m *PruningParams) GetBlocksToPrune() uint64 { - if m != nil { - return m.BlocksToPrune - } - return 0 -} - -// Params is the set of parameters for the x/Alerts module. -type Params struct { - // AlertParams is the set of parameters for the x/Alerts module's Alerting. - AlertParams AlertParams `protobuf:"bytes,1,opt,name=alert_params,json=alertParams,proto3" json:"alert_params"` - // ConclusionVerificationParams is the set of parameters for the x/Alerts - // module's conclusion verification. - ConclusionVerificationParams *types1.Any `protobuf:"bytes,2,opt,name=conclusion_verification_params,json=conclusionVerificationParams,proto3" json:"conclusion_verification_params,omitempty"` - // PruningParams is the set of parameters for the x/Alerts module's pruning. - PruningParams PruningParams `protobuf:"bytes,3,opt,name=pruning_params,json=pruningParams,proto3" json:"pruning_params"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_7b18f585e730177c, []int{2} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetAlertParams() AlertParams { - if m != nil { - return m.AlertParams - } - return AlertParams{} -} - -func (m *Params) GetConclusionVerificationParams() *types1.Any { - if m != nil { - return m.ConclusionVerificationParams - } - return nil -} - -func (m *Params) GetPruningParams() PruningParams { - if m != nil { - return m.PruningParams - } - return PruningParams{} -} - -// GenesisState is the state that must be provided at genesis. It contains -// params for the module, and the set initial Alerts. -type GenesisState struct { - // Params is the set of x/Alerts parameters - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // Alerts is the set of Alerts that have been submitted to the module - Alerts []AlertWithStatus `protobuf:"bytes,2,rep,name=alerts,proto3" json:"alerts"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_7b18f585e730177c, []int{3} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *GenesisState) GetAlerts() []AlertWithStatus { - if m != nil { - return m.Alerts - } - return nil -} - -func init() { - proto.RegisterType((*AlertParams)(nil), "slinky.alerts.v1.AlertParams") - proto.RegisterType((*PruningParams)(nil), "slinky.alerts.v1.PruningParams") - proto.RegisterType((*Params)(nil), "slinky.alerts.v1.Params") - proto.RegisterType((*GenesisState)(nil), "slinky.alerts.v1.GenesisState") -} - -func init() { proto.RegisterFile("slinky/alerts/v1/genesis.proto", fileDescriptor_7b18f585e730177c) } - -var fileDescriptor_7b18f585e730177c = []byte{ - // 536 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcb, 0x8e, 0xd3, 0x30, - 0x14, 0xad, 0xdb, 0xaa, 0x80, 0x33, 0xe5, 0x11, 0xcd, 0x22, 0x33, 0x62, 0x32, 0xa5, 0x0b, 0x54, - 0x90, 0x6a, 0xab, 0x45, 0x62, 0x8b, 0xda, 0x0a, 0xd8, 0xb0, 0x18, 0x02, 0x02, 0x89, 0x4d, 0xe4, - 0x64, 0x3c, 0x19, 0xab, 0x89, 0x1d, 0xc5, 0x4e, 0xd5, 0x7e, 0x01, 0x2b, 0x24, 0xc4, 0x57, 0xb0, - 0x42, 0x2c, 0xf8, 0x88, 0x11, 0xab, 0x59, 0xb2, 0x42, 0xa8, 0x5d, 0xf0, 0x1b, 0x28, 0xb6, 0x3b, - 0xea, 0x50, 0x1e, 0x9b, 0xaa, 0xe7, 0xdc, 0x7b, 0xcf, 0xb9, 0xf7, 0xb4, 0x86, 0xbe, 0x4c, 0x19, - 0x9f, 0x2e, 0x30, 0x49, 0x69, 0xa1, 0x24, 0x9e, 0x0d, 0x70, 0x42, 0x39, 0x95, 0x4c, 0xa2, 0xbc, - 0x10, 0x4a, 0xb8, 0x37, 0x4d, 0x1d, 0x99, 0x3a, 0x9a, 0x0d, 0xf6, 0xfd, 0x58, 0xc8, 0x4c, 0x48, - 0x1c, 0x11, 0x49, 0xf1, 0x6c, 0x10, 0x51, 0x45, 0x06, 0x38, 0x16, 0x8c, 0x9b, 0x89, 0xfd, 0x5b, - 0x24, 0x63, 0x5c, 0x60, 0xfd, 0x69, 0xa9, 0x3d, 0x33, 0x12, 0x6a, 0x84, 0x0d, 0xb0, 0xa5, 0xdd, - 0x44, 0x24, 0xc2, 0xf0, 0xd5, 0x37, 0xcb, 0x1e, 0x6c, 0x6d, 0x65, 0xfd, 0xad, 0x5e, 0x22, 0x44, - 0x92, 0x52, 0xac, 0x51, 0x54, 0x9e, 0x60, 0xc2, 0x17, 0xa6, 0xd4, 0xfd, 0x00, 0xa0, 0x33, 0xaa, - 0x7a, 0x8f, 0x48, 0x41, 0x32, 0xe9, 0x7a, 0xf0, 0x0a, 0xe5, 0x24, 0x4a, 0xe9, 0xb1, 0x07, 0x3a, - 0xa0, 0x77, 0x35, 0x58, 0x43, 0xf7, 0x31, 0x74, 0x22, 0xc1, 0x8f, 0x43, 0x92, 0x89, 0x92, 0x2b, - 0xaf, 0xde, 0x01, 0x3d, 0x67, 0xb8, 0x87, 0xec, 0x76, 0xd5, 0x75, 0xc8, 0x5e, 0x87, 0x26, 0x82, - 0xf1, 0xf1, 0xb5, 0xb3, 0xef, 0x87, 0xb5, 0x8f, 0x3f, 0x3f, 0xdf, 0x07, 0x01, 0xac, 0x06, 0x47, - 0x7a, 0xce, 0xed, 0xc2, 0x76, 0x46, 0xe6, 0x61, 0x94, 0x8a, 0x78, 0x1a, 0x92, 0x84, 0x7a, 0x8d, - 0x0e, 0xe8, 0x35, 0x03, 0x27, 0x23, 0xf3, 0x71, 0xc5, 0x8d, 0x12, 0xda, 0x7d, 0x0e, 0xdb, 0x47, - 0x45, 0xc9, 0x19, 0x4f, 0xfe, 0xbb, 0xd5, 0x5d, 0x78, 0x43, 0x4b, 0xc9, 0x50, 0x89, 0x30, 0x2f, - 0x4a, 0x4e, 0xf5, 0x66, 0xcd, 0xa0, 0x6d, 0xe8, 0x97, 0xa2, 0x52, 0xa2, 0xdd, 0x4f, 0x75, 0xd8, - 0xb2, 0x62, 0x4f, 0xe0, 0x8e, 0x4e, 0x27, 0xcc, 0x35, 0xd6, 0x8a, 0xce, 0xf0, 0x00, 0xfd, 0xfe, - 0xcb, 0xa1, 0x8d, 0x5c, 0xc6, 0xcd, 0xea, 0x9a, 0xc0, 0x21, 0x1b, 0x51, 0xbd, 0x03, 0xd0, 0x8f, - 0x05, 0x8f, 0xd3, 0x52, 0x32, 0xc1, 0xc3, 0x19, 0x2d, 0xd8, 0x09, 0x8b, 0x89, 0xaa, 0x80, 0x95, - 0x36, 0x21, 0xed, 0x22, 0x93, 0x3f, 0x5a, 0xe7, 0x8f, 0x46, 0x7c, 0x31, 0x1e, 0x7c, 0xfd, 0xd2, - 0xef, 0x6f, 0x79, 0x4e, 0x2e, 0x04, 0x5f, 0x6d, 0xe8, 0x19, 0xc7, 0xe0, 0x76, 0xfc, 0x8f, 0xaa, - 0xfb, 0x0c, 0x5e, 0xcf, 0x4d, 0x6a, 0x6b, 0xfb, 0x86, 0xb6, 0x3f, 0xdc, 0xbe, 0xec, 0x52, 0xba, - 0xf6, 0xb6, 0x76, 0xbe, 0x49, 0x76, 0xdf, 0x02, 0xb8, 0xf3, 0xd4, 0xfc, 0xb5, 0x5f, 0x28, 0xa2, - 0xa8, 0xfb, 0x10, 0xb6, 0x2e, 0x05, 0xe6, 0xfd, 0x41, 0x76, 0x53, 0xcf, 0x76, 0xbb, 0x8f, 0x60, - 0xcb, 0x74, 0x78, 0xf5, 0x4e, 0xa3, 0xe7, 0x0c, 0xef, 0xfc, 0x25, 0xe8, 0xd7, 0x4c, 0x9d, 0x56, - 0x4e, 0xe5, 0x85, 0x80, 0x69, 0x18, 0x4f, 0xce, 0x96, 0x3e, 0x38, 0x5f, 0xfa, 0xe0, 0xc7, 0xd2, - 0x07, 0xef, 0x57, 0x7e, 0xed, 0x7c, 0xe5, 0xd7, 0xbe, 0xad, 0xfc, 0xda, 0x9b, 0x7b, 0x09, 0x53, - 0xa7, 0x65, 0x84, 0x62, 0x91, 0x61, 0x39, 0x65, 0x79, 0x3f, 0xa3, 0x33, 0x6c, 0x9f, 0xc2, 0x7c, - 0xfd, 0x18, 0xd4, 0x22, 0xa7, 0x32, 0x6a, 0xe9, 0xec, 0x1f, 0xfc, 0x0a, 0x00, 0x00, 0xff, 0xff, - 0xce, 0x74, 0xdb, 0x08, 0xc0, 0x03, 0x00, 0x00, -} - -func (m *AlertParams) 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 *AlertParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlertParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MaxBlockAge != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MaxBlockAge)) - i-- - dAtA[i] = 0x18 - } - { - size, err := m.BondAmount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PruningParams) 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 *PruningParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PruningParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BlocksToPrune != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.BlocksToPrune)) - i-- - dAtA[i] = 0x10 - } - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.PruningParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.ConclusionVerificationParams != nil { - { - size, err := m.ConclusionVerificationParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.AlertParams.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 (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Alerts) > 0 { - for iNdEx := len(m.Alerts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Alerts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.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 - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *AlertParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Enabled { - n += 2 - } - l = m.BondAmount.Size() - n += 1 + l + sovGenesis(uint64(l)) - if m.MaxBlockAge != 0 { - n += 1 + sovGenesis(uint64(m.MaxBlockAge)) - } - return n -} - -func (m *PruningParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Enabled { - n += 2 - } - if m.BlocksToPrune != 0 { - n += 1 + sovGenesis(uint64(m.BlocksToPrune)) - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.AlertParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - if m.ConclusionVerificationParams != nil { - l = m.ConclusionVerificationParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - l = m.PruningParams.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.Alerts) > 0 { - for _, e := range m.Alerts { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *AlertParams) 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: AlertParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlertParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondAmount", 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.BondAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockAge", wireType) - } - m.MaxBlockAge = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxBlockAge |= 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 (m *PruningParams) 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: PruningParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PruningParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksToPrune", wireType) - } - m.BlocksToPrune = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlocksToPrune |= 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 (m *Params) 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AlertParams", 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.AlertParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConclusionVerificationParams", 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 m.ConclusionVerificationParams == nil { - m.ConclusionVerificationParams = &types1.Any{} - } - if err := m.ConclusionVerificationParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PruningParams", 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.PruningParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 (m *GenesisState) 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alerts", 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.Alerts = append(m.Alerts, AlertWithStatus{}) - if err := m.Alerts[len(m.Alerts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/alerts/types/genesis_test.go b/x/alerts/types/genesis_test.go deleted file mode 100644 index a7273ac14..000000000 --- a/x/alerts/types/genesis_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package types_test - -import ( - "testing" - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func TestGenesisValidation(t *testing.T) { - type testCase struct { - name string - genesis types.GenesisState - valid bool - } - - cases := []testCase{ - { - name: "genesis with invalid params - fail", - genesis: types.GenesisState{ - Params: types.NewParams(types.AlertParams{BondAmount: sdk.NewCoin("test", math.NewInt(1000000))}, nil, types.PruningParams{}), - }, - }, - { - name: "genesis with valid params - pass", - genesis: types.GenesisState{ - Params: types.NewParams(types.AlertParams{BondAmount: sdk.NewCoin("test", math.NewInt(0))}, nil, types.PruningParams{}), - }, - valid: true, - }, - { - name: "genesis with an invalid alert - fail", - genesis: types.NewGenesisState(types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{}), []types.AlertWithStatus{ - types.NewAlertWithStatus( - types.Alert{ - Height: 1, - Signer: "", - }, - types.NewAlertStatus(1, 2, time.Now(), 1), - ), - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ), - }), - }, - { - name: "genesis with duplicate alerts - fail", - genesis: types.NewGenesisState(types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{}), []types.AlertWithStatus{ - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ), - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("test1"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 0), - ), - }), - }, - { - name: "genesis with valid non-duplicate alerts - pass", - genesis: types.NewGenesisState(types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{}), []types.AlertWithStatus{ - types.NewAlertWithStatus( - types.NewAlert(1, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE", "QUOTE")), - types.NewAlertStatus(1, 2, time.Now(), 1), - ), - types.NewAlertWithStatus( - types.NewAlert(0, sdk.AccAddress("test"), slinkytypes.NewCurrencyPair("BASE2", "QUOTE2")), - types.NewAlertStatus(1, 2, time.Now(), 0), - ), - }), - valid: true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.genesis.ValidateBasic() - if tc.valid { - require.Nil(t, err) - return - } - - require.NotNil(t, err) - }) - } -} - -func TestDefaultGenesisValidation(t *testing.T) { - // test that the default genesis is valid - genesis := types.DefaultGenesisState() - require.NoError(t, genesis.ValidateBasic()) -} diff --git a/x/alerts/types/keys.go b/x/alerts/types/keys.go deleted file mode 100644 index 8d7d9237b..000000000 --- a/x/alerts/types/keys.go +++ /dev/null @@ -1,20 +0,0 @@ -package types - -import ( - "cosmossdk.io/collections" -) - -const ( - // ModuleName is the name of the module. - ModuleName = "alerts" - - // StoreKey is the default store key for alerts. - StoreKey = ModuleName -) - -var ( - // AlertStoreKeyPrefix is the prefix for the alert store key. - AlertStoreKeyPrefix = collections.NewPrefix(0) - // ParamsStoreKeyPrefix is the prefix for the params store key. - ParamsStoreKeyPrefix = collections.NewPrefix(1) -) diff --git a/x/alerts/types/mocks/bank_keeper.go b/x/alerts/types/mocks/bank_keeper.go deleted file mode 100644 index 31faf3c68..000000000 --- a/x/alerts/types/mocks/bank_keeper.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - types "github.com/cosmos/cosmos-sdk/types" - mock "github.com/stretchr/testify/mock" -) - -// BankKeeper is an autogenerated mock type for the BankKeeper type -type BankKeeper struct { - mock.Mock -} - -// BurnCoins provides a mock function with given fields: ctx, moduleName, amounts -func (_m *BankKeeper) BurnCoins(ctx context.Context, moduleName string, amounts types.Coins) error { - ret := _m.Called(ctx, moduleName, amounts) - - if len(ret) == 0 { - panic("no return value specified for BurnCoins") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.Coins) error); ok { - r0 = rf(ctx, moduleName, amounts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MintCoins provides a mock function with given fields: ctx, moduleName, amt -func (_m *BankKeeper) MintCoins(ctx context.Context, moduleName string, amt types.Coins) error { - ret := _m.Called(ctx, moduleName, amt) - - if len(ret) == 0 { - panic("no return value specified for MintCoins") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.Coins) error); ok { - r0 = rf(ctx, moduleName, amt) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SendCoinsFromAccountToModule provides a mock function with given fields: ctx, senderAddr, recipientModule, amt -func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { - ret := _m.Called(ctx, senderAddr, recipientModule, amt) - - if len(ret) == 0 { - panic("no return value specified for SendCoinsFromAccountToModule") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, string, types.Coins) error); ok { - r0 = rf(ctx, senderAddr, recipientModule, amt) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt -func (_m *BankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { - ret := _m.Called(ctx, senderModule, recipientAddr, amt) - - if len(ret) == 0 { - panic("no return value specified for SendCoinsFromModuleToAccount") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.AccAddress, types.Coins) error); ok { - r0 = rf(ctx, senderModule, recipientAddr, amt) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewBankKeeper creates a new instance of BankKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewBankKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *BankKeeper { - mock := &BankKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/alerts/types/mocks/incentive_keeper.go b/x/alerts/types/mocks/incentive_keeper.go deleted file mode 100644 index 1c03b3cfa..000000000 --- a/x/alerts/types/mocks/incentive_keeper.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - incentivestypes "github.com/skip-mev/slinky/x/incentives/types" - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// IncentiveKeeper is an autogenerated mock type for the IncentiveKeeper type -type IncentiveKeeper struct { - mock.Mock -} - -// AddIncentives provides a mock function with given fields: ctx, incentives -func (_m *IncentiveKeeper) AddIncentives(ctx types.Context, incentives []incentivestypes.Incentive) error { - ret := _m.Called(ctx, incentives) - - if len(ret) == 0 { - panic("no return value specified for AddIncentives") - } - - var r0 error - if rf, ok := ret.Get(0).(func(types.Context, []incentivestypes.Incentive) error); ok { - r0 = rf(ctx, incentives) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewIncentiveKeeper creates a new instance of IncentiveKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewIncentiveKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *IncentiveKeeper { - mock := &IncentiveKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/alerts/types/mocks/oracle_keeper.go b/x/alerts/types/mocks/oracle_keeper.go deleted file mode 100644 index 427426d11..000000000 --- a/x/alerts/types/mocks/oracle_keeper.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - pkgtypes "github.com/skip-mev/slinky/pkg/types" - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// OracleKeeper is an autogenerated mock type for the OracleKeeper type -type OracleKeeper struct { - mock.Mock -} - -// HasCurrencyPair provides a mock function with given fields: ctx, cp -func (_m *OracleKeeper) HasCurrencyPair(ctx types.Context, cp pkgtypes.CurrencyPair) bool { - ret := _m.Called(ctx, cp) - - if len(ret) == 0 { - panic("no return value specified for HasCurrencyPair") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(types.Context, pkgtypes.CurrencyPair) bool); ok { - r0 = rf(ctx, cp) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// NewOracleKeeper creates a new instance of OracleKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewOracleKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *OracleKeeper { - mock := &OracleKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/alerts/types/mocks/staking_keeper.go b/x/alerts/types/mocks/staking_keeper.go deleted file mode 100644 index 5280f2ccd..000000000 --- a/x/alerts/types/mocks/staking_keeper.go +++ /dev/null @@ -1,117 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - math "cosmossdk.io/math" - cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" - - mock "github.com/stretchr/testify/mock" - - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// StakingKeeper is an autogenerated mock type for the StakingKeeper type -type StakingKeeper struct { - mock.Mock -} - -// BondDenom provides a mock function with given fields: ctx -func (_m *StakingKeeper) BondDenom(ctx context.Context) (string, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for BondDenom") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (string, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) string); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetValidatorByConsAddr provides a mock function with given fields: ctx, consAddr -func (_m *StakingKeeper) GetValidatorByConsAddr(ctx context.Context, consAddr cosmos_sdktypes.ConsAddress) (stakingtypes.Validator, error) { - ret := _m.Called(ctx, consAddr) - - if len(ret) == 0 { - panic("no return value specified for GetValidatorByConsAddr") - } - - var r0 stakingtypes.Validator - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) (stakingtypes.Validator, error)); ok { - return rf(ctx, consAddr) - } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) stakingtypes.Validator); ok { - r0 = rf(ctx, consAddr) - } else { - r0 = ret.Get(0).(stakingtypes.Validator) - } - - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.ConsAddress) error); ok { - r1 = rf(ctx, consAddr) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Slash provides a mock function with given fields: ctx, consAddr, infractionHeight, power, slashFactor -func (_m *StakingKeeper) Slash(ctx context.Context, consAddr cosmos_sdktypes.ConsAddress, infractionHeight int64, power int64, slashFactor math.LegacyDec) (math.Int, error) { - ret := _m.Called(ctx, consAddr, infractionHeight, power, slashFactor) - - if len(ret) == 0 { - panic("no return value specified for Slash") - } - - var r0 math.Int - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress, int64, int64, math.LegacyDec) (math.Int, error)); ok { - return rf(ctx, consAddr, infractionHeight, power, slashFactor) - } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress, int64, int64, math.LegacyDec) math.Int); ok { - r0 = rf(ctx, consAddr, infractionHeight, power, slashFactor) - } else { - r0 = ret.Get(0).(math.Int) - } - - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.ConsAddress, int64, int64, math.LegacyDec) error); ok { - r1 = rf(ctx, consAddr, infractionHeight, power, slashFactor) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewStakingKeeper creates a new instance of StakingKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewStakingKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *StakingKeeper { - mock := &StakingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/alerts/types/msgs.go b/x/alerts/types/msgs.go deleted file mode 100644 index fb2d9b62c..000000000 --- a/x/alerts/types/msgs.go +++ /dev/null @@ -1,107 +0,0 @@ -package types - -import ( - "fmt" - - "cosmossdk.io/x/tx/signing" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/protobuf/proto" - - alertv1 "github.com/skip-mev/slinky/api/slinky/alerts/v1" -) - -var ( - _ sdk.Msg = &MsgAlert{} - _ sdk.Msg = &MsgConclusion{} - _ sdk.Msg = &MsgUpdateParams{} -) - -// ProvideMsgAlertGetSigners provides the CustomGetSigners method for the MsgAlert. -func ProvideMsgAlertGetSigners() signing.CustomGetSigner { - return signing.CustomGetSigner{ - MsgType: proto.MessageName(&alertv1.MsgAlert{}), - Fn: func(m proto.Message) ([][]byte, error) { - msg := m.(*alertv1.MsgAlert) - signer, err := sdk.AccAddressFromBech32(msg.Alert.Signer) - if err != nil { - return nil, err - } - return [][]byte{signer}, nil - }, - } -} - -// NewMsgAlert creates a new MsgAlert, given the alert details. -func NewMsgAlert(a Alert) *MsgAlert { - return &MsgAlert{ - Alert: a, - } -} - -// ValidateBasic performs basic validation of the MsgAlert fields, i.e. on the underlying Alert. -func (msg *MsgAlert) ValidateBasic() error { - return msg.Alert.ValidateBasic() -} - -// NewMsgConclusion creates a new MsgConclusion, given the conclusion, and the -// conclusion signer. -func NewMsgConclusion(c Conclusion, signer sdk.AccAddress) *MsgConclusion { - msg := &MsgConclusion{ - Signer: signer.String(), - } - - var err error - if c != nil { - // marshal to any - msg.Conclusion, err = codectypes.NewAnyWithValue(c) - if err != nil { - return nil - } - } - - return msg -} - -// ValidateBasic performs basic validation of the MsgConclusion fields, i.e. that the signer address -// is valid, and the alert is non-nil. -func (msg *MsgConclusion) ValidateBasic() error { - // check signer validity - if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { - return err - } - - // check conclusion validity - if msg.Conclusion == nil { - return fmt.Errorf("conclusion cannot be nil") - } - - // unmarshal the any into a conclusion - var c Conclusion - if err := pc.UnpackAny(msg.Conclusion, &c); err != nil { - return err - } - - return c.ValidateBasic() -} - -// NewMsgUpdateParams creates a new MsgUpdateParams, given the new params, and the authority address -// that is allowed to update the params. -func NewMsgUpdateParams(params Params, authority sdk.AccAddress) *MsgUpdateParams { - return &MsgUpdateParams{ - Authority: authority.String(), - Params: params, - } -} - -// ValidateBasic checks that the params in the msg are valid, and that the authority address is valid -// if either check fails the method will error. -func (m *MsgUpdateParams) ValidateBasic() error { - // check authority address - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return err - } - - // check params - return m.Params.Validate() -} diff --git a/x/alerts/types/msgs_test.go b/x/alerts/types/msgs_test.go deleted file mode 100644 index d981f7514..000000000 --- a/x/alerts/types/msgs_test.go +++ /dev/null @@ -1,181 +0,0 @@ -package types_test - -import ( - "math/big" - "testing" - - "cosmossdk.io/math" - cmtabci "github.com/cometbft/cometbft/abci/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -func TestMsgAlertValidateBasic(t *testing.T) { - type testCase struct { - name string - types.MsgAlert - valid bool - } - - testCases := []testCase{ - { - "if the alert is invalid, the message is invalid", - *types.NewMsgAlert(types.Alert{ - Height: 0, - Signer: "", - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - }), - false, - }, - { - "if the alert is valid, the message is valid", - *types.NewMsgAlert(types.NewAlert(0, sdk.AccAddress("cosmos1"), slinkytypes.NewCurrencyPair("BTC", "USD"))), - true, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.MsgAlert.ValidateBasic() - if tc.valid && err != nil { - t.Errorf("expected no error, got %v", err) - } - if !tc.valid && err == nil { - t.Errorf("expected error, got nil") - } - }) - } -} - -func TestMsgConclusion(t *testing.T) { - invalidConclusionAny, err := codectypes.NewAnyWithValue(&types.MultiSigConclusion{}) - require.NoError(t, err) - - validConclusionAny, err := codectypes.NewAnyWithValue(&types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: types.Alert{ - Height: 1, - Signer: sdk.AccAddress("cosmos1").String(), - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - }, - PriceBound: types.PriceBound{ - High: big.NewInt(1).String(), - Low: big.NewInt(0).String(), - }, - Signatures: []types.Signature{ - { - sdk.AccAddress("cosmos1").String(), - nil, - }, - }, - Status: false, - }) - require.NoError(t, err) - - t.Run("test validate basic", func(t *testing.T) { - cases := []struct { - name string - msg types.MsgConclusion - valid bool - }{ - { - "invalid signer address", - types.MsgConclusion{ - Signer: "invalid", - Conclusion: validConclusionAny, - }, - false, - }, - { - "nil conclusion", - types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: nil, - }, - false, - }, - { - "invalid conclusion", - types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: invalidConclusionAny, - }, - false, - }, - { - "valid conclusion", - types.MsgConclusion{ - Signer: sdk.AccAddress("cosmos1").String(), - Conclusion: validConclusionAny, - }, - true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.msg.ValidateBasic() - if tc.valid && err != nil { - t.Errorf("expected no error, got %v", err) - } - if !tc.valid && err == nil { - t.Errorf("expected error, got nil") - } - }) - } - }) -} - -func TestMsgUpdateParams(t *testing.T) { - cases := []struct { - name string - msg types.MsgUpdateParams - valid bool - }{ - { - "invalid signer address", - types.MsgUpdateParams{ - Authority: "false", - Params: types.DefaultParams("denom", nil), - }, - false, - }, - { - "invalid params", - types.MsgUpdateParams{ - Authority: sdk.AccAddress("cosmos1").String(), - Params: types.Params{ - AlertParams: types.AlertParams{ - Enabled: false, - BondAmount: sdk.NewCoin("denom", math.NewInt(1)), - }, - }, - }, - false, - }, - { - "valid message", - types.MsgUpdateParams{ - Authority: sdk.AccAddress("cosmos1").String(), - Params: types.DefaultParams("denom", nil), - }, - true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.msg.ValidateBasic() - if tc.valid && err != nil { - t.Errorf("expected no error, got %v", err) - } - if !tc.valid && err == nil { - t.Errorf("expected error, got nil") - } - }) - } -} diff --git a/x/alerts/types/multi_sig_conclusion.go b/x/alerts/types/multi_sig_conclusion.go deleted file mode 100644 index 1009b3e2c..000000000 --- a/x/alerts/types/multi_sig_conclusion.go +++ /dev/null @@ -1,251 +0,0 @@ -package types - -import ( - "encoding/binary" - "fmt" - - cmthash "github.com/cometbft/cometbft/crypto/tmhash" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - _ Conclusion = &MultiSigConclusion{} - _ ConclusionVerificationParams = &MultiSigConclusionVerificationParams{} -) - -const ( - Secp256k1Type = "secp256k1" - Secp256r1Type = "secp256r1" - Ed25519Type = "ed25519" -) - -// NewMultiSigVerificationParams creates the parameters necessary for verification of a MultiSigConclusion. This method will -// derive the addresses corresponding to the provided public-keys, and will store the address -> public key mapping, -// this method will fail if no public-keys are given, or if duplicates are provided. -func NewMultiSigVerificationParams(pks []cryptotypes.PubKey) (ConclusionVerificationParams, error) { - signers := make(map[string]struct{}) - - // expect there to be at least 1 signer - if len(pks) == 0 { - return nil, fmt.Errorf("no signers provided") - } - - pbks := make([]*codectypes.Any, 0) - - for _, pk := range pks { - // get signer address from pubkey - signer := sdk.AccAddress(pk.Address()).String() - - // check for duplicate signers - if _, ok := signers[signer]; ok { - return nil, fmt.Errorf("duplicate signer: %s", signer) - } - - // pack the pubkey into an any - pbk, err := codectypes.NewAnyWithValue(pk) - if err != nil { - return nil, err - } - - pbks = append(pbks, pbk) - - // store signer in map - signers[signer] = struct{}{} - } - - return &MultiSigConclusionVerificationParams{ - Signers: pbks, - }, nil -} - -// ValidateBasic checks that all signers correspond to their pubkeys, and that the signer addresses are valid bech32 addresses. -// It also checks that there is at least 1 signer. This method also validates that the signers are not duplicated. -// -// NOTICE: the public-keys given must be of type secp2561k1, secp256r1, or ed25519. -func (params *MultiSigConclusionVerificationParams) ValidateBasic() error { - // check that there is at least 1 signer - if len(params.Signers) == 0 { - return fmt.Errorf("no signers provided") - } - - signers := make(map[string]struct{}) - - // check validity of pubkeys - for _, pk := range params.Signers { - var pkv cryptotypes.PubKey - if err := pc.UnpackAny(pk, &pkv); err != nil { - return err - } - - // check that the pubkey is non-nil - if pkv == nil { - return fmt.Errorf("nil pubkey") - } - - // check that the pubkey is of a valid type - if err := validatePkType(pkv); err != nil { - return err - } - - // get signer address from pubkey - signer := sdk.AccAddress(pkv.Address()).String() - if _, ok := signers[signer]; ok { - return fmt.Errorf("duplicate signer: %s", signer) - } - - // store signer in map - signers[signer] = struct{}{} - } - - return nil -} - -func validatePkType(pkv cryptotypes.PubKey) error { - switch { - case pkv.Type() == Secp256k1Type: - if _, ok := pkv.(*secp256k1.PubKey); !ok { - return fmt.Errorf("invalid secp256k1 pubkey") - } - case pkv.Type() == Secp256r1Type: - if _, ok := pkv.(*secp256r1.PubKey); !ok { - return fmt.Errorf("invalid secp256r1 pubkey") - } - case pkv.Type() == Ed25519Type: - if _, ok := pkv.(*ed25519.PubKey); !ok { - return fmt.Errorf("invalid ed25519 pubkey") - } - default: - return fmt.Errorf("invalid pubkey type: %s", pkv.Type()) - } - - return nil -} - -// ValidateBasic validates the Conclusion. Specifically, it validates that the signers are valid bech32 addresses, and that the -// sub-fields are non-nil. -func (c *MultiSigConclusion) ValidateBasic() error { - // check that the alert is valid - if err := c.Alert.ValidateBasic(); err != nil { - return err - } - - // check that the price-bound is valid - if err := c.PriceBound.ValidateBasic(); err != nil { - return err - } - - if len(c.Signatures) == 0 { - return fmt.Errorf("no signatures provided") - } - - // check that each signer is a valid bech32 address - for _, signature := range c.Signatures { - if _, err := sdk.AccAddressFromBech32(signature.Signer); err != nil { - return err - } - } - - return nil -} - -// Verify verifies the conclusion. Specifically, it verifies that the signatures are valid, and that the oracle-data is valid. -func (c *MultiSigConclusion) Verify(params ConclusionVerificationParams) error { - // check that the params are valid - if err := params.ValidateBasic(); err != nil { - return err - } - - // check that the conclusion is valid - if err := c.ValidateBasic(); err != nil { - return err - } - - // assert the type of the params - multiSigParams, ok := params.(*MultiSigConclusionVerificationParams) - if !ok { - return fmt.Errorf("invalid params type: %T", params) - } - - sigBytes, err := c.SignBytes() - if err != nil { - return err - } - - signatures := signaturesToSignersMap(c.Signatures) - - // verify the signatures of the Conclusion data - for _, pkb := range multiSigParams.Signers { - // get the signer address associated w/ pkb - var pkv cryptotypes.PubKey - if err := pc.UnpackAny(pkb, &pkv); err != nil { - return err - } - - signer := sdk.AccAddress(pkv.Address()).String() - sig, ok := signatures[signer] - if !ok { - return fmt.Errorf("no signature provided for signer: %s", signer) - } - - // verify the signature - if !pkv.VerifySignature(sigBytes, sig) { - return fmt.Errorf("signature verification failed for signer: %s", signer) - } - - } - - return nil -} - -func signaturesToSignersMap(signatures []Signature) map[string][]byte { - signaturesMap := make(map[string][]byte) - - for _, sig := range signatures { - signaturesMap[sig.Signer] = sig.Signature - } - - return signaturesMap -} - -// SignBytes returns the bytes that should be signed by the signers, i.e. the 20-byte truncated hash of the marshalled oracle-data, -// the alert UID, the price-bound, and the status. -func (c *MultiSigConclusion) SignBytes() ([]byte, error) { - bz := make([]byte, 0) - - // append oracle-data - oracleData, err := c.ExtendedCommitInfo.Marshal() - if err != nil { - return nil, err - } - - bz = append(bz, oracleData...) - - // append alert - bz = append(bz, c.Alert.UID()...) - - // append price-bound - priceBoundBz, err := c.PriceBound.Marshal() - if err != nil { - return nil, err - } - bz = append(bz, priceBoundBz...) - - // append status - switch c.Status { - case true: - bz = append(bz, 1) - case false: - bz = append(bz, 0) - } - - // finally append, and sign over the CurrencyPairID - cpIDbz := make([]byte, 8) - binary.BigEndian.PutUint64(cpIDbz, c.CurrencyPairID) - - return cmthash.SumTruncated(append(bz, cpIDbz...)), nil -} diff --git a/x/alerts/types/multi_sig_conclusion_test.go b/x/alerts/types/multi_sig_conclusion_test.go deleted file mode 100644 index c28bd163c..000000000 --- a/x/alerts/types/multi_sig_conclusion_test.go +++ /dev/null @@ -1,299 +0,0 @@ -package types_test - -import ( - "math/big" - "testing" - - cmtabci "github.com/cometbft/cometbft/abci/types" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" -) - -type MultiSigConclusionTestSuite struct { - // test-suite - suite.Suite - - pks []cryptotypes.PubKey - pvks []cryptotypes.PrivKey -} - -func TestMultiSigConclusionTestSuite(t *testing.T) { - suite.Run(t, new(MultiSigConclusionTestSuite)) -} - -func (s *MultiSigConclusionTestSuite) SetupTest() { - // create the set of public / private keys - s.pks = make([]cryptotypes.PubKey, 3) - s.pvks = make([]cryptotypes.PrivKey, 3) - - // create a secp256k1, ed25519, and secp256r1 key - s.pvks[0] = secp256k1.GenPrivKey() - s.pks[0] = s.pvks[0].PubKey() - - s.pvks[1] = ed25519.GenPrivKey() - s.pks[1] = s.pvks[1].PubKey() - - var err error - s.pvks[2], err = secp256r1.GenPrivKey() - s.Require().NoError(err) - s.pks[2] = s.pvks[2].PubKey() -} - -type invalidPubKey struct { - cryptotypes.PubKey -} - -func (i invalidPubKey) Type() string { - return "invalid" -} - -func (s *MultiSigConclusionTestSuite) TestParams() { - s.Run("test NewMultiSigVerificationParams()", func() { - s.Run("test duplicate pub-keys fails", func() { - _, err := types.NewMultiSigVerificationParams([]cryptotypes.PubKey{s.pks[0], s.pks[0]}) - s.Require().Error(err) - }) - - s.Run("test 0 pubkeys fails", func() { - _, err := types.NewMultiSigVerificationParams([]cryptotypes.PubKey{}) - s.Require().Error(err) - }) - - s.Run("test all 3 pubkeys passes validate basic", func() { - params, err := types.NewMultiSigVerificationParams(s.pks) - s.Require().NoError(err) - - // passes validate-basic - s.Require().NoError(params.ValidateBasic()) - }) - }) - - s.Run("test ValidateBasic", func() { - s.Run("signers map with invalid pubkey", func() { - params := types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{ - nil, - }, - } - - s.Require().Error(params.ValidateBasic()) - }) - - s.Run("empty signers array", func() { - params := types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{}, - } - - s.Require().Error(params.ValidateBasic()) - }) - - s.Run("invalid public key type in array", func() { - pkAny, err := codectypes.NewAnyWithValue(&invalidPubKey{ - PubKey: s.pks[0], - }) - s.Require().NoError(err) - - params := types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{pkAny}, - } - - s.Require().Error(params.ValidateBasic()) - }) - - a, err := codectypes.NewAnyWithValue(s.pks[0]) - s.Require().NoError(err) - - s.Run("duplicate public-keys", func() { - params := types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{a, a}, - } - - s.Require().Error(params.ValidateBasic()) - }) - - s.Run("public keys are all valid", func() { - params := types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{a}, - } - - s.Require().NoError(params.ValidateBasic()) - }) - }) -} - -func (s *MultiSigConclusionTestSuite) TestConclusion() { - low := big.NewInt(1) - high := big.NewInt(2) - invalidPriceBound := types.PriceBound{ - High: low.String(), - Low: high.String(), - } - priceBound := types.PriceBound{ - Low: low.String(), - High: high.String(), - } - s.Run("test ValidateBasic()", func() { - alert := types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("A", "B")) - - cases := []struct { - name string - conclusion types.MultiSigConclusion - valid bool - }{ - { - "invalid alert - fail", - types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: types.Alert{}, - PriceBound: types.PriceBound{}, - }, - false, - }, - { - "invalid price-bound - fail", - types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: invalidPriceBound, - }, - false, - }, - { - "invalid signer address", - types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: types.PriceBound{}, - Signatures: []types.Signature{ - { - "invalid", - nil, - }, - }, - }, - false, - }, - { - "no signers", - types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: priceBound, - Signatures: nil, - }, - false, - }, - { - "valid conclusion", - types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: priceBound, - Signatures: []types.Signature{ - { - sdk.AccAddress(s.pks[0].Address()).String(), - nil, - }, - }, - }, - true, - }, - } - - for _, tc := range cases { - s.Run(tc.name, func() { - err := tc.conclusion.ValidateBasic() - if tc.valid { - s.Require().NoError(err) - } else { - s.Require().Error(err) - } - }) - } - }) - - s.Run("test Verify()", func() { - params, err := types.NewMultiSigVerificationParams(s.pks) - s.Require().NoError(err) - alert := types.NewAlert(1, sdk.AccAddress("abc"), slinkytypes.NewCurrencyPair("A", "B")) - - s.Run("invalid params - fail", func() { - msc := types.MultiSigConclusion{} - - s.Require().Error(msc.Verify(&types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{nil}, - })) - }) - - s.Run("invalid conclusion - fail", func() { - msc := types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: types.Alert{}, - PriceBound: priceBound, - } - - s.Require().Error(msc.Verify(params)) - }) - - s.Run("invalid signature - fail", func() { - msc := types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: priceBound, - Signatures: []types.Signature{ - { - s.pks[0].Address().String(), - nil, - }, - }, - } - - s.Require().Error(msc.Verify(params)) - }) - - s.Run("valid conclusion - success", func() { - msc := types.MultiSigConclusion{ - ExtendedCommitInfo: cmtabci.ExtendedCommitInfo{}, - Alert: alert, - PriceBound: priceBound, - } - - signBytes, err := msc.SignBytes() - s.Require().NoError(err) - - sig0, err := s.pvks[0].Sign(signBytes) - s.Require().NoError(err) - - sig1, err := s.pvks[1].Sign(signBytes) - s.Require().NoError(err) - - sig2, err := s.pvks[2].Sign(signBytes) - s.Require().NoError(err) - - msc.Signatures = []types.Signature{ - { - sdk.AccAddress(s.pks[0].Address()).String(), - sig0, - }, - { - sdk.AccAddress(s.pks[1].Address()).String(), - sig1, - }, - { - sdk.AccAddress(s.pks[2].Address()).String(), - sig2, - }, - } - - s.Require().NoError(msc.Verify(params)) - }) - }) -} diff --git a/x/alerts/types/params.go b/x/alerts/types/params.go deleted file mode 100644 index 459ed844b..000000000 --- a/x/alerts/types/params.go +++ /dev/null @@ -1,129 +0,0 @@ -package types - -import ( - "fmt" - - "cosmossdk.io/math" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - // DefaultEnabled is the default value for the enabled flag. - DefaultEnabled = true - - // DefaultPruningEnabled is the default value for the pruning enabled flag. - DefaultPruningEnabled = true - - // DefaultBondAmount is the default value for the bond amount. - DefaultBondAmount = math.NewInt(1000000) - - // DefaultAlertExpiry is the maximum age of an alert. - DefaultAlertExpiry = uint64(10000) - - // DefaultBlocksToPrune is the default number of blocks an alert is kept in state - // until it is pruned. - DefaultBlocksToPrune = uint64(1000) -) - -// NewParams creates a new Params object, this method will panic if the provided ConclusionVerificationParams -// cannot be encoded to an Any. -// -// NOTICE: The MaxBlockAge + BlocksToPrune < UnbondingPeriod. This inequality is required to ensure that -// any infracting validator cannot unbond to avoid being slashed. -func NewParams(ap AlertParams, cvp ConclusionVerificationParams, pp PruningParams) Params { - params := Params{ - AlertParams: ap, - PruningParams: pp, - } - - var err error - if cvp != nil { - params.ConclusionVerificationParams, err = codectypes.NewAnyWithValue(cvp) - if err != nil { - panic(err) - } - } - - return params -} - -// DefaultParams returns a default set of parameters, i.e. BondAmount is set to -// DefaultBondAmount. -func DefaultParams(denom string, cvp ConclusionVerificationParams) Params { - return NewParams( - AlertParams{ - Enabled: DefaultEnabled, - BondAmount: sdk.NewCoin(denom, DefaultBondAmount), - MaxBlockAge: DefaultAlertExpiry, - }, - cvp, - PruningParams{ - Enabled: DefaultPruningEnabled, - BlocksToPrune: DefaultBlocksToPrune, - }, - ) -} - -// Validate performs a basic validation of the AlertParams, i.e. if Alerts are enabled, that the -// bond amount is non-zero, and that the MaxBlockAge is non-zero. -func (ap *AlertParams) Validate() error { - if !ap.Enabled { - if !ap.BondAmount.IsZero() || !(ap.MaxBlockAge == 0) { - return fmt.Errorf("invalid alert params: bond amount must be zero if alerts are disabled") - } - - return nil - } - - if ap.BondAmount.IsZero() || ap.BondAmount.IsNegative() { - return fmt.Errorf("invalid alert params: bond amount must be non-zero") - } - - if ap.MaxBlockAge == 0 { - return fmt.Errorf("invalid alert params: max block age must be non-zero") - } - - return nil -} - -// Validate performs basic validation of the Pruning Params, specifically, that the BlocksToPrune is -// non-zero if pruning is enabled, and zero if disabled. -func (pp *PruningParams) Validate() error { - if !pp.Enabled { - if pp.BlocksToPrune != 0 { - return fmt.Errorf("invalid pruning params: blocks to prune must be zero if pruning is disabled") - } - - return nil - } - - if pp.BlocksToPrune == 0 { - return fmt.Errorf("invalid pruning params: blocks to prune must be non-zero if pruning is enabled") - } - - return nil -} - -// Validate performs a basic validation of the Params, i.e. that the AlertParams are valid, -// and the ConclusionVerificationParams are valid (if present). -func (p *Params) Validate() error { - if p.ConclusionVerificationParams != nil { - // Unmarshal the Any into a ConclusionVerificationParams - var params ConclusionVerificationParams - if err := pc.UnpackAny(p.ConclusionVerificationParams, ¶ms); err != nil { - return err - } - - // Validate the ConclusionVerificationParams - if err := params.ValidateBasic(); err != nil { - return err - } - } - - if err := p.PruningParams.Validate(); err != nil { - return err - } - - return p.AlertParams.Validate() -} diff --git a/x/alerts/types/params_test.go b/x/alerts/types/params_test.go deleted file mode 100644 index 0bc9c0e3f..000000000 --- a/x/alerts/types/params_test.go +++ /dev/null @@ -1,106 +0,0 @@ -package types_test - -import ( - "testing" - - "cosmossdk.io/math" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -func TestParamsValidation(t *testing.T) { - type testCase struct { - name string - // params to validate - params types.Params - // expected result - valid bool - } - - pk := secp256k1.GenPrivKey() - pkany, err := codectypes.NewAnyWithValue(pk.PubKey()) - require.NoError(t, err) - - cases := []testCase{ - { - name: "not-enabled, but bond amount is non-zero - fail", - params: types.NewParams( - types.AlertParams{BondAmount: sdk.NewCoin("test", math.NewInt(1000000))}, nil, types.PruningParams{}), - }, - { - name: "not enabled and bond amount is zero - pass", - params: types.NewParams(types.AlertParams{BondAmount: sdk.NewCoin("test", math.NewInt(0))}, nil, types.PruningParams{}), - valid: true, - }, - { - name: "not enabled and max-block-age is non-zero -fail", - params: types.NewParams(types.AlertParams{BondAmount: sdk.NewCoin("test", math.NewInt(0)), MaxBlockAge: 1}, nil, types.PruningParams{}), - }, - { - name: "enabled, but max-block-age is zero - fail", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1))}, nil, types.PruningParams{}), - }, - { - name: "enabled, but bond amount is zero - fail", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(0)), MaxBlockAge: 1}, nil, types.PruningParams{}), - }, - { - name: "enabled, but bond amount is negative - fail", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.Coin{Denom: "test", Amount: math.NewInt(-1)}, MaxBlockAge: 1}, nil, types.PruningParams{}), - }, - { - name: "enabled, but bond amount is non-zero - pass", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{}), - valid: true, - }, - { - name: "valid alert params, but invalid conclusion verification params - fail", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, &types.MultiSigConclusionVerificationParams{ - Signers: []*codectypes.Any{pkany, pkany}, - }, types.PruningParams{}), - }, - { - name: "valid alert params, but invalid pruning params (disabled + non-zero blocks-to-prune) - fail", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{ - Enabled: false, - BlocksToPrune: 10, - }), - }, - { - name: "valid alert params, but invalid pruning params (enabled + zero blocks-to-prune) - fail", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{ - Enabled: true, - }), - }, - { - name: "valid alert params, and valid pruning params (enabled + non-zero blocks-to-prune) - pass", - params: types.NewParams(types.AlertParams{Enabled: true, BondAmount: sdk.NewCoin("test", math.NewInt(1000000)), MaxBlockAge: 1}, nil, types.PruningParams{ - Enabled: true, - BlocksToPrune: 10, - }), - valid: true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.params.Validate() - if tc.valid && err != nil { - t.Errorf("expected params to be valid, got error: %v", err) - } - if !tc.valid && err == nil { - t.Errorf("expected params to be invalid, got nil error") - } - }) - } -} - -func TestDefaultParamsValidate(t *testing.T) { - // test that the default params are valid - params := types.DefaultParams("test", nil) - require.NoError(t, params.Validate()) -} diff --git a/x/alerts/types/price_bound.go b/x/alerts/types/price_bound.go deleted file mode 100644 index 787fc683a..000000000 --- a/x/alerts/types/price_bound.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - "fmt" - "math/big" -) - -// ValidateBasic validates the PriceBound, specifically that the high price-bound is greater than the low price-bound, and -// that the high / low price-bounds are valid big.Int values. -func (pb *PriceBound) ValidateBasic() error { - high, converted := new(big.Int).SetString(pb.High, 10) - if !converted { - return fmt.Errorf("invalid high price-bound %s", pb.High) - } - - low, converted := new(big.Int).SetString(pb.Low, 10) - if !converted { - return fmt.Errorf("invalid low price-bound %s", pb.Low) - } - - if high.Cmp(low) <= 0 { - return fmt.Errorf("high price-bound %s must be greater than low price-bound %s", pb.High, pb.Low) - } - - return nil -} - -// GetHighInt returns the high price-bound as a big.Int. -func (pb *PriceBound) GetHighInt() (*big.Int, error) { - high, converted := new(big.Int).SetString(pb.High, 10) - if !converted { - return nil, fmt.Errorf("invalid high price-bound %s", pb.High) - } - - return high, nil -} - -// GetLowInt returns the low price-bound as a big.Int. -func (pb *PriceBound) GetLowInt() (*big.Int, error) { - low, converted := new(big.Int).SetString(pb.Low, 10) - if !converted { - return nil, fmt.Errorf("invalid low price-bound %s", pb.Low) - } - - return low, nil -} diff --git a/x/alerts/types/price_bound_test.go b/x/alerts/types/price_bound_test.go deleted file mode 100644 index 0b3cfa0aa..000000000 --- a/x/alerts/types/price_bound_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/alerts/types" -) - -func TestPriceBound(t *testing.T) { - t.Run("test ValidateBasic()", func(t *testing.T) { - cases := []struct { - name string - priceBound types.PriceBound - valid bool - }{ - { - "valid price-bound", - types.PriceBound{ - High: "1", - Low: "0", - }, - true, - }, - { - "invalid price-bound", - types.PriceBound{ - High: "0", - Low: "1", - }, - false, - }, - { - "invalid price-bound high == low", - types.PriceBound{ - High: "1", - Low: "1", - }, - false, - }, - { - "invalid price-bound invalid strings", - types.PriceBound{ - High: "", - Low: "", - }, - false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.priceBound.ValidateBasic() - if tc.valid && err != nil { - t.Fatalf("expected price-bound to be valid but got error: %s", err) - } - - if !tc.valid && err == nil { - t.Fatal("expected price-bound to be invalid but got no error") - } - }) - } - }) - - t.Run("test GetHighInt()", func(t *testing.T) { - // invalid high value fails - pb := types.PriceBound{ - High: "x", - Low: "2", - } - _, err := pb.GetHighInt() - require.NotNil(t, err) - - // valid high value succeeds - pb = types.PriceBound{ - High: "1", - Low: "0", - } - - high, err := pb.GetHighInt() - require.Nil(t, err) - require.Equal(t, high.Uint64(), uint64(1)) - }) - - t.Run("test GetLowInt()", func(t *testing.T) { - // invalid low value fails - pb := types.PriceBound{ - High: "1", - Low: "x", - } - _, err := pb.GetLowInt() - require.NotNil(t, err) - - // valid low value succeeds - pb = types.PriceBound{ - High: "2", - Low: "1", - } - - low, err := pb.GetLowInt() - require.Nil(t, err) - require.Equal(t, low.Uint64(), uint64(1)) - }) -} diff --git a/x/alerts/types/query.pb.go b/x/alerts/types/query.pb.go deleted file mode 100644 index 72e19cd6b..000000000 --- a/x/alerts/types/query.pb.go +++ /dev/null @@ -1,953 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/alerts/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// AlertStatus is the type for the status of an Alert, it can be Unconcluded or -// Concluded. -type AlertStatusID int32 - -const ( - AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED AlertStatusID = 0 - AlertStatusID_CONCLUSION_STATUS_UNCONCLUDED AlertStatusID = 1 - AlertStatusID_CONCLUSION_STATUS_CONCLUDED AlertStatusID = 2 -) - -var AlertStatusID_name = map[int32]string{ - 0: "CONCLUSION_STATUS_UNSPECIFIED", - 1: "CONCLUSION_STATUS_UNCONCLUDED", - 2: "CONCLUSION_STATUS_CONCLUDED", -} - -var AlertStatusID_value = map[string]int32{ - "CONCLUSION_STATUS_UNSPECIFIED": 0, - "CONCLUSION_STATUS_UNCONCLUDED": 1, - "CONCLUSION_STATUS_CONCLUDED": 2, -} - -func (x AlertStatusID) String() string { - return proto.EnumName(AlertStatusID_name, int32(x)) -} - -func (AlertStatusID) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_800538fad6183f61, []int{0} -} - -// AlertsRequest is the request type for the Query.Alerts RPC method, the status -// field indicates whether the request should return only Unconcluded / -// Concluded Alerts, or all Alerts. -type AlertsRequest struct { - Status AlertStatusID `protobuf:"varint,1,opt,name=status,proto3,enum=slinky.alerts.v1.AlertStatusID" json:"status,omitempty"` -} - -func (m *AlertsRequest) Reset() { *m = AlertsRequest{} } -func (m *AlertsRequest) String() string { return proto.CompactTextString(m) } -func (*AlertsRequest) ProtoMessage() {} -func (*AlertsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_800538fad6183f61, []int{0} -} -func (m *AlertsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlertsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlertsRequest.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 *AlertsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlertsRequest.Merge(m, src) -} -func (m *AlertsRequest) XXX_Size() int { - return m.Size() -} -func (m *AlertsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AlertsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AlertsRequest proto.InternalMessageInfo - -func (m *AlertsRequest) GetStatus() AlertStatusID { - if m != nil { - return m.Status - } - return AlertStatusID_CONCLUSION_STATUS_UNSPECIFIED -} - -// AlertsResponse is the response type for the Query.Alerts RPC method, it -// contains the list of Alerts that are being tracked by the alerts module. -type AlertsResponse struct { - Alerts []Alert `protobuf:"bytes,1,rep,name=alerts,proto3" json:"alerts"` -} - -func (m *AlertsResponse) Reset() { *m = AlertsResponse{} } -func (m *AlertsResponse) String() string { return proto.CompactTextString(m) } -func (*AlertsResponse) ProtoMessage() {} -func (*AlertsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_800538fad6183f61, []int{1} -} -func (m *AlertsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AlertsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AlertsResponse.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 *AlertsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AlertsResponse.Merge(m, src) -} -func (m *AlertsResponse) XXX_Size() int { - return m.Size() -} -func (m *AlertsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AlertsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AlertsResponse proto.InternalMessageInfo - -func (m *AlertsResponse) GetAlerts() []Alert { - if m != nil { - return m.Alerts - } - return nil -} - -// ParamsRequest is the request type for the Query.Params RPC method. -type ParamsRequest struct { -} - -func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } -func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } -func (*ParamsRequest) ProtoMessage() {} -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_800538fad6183f61, []int{2} -} -func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsRequest.Merge(m, src) -} -func (m *ParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *ParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo - -// ParamsResponse is the response type for the Query.Params RPC method, it -// contains the Params of the module. -type ParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } -func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } -func (*ParamsResponse) ProtoMessage() {} -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_800538fad6183f61, []int{3} -} -func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsResponse.Merge(m, src) -} -func (m *ParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *ParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo - -func (m *ParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterEnum("slinky.alerts.v1.AlertStatusID", AlertStatusID_name, AlertStatusID_value) - proto.RegisterType((*AlertsRequest)(nil), "slinky.alerts.v1.AlertsRequest") - proto.RegisterType((*AlertsResponse)(nil), "slinky.alerts.v1.AlertsResponse") - proto.RegisterType((*ParamsRequest)(nil), "slinky.alerts.v1.ParamsRequest") - proto.RegisterType((*ParamsResponse)(nil), "slinky.alerts.v1.ParamsResponse") -} - -func init() { proto.RegisterFile("slinky/alerts/v1/query.proto", fileDescriptor_800538fad6183f61) } - -var fileDescriptor_800538fad6183f61 = []byte{ - // 424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x33, 0xab, 0xe6, 0x30, 0xcb, 0xd6, 0x32, 0x08, 0x86, 0xb8, 0x9b, 0xc6, 0x9c, 0x56, - 0xc1, 0x0c, 0x1b, 0x51, 0xcf, 0xbb, 0x49, 0x75, 0x03, 0xd2, 0x5d, 0x9b, 0xf6, 0xe2, 0xa5, 0xa4, - 0x32, 0xc4, 0xd0, 0x26, 0x93, 0x66, 0x26, 0xc1, 0x5e, 0xfd, 0x04, 0x82, 0x5f, 0xaa, 0xc7, 0x82, - 0x17, 0x4f, 0x22, 0xad, 0x7e, 0x0f, 0x69, 0x26, 0x83, 0xd4, 0x34, 0xde, 0x86, 0xf7, 0x7e, 0xff, - 0xff, 0x7b, 0xf3, 0x9f, 0x81, 0xa7, 0x6c, 0x1e, 0xa7, 0xb3, 0x25, 0x0e, 0xe7, 0x24, 0xe7, 0x0c, - 0x97, 0x17, 0x78, 0x51, 0x90, 0x7c, 0x69, 0x67, 0x39, 0xe5, 0x14, 0x75, 0x45, 0xd7, 0x16, 0x5d, - 0xbb, 0xbc, 0xd0, 0x4f, 0x23, 0x4a, 0xa3, 0x39, 0xc1, 0x61, 0x16, 0xe3, 0x30, 0x4d, 0x29, 0x0f, - 0x79, 0x4c, 0x53, 0x26, 0x78, 0xfd, 0xac, 0xe1, 0x56, 0x2b, 0x45, 0xdb, 0x68, 0xb4, 0x23, 0x92, - 0x12, 0x16, 0xcb, 0xfe, 0x83, 0x88, 0x46, 0xb4, 0x3a, 0xe2, 0xdd, 0x49, 0x54, 0xad, 0x6b, 0x78, - 0x72, 0x59, 0x09, 0x86, 0x64, 0x51, 0x10, 0xc6, 0xd1, 0x2b, 0xa8, 0x32, 0x1e, 0xf2, 0x82, 0x69, - 0xc0, 0x04, 0xe7, 0x1d, 0xa7, 0x67, 0xff, 0xbb, 0xa6, 0x5d, 0x09, 0x82, 0x0a, 0xf2, 0xbd, 0x61, - 0x8d, 0x5b, 0x6f, 0x60, 0x47, 0x3a, 0xb1, 0x8c, 0xa6, 0x8c, 0xa0, 0x17, 0x50, 0x15, 0x22, 0x0d, - 0x98, 0x77, 0xce, 0x8f, 0x9d, 0x87, 0x2d, 0x56, 0x57, 0x77, 0x57, 0x3f, 0x7a, 0xca, 0xb0, 0x86, - 0xad, 0xfb, 0xf0, 0xe4, 0x36, 0xcc, 0xc3, 0x44, 0xae, 0x64, 0x5d, 0xc3, 0x8e, 0x2c, 0xd4, 0xce, - 0x2f, 0xa1, 0x9a, 0x55, 0x95, 0x6a, 0xc9, 0x63, 0x47, 0x6b, 0x3a, 0x0b, 0x85, 0xb4, 0x16, 0xf4, - 0xd3, 0xb2, 0xbe, 0xad, 0x5c, 0x1e, 0x3d, 0x86, 0x67, 0xee, 0xcd, 0xc0, 0x7d, 0x3b, 0x0e, 0xfc, - 0x9b, 0xc1, 0x24, 0x18, 0x5d, 0x8e, 0xc6, 0xc1, 0x64, 0x3c, 0x08, 0x6e, 0xfb, 0xae, 0xff, 0xda, - 0xef, 0x7b, 0x5d, 0xa5, 0x0d, 0x11, 0x35, 0xaf, 0xef, 0x75, 0x01, 0xea, 0xc1, 0x47, 0x4d, 0xe4, - 0x2f, 0x70, 0xe4, 0xfc, 0x06, 0xf0, 0xde, 0xbb, 0xdd, 0xd3, 0xa3, 0x04, 0xaa, 0x22, 0x25, 0xd4, - 0x16, 0xac, 0xbc, 0xb6, 0x6e, 0xb6, 0x03, 0x22, 0x06, 0xcb, 0xfc, 0xfc, 0xed, 0xd7, 0xd7, 0x23, - 0x1d, 0x69, 0xb8, 0xe5, 0x6b, 0xec, 0xc6, 0x89, 0x20, 0x0e, 0x8d, 0xdb, 0x4b, 0xf9, 0xd0, 0xb8, - 0xfd, 0xd4, 0xff, 0x37, 0x4e, 0xe4, 0x7b, 0xe5, 0xae, 0x36, 0x06, 0x58, 0x6f, 0x0c, 0xf0, 0x73, - 0x63, 0x80, 0x2f, 0x5b, 0x43, 0x59, 0x6f, 0x0d, 0xe5, 0xfb, 0xd6, 0x50, 0xde, 0x3f, 0x89, 0x62, - 0xfe, 0xb1, 0x98, 0xda, 0x1f, 0x68, 0x82, 0xd9, 0x2c, 0xce, 0x9e, 0x25, 0xa4, 0x94, 0x36, 0x9f, - 0xa4, 0x11, 0x5f, 0x66, 0x84, 0x4d, 0xd5, 0xea, 0x67, 0x3e, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, - 0x79, 0x27, 0xfa, 0xc0, 0x3e, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Alerts gets all alerts in state under the given status. If no status is - // given, all Alerts are returned - Alerts(ctx context.Context, in *AlertsRequest, opts ...grpc.CallOption) (*AlertsResponse, error) - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Alerts(ctx context.Context, in *AlertsRequest, opts ...grpc.CallOption) (*AlertsResponse, error) { - out := new(AlertsResponse) - err := c.cc.Invoke(ctx, "/slinky.alerts.v1.Query/Alerts", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, "/slinky.alerts.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Alerts gets all alerts in state under the given status. If no status is - // given, all Alerts are returned - Alerts(context.Context, *AlertsRequest) (*AlertsResponse, error) - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Alerts(ctx context.Context, req *AlertsRequest) (*AlertsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Alerts not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Alerts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AlertsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Alerts(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.alerts.v1.Query/Alerts", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Alerts(ctx, req.(*AlertsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.alerts.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.alerts.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Alerts", - Handler: _Query_Alerts_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/alerts/v1/query.proto", -} - -func (m *AlertsRequest) 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 *AlertsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlertsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Status != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AlertsResponse) 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 *AlertsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AlertsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Alerts) > 0 { - for iNdEx := len(m.Alerts) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Alerts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *AlertsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != 0 { - n += 1 + sovQuery(uint64(m.Status)) - } - return n -} - -func (m *AlertsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Alerts) > 0 { - for _, e := range m.Alerts { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *ParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *AlertsRequest) 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 ErrIntOverflowQuery - } - 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: AlertsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlertsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= AlertStatusID(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AlertsResponse) 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 ErrIntOverflowQuery - } - 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: AlertsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AlertsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alerts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Alerts = append(m.Alerts, Alert{}) - if err := m.Alerts[len(m.Alerts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsRequest) 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 ErrIntOverflowQuery - } - 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: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsResponse) 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 ErrIntOverflowQuery - } - 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: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/alerts/types/query.pb.gw.go b/x/alerts/types/query.pb.gw.go deleted file mode 100644 index 351b3c93e..000000000 --- a/x/alerts/types/query.pb.gw.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: slinky/alerts/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -var ( - filter_Query_Alerts_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_Alerts_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AlertsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Alerts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Alerts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Alerts_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AlertsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Alerts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Alerts(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Alerts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Alerts_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Alerts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Alerts_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Alerts_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Alerts_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Alerts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"slinky", "alerts", "v1"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "alerts", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Alerts_0 = runtime.ForwardResponseMessage - - forward_Query_Params_0 = runtime.ForwardResponseMessage -) diff --git a/x/alerts/types/strategies/codec.go b/x/alerts/types/strategies/codec.go deleted file mode 100644 index 7a78de283..000000000 --- a/x/alerts/types/strategies/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package strategies - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - "github.com/cosmos/cosmos-sdk/codec/types" - - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -// RegisterLegacyAminoCodec registers the necessary x/incentives interfaces (messages) on the -// cdc. These types are used for amino serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // register the ValidatorAlertIncentive - legacy.RegisterAminoMsg(cdc, &ValidatorAlertIncentive{}, "slinky/x/alerts/ValidatorAlertIncentive") -} - -// RegisterInterfaces registers the x/incentives messages + message service w/ the InterfaceRegistry (registry). -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*incentivetypes.Incentive)(nil), - &ValidatorAlertIncentive{}, - ) -} diff --git a/x/alerts/types/strategies/handlers.go b/x/alerts/types/strategies/handlers.go deleted file mode 100644 index 7067d0462..000000000 --- a/x/alerts/types/strategies/handlers.go +++ /dev/null @@ -1,12 +0,0 @@ -package strategies - -import ( - cmtabci "github.com/cometbft/cometbft/abci/types" - - "github.com/skip-mev/slinky/x/alerts/types" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -// ValidatorIncentiveHandler determines whether a validator's price report deviated significantly from -// what was expected off-chain, and returns the alert to be issued to the incentives keeper if so. -type ValidatorIncentiveHandler func(ve cmtabci.ExtendedVoteInfo, pb types.PriceBound, a types.Alert, cpID uint64) (incentivetypes.Incentive, error) diff --git a/x/alerts/types/strategies/strategies.pb.go b/x/alerts/types/strategies/strategies.pb.go deleted file mode 100644 index d247c791d..000000000 --- a/x/alerts/types/strategies/strategies.pb.go +++ /dev/null @@ -1,425 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/alerts/v1/strategies.proto - -package strategies - -import ( - fmt "fmt" - types "github.com/cometbft/cometbft/abci/types" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// ValidatorAlertIncentive defines the incentive strategy to be executed for a -// validator that has been confirmed to have at fault for an x/alerts alert. -// This strategy is expected to slash half of the validator's stake. -type ValidatorAlertIncentive struct { - // The validator that has been confirmed to have been at fault for an alert. - Validator types.Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` - // AlertSigner is the signer of the alert referenced by the conclusion that - // created this incentive. - AlertSigner string `protobuf:"bytes,2,opt,name=alert_signer,json=alertSigner,proto3" json:"alert_signer,omitempty"` - // AlertHeight is the height at which the infraction occurred - AlertHeight uint64 `protobuf:"varint,3,opt,name=alert_height,json=alertHeight,proto3" json:"alert_height,omitempty"` -} - -func (m *ValidatorAlertIncentive) Reset() { *m = ValidatorAlertIncentive{} } -func (m *ValidatorAlertIncentive) String() string { return proto.CompactTextString(m) } -func (*ValidatorAlertIncentive) ProtoMessage() {} -func (*ValidatorAlertIncentive) Descriptor() ([]byte, []int) { - return fileDescriptor_1771803e525beb24, []int{0} -} -func (m *ValidatorAlertIncentive) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorAlertIncentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorAlertIncentive.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 *ValidatorAlertIncentive) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorAlertIncentive.Merge(m, src) -} -func (m *ValidatorAlertIncentive) XXX_Size() int { - return m.Size() -} -func (m *ValidatorAlertIncentive) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorAlertIncentive.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorAlertIncentive proto.InternalMessageInfo - -func (m *ValidatorAlertIncentive) GetValidator() types.Validator { - if m != nil { - return m.Validator - } - return types.Validator{} -} - -func (m *ValidatorAlertIncentive) GetAlertSigner() string { - if m != nil { - return m.AlertSigner - } - return "" -} - -func (m *ValidatorAlertIncentive) GetAlertHeight() uint64 { - if m != nil { - return m.AlertHeight - } - return 0 -} - -func init() { - proto.RegisterType((*ValidatorAlertIncentive)(nil), "slinky.alerts.v1.ValidatorAlertIncentive") -} - -func init() { proto.RegisterFile("slinky/alerts/v1/strategies.proto", fileDescriptor_1771803e525beb24) } - -var fileDescriptor_1771803e525beb24 = []byte{ - // 350 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0x4f, 0xcc, 0x49, 0x2d, 0x2a, 0x29, 0xd6, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x29, - 0x4a, 0x2c, 0x49, 0x4d, 0xcf, 0x4c, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, - 0x28, 0xd1, 0x83, 0x28, 0xd1, 0x2b, 0x33, 0x94, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, - 0x93, 0x10, 0x45, 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x60, 0x9e, 0x3e, 0x84, - 0x03, 0x95, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x50, 0x51, 0xe9, 0x92, 0xd4, - 0xbc, 0x94, 0xd4, 0xa2, 0xdc, 0xcc, 0xbc, 0x12, 0xfd, 0xc4, 0xa4, 0xe4, 0x4c, 0xfd, 0x92, 0xca, - 0x02, 0x98, 0x95, 0x4a, 0x9d, 0x4c, 0x5c, 0xe2, 0x61, 0x89, 0x39, 0x99, 0x29, 0x89, 0x25, 0xf9, - 0x45, 0x8e, 0x20, 0x7b, 0x3d, 0xf3, 0x92, 0x53, 0xf3, 0x4a, 0x32, 0xcb, 0x52, 0x85, 0xec, 0xb8, - 0x38, 0xcb, 0x60, 0x52, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x08, 0xc3, 0xf4, - 0x40, 0x86, 0xe9, 0xc1, 0x35, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x84, 0xd0, 0x22, 0x64, - 0xcd, 0xc5, 0x03, 0xf6, 0x49, 0x7c, 0x71, 0x66, 0x7a, 0x5e, 0x6a, 0x91, 0x04, 0x93, 0x02, 0xa3, - 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, 0x67, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, - 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0x71, 0x83, 0x55, 0x07, 0x83, 0x15, 0x0b, 0x29, - 0xc2, 0x34, 0x67, 0xa4, 0x66, 0xa6, 0x67, 0x94, 0x48, 0x30, 0x2b, 0x30, 0x6a, 0xb0, 0x40, 0x95, - 0x78, 0x80, 0x85, 0xac, 0xfc, 0x4e, 0x6d, 0xd1, 0x95, 0x83, 0x06, 0x59, 0x26, 0xcc, 0xd5, 0xa0, - 0x60, 0xd3, 0x83, 0xfb, 0xa1, 0xeb, 0xf9, 0x06, 0x2d, 0x75, 0x68, 0xc0, 0x57, 0xc0, 0x82, 0x1e, - 0x87, 0x7f, 0x9d, 0xfc, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, - 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x24, - 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xbf, 0x38, 0x3b, 0xb3, 0x40, 0x37, - 0x37, 0xb5, 0x4c, 0x1f, 0xdd, 0x58, 0x70, 0xb0, 0x22, 0x45, 0x6a, 0x12, 0x1b, 0x38, 0x88, 0x8d, - 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0xae, 0xac, 0x85, 0xfa, 0x01, 0x00, 0x00, -} - -func (m *ValidatorAlertIncentive) 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 *ValidatorAlertIncentive) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorAlertIncentive) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AlertHeight != 0 { - i = encodeVarintStrategies(dAtA, i, uint64(m.AlertHeight)) - i-- - dAtA[i] = 0x18 - } - if len(m.AlertSigner) > 0 { - i -= len(m.AlertSigner) - copy(dAtA[i:], m.AlertSigner) - i = encodeVarintStrategies(dAtA, i, uint64(len(m.AlertSigner))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStrategies(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintStrategies(dAtA []byte, offset int, v uint64) int { - offset -= sovStrategies(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ValidatorAlertIncentive) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Validator.Size() - n += 1 + l + sovStrategies(uint64(l)) - l = len(m.AlertSigner) - if l > 0 { - n += 1 + l + sovStrategies(uint64(l)) - } - if m.AlertHeight != 0 { - n += 1 + sovStrategies(uint64(m.AlertHeight)) - } - return n -} - -func sovStrategies(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozStrategies(x uint64) (n int) { - return sovStrategies(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ValidatorAlertIncentive) 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 ErrIntOverflowStrategies - } - 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: ValidatorAlertIncentive: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorAlertIncentive: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStrategies - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStrategies - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStrategies - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AlertSigner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStrategies - } - 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 ErrInvalidLengthStrategies - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStrategies - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AlertSigner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AlertHeight", wireType) - } - m.AlertHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStrategies - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AlertHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipStrategies(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthStrategies - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStrategies(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStrategies - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStrategies - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStrategies - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthStrategies - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupStrategies - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthStrategies - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthStrategies = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStrategies = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupStrategies = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/alerts/types/strategies/validator_incentive.go b/x/alerts/types/strategies/validator_incentive.go deleted file mode 100644 index 693692ee9..000000000 --- a/x/alerts/types/strategies/validator_incentive.go +++ /dev/null @@ -1,147 +0,0 @@ -package strategies - -import ( - "fmt" - - "cosmossdk.io/math" - cmtabci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/alerts/types" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -const ( - // ValidatorAlertIncentiveType is the type of incentive issued for validators upon being referenced in a Conclusion. - ValidatorAlertIncentiveType = "validator_alert" -) - -var ( - _ incentivetypes.Incentive = (*ValidatorAlertIncentive)(nil) - defaultSlashFactor = math.LegacyNewDecFromIntWithPrec(math.NewInt(5), 1) -) - -// NewValidatorAlertIncentive returns a new ValidatorAlertIncentive. ValidatorAlertIncentive defines the incentive strategy to -// be executed for a validator that has been confirmed to have at fault for an x/alerts alert. This strategy is expected to -// slash half of the validator's stake, and reward the slashed stake to the alerter. -func NewValidatorAlertIncentive(validator cmtabci.Validator, alertHeight uint64, signer sdk.AccAddress) incentivetypes.Incentive { - return &ValidatorAlertIncentive{ - Validator: validator, - AlertHeight: alertHeight, - AlertSigner: signer.String(), - } -} - -// ValidateBasic does a basic stateless validation check on the ValidatorAlertIncentive. Specifically, this method -// checks that the validator's address is valid, and it's power is non-negative. -func (b *ValidatorAlertIncentive) ValidateBasic() error { - // the only check we can do statelessly is that the validator address is non-nil - if b.Validator.Address == nil { - return fmt.Errorf("validator address cannot be nil") - } - - // the only check we can do statelessly is that the validator power is non-negative - if b.Validator.Power <= 0 { - return fmt.Errorf("validator power must be > 0: %d", b.Validator.Power) - } - - // check signer validity - if _, err := sdk.AccAddressFromBech32(b.AlertSigner); err != nil { - return fmt.Errorf("validator address is invalid: %w", err) - } - - return nil -} - -// Type returns the type of the incentive. -func (b *ValidatorAlertIncentive) Type() string { - return ValidatorAlertIncentiveType -} - -// Copy returns a copy of the incentive. -func (b *ValidatorAlertIncentive) Copy() incentivetypes.Incentive { - val := b.Validator - - val.Address = make([]byte, len(b.Validator.Address)) - - // we need to copy the address, since it's a reference type - copy(val.Address, b.Validator.Address) - - return &ValidatorAlertIncentive{ - Validator: val, - AlertSigner: b.AlertSigner, - AlertHeight: b.AlertHeight, - } -} - -// DefaultValidatorAlertIncentiveStrategy is the default strategy for issuing incentives to validators upon being deemed -// at fault for an x/alerts alert. This method returns a Strategy that executes wrt. the given StakingKeeper / BankKeeper. -// -// NOTICE: -// The DefaultSlashFactor is 50% of each validator's stake. See NewValidatorAlertIncentiveStrategy for more details. -func DefaultValidatorAlertIncentiveStrategy(sk types.StakingKeeper, bk types.BankKeeper) incentivetypes.Strategy { - return NewValidatorAlertIncentiveStrategy(sk, bk, defaultSlashFactor) -} - -// NewValidatorAlertIncentiveStrategy is the default strategy for issuing incentives to validators upon being -// referenced in a Conclusion. This method returns a Strategy that executes wrt. the given StakingKeeper / BankKeeper. -// Notice, this strategy will slash half of the validator's stake, and mint the amount slashed to the alerter. -// -// CONTRACT: as of v0.50.0-rc2 of the Cosmos SDK, the Slash method will burn staked tokens, this is crucial to our logic -// in order for this operation to not inflate the bond-denom's total supply. -func NewValidatorAlertIncentiveStrategy(sk types.StakingKeeper, bk types.BankKeeper, slashFactor math.LegacyDec) incentivetypes.Strategy { - return func(ctx sdk.Context, incentive incentivetypes.Incentive) (_ incentivetypes.Incentive, err error) { - // assert type of incentive - validatorAlertIncentive, ok := incentive.(*ValidatorAlertIncentive) - if !ok { - return nil, fmt.Errorf("incentive must be of type ValidatorAlertIncentive, got %T", incentive) - } - - ctx.Logger().Info("validator alert incentive executed", "incentive", validatorAlertIncentive) - - ca := sdk.ConsAddress(validatorAlertIncentive.Validator.Address) - // check that the validator exists - if _, err := sk.GetValidatorByConsAddr(ctx, ca); err != nil { - return nil, fmt.Errorf("validator with address %s does not exist", ca) - } - - // adjust the alert height to account for the validator update delay to comet, notice - // comet's view of the validator set is always buffed, in that updates returned from the app - // are applied after the validator update delay blocks from when they are given to comet. - infractionHeight := validatorAlertIncentive.AlertHeight - uint64(sdk.ValidatorUpdateDelay) - - // slash the validator - amountSlashed, err := sk.Slash(ctx, ca, int64(infractionHeight), validatorAlertIncentive.Validator.Power, slashFactor) - if err != nil { - return nil, fmt.Errorf("failed to slash validator: %w", err) - } - - ctx.Logger().Info("slashed validator", "validator", validatorAlertIncentive.Validator, "amount_slashed", amountSlashed) - - // get bond denom to mint to alerter from slashed validator - denom, err := sk.BondDenom(ctx) - if err != nil { - return nil, fmt.Errorf("failed to get bond denom: %w", err) - } - coinsToMint := sdk.NewCoins(sdk.NewCoin(denom, amountSlashed)) - - // mint the slashed tokens (burned) to the signer of the alert - if err := bk.MintCoins(ctx, types.ModuleName, coinsToMint); err != nil { - return nil, fmt.Errorf("failed to mint coins: %w", err) - } - - alertSigner, err := sdk.AccAddressFromBech32(validatorAlertIncentive.AlertSigner) - if err != nil { - return nil, fmt.Errorf("failed to parse alert signer address: %w", err) - } - - // send the slashed tokens to the signer of the alert - if err := bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, alertSigner, coinsToMint); err != nil { - return nil, fmt.Errorf("failed to send coins: %w", err) - } - - ctx.Logger().Info("minted coins to alert signer", "signer", alertSigner, "amount_minted", amountSlashed) - - return nil, nil - } -} diff --git a/x/alerts/types/strategies/validator_incentive_handler.go b/x/alerts/types/strategies/validator_incentive_handler.go deleted file mode 100644 index ce2026277..000000000 --- a/x/alerts/types/strategies/validator_incentive_handler.go +++ /dev/null @@ -1,71 +0,0 @@ -package strategies - -import ( - "math/big" - - cmtabci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkyabci "github.com/skip-mev/slinky/abci/ve/types" - "github.com/skip-mev/slinky/x/alerts/types" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" -) - -// DefaultHandleValidatorIncentive returns a ValidatorIncentiveHandler which creates a ValidatorAlertIncentive if a validator -// reported a price that lied outside the bounds of what was expected off-chain. If a validator failed to report a price for -// the ticker, or their price was within the bounds, no incentive is issued. -// -// NOTICE: no signature checks are performed on the vote-extension, as it is expected that the caller has verified the -// ExtendedVoteInfo's signature before calling this function. -func DefaultHandleValidatorIncentive() ValidatorIncentiveHandler { - return func(ve cmtabci.ExtendedVoteInfo, pb types.PriceBound, a types.Alert, cpID uint64) (incentivetypes.Incentive, error) { - // validate the alert - if err := a.ValidateBasic(); err != nil { - return nil, err - } - - // validate the price-bound - if err := pb.ValidateBasic(); err != nil { - return nil, err - } - - // unmarshal the vote-extension - var voteExt slinkyabci.OracleVoteExtension - if err := voteExt.Unmarshal(ve.VoteExtension); err != nil { - return nil, err - } - - // check for existence, if it doesn't exist, return nil - priceBz, ok := voteExt.Prices[cpID] - if !ok { - return nil, nil - } - - var price big.Int - price.SetBytes(priceBz) - - // check bounds - low, err := pb.GetLowInt() - if err != nil { - return nil, err - } - - high, err := pb.GetHighInt() - if err != nil { - return nil, err - } - - // check if the price is outside the bounds - if !(price.Cmp(low) >= 0) || !(price.Cmp(high) <= 0) { - // get signer address - signer, err := sdk.AccAddressFromBech32(a.Signer) - if err != nil { - return nil, err - } - - return NewValidatorAlertIncentive(ve.Validator, a.Height, signer), nil - } - - return nil, nil - } -} diff --git a/x/alerts/types/strategies/validator_incentive_test.go b/x/alerts/types/strategies/validator_incentive_test.go deleted file mode 100644 index fcc29d3fe..000000000 --- a/x/alerts/types/strategies/validator_incentive_test.go +++ /dev/null @@ -1,469 +0,0 @@ -package strategies_test - -import ( - "fmt" - "math/big" - "testing" - - "cosmossdk.io/log" - "cosmossdk.io/math" - cmtabci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" - - slinkyabci "github.com/skip-mev/slinky/abci/ve/types" - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/alerts/types" - "github.com/skip-mev/slinky/x/alerts/types/mocks" - "github.com/skip-mev/slinky/x/alerts/types/strategies" - incentivetypes "github.com/skip-mev/slinky/x/incentives/types" - "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice" -) - -func TestValidatorAlertIncentive(t *testing.T) { - t.Run("test validate basic", func(t *testing.T) { - cases := []struct { - name string - validatorIncentive incentivetypes.Incentive - valid bool - }{ - { - "nil address", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: nil, - Power: 1, - }, 1, sdk.AccAddress("test")), - false, - }, - { - "negative power", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: -1, - }, 1, sdk.AccAddress("test")), - false, - }, - { - "zero power", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 0, - }, 1, sdk.AccAddress("test")), - false, - }, - { - "invalid acc-address string - fail", - &strategies.ValidatorAlertIncentive{ - Validator: cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, - AlertHeight: 1, - AlertSigner: "", - }, - false, - }, - { - "valid", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")), - true, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - err := tc.validatorIncentive.ValidateBasic() - - if tc.valid && err != nil { - t.Errorf("expected no error, got %s", err) - } - - if !tc.valid && err == nil { - t.Errorf("expected error, got nil") - } - }) - } - }) - - t.Run("test type", func(t *testing.T) { - ic := strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")) - - require.Equal(t, ic.Type(), strategies.ValidatorAlertIncentiveType) - }) - - t.Run("test copy", func(t *testing.T) { - ic := strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")) - - icCopy := ic.Copy() - - require.Equal(t, ic, icCopy) - require.False(t, &ic == &icCopy) - - // assert addresses are diff - addr1 := ic.(*strategies.ValidatorAlertIncentive).Validator.Address - addr2 := icCopy.(*strategies.ValidatorAlertIncentive).Validator.Address - - addr1[0] = 1 - - require.NotEqual(t, addr1, addr2) - }) -} - -func TestStrategy(t *testing.T) { - var ( - mockStakingKeeper *mocks.StakingKeeper - mockBankKeeper *mocks.BankKeeper - ) - - ctx := sdk.Context{}.WithLogger(log.NewNopLogger()) - - slashFraction := math.LegacyNewDecFromIntWithPrec(math.NewInt(5), 1) - - cases := []struct { - name string - validatorIncentive incentivetypes.Incentive - setup func() - expectedErr error - }{ - { - "incorrect incentive type", - &goodprice.GoodPriceIncentive{}, - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - }, - fmt.Errorf("incentive must be of type ValidatorAlertIncentive, got %T", &goodprice.GoodPriceIncentive{}), - }, - { - "validator not found error", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")), - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - mockStakingKeeper.On("GetValidatorByConsAddr", ctx, sdk.ConsAddress("test")).Return(stakingtypes.Validator{}, fmt.Errorf("error")).Once() - }, - fmt.Errorf("validator with address %s does not exist", sdk.ConsAddress("test")), - }, - { - "slash error", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")), - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - mockStakingKeeper.On("GetValidatorByConsAddr", ctx, sdk.ConsAddress("test")).Return(stakingtypes.Validator{}, nil).Once() - mockStakingKeeper.On("Slash", ctx, sdk.ConsAddress("test"), 1-sdk.ValidatorUpdateDelay, int64(1), slashFraction).Return(math.Int{}, fmt.Errorf("slash error")).Once() - }, - fmt.Errorf("failed to slash validator: slash error"), - }, - { - "bond denom error", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")), - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - mockStakingKeeper.On("GetValidatorByConsAddr", ctx, sdk.ConsAddress("test")).Return(stakingtypes.Validator{}, nil).Once() - mockStakingKeeper.On("Slash", ctx, sdk.ConsAddress("test"), 1-sdk.ValidatorUpdateDelay, int64(1), slashFraction).Return(math.NewInt(1), nil).Once() - mockStakingKeeper.On("BondDenom", ctx).Return("", fmt.Errorf("error")) - }, - fmt.Errorf("failed to get bond denom: error"), - }, - { - "mint coins error", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("test")), - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - mockStakingKeeper.On("GetValidatorByConsAddr", ctx, sdk.ConsAddress("test")).Return(stakingtypes.Validator{}, nil).Once() - mockStakingKeeper.On("Slash", ctx, sdk.ConsAddress("test"), 1-sdk.ValidatorUpdateDelay, int64(1), slashFraction).Return(math.NewInt(1), nil).Once() - mockStakingKeeper.On("BondDenom", ctx).Return("stake", nil).Once() - mockBankKeeper.On("MintCoins", ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1)))).Return(fmt.Errorf("mint error")).Once() - }, - fmt.Errorf("failed to mint coins: mint error"), - }, - { - "send coins error", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("signer")), - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - mockStakingKeeper.On("GetValidatorByConsAddr", ctx, sdk.ConsAddress("test")).Return(stakingtypes.Validator{}, nil).Once() - mockStakingKeeper.On("Slash", ctx, sdk.ConsAddress("test"), 1-sdk.ValidatorUpdateDelay, int64(1), slashFraction).Return(math.NewInt(1), nil).Once() - mockStakingKeeper.On("BondDenom", ctx).Return("stake", nil).Once() - mockBankKeeper.On("MintCoins", ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1)))).Return(nil).Once() - mockBankKeeper.On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, sdk.AccAddress("signer"), sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1)))).Return(fmt.Errorf("send error")).Once() - }, - fmt.Errorf("failed to send coins: send error"), - }, - { - "success", - strategies.NewValidatorAlertIncentive(cmtabci.Validator{ - Address: []byte("test"), - Power: 1, - }, 1, sdk.AccAddress("signer")), - func() { - mockStakingKeeper = mocks.NewStakingKeeper(t) - mockBankKeeper = mocks.NewBankKeeper(t) - mockStakingKeeper.On("GetValidatorByConsAddr", ctx, sdk.ConsAddress("test")).Return(stakingtypes.Validator{}, nil).Once() - mockStakingKeeper.On("Slash", ctx, sdk.ConsAddress("test"), 1-sdk.ValidatorUpdateDelay, int64(1), slashFraction).Return(math.NewInt(1), nil).Once() - mockStakingKeeper.On("BondDenom", ctx).Return("stake", nil).Once() - mockBankKeeper.On("MintCoins", ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1)))).Return(nil).Once() - mockBankKeeper.On("SendCoinsFromModuleToAccount", ctx, types.ModuleName, sdk.AccAddress("signer"), sdk.NewCoins(sdk.NewCoin("stake", math.NewInt(1)))).Return(nil).Once() - }, - nil, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - tc.setup() - strategy := strategies.DefaultValidatorAlertIncentiveStrategy(mockStakingKeeper, mockBankKeeper) - - _, err := strategy(ctx, tc.validatorIncentive) - if err == nil { - if tc.expectedErr != nil { - t.Errorf("expected error %s, got nil", tc.expectedErr) - } - return - } - - if err.Error() != tc.expectedErr.Error() { - t.Errorf("expected error %s, got %s", tc.expectedErr, err) - } - }) - } -} - -func TestDefaultHandler(t *testing.T) { - cases := []struct { - name string - od slinkyabci.OracleVoteExtension - pb types.PriceBound - a types.Alert - v cmtabci.Validator - ic *strategies.ValidatorAlertIncentive - id uint64 - valid bool - }{ - { - "invalid alert", - slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{}, - }, - types.PriceBound{ - High: "1", - Low: "2", - }, - types.Alert{ - Signer: sdk.AccAddress("test").String(), - Height: 1, - }, - cmtabci.Validator{ - Address: []byte("test"), - }, - nil, - 0, - false, - }, - { - "invalid price-bound", - slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{}, - }, - types.PriceBound{ - High: "1", - Low: "1", - }, - types.Alert{ - Signer: sdk.AccAddress("test").String(), - Height: 1, - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "A", - Quote: "B", - }, - }, - cmtabci.Validator{ - Address: []byte("test"), - }, - nil, - 0, - false, - }, - { - "no price report, nil incentive", - slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{}, - }, - types.PriceBound{ - High: "2", - Low: "1", - }, - types.Alert{ - Signer: sdk.AccAddress("test").String(), - Height: 1, - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "A", - Quote: "B", - }, - }, - cmtabci.Validator{ - Address: []byte("test"), - }, - nil, - 0, - true, - }, - { - "if price is higher than high bound, incentive is non-nil", - slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: big.NewInt(3).Bytes(), - }, - }, - types.PriceBound{ - High: "2", - Low: "1", - }, - types.Alert{ - Signer: sdk.AccAddress("signer").String(), - Height: 1, - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "A", - Quote: "B", - }, - }, - cmtabci.Validator{ - Address: []byte("test"), - }, - &strategies.ValidatorAlertIncentive{ - Validator: cmtabci.Validator{ - Address: []byte("test"), - }, - AlertSigner: sdk.AccAddress("signer").String(), - AlertHeight: 1, - }, - 0, - true, - }, - { - "if price is lower than low bound, incentive is non-nil", - slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: big.NewInt(0).Bytes(), - }, - }, - types.PriceBound{ - High: "2", - Low: "1", - }, - types.Alert{ - Signer: sdk.AccAddress("signer").String(), - Height: 1, - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "A", - Quote: "B", - }, - }, - cmtabci.Validator{ - Address: []byte("test"), - }, - &strategies.ValidatorAlertIncentive{ - Validator: cmtabci.Validator{ - Address: []byte("test"), - }, - AlertSigner: sdk.AccAddress("signer").String(), - AlertHeight: 1, - }, - 0, - true, - }, - { - "if price is within bounds, incentive is nil", - slinkyabci.OracleVoteExtension{ - Prices: map[uint64][]byte{ - 0: big.NewInt(1).Bytes(), - }, - }, - types.PriceBound{ - High: "2", - Low: "1", - }, - types.Alert{ - Signer: sdk.AccAddress("signer").String(), - Height: 1, - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "A", - Quote: "B", - }, - }, - cmtabci.Validator{ - Address: []byte("test"), - }, - nil, - 0, - true, - }, - } - - handler := strategies.DefaultHandleValidatorIncentive() - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - bz, err := tc.od.Marshal() - require.NoError(t, err) - - // create extendedVoteInfo - incentive, err := handler( - cmtabci.ExtendedVoteInfo{ - VoteExtension: bz, - Validator: tc.v, - }, - tc.pb, - tc.a, - tc.id, - ) - - // check for expected errors - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - return - } - - // if error is not expected, check for expected incentive - if tc.ic != nil { - gotIc, ok := incentive.(*strategies.ValidatorAlertIncentive) - require.True(t, ok) - - require.Equal(t, tc.ic, gotIc) - } else { - require.Nil(t, incentive) - } - }) - } -} diff --git a/x/alerts/types/tx.pb.go b/x/alerts/types/tx.pb.go deleted file mode 100644 index e93f4d1a3..000000000 --- a/x/alerts/types/tx.pb.go +++ /dev/null @@ -1,1346 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/alerts/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgAlert defines a message to create an alert. -type MsgAlert struct { - // alert is the alert to be filed - Alert Alert `protobuf:"bytes,1,opt,name=alert,proto3" json:"alert"` -} - -func (m *MsgAlert) Reset() { *m = MsgAlert{} } -func (m *MsgAlert) String() string { return proto.CompactTextString(m) } -func (*MsgAlert) ProtoMessage() {} -func (*MsgAlert) Descriptor() ([]byte, []int) { - return fileDescriptor_ddd37b6330b105e2, []int{0} -} -func (m *MsgAlert) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAlert) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAlert.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 *MsgAlert) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAlert.Merge(m, src) -} -func (m *MsgAlert) XXX_Size() int { - return m.Size() -} -func (m *MsgAlert) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAlert.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAlert proto.InternalMessageInfo - -func (m *MsgAlert) GetAlert() Alert { - if m != nil { - return m.Alert - } - return Alert{} -} - -type MsgAlertResponse struct { -} - -func (m *MsgAlertResponse) Reset() { *m = MsgAlertResponse{} } -func (m *MsgAlertResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAlertResponse) ProtoMessage() {} -func (*MsgAlertResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ddd37b6330b105e2, []int{1} -} -func (m *MsgAlertResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAlertResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAlertResponse.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 *MsgAlertResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAlertResponse.Merge(m, src) -} -func (m *MsgAlertResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAlertResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAlertResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAlertResponse proto.InternalMessageInfo - -// MsgConclusion defines a message carrying a Conclusion made by the SecondTier, -// which will be used to close an alert. And trigger any ramifications of the -// conclusion. -type MsgConclusion struct { - // signer is the signer of this transaction (notice, this may not always be a - // node from the SecondTier) - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // conclusion is the conclusion to be filed - Conclusion *types.Any `protobuf:"bytes,2,opt,name=conclusion,proto3" json:"conclusion,omitempty"` -} - -func (m *MsgConclusion) Reset() { *m = MsgConclusion{} } -func (m *MsgConclusion) String() string { return proto.CompactTextString(m) } -func (*MsgConclusion) ProtoMessage() {} -func (*MsgConclusion) Descriptor() ([]byte, []int) { - return fileDescriptor_ddd37b6330b105e2, []int{2} -} -func (m *MsgConclusion) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgConclusion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgConclusion.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 *MsgConclusion) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgConclusion.Merge(m, src) -} -func (m *MsgConclusion) XXX_Size() int { - return m.Size() -} -func (m *MsgConclusion) XXX_DiscardUnknown() { - xxx_messageInfo_MsgConclusion.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgConclusion proto.InternalMessageInfo - -func (m *MsgConclusion) GetSigner() string { - if m != nil { - return m.Signer - } - return "" -} - -func (m *MsgConclusion) GetConclusion() *types.Any { - if m != nil { - return m.Conclusion - } - return nil -} - -type MsgConclusionResponse struct { -} - -func (m *MsgConclusionResponse) Reset() { *m = MsgConclusionResponse{} } -func (m *MsgConclusionResponse) String() string { return proto.CompactTextString(m) } -func (*MsgConclusionResponse) ProtoMessage() {} -func (*MsgConclusionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ddd37b6330b105e2, []int{3} -} -func (m *MsgConclusionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgConclusionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgConclusionResponse.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 *MsgConclusionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgConclusionResponse.Merge(m, src) -} -func (m *MsgConclusionResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgConclusionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgConclusionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgConclusionResponse proto.InternalMessageInfo - -// MsgUpdateParams defines the message type expected by the UpdateParams rpc. It -// contains an authority address, and the new Params for the x/alerts module. -type MsgUpdateParams struct { - // authority is the address of the authority that is submitting the update - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params is the new set of parameters for the x/alerts module - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ddd37b6330b105e2, []int{4} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ddd37b6330b105e2, []int{5} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgAlert)(nil), "slinky.alerts.v1.MsgAlert") - proto.RegisterType((*MsgAlertResponse)(nil), "slinky.alerts.v1.MsgAlertResponse") - proto.RegisterType((*MsgConclusion)(nil), "slinky.alerts.v1.MsgConclusion") - proto.RegisterType((*MsgConclusionResponse)(nil), "slinky.alerts.v1.MsgConclusionResponse") - proto.RegisterType((*MsgUpdateParams)(nil), "slinky.alerts.v1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "slinky.alerts.v1.MsgUpdateParamsResponse") -} - -func init() { proto.RegisterFile("slinky/alerts/v1/tx.proto", fileDescriptor_ddd37b6330b105e2) } - -var fileDescriptor_ddd37b6330b105e2 = []byte{ - // 536 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0x0b, 0x89, 0xe8, 0x01, 0xa2, 0x58, 0x41, 0x49, 0x8c, 0xea, 0x50, 0x2f, 0xd0, 0x48, - 0xf1, 0x91, 0x56, 0xca, 0x90, 0x2d, 0xe9, 0xc0, 0x14, 0x09, 0x05, 0x95, 0x01, 0x21, 0x21, 0x27, - 0x39, 0xae, 0x56, 0xe3, 0x3b, 0xcb, 0xcf, 0x89, 0xea, 0x0d, 0x31, 0xc2, 0xc2, 0x4f, 0xe0, 0x27, - 0x64, 0xe8, 0xc2, 0x3f, 0xa8, 0x60, 0xa9, 0x98, 0x98, 0x10, 0x4a, 0x86, 0xf0, 0x33, 0x90, 0xcf, - 0x77, 0x71, 0x1a, 0x07, 0x65, 0xb1, 0xfc, 0xee, 0xfb, 0xde, 0xf7, 0xbd, 0xef, 0xdd, 0xa1, 0x0a, - 0x8c, 0x5c, 0x76, 0x1e, 0x61, 0x67, 0x44, 0x82, 0x10, 0xf0, 0xa4, 0x81, 0xc3, 0x0b, 0xdb, 0x0f, - 0x78, 0xc8, 0xf5, 0xbd, 0x04, 0xb2, 0x13, 0xc8, 0x9e, 0x34, 0x8c, 0xfd, 0x0c, 0x59, 0x62, 0xa2, - 0xc1, 0xa8, 0x0c, 0x38, 0x78, 0x1c, 0xde, 0x89, 0x0a, 0x27, 0x85, 0x84, 0x4a, 0x49, 0x85, 0x3d, - 0xa0, 0x71, 0x9b, 0x07, 0x54, 0x02, 0x0f, 0x1d, 0xcf, 0x65, 0x1c, 0x8b, 0xaf, 0x3c, 0x2a, 0x52, - 0x4e, 0x79, 0xa2, 0x11, 0xff, 0x29, 0x71, 0xca, 0x39, 0x1d, 0x11, 0x2c, 0xaa, 0xfe, 0xf8, 0x3d, - 0x76, 0x58, 0x24, 0x21, 0x33, 0x33, 0x16, 0x25, 0x8c, 0x80, 0x2b, 0xcd, 0xad, 0x3e, 0xba, 0xd3, - 0x05, 0xda, 0x8e, 0x51, 0xfd, 0x18, 0xe5, 0x05, 0xad, 0xac, 0x3d, 0xd1, 0x9e, 0xdd, 0x3d, 0x2a, - 0xd9, 0xeb, 0x21, 0x6d, 0xc1, 0xeb, 0xdc, 0xbe, 0xfa, 0x5d, 0xcd, 0xf5, 0x12, 0x6e, 0xeb, 0xe0, - 0xef, 0xd7, 0x6a, 0xee, 0xd3, 0x62, 0x5a, 0x2b, 0x4b, 0xa7, 0x0b, 0xe5, 0xa5, 0x74, 0x2d, 0x1d, - 0xed, 0xa9, 0xff, 0x1e, 0x01, 0x9f, 0x33, 0x20, 0xd6, 0x0f, 0x0d, 0xdd, 0xef, 0x02, 0x3d, 0xe1, - 0x6c, 0x30, 0x1a, 0x83, 0xcb, 0x99, 0xfe, 0x1c, 0x15, 0xc0, 0xa5, 0x8c, 0x04, 0xc2, 0x7e, 0xb7, - 0x53, 0xfe, 0x79, 0x59, 0x2f, 0xca, 0x45, 0xb5, 0x87, 0xc3, 0x80, 0x00, 0xbc, 0x0a, 0x03, 0x97, - 0xd1, 0x9e, 0xe4, 0xe9, 0xa7, 0x08, 0x0d, 0x96, 0xfd, 0xe5, 0x1d, 0x31, 0x74, 0xd1, 0x4e, 0x76, - 0x61, 0xab, 0x5d, 0xd8, 0x6d, 0x16, 0x75, 0xaa, 0xdf, 0x2f, 0xeb, 0x8f, 0x33, 0x69, 0x52, 0xf3, - 0xde, 0x8a, 0x50, 0xab, 0x11, 0x27, 0xfa, 0xb8, 0x98, 0xd6, 0xa4, 0x4f, 0x1c, 0x6e, 0x7f, 0x43, - 0xb8, 0xb4, 0xdd, 0x2a, 0xa1, 0x47, 0x37, 0x0e, 0x96, 0x31, 0xbf, 0x69, 0xe8, 0x41, 0x17, 0xe8, - 0xa9, 0x3f, 0x74, 0x42, 0xf2, 0xd2, 0x09, 0x1c, 0x0f, 0xf4, 0x26, 0xda, 0x75, 0xc6, 0xe1, 0x19, - 0x0f, 0xdc, 0x30, 0xda, 0x9a, 0x35, 0xa5, 0xea, 0x4d, 0x54, 0xf0, 0x85, 0x82, 0x8c, 0x5a, 0xce, - 0xde, 0x4f, 0xe2, 0x20, 0x2f, 0x48, 0xb2, 0x5b, 0x4d, 0x95, 0x27, 0xd5, 0x8a, 0x23, 0x55, 0x37, - 0x44, 0x5a, 0x9d, 0xd3, 0xaa, 0xa0, 0xd2, 0xda, 0x91, 0x8a, 0x75, 0xf4, 0x79, 0x07, 0xdd, 0xea, - 0x02, 0xd5, 0x5f, 0xa0, 0x7c, 0xf2, 0x74, 0x8c, 0xec, 0x2c, 0xea, 0xca, 0x0d, 0xeb, 0xff, 0x98, - 0x12, 0xd4, 0x5f, 0x23, 0xb4, 0xf2, 0x14, 0xaa, 0x1b, 0x3b, 0x52, 0x82, 0xf1, 0x74, 0x0b, 0x61, - 0xa9, 0xfb, 0x16, 0xdd, 0xbb, 0xb1, 0xfb, 0x83, 0x8d, 0x8d, 0xab, 0x14, 0xe3, 0x70, 0x2b, 0x45, - 0xa9, 0x1b, 0xf9, 0x0f, 0x8b, 0x69, 0x4d, 0xeb, 0x9c, 0x5c, 0xcd, 0x4c, 0xed, 0x7a, 0x66, 0x6a, - 0x7f, 0x66, 0xa6, 0xf6, 0x65, 0x6e, 0xe6, 0xae, 0xe7, 0x66, 0xee, 0xd7, 0xdc, 0xcc, 0xbd, 0x39, - 0xa4, 0x6e, 0x78, 0x36, 0xee, 0xdb, 0x03, 0xee, 0x61, 0x38, 0x77, 0xfd, 0xba, 0x47, 0x26, 0x78, - 0x7d, 0xef, 0x61, 0xe4, 0x13, 0xe8, 0x17, 0xc4, 0x83, 0x3d, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, - 0x54, 0x0a, 0x26, 0x99, 0x75, 0x04, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // Alert creates a new alert. On alert creation (if valid), the alert will be - // saved to state, and its bond will be escrowed until a corresponding - // Conclusion is filed to close the alert. - Alert(ctx context.Context, in *MsgAlert, opts ...grpc.CallOption) (*MsgAlertResponse, error) - // Conclusion closes an alert. On alert conclusion (if valid), the alert will - // be marked as Concluded, the bond for the alert will either be burned or - // returned, and a set of incentives will be issued to the validators deemed - // malicious by the conclusion. - Conclusion(ctx context.Context, in *MsgConclusion, opts ...grpc.CallOption) (*MsgConclusionResponse, error) - // UpdateParams updates the parameters of the alerts module. Specifically, the - // only address that is capable of submitting this Msg is the - // module-authority, in general, the x/gov module-account. The process for - // executing this message will be via governance proposal - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) Alert(ctx context.Context, in *MsgAlert, opts ...grpc.CallOption) (*MsgAlertResponse, error) { - out := new(MsgAlertResponse) - err := c.cc.Invoke(ctx, "/slinky.alerts.v1.Msg/Alert", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Conclusion(ctx context.Context, in *MsgConclusion, opts ...grpc.CallOption) (*MsgConclusionResponse, error) { - out := new(MsgConclusionResponse) - err := c.cc.Invoke(ctx, "/slinky.alerts.v1.Msg/Conclusion", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/slinky.alerts.v1.Msg/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // Alert creates a new alert. On alert creation (if valid), the alert will be - // saved to state, and its bond will be escrowed until a corresponding - // Conclusion is filed to close the alert. - Alert(context.Context, *MsgAlert) (*MsgAlertResponse, error) - // Conclusion closes an alert. On alert conclusion (if valid), the alert will - // be marked as Concluded, the bond for the alert will either be burned or - // returned, and a set of incentives will be issued to the validators deemed - // malicious by the conclusion. - Conclusion(context.Context, *MsgConclusion) (*MsgConclusionResponse, error) - // UpdateParams updates the parameters of the alerts module. Specifically, the - // only address that is capable of submitting this Msg is the - // module-authority, in general, the x/gov module-account. The process for - // executing this message will be via governance proposal - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) Alert(ctx context.Context, req *MsgAlert) (*MsgAlertResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Alert not implemented") -} -func (*UnimplementedMsgServer) Conclusion(ctx context.Context, req *MsgConclusion) (*MsgConclusionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Conclusion not implemented") -} -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_Alert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAlert) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Alert(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.alerts.v1.Msg/Alert", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Alert(ctx, req.(*MsgAlert)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Conclusion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgConclusion) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Conclusion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.alerts.v1.Msg/Conclusion", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Conclusion(ctx, req.(*MsgConclusion)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.alerts.v1.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.alerts.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Alert", - Handler: _Msg_Alert_Handler, - }, - { - MethodName: "Conclusion", - Handler: _Msg_Conclusion_Handler, - }, - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/alerts/v1/tx.proto", -} - -func (m *MsgAlert) 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 *MsgAlert) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAlert) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Alert.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgAlertResponse) 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 *MsgAlertResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAlertResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgConclusion) 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 *MsgConclusion) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgConclusion) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Conclusion != nil { - { - size, err := m.Conclusion.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgConclusionResponse) 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 *MsgConclusionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgConclusionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgAlert) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Alert.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgAlertResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgConclusion) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Conclusion != nil { - l = m.Conclusion.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgConclusionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgAlert) 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 ErrIntOverflowTx - } - 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: MsgAlert: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAlert: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alert", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Alert.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAlertResponse) 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 ErrIntOverflowTx - } - 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: MsgAlertResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAlertResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgConclusion) 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 ErrIntOverflowTx - } - 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: MsgConclusion: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConclusion: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conclusion", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Conclusion == nil { - m.Conclusion = &types.Any{} - } - if err := m.Conclusion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgConclusionResponse) 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 ErrIntOverflowTx - } - 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: MsgConclusionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgConclusionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParams) 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 ErrIntOverflowTx - } - 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: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParamsResponse) 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 ErrIntOverflowTx - } - 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: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/incentives/client/cli/query.go b/x/incentives/client/cli/query.go deleted file mode 100644 index 5f1face9b..000000000 --- a/x/incentives/client/cli/query.go +++ /dev/null @@ -1,98 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -// GetQueryCmd returns the parent command for all x/incentives cli query commands. The -// provided clientCtx should have, at a minimum, a verifier, CometBFT RPC client, -// and marshaler set. -func GetQueryCmd() *cobra.Command { - // create base-command - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), - RunE: client.ValidateCmd, - } - - // add sub-commands - cmd.AddCommand( - GetIncentivesByTypeCmd(), - GetAllIncentivesCmd(), - ) - - return cmd -} - -// GetIncentivesByTypeCmd returns the cli-command that queries the incentives of a given type. -// This is essentially a wrapper around the module's QueryClient, as under-the-hood it constructs -// a request to a query-client served over a grpc-conn embedded in the clientCtx. -func GetIncentivesByTypeCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "type [type]", - Short: "Query for all incentives of a specified type", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - // get context - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // retrieve incentive type from arguments - incentiveType := args[0] - - // create client - qc := types.NewQueryClient(clientCtx) - - // query for incentives - res, err := qc.GetIncentivesByType(clientCtx.CmdContext, &types.GetIncentivesByTypeRequest{ - IncentiveType: incentiveType, - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -// GetAllIncentivesCmd returns the cli-command that queries all incentives currently stored in the -// incentives module. This is essentially a wrapper around the module's QueryClient, as under-the-hood -// it constructs a request to a query-client served over a grpc-conn embedded in the clientCtx. -func GetAllIncentivesCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "all-incentives", - Short: "Query for all incentives currently stored in the module", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, _ []string) error { - // get context - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - // create client - qc := types.NewQueryClient(clientCtx) - - // query for incentives - res, err := qc.GetAllIncentives(clientCtx.CmdContext, &types.GetAllIncentivesRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - flags.AddQueryFlagsToCmd(cmd) - return cmd -} diff --git a/x/incentives/keeper/genesis.go b/x/incentives/keeper/genesis.go deleted file mode 100644 index d5f532180..000000000 --- a/x/incentives/keeper/genesis.go +++ /dev/null @@ -1,88 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -// InitGenesis initializes the store state from a genesis state. Note, that -// all of the incentive types (e.g. badprice, goodprice) must be registered -// with the keeper in order for this to execute successfully. -func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { - // Validate the genesis state. - if err := gs.ValidateBasic(); err != nil { - panic(err) - } - - // Create a reverse map of the incentives. - reverseMap := make(map[string]types.Incentive) - for incentive := range k.incentiveStrategies { - reverseMap[incentive.Type()] = incentive - } - - // Add each incentive to the store. - for _, entry := range gs.Registry { - name, incentives := entry.IncentiveType, entry.Entries - - // Get the incentive type. - incentiveType, ok := reverseMap[name] - if !ok { - panic("unknown incentive type: " + name) - } - - // Unmarshal each incentive with the correspond type. - unmarshalledIncentives := make([]types.Incentive, len(incentives)) - for i, bz := range incentives { - // Attempt to unmarshal the incentive. - if err := incentiveType.Unmarshal(bz); err != nil { - panic(err) - } - - unmarshalledIncentives[i] = incentiveType.Copy() - } - - // Add the incentives to the store. - if err := k.AddIncentives(ctx, unmarshalledIncentives); err != nil { - panic(err) - } - - // Remove the incentive type from the reverse map since we've already - // processed it. - delete(reverseMap, name) - } -} - -// ExportGenesis returns the current store state as a genesis state. Note, that -// if any of the incentive types have no entries in the store, they will not -// be included in the genesis state. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - incentiveGenesis := make([]types.IncentivesByType, 0) - - // Get all of the incentive types and sort them by name. - sortedIncentives := types.SortIncentivesStrategiesMap(k.incentiveStrategies) - - // Iterate over each incentive type. - for _, incentiveType := range sortedIncentives { - // Get the incentives for the current type. - incentives, err := k.GetIncentivesByType(ctx, incentiveType) - if err != nil { - panic(err) - } - - if len(incentives) == 0 { - continue - } - - // Marshal each incentive. - marshalledIncentives, err := types.IncentivesToBytes(incentives...) - if err != nil { - panic(err) - } - - // Add the incentives to the genesis state. - incentiveGenesis = append(incentiveGenesis, types.NewIncentives(incentiveType.Type(), marshalledIncentives)) - } - - return types.NewGenesisState(incentiveGenesis) -} diff --git a/x/incentives/keeper/genesis_test.go b/x/incentives/keeper/genesis_test.go deleted file mode 100644 index b9c9f4270..000000000 --- a/x/incentives/keeper/genesis_test.go +++ /dev/null @@ -1,283 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" - "github.com/skip-mev/slinky/x/incentives/types/examples/badprice" - "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice" -) - -func (s *KeeperTestSuite) TestInitGenesis() { - s.Run("can initialize genesis with no incentives", func() { - genesis := types.NewDefaultGenesisState() - s.incentivesKeeper.InitGenesis(s.ctx, *genesis) - }) - - s.Run("can initialize genesis with a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - // Create the genesis state. - bz, err := badPrice.Marshal() - s.Require().NoError(err) - - badPriceIncentives := types.NewIncentives(badprice.BadPriceIncentiveType, [][]byte{bz}) - genesis := types.NewGenesisState([]types.IncentivesByType{badPriceIncentives}) - - // Initialize the genesis state. - s.incentivesKeeper.InitGenesis(s.ctx, *genesis) - - // Check that the incentive was added to the store. - incentives, err := s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - // Check that the incentive is the same as the one we added. - i, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator.String(), i.Validator) - s.Require().Equal(amount.String(), i.Amount) - }) - - s.Run("can initialize genesis with multiple incentives", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - - // Create the genesis state. - bz1, err := badPrice1.Marshal() - s.Require().NoError(err) - - bz2, err := badPrice2.Marshal() - s.Require().NoError(err) - - badPriceIncentives := types.NewIncentives(badprice.BadPriceIncentiveType, [][]byte{bz1, bz2}) - genesis := types.NewGenesisState([]types.IncentivesByType{badPriceIncentives}) - - // Initialize the genesis state. - s.incentivesKeeper.InitGenesis(s.ctx, *genesis) - - // Check that the incentives were added to the store. - incentives, err := s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - // Check that the incentives are the same as the ones we added. - i1, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(amount1.String(), i1.Amount) - - i2, ok := incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(amount2.String(), i2.Amount) - }) - - s.Run("can initialize genesis with multiple incentive types", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice := badprice.NewBadPriceIncentive(validator1, amount1) - goodPrice := goodprice.NewGoodPriceIncentive(validator2, amount2) - - // Create the genesis state. - bz1, err := badPrice.Marshal() - s.Require().NoError(err) - - bz2, err := goodPrice.Marshal() - s.Require().NoError(err) - - badPriceIncentives := types.NewIncentives(badprice.BadPriceIncentiveType, [][]byte{bz1}) - goodPriceIncentives := types.NewIncentives(goodprice.GoodPriceIncentiveType, [][]byte{bz2}) - genesis := types.NewGenesisState([]types.IncentivesByType{badPriceIncentives, goodPriceIncentives}) - - // Initialize the genesis state. - s.incentivesKeeper.InitGenesis(s.ctx, *genesis) - - // Check that the incentives were added to the store. - incentives, err := s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i1, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(amount1.String(), i1.Amount) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i2, ok := incentives[0].(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(amount2.String(), i2.Amount) - }) - - s.Run("errors when initializing genesis with unsupported incentive type", func() { - unsupportedIncentive := types.NewIncentives("unsupported", [][]byte{[]byte("unsupported")}) - genesis := types.NewGenesisState([]types.IncentivesByType{unsupportedIncentive}) - - // catch and check that initgenesis panics - defer func() { - r := recover() - s.Require().NotNil(r) - }() - - s.incentivesKeeper.InitGenesis(s.ctx, *genesis) - }) - - s.Run("errors when initializing genesis with invalid incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - // marshal the incentive to a byte slice - bz, err := badPrice.Marshal() - s.Require().NoError(err) - - // modify the byte slice to make it invalid - bz[0] = 0x00 - - // create the genesis state - badPriceIncentives := types.NewIncentives(badprice.BadPriceIncentiveType, [][]byte{bz}) - genesis := types.NewGenesisState([]types.IncentivesByType{badPriceIncentives}) - - // catch and check that initgenesis panics - defer func() { - r := recover() - s.Require().NotNil(r) - }() - - s.incentivesKeeper.InitGenesis(s.ctx, *genesis) - }) -} - -func (s *KeeperTestSuite) TestExportGenesis() { - s.Run("can export genesis with no incentives", func() { - genesis := s.incentivesKeeper.ExportGenesis(s.ctx) - s.Require().NotNil(genesis) - - // Check that the genesis state is valid. - err := genesis.ValidateBasic() - s.Require().NoError(err) - - // Check that the genesis state is empty. - s.Require().Len(genesis.Registry, 0) - }) - - s.Run("can export genesis with a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - // Add the incentive to the store. - err := s.incentivesKeeper.AddIncentives(s.ctx, []types.Incentive{badPrice}) - s.Require().NoError(err) - - // Export the genesis state. - genesis := s.incentivesKeeper.ExportGenesis(s.ctx) - s.Require().NotNil(genesis) - - // Check that the genesis state is valid. - err = genesis.ValidateBasic() - s.Require().NoError(err) - - // Check that the genesis state contains the incentive. - s.Require().Len(genesis.Registry, 1) - s.Require().Equal(badprice.BadPriceIncentiveType, genesis.Registry[0].IncentiveType) - s.Require().Len(genesis.Registry[0].Entries, 1) - - bz, err := badPrice.Marshal() - s.Require().NoError(err) - s.Require().Equal(bz, genesis.Registry[0].Entries[0]) - }) - - s.Run("can export genesis with multiple incentives", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - - // Add the incentives to the store. - err := s.incentivesKeeper.AddIncentives(s.ctx, []types.Incentive{badPrice1, badPrice2}) - s.Require().NoError(err) - - // Export the genesis state. - genesis := s.incentivesKeeper.ExportGenesis(s.ctx) - s.Require().NotNil(genesis) - - // Check that the genesis state is valid. - err = genesis.ValidateBasic() - s.Require().NoError(err) - - // Check that the genesis state contains the incentives. - s.Require().Len(genesis.Registry, 1) - s.Require().Equal(badprice.BadPriceIncentiveType, genesis.Registry[0].IncentiveType) - s.Require().Len(genesis.Registry[0].Entries, 2) - - bz1, err := badPrice1.Marshal() - s.Require().NoError(err) - - bz2, err := badPrice2.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz1, genesis.Registry[0].Entries[0]) - s.Require().Equal(bz2, genesis.Registry[0].Entries[1]) - }) - - s.Run("can export genesis with multiple incentive types", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice := badprice.NewBadPriceIncentive(validator1, amount1) - goodPrice := goodprice.NewGoodPriceIncentive(validator2, amount2) - - // Add the incentives to the store. - err := s.incentivesKeeper.AddIncentives(s.ctx, []types.Incentive{badPrice, goodPrice}) - s.Require().NoError(err) - - // Export the genesis state. - genesis := s.incentivesKeeper.ExportGenesis(s.ctx) - s.Require().NotNil(genesis) - - // Check that the genesis state is valid. - err = genesis.ValidateBasic() - s.Require().NoError(err) - - // Check that the genesis state contains the incentives. - s.Require().Len(genesis.Registry, 2) - s.Require().Equal(badprice.BadPriceIncentiveType, genesis.Registry[0].IncentiveType) - s.Require().Len(genesis.Registry[0].Entries, 1) - s.Require().Equal(goodprice.GoodPriceIncentiveType, genesis.Registry[1].IncentiveType) - s.Require().Len(genesis.Registry[1].Entries, 1) - - bz1, err := badPrice.Marshal() - s.Require().NoError(err) - - bz2, err := goodPrice.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz1, genesis.Registry[0].Entries[0]) - s.Require().Equal(bz2, genesis.Registry[1].Entries[0]) - }) -} diff --git a/x/incentives/keeper/grpc_query.go b/x/incentives/keeper/grpc_query.go deleted file mode 100644 index f4bda2599..000000000 --- a/x/incentives/keeper/grpc_query.go +++ /dev/null @@ -1,98 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -var _ types.QueryServer = QueryServer{} - -// QueryServer is the default implementation of the x/incentives QueryServer. -type QueryServer struct { - k Keeper -} - -// NewQueryServer returns an implementation of the x/incentives QueryServer. -func NewQueryServer(k Keeper) QueryServer { - return QueryServer{ - k, - } -} - -// GetIncentivesByType returns all incentives of a given type currently stored in the -// incentives module. If the type is not registered with the module, an error is returned. -func (q QueryServer) GetIncentivesByType( - ctx context.Context, - req *types.GetIncentivesByTypeRequest, -) (*types.GetIncentivesByTypeResponse, error) { - if req == nil { - return nil, fmt.Errorf("request cannot be nil") - } - - var incentive types.Incentive - for i := range q.k.incentiveStrategies { - if i.Type() == req.IncentiveType { - incentive = i - break - } - } - - if incentive == nil { - return nil, fmt.Errorf("unknown incentive type: %s", req.IncentiveType) - } - - incentives, err := q.k.GetIncentivesByType(sdk.UnwrapSDKContext(ctx), incentive) - if err != nil { - return nil, err - } - - incentiveBytes, err := types.IncentivesToBytes(incentives...) - if err != nil { - return nil, err - } - - resp := types.GetIncentivesByTypeResponse{ - Entries: incentiveBytes, - } - - return &resp, nil -} - -// GetAllIncentives returns all incentives currently stored in the module. -func (q QueryServer) GetAllIncentives( - ctx context.Context, - _ *types.GetAllIncentivesRequest, -) (*types.GetAllIncentivesResponse, error) { - incentives := make([]types.IncentivesByType, 0) - - // Get all of the incentive types and sort them by name. - sortedIncentives := types.SortIncentivesStrategiesMap(q.k.incentiveStrategies) - - for _, incentive := range sortedIncentives { - incentivesByType, err := q.k.GetIncentivesByType(sdk.UnwrapSDKContext(ctx), incentive) - if err != nil { - return nil, err - } - - if len(incentivesByType) == 0 { - continue - } - - incentiveBytes, err := types.IncentivesToBytes(incentivesByType...) - if err != nil { - return nil, err - } - - incentives = append(incentives, types.NewIncentives(incentive.Type(), incentiveBytes)) - } - - resp := types.GetAllIncentivesResponse{ - Registry: incentives, - } - - return &resp, nil -} diff --git a/x/incentives/keeper/grpc_query_test.go b/x/incentives/keeper/grpc_query_test.go deleted file mode 100644 index adc13e9f9..000000000 --- a/x/incentives/keeper/grpc_query_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" - "github.com/skip-mev/slinky/x/incentives/types/examples/badprice" - "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice" -) - -func (s *KeeperTestSuite) TestGetIncentivesByType() { - s.Run("returns an error with empty type", func() { - _, err := s.queryServer.GetIncentivesByType(s.ctx, nil) - s.Require().Error(err) - }) - - s.Run("returns an error with unsupported type", func() { - req := &types.GetIncentivesByTypeRequest{IncentiveType: "unsupported"} - _, err := s.queryServer.GetIncentivesByType(s.ctx, req) - s.Require().Error(err) - }) - - s.Run("returns an empty list with no incentives", func() { - req := &types.GetIncentivesByTypeRequest{IncentiveType: badprice.BadPriceIncentiveType} - resp, err := s.queryServer.GetIncentivesByType(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Entries, 0) - }) - - s.Run("returns a single incentive stored in the module", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - incentives := []types.Incentive{badPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - req := &types.GetIncentivesByTypeRequest{IncentiveType: badprice.BadPriceIncentiveType} - resp, err := s.queryServer.GetIncentivesByType(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Entries, 1) - - // check that the incentive is the same as the one we added - bz, err := badPrice.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz, resp.Entries[0]) - }) - - s.Run("returns multiple incentives stored in the module", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - - incentives := []types.Incentive{badPrice1, badPrice2} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - req := &types.GetIncentivesByTypeRequest{IncentiveType: badprice.BadPriceIncentiveType} - resp, err := s.queryServer.GetIncentivesByType(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Entries, 2) - - // check that the incentives are the same as the ones we added - bz1, err := badPrice1.Marshal() - s.Require().NoError(err) - - bz2, err := badPrice2.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz1, resp.Entries[0]) - s.Require().Equal(bz2, resp.Entries[1]) - }) -} - -func (s *KeeperTestSuite) TestGetAllIncentives() { - s.Run("returns an empty list with no incentives", func() { - req := &types.GetAllIncentivesRequest{} - resp, err := s.queryServer.GetAllIncentives(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Registry, 0) - }) - - s.Run("returns a single incentive stored in the module", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - incentives := []types.Incentive{badPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - req := &types.GetAllIncentivesRequest{} - resp, err := s.queryServer.GetAllIncentives(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Registry, 1) - - s.Require().Equal(badprice.BadPriceIncentiveType, resp.Registry[0].IncentiveType) - s.Require().Len(resp.Registry[0].Entries, 1) - - // check that the incentive is the same as the one we added - bz, err := badPrice.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz, resp.Registry[0].Entries[0]) - }) - - s.Run("returns multiple incentives stored in the module", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - - incentives := []types.Incentive{badPrice1, badPrice2} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - req := &types.GetAllIncentivesRequest{} - resp, err := s.queryServer.GetAllIncentives(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Registry, 1) - - s.Require().Equal(badprice.BadPriceIncentiveType, resp.Registry[0].IncentiveType) - s.Require().Len(resp.Registry[0].Entries, 2) - - // check that the incentives are the same as the ones we added - bz1, err := badPrice1.Marshal() - s.Require().NoError(err) - - bz2, err := badPrice2.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz1, resp.Registry[0].Entries[0]) - s.Require().Equal(bz2, resp.Registry[0].Entries[1]) - }) - - s.Run("returns a single incentive for each type", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice := badprice.NewBadPriceIncentive(validator1, amount1) - goodPrice := goodprice.NewGoodPriceIncentive(validator2, amount2) - - incentives := []types.Incentive{badPrice, goodPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - req := &types.GetAllIncentivesRequest{} - resp, err := s.queryServer.GetAllIncentives(s.ctx, req) - s.Require().NoError(err) - s.Require().Len(resp.Registry, 2) - - s.Require().Equal(badprice.BadPriceIncentiveType, resp.Registry[0].IncentiveType) - s.Require().Len(resp.Registry[0].Entries, 1) - - s.Require().Equal(goodprice.GoodPriceIncentiveType, resp.Registry[1].IncentiveType) - s.Require().Len(resp.Registry[1].Entries, 1) - - // check that the incentives are the same as the ones we added - bz1, err := badPrice.Marshal() - s.Require().NoError(err) - - bz2, err := goodPrice.Marshal() - s.Require().NoError(err) - - s.Require().Equal(bz1, resp.Registry[0].Entries[0]) - s.Require().Equal(bz2, resp.Registry[1].Entries[0]) - }) -} diff --git a/x/incentives/keeper/incentives.go b/x/incentives/keeper/incentives.go deleted file mode 100644 index 208564734..000000000 --- a/x/incentives/keeper/incentives.go +++ /dev/null @@ -1,129 +0,0 @@ -package keeper - -import ( - storetypes "cosmossdk.io/store/types" - db "github.com/cosmos/cosmos-db" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -// GetIncentivesByType returns all incentives of a given type. -func (k Keeper) GetIncentivesByType(ctx sdk.Context, incentive types.Incentive) ([]types.Incentive, error) { - key := types.GetIncentiveKey(incentive) - - // Create a callback to unmarshal the incentives. - var incentives []types.Incentive - cb := func(it db.Iterator) error { - if err := incentive.Unmarshal(it.Value()); err != nil { - return err - } - - // Copy the incentive, and append it to the list of incentives. - incentives = append(incentives, incentive.Copy()) - return nil - } - - // Iterate through all incentives of the given type, unmashalling them, - // and appending them to the list of incentives. - if err := k.iteratorFunc(ctx, key, cb); err != nil { - return nil, err - } - - return incentives, nil -} - -// AddIncentives adds a set of incentives to the module's state. -func (k Keeper) AddIncentives(ctx sdk.Context, incentives []types.Incentive) error { - for _, incentive := range incentives { - if err := k.addIncentive(ctx, incentive); err != nil { - return err - } - } - - return nil -} - -// addIncentive adds a single incentive to the module's state. -func (k Keeper) addIncentive(ctx sdk.Context, incentive types.Incentive) error { - // Get the next incentive index. - index, err := k.getIncentiveCount(ctx, incentive) - if err != nil { - return err - } - - // Marshal the incentive into - bz, err := incentive.Marshal() - if err != nil { - return err - } - - // set the incentive in the store - store := ctx.KVStore(k.storeKey) - key := types.GetIncentiveKeyWithIndex(incentive, index+1) - store.Set(key, bz) - - // increment the incentive count - k.setIncentiveCount(ctx, incentive, index+1) - - return nil -} - -// RemoveIncentivesByType removes all incentives of a given type from the module's state. -func (k Keeper) RemoveIncentivesByType(ctx sdk.Context, incentive types.Incentive) error { - key := types.GetIncentiveKey(incentive) - - // Create a callback to delete the incentives. - cb := func(it db.Iterator) error { - store := ctx.KVStore(k.storeKey) - store.Delete(it.Key()) - return nil - } - - // Iterate through all incentives of the given type, deleting them. - return k.iteratorFunc(ctx, key, cb) -} - -// getIncentiveCount returns the number of incentives of a given type. Note that this -// is the number of incentives that have been added to the module's state, not the -// number of incentives that are currently active. -func (k Keeper) getIncentiveCount(ctx sdk.Context, incentive types.Incentive) (uint64, error) { - key := types.GetIncentiveCountKey(incentive) - - store := ctx.KVStore(k.storeKey) - bz := store.Get(key) - if bz == nil { - return 0, nil - } - - return sdk.BigEndianToUint64(bz), nil -} - -// setIncentiveCount updates the number of incentives of a given type. Note that this -// is the number of incentives that have been added to the module's state, not the -// number of incentives that are currently active. -func (k Keeper) setIncentiveCount(ctx sdk.Context, incentive types.Incentive, count uint64) { - key := types.GetIncentiveCountKey(incentive) - - store := ctx.KVStore(k.storeKey) - bz := sdk.Uint64ToBigEndian(count) - store.Set(key, bz) -} - -// iteratorFunc is a helper function that will create an iterator for a given -// store, and execute a call-back for each key/value pair. -func (k Keeper) iteratorFunc(ctx sdk.Context, prefix []byte, f func(db.Iterator) error) error { - // get iterator for store w/ prefix - store := ctx.KVStore(k.storeKey) - it := storetypes.KVStorePrefixIterator(store, prefix) - - // close the iterator - defer it.Close() - for ; it.Valid(); it.Next() { - // execute call-back, and return error if necessary - if err := f(it); err != nil { - return err - } - } - return nil -} diff --git a/x/incentives/keeper/incentives_test.go b/x/incentives/keeper/incentives_test.go deleted file mode 100644 index 46215a03d..000000000 --- a/x/incentives/keeper/incentives_test.go +++ /dev/null @@ -1,161 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" - "github.com/skip-mev/slinky/x/incentives/types/examples/badprice" - "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice" -) - -func (s *KeeperTestSuite) TestAddIncentives() { - s.Run("can add an empty list of incentives", func() { - err := s.incentivesKeeper.AddIncentives(s.ctx, nil) - s.Require().NoError(err) - - // Check the count of incentives for each type. - incentives, err := s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - }) - - s.Run("can add a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - incentives := []types.Incentive{badPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // retrieve the incentive from the store - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - // check that the incentive is the same as the one we added - i, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator.String(), i.Validator) - s.Require().Equal(amount.String(), i.Amount) - }) - - s.Run("can add multiple incentives", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - - incentives := []types.Incentive{badPrice1, badPrice2} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // retrieve the incentives from the store - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - // check that the incentives are the same as the ones we added - i1, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(amount1.String(), i1.Amount) - - i2, ok := incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(amount2.String(), i2.Amount) - }) - - s.Run("can add single incentive of different types", func() { - goodValidator := sdk.ValAddress([]byte("good_validator")) - goodAmount := math.NewInt(100) - goodPrice := goodprice.NewGoodPriceIncentive(goodValidator, goodAmount) - - badValidator := sdk.ValAddress([]byte("bad_validator")) - badAmount := math.NewInt(200) - badPrice := badprice.NewBadPriceIncentive(badValidator, badAmount) - - incentives := []types.Incentive{goodPrice, badPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // retrieve the incentives from the store - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i1, ok := incentives[0].(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - s.Require().Equal(goodValidator.String(), i1.Validator) - s.Require().Equal(goodAmount.String(), i1.Amount) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i2, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(badValidator.String(), i2.Validator) - s.Require().Equal(badAmount.String(), i2.Amount) - }) - - s.Run("can add multiple incentives of different types", func() { - goodValidator1 := sdk.ValAddress([]byte("good_validator1")) - goodAmount1 := math.NewInt(100) - goodPrice1 := goodprice.NewGoodPriceIncentive(goodValidator1, goodAmount1) - - goodValidator2 := sdk.ValAddress([]byte("good_validator2")) - goodAmount2 := math.NewInt(200) - goodPrice2 := goodprice.NewGoodPriceIncentive(goodValidator2, goodAmount2) - - badValidator1 := sdk.ValAddress([]byte("bad_validator1")) - badAmount1 := math.NewInt(300) - badPrice1 := badprice.NewBadPriceIncentive(badValidator1, badAmount1) - - badValidator2 := sdk.ValAddress([]byte("bad_validator2")) - badAmount2 := math.NewInt(400) - badPrice2 := badprice.NewBadPriceIncentive(badValidator2, badAmount2) - - incentives := []types.Incentive{goodPrice1, goodPrice2, badPrice1, badPrice2} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // retrieve the incentives from the store - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - i1, ok := incentives[0].(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - s.Require().Equal(goodValidator1.String(), i1.Validator) - s.Require().Equal(goodAmount1.String(), i1.Amount) - - i2, ok := incentives[1].(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - s.Require().Equal(goodValidator2.String(), i2.Validator) - s.Require().Equal(goodAmount2.String(), i2.Amount) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - i3, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(badValidator1.String(), i3.Validator) - s.Require().Equal(badAmount1.String(), i3.Amount) - - i4, ok := incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(badValidator2.String(), i4.Validator) - s.Require().Equal(badAmount2.String(), i4.Amount) - }) -} diff --git a/x/incentives/keeper/keeper.go b/x/incentives/keeper/keeper.go deleted file mode 100644 index 0d20ebf56..000000000 --- a/x/incentives/keeper/keeper.go +++ /dev/null @@ -1,33 +0,0 @@ -package keeper - -import ( - storetypes "cosmossdk.io/store/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -type ( - // Keeper is the base keeper for the x/incentives module. - Keeper struct { - storeKey storetypes.StoreKey - - // incentiveStrategies is a map of incentive types to their corresponding strategy - // functions. - incentiveStrategies map[types.Incentive]types.Strategy - } -) - -// NewKeeper constructs a new keeper from a store-key and a given set of -// (incentive, strategies) pairings. Note, if the strategies map is empty, -// then the keeper will not be able to process any incentives. This must be -// set by the application developer. Each incentive type must have a -// corresponding strategy function. -func NewKeeper( - sk storetypes.StoreKey, - incentiveStrategies map[types.Incentive]types.Strategy, -) Keeper { - return Keeper{ - storeKey: sk, - incentiveStrategies: incentiveStrategies, - } -} diff --git a/x/incentives/keeper/keeper_test.go b/x/incentives/keeper/keeper_test.go deleted file mode 100644 index db7c47a99..000000000 --- a/x/incentives/keeper/keeper_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package keeper_test - -import ( - "testing" - - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/suite" - - "github.com/skip-mev/slinky/x/incentives/keeper" - "github.com/skip-mev/slinky/x/incentives/types" - "github.com/skip-mev/slinky/x/incentives/types/examples/badprice" - "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice" - "github.com/skip-mev/slinky/x/incentives/types/examples/mocks" -) - -type KeeperTestSuite struct { - suite.Suite - - incentivesKeeper keeper.Keeper - queryServer keeper.QueryServer - key storetypes.StoreKey - ctx sdk.Context - - // mock strategies - stakingKeeper mocks.StakingKeeper - bankKeeper mocks.BankKeeper -} - -func (s *KeeperTestSuite) SetupTest() { - s.key = storetypes.NewKVStoreKey(types.StoreKey) - s.ctx = testutil.DefaultContext(s.key, storetypes.NewTransientStoreKey("transient_key")) - s.incentivesKeeper = keeper.NewKeeper(s.key, nil) - s.queryServer = keeper.NewQueryServer(s.incentivesKeeper) -} - -func (s *KeeperTestSuite) SetupSubTest() { - err := s.incentivesKeeper.RemoveIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - - incentives, err := s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - - err = s.incentivesKeeper.RemoveIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - - // Reset the mock strategies. - s.bankKeeper = *mocks.NewBankKeeper(s.T()) - s.stakingKeeper = *mocks.NewStakingKeeper(s.T()) - - badPriceStrategy := badprice.NewBadPriceIncentiveStrategy(&s.stakingKeeper).GetStrategy() - goodPriceStrategy := goodprice.NewGoodPriceIncentiveStrategy(&s.bankKeeper).GetStrategy() - strategies := map[types.Incentive]types.Strategy{ - &badprice.BadPriceIncentive{}: badPriceStrategy, - &goodprice.GoodPriceIncentive{}: goodPriceStrategy, - } - - // Reset the keeper with the new strategies. - s.incentivesKeeper = keeper.NewKeeper(s.key, strategies) - s.queryServer = keeper.NewQueryServer(s.incentivesKeeper) -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} diff --git a/x/incentives/keeper/strategy.go b/x/incentives/keeper/strategy.go deleted file mode 100644 index 1b2779d6f..000000000 --- a/x/incentives/keeper/strategy.go +++ /dev/null @@ -1,81 +0,0 @@ -package keeper - -import ( - storetypes "cosmossdk.io/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -// ExecuteByIncentiveTypeCB is a callback function that can utilized to update all -// incentives of a given type. This is useful for having incentive/strategy pairs -// that are meant to last several blocks. This function should return the updated -// incentive, or nil if the incentive should be deleted. -type ExecuteByIncentiveTypeCB func(incentive types.Incentive) (types.Incentive, error) - -// ExecuteStrategies executes all of the strategies with the stored incentives. -func (k Keeper) ExecuteStrategies(ctx sdk.Context) error { - for incentive, strategy := range k.incentiveStrategies { - if err := k.ExecuteIncentiveStrategy(ctx, incentive, strategy); err != nil { - return err - } - } - - return nil -} - -// ExecuteIncentiveStrategy executes a given strategy for all incentives of a given type. -// Note that the strategy may mutate the incentive, and return a new incentive to be -// stored. Strategies must return nil if the incentive should be deleted. Otherwise, the -// incentive will be updated. -func (k Keeper) ExecuteIncentiveStrategy( - ctx sdk.Context, - incentive types.Incentive, - strategy types.Strategy, -) error { - cb := func(incentive types.Incentive) (types.Incentive, error) { - return strategy(ctx, incentive) - } - - return k.ExecuteByIncentiveType(ctx, incentive, cb) -} - -// ExecuteByIncentiveType updates all incentives of a given type. -func (k Keeper) ExecuteByIncentiveType( - ctx sdk.Context, - incentive types.Incentive, - cb ExecuteByIncentiveTypeCB, -) error { - // get iterator for store w/ prefix - store := ctx.KVStore(k.storeKey) - key := types.GetIncentiveKey(incentive) - it := storetypes.KVStorePrefixIterator(store, key) - - // close the iterator - defer it.Close() - for ; it.Valid(); it.Next() { - // Unmarshal the incentive. - if err := incentive.Unmarshal(it.Value()); err != nil { - return err - } - - update, err := cb(incentive) - if err != nil { - return err - } - - // If the callback returns nil, then delete the incentive. - if update == nil { - store.Delete(it.Key()) - } else { - updateBz, err := update.Marshal() - if err != nil { - return err - } - - store.Set(it.Key(), updateBz) - } - } - - return nil -} diff --git a/x/incentives/keeper/strategy_test.go b/x/incentives/keeper/strategy_test.go deleted file mode 100644 index 9d8fb77a1..000000000 --- a/x/incentives/keeper/strategy_test.go +++ /dev/null @@ -1,486 +0,0 @@ -package keeper_test - -import ( - "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/mock" - - "github.com/skip-mev/slinky/x/incentives/keeper" - "github.com/skip-mev/slinky/x/incentives/types" - "github.com/skip-mev/slinky/x/incentives/types/examples/badprice" - "github.com/skip-mev/slinky/x/incentives/types/examples/goodprice" -) - -func (s *KeeperTestSuite) TestExecuteByIncentiveType() { - deleteCB := func(_ types.Incentive) (types.Incentive, error) { - return nil, nil - } - - updatePriceCB := func(incentive types.Incentive) (types.Incentive, error) { - badPrice, ok := incentive.(*badprice.BadPriceIncentive) - s.Require().True(ok) - - badPrice.Amount = math.NewInt(200000).String() - return badPrice, nil - } - - s.Run("can update an empty list of incentives", func() { - err := s.incentivesKeeper.ExecuteByIncentiveType(s.ctx, &badprice.BadPriceIncentive{}, deleteCB) - s.Require().NoError(err) - - // Check the count of incentives for each type. - incentives, err := s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - }) - - s.Run("can run a no-op on a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - incentives := []types.Incentive{badPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Update the incentives with the no-op callback. - err = s.incentivesKeeper.ExecuteByIncentiveType(s.ctx, &badprice.BadPriceIncentive{}, deleteCB) - s.Require().NoError(err) - - // Check that the incentive was removed from the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - }) - - s.Run("can run a valid update on a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - incentives := []types.Incentive{badPrice} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Check the incentive in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator.String(), i.Validator) - s.Require().Equal(amount.String(), i.Amount) - - // Update the incentives with the update callback. - err = s.incentivesKeeper.ExecuteByIncentiveType(s.ctx, &badprice.BadPriceIncentive{}, updatePriceCB) - s.Require().NoError(err) - - // Check that the incentive was updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i, ok = incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator.String(), i.Validator) - s.Require().Equal(math.NewInt(200000).String(), i.Amount) - }) - - s.Run("can update multiple incentives", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - - incentives := []types.Incentive{badPrice1, badPrice2} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Check the incentives in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - i1, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(amount1.String(), i1.Amount) - - i2, ok := incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(amount2.String(), i2.Amount) - - // Update the incentives with the update callback. - err = s.incentivesKeeper.ExecuteByIncentiveType(s.ctx, &badprice.BadPriceIncentive{}, updatePriceCB) - s.Require().NoError(err) - - // Check that the incentives were updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - i1, ok = incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(math.NewInt(200000).String(), i1.Amount) - - i2, ok = incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(math.NewInt(200000).String(), i2.Amount) - }) - - s.Run("can update some incentives and remove others", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - validator3 := sdk.ValAddress([]byte("validator3")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - amount3 := math.NewInt(300) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - badPrice3 := badprice.NewBadPriceIncentive(validator3, amount3) - - incentives := []types.Incentive{badPrice1, badPrice2, badPrice3} - - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Check the incentives in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 3) - - i1, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(amount1.String(), i1.Amount) - - i2, ok := incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(amount2.String(), i2.Amount) - - i3, ok := incentives[2].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator3.String(), i3.Validator) - s.Require().Equal(amount3.String(), i3.Amount) - - cb := func(incentive types.Incentive) (types.Incentive, error) { - badPrice, ok := incentive.(*badprice.BadPriceIncentive) - s.Require().True(ok) - - // If this is validator 2 we remove - if badPrice.Validator == validator2.String() { - return nil, nil - } - - // Otherwise we update the price - badPrice.Amount = math.NewInt(200000).String() - return badPrice, nil - } - - // Update the incentives with the update callback. - err = s.incentivesKeeper.ExecuteByIncentiveType(s.ctx, &badprice.BadPriceIncentive{}, cb) - s.Require().NoError(err) - - // Check that the incentives were updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 2) - - i1, ok = incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i1.Validator) - s.Require().Equal(math.NewInt(200000).String(), i1.Amount) - - i2, ok = incentives[1].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator3.String(), i2.Validator) - s.Require().Equal(math.NewInt(200000).String(), i2.Amount) - }) -} - -func (s *KeeperTestSuite) TestExecuteStrategies() { - s.Run("can execute a strategy on an empty list of incentives", func() { - err := s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - }) - - s.Run("can execute a strategy on a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - // Add the incentive to the store. - incentives := []types.Incentive{badPrice} - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Mock the results of the staking keeper. - s.stakingKeeper.On("GetValidatorStake", mock.Anything, validator).Return(amount, true).Once() - s.stakingKeeper.On("Slash", mock.Anything, validator, amount).Return(nil).Once() - - // Execute the strategy. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentive was removed from the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - }) - - s.Run("stores the incentive if the strategy returns an error", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - // Add the incentive to the store. - incentives := []types.Incentive{badPrice} - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Mock the results of the staking keeper. - s.stakingKeeper.On("GetValidatorStake", mock.Anything, validator).Return(amount, true).Once() - s.stakingKeeper.On("Slash", mock.Anything, validator, amount).Return(fmt.Errorf("slash error")).Once() - - // Execute the strategy. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().Error(err) - - // Check that the incentive was not removed from the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - }) - - s.Run("can execute a strategy on multiple of the same incentive types", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice1 := badprice.NewBadPriceIncentive(validator1, amount1) - badPrice2 := badprice.NewBadPriceIncentive(validator2, amount2) - incentives := []types.Incentive{badPrice1, badPrice2} - - // Add the incentives to the store. - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Mock the results of the staking keeper. - s.stakingKeeper.On("GetValidatorStake", mock.Anything, validator1).Return(amount1, true).Once() - s.stakingKeeper.On("Slash", mock.Anything, validator1, amount1).Return(nil).Once() - - s.stakingKeeper.On("GetValidatorStake", mock.Anything, validator2).Return(amount2, true).Once() - s.stakingKeeper.On("Slash", mock.Anything, validator2, amount2).Return(nil).Once() - - // Execute the strategy. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentives were removed from the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - }) - - s.Run("can execute a strategy on multiple different incentive types", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice := badprice.NewBadPriceIncentive(validator1, amount1) - goodPrice := goodprice.NewGoodPriceIncentive(validator2, amount2) - incentives := []types.Incentive{badPrice, goodPrice} - - // Add the incentives to the store. - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Mock the results of the staking keeper. - s.stakingKeeper.On("GetValidatorStake", mock.Anything, validator1).Return(amount1, true).Once() - s.stakingKeeper.On("Slash", mock.Anything, validator1, amount1).Return(nil).Once() - - // Mock the results of the bank keeper. - s.bankKeeper.On( - "MintCoins", - mock.Anything, mock.Anything, amount2, - ).Return(nil).Once() - - s.bankKeeper.On( - "SendCoinsFromModuleToAccount", - mock.Anything, mock.Anything, validator2, amount2, - ).Return(nil).Once() - - // Execute the strategy. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentives were removed from the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 0) - }) - - updateBadPriceStrategy := func(_ sdk.Context, incentive types.Incentive) (types.Incentive, error) { - badPrice, ok := incentive.(*badprice.BadPriceIncentive) - s.Require().True(ok) - - amount, ok := math.NewIntFromString(badPrice.Amount) - s.Require().True(ok) - - amount = amount.Add(math.NewInt(100)) - badPrice.Amount = amount.String() - - return badPrice, nil - } - - s.Run("can run an update strategy on a single incentive", func() { - validator := sdk.ValAddress([]byte("validator")) - amount := math.NewInt(100) - badPrice := badprice.NewBadPriceIncentive(validator, amount) - - // create a new keeper with the updated strategy - strategies := map[types.Incentive]types.Strategy{ - &badprice.BadPriceIncentive{}: updateBadPriceStrategy, - } - s.incentivesKeeper = keeper.NewKeeper(s.key, strategies) - - // Add the incentive to the store. - incentives := []types.Incentive{badPrice} - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Execute the strategy. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentive was updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator.String(), i.Validator) - s.Require().Equal(math.NewInt(200).String(), i.Amount) - - // Execute the strategy again. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentive was updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i, ok = incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator.String(), i.Validator) - s.Require().Equal(math.NewInt(300).String(), i.Amount) - }) - - updateGoodPriceStrategy := func(_ sdk.Context, incentive types.Incentive) (types.Incentive, error) { - goodPrice, ok := incentive.(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - - amount, ok := math.NewIntFromString(goodPrice.Amount) - s.Require().True(ok) - - amount = amount.Add(math.NewInt(100)) - goodPrice.Amount = amount.String() - - return goodPrice, nil - } - - s.Run("can run an update strategy on multiple different incentive types", func() { - validator1 := sdk.ValAddress([]byte("validator1")) - validator2 := sdk.ValAddress([]byte("validator2")) - - amount1 := math.NewInt(100) - amount2 := math.NewInt(200) - - badPrice := badprice.NewBadPriceIncentive(validator1, amount1) - goodPrice := goodprice.NewGoodPriceIncentive(validator2, amount2) - - // create a new keeper with the updated strategy - strategies := map[types.Incentive]types.Strategy{ - &badprice.BadPriceIncentive{}: updateBadPriceStrategy, - &goodprice.GoodPriceIncentive{}: updateGoodPriceStrategy, - } - s.incentivesKeeper = keeper.NewKeeper(s.key, strategies) - - // Add the incentives to the store. - incentives := []types.Incentive{badPrice, goodPrice} - err := s.incentivesKeeper.AddIncentives(s.ctx, incentives) - s.Require().NoError(err) - - // Execute the strategy. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentives were updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i, ok := incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i.Validator) - s.Require().Equal(math.NewInt(200).String(), i.Amount) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i2, ok := incentives[0].(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(math.NewInt(300).String(), i2.Amount) - - // Execute the strategy again. - err = s.incentivesKeeper.ExecuteStrategies(s.ctx) - s.Require().NoError(err) - - // Check that the incentives were updated in the store. - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &badprice.BadPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i, ok = incentives[0].(*badprice.BadPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator1.String(), i.Validator) - s.Require().Equal(math.NewInt(300).String(), i.Amount) - - incentives, err = s.incentivesKeeper.GetIncentivesByType(s.ctx, &goodprice.GoodPriceIncentive{}) - s.Require().NoError(err) - s.Require().Len(incentives, 1) - - i2, ok = incentives[0].(*goodprice.GoodPriceIncentive) - s.Require().True(ok) - s.Require().Equal(validator2.String(), i2.Validator) - s.Require().Equal(math.NewInt(400).String(), i2.Amount) - }) -} diff --git a/x/incentives/module.go b/x/incentives/module.go deleted file mode 100644 index ad368b5d0..000000000 --- a/x/incentives/module.go +++ /dev/null @@ -1,189 +0,0 @@ -package incentives - -import ( - "context" - "encoding/json" - - "cosmossdk.io/core/appmodule" - "cosmossdk.io/depinject" - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - incentivesmodulev1 "github.com/skip-mev/slinky/api/slinky/incentives/module/v1" - "github.com/skip-mev/slinky/x/incentives/client/cli" - "github.com/skip-mev/slinky/x/incentives/keeper" - "github.com/skip-mev/slinky/x/incentives/types" -) - -// ConsensusVersion is the x/incentives module's current version, as modules integrate and -// updates are made, this value determines what version of the module is being run by the chain. -const ConsensusVersion = 1 - -var ( - _ module.HasName = AppModule{} - _ module.HasGenesis = AppModule{} - _ module.AppModuleBasic = AppModule{} - _ module.HasServices = AppModule{} - - _ appmodule.AppModule = AppModule{} - _ appmodule.HasBeginBlocker = AppModule{} - _ appmodule.HasEndBlocker = AppModule{} -) - -// AppModuleBasic defines the base interface that the x/incentives module exposes to the -// application. -type AppModuleBasic struct { - cdc codec.Codec -} - -// Name returns the name of this module. -func (AppModuleBasic) Name() string { return types.ModuleName } - -// RegisterLegacyAminoCodec registers the necessary types from the x/incentives module -// for amino serialization. -func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} - -// RegisterInterfaces registers the necessary implementations / interfaces in the -// x/incentives module w/ the interface-registry. -func (AppModuleBasic) RegisterInterfaces(_ codectypes.InterfaceRegistry) {} - -// RegisterGRPCGatewayRoutes registers the necessary REST routes for the GRPC-gateway to -// the x/incentives module QueryService on mux. This method panics on failure. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(cliCtx client.Context, mux *runtime.ServeMux) { - // Register the gate-way routes w/ the provided mux. - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(cliCtx)); err != nil { - panic(err) - } -} - -// GetTxCmd is a no-op, as no txs are registered for submission. -func (AppModuleBasic) GetTxCmd() *cobra.Command { - return nil -} - -// GetQueryCmd returns the x/incentives module base query cli-command. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// DefaultGenesis returns default genesis state as raw bytes for the incentives -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.NewDefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the x/incentives module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var gs types.GenesisState - if err := cdc.UnmarshalJSON(bz, &gs); err != nil { - return err - } - - return gs.ValidateBasic() -} - -// AppModule represents an application module for the x/incentives module. -type AppModule struct { - AppModuleBasic - - k keeper.Keeper -} - -// NewAppModule returns an application module for the x/incentives module. -func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{ - cdc: cdc, - }, - k: k, - } -} - -// BeginBlock returns the beginblocker for the x/incentives module. -func (am AppModule) BeginBlock(ctx context.Context) error { - return am.k.ExecuteStrategies(sdk.UnwrapSDKContext(ctx)) -} - -// EndBlock is a no-op for x/incentives. -func (am AppModule) EndBlock(_ context.Context) error { - return nil -} - -// IsAppModule implements the appmodule.AppModule interface. -func (AppModule) IsAppModule() {} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (AppModule) IsOnePerModuleType() {} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } - -// RegisterServices registers the module's services with the app's module configurator. -func (am AppModule) RegisterServices(cfc module.Configurator) { - // Register the query service. - types.RegisterQueryServer(cfc.QueryServer(), keeper.NewQueryServer(am.k)) -} - -// RegisterInvariants registers the invariants of the incentives module. If an invariant -// deviates from its predicted value, the InvariantRegistry triggers appropriate -// logic (most often the chain will be halted). No invariants exist for the incentives module. -func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// InitGenesis performs the genesis initialization for the x/incentives module. It determines the -// genesis state to initialize from via a json-encoded genesis-state. This method returns no validator set updates. -// This method panics on any errors. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) { - var gs types.GenesisState - cdc.MustUnmarshalJSON(bz, &gs) - - am.k.InitGenesis(ctx, gs) -} - -// ExportGenesis returns the incentives module's exported genesis state as raw -// JSON bytes. This method panics on any error. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.k.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -func init() { - appmodule.Register( - &incentivesmodulev1.Module{}, - appmodule.Provide(ProvideModule), - ) -} - -type Inputs struct { - depinject.In - - Config *incentivesmodulev1.Module - Cdc codec.Codec - Key *storetypes.KVStoreKey - - // IncentiveStrategies - IncentiveStrategies map[types.Incentive]types.Strategy `optional:"true"` -} - -type Outputs struct { - depinject.Out - - IncentivesKeeper keeper.Keeper - Module appmodule.AppModule -} - -func ProvideModule(in Inputs) Outputs { - incentivesKeeper := keeper.NewKeeper( - in.Key, - in.IncentiveStrategies, - ) - - m := NewAppModule(in.Cdc, incentivesKeeper) - - return Outputs{IncentivesKeeper: incentivesKeeper, Module: m} -} diff --git a/x/incentives/types/examples/badprice/badprice.pb.go b/x/incentives/types/examples/badprice/badprice.pb.go deleted file mode 100644 index 8eaa95fdb..000000000 --- a/x/incentives/types/examples/badprice/badprice.pb.go +++ /dev/null @@ -1,382 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/incentives/v1/examples/badprice.proto - -package badprice - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// BadPriceIncentive is a message that contains the information about a bad -// price that was submitted by a validator. -// -// NOTE: This is an example of a bad price incentive. It is not used in -// production. -type BadPriceIncentive struct { - // Validator is the address of the validator that submitted the bad price. - Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` - // Amount is the amount to slash. - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *BadPriceIncentive) Reset() { *m = BadPriceIncentive{} } -func (m *BadPriceIncentive) String() string { return proto.CompactTextString(m) } -func (*BadPriceIncentive) ProtoMessage() {} -func (*BadPriceIncentive) Descriptor() ([]byte, []int) { - return fileDescriptor_15e61ac5e43a8d93, []int{0} -} -func (m *BadPriceIncentive) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BadPriceIncentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BadPriceIncentive.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 *BadPriceIncentive) XXX_Merge(src proto.Message) { - xxx_messageInfo_BadPriceIncentive.Merge(m, src) -} -func (m *BadPriceIncentive) XXX_Size() int { - return m.Size() -} -func (m *BadPriceIncentive) XXX_DiscardUnknown() { - xxx_messageInfo_BadPriceIncentive.DiscardUnknown(m) -} - -var xxx_messageInfo_BadPriceIncentive proto.InternalMessageInfo - -func (m *BadPriceIncentive) GetValidator() string { - if m != nil { - return m.Validator - } - return "" -} - -func (m *BadPriceIncentive) GetAmount() string { - if m != nil { - return m.Amount - } - return "" -} - -func init() { - proto.RegisterType((*BadPriceIncentive)(nil), "slinky.incentives.v1.BadPriceIncentive") -} - -func init() { - proto.RegisterFile("slinky/incentives/v1/examples/badprice.proto", fileDescriptor_15e61ac5e43a8d93) -} - -var fileDescriptor_15e61ac5e43a8d93 = []byte{ - // 255 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x29, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0x2d, 0xd6, 0x2f, 0x33, - 0xd4, 0x4f, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x4f, 0x4a, 0x4c, 0x29, 0x28, 0xca, - 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xa8, 0xd6, 0x43, 0xa8, 0xd6, - 0x2b, 0x33, 0x94, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x85, 0x52, 0x92, - 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x91, 0x52, 0x9a, 0xc8, - 0xc8, 0x25, 0xe8, 0x94, 0x98, 0x12, 0x00, 0x32, 0xd6, 0x13, 0x66, 0x8e, 0x90, 0x0c, 0x17, 0x67, - 0x59, 0x62, 0x4e, 0x66, 0x4a, 0x62, 0x49, 0x7e, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, - 0x42, 0x40, 0x48, 0x8c, 0x8b, 0x2d, 0x31, 0x37, 0xbf, 0x34, 0xaf, 0x44, 0x82, 0x09, 0x2c, 0x05, - 0xe5, 0x59, 0xb9, 0x9d, 0xda, 0xa2, 0x2b, 0x87, 0xcd, 0x4d, 0x7a, 0x70, 0x93, 0xbb, 0x9e, 0x6f, - 0xd0, 0x92, 0x87, 0x7a, 0x32, 0xbf, 0x28, 0x31, 0x39, 0x27, 0x55, 0x1f, 0xc3, 0x76, 0xa7, 0xc8, - 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, - 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xb2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, - 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f, 0xce, 0xce, 0x2c, 0xd0, 0xcd, 0x4d, 0x2d, 0xd3, 0x87, - 0x1a, 0x57, 0x81, 0x1c, 0x6a, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x98, 0x01, 0x97, 0xc4, 0x06, 0xf6, - 0xb5, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xf3, 0x90, 0xb4, 0x69, 0x01, 0x00, 0x00, -} - -func (m *BadPriceIncentive) 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 *BadPriceIncentive) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BadPriceIncentive) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintBadprice(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x12 - } - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintBadprice(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintBadprice(dAtA []byte, offset int, v uint64) int { - offset -= sovBadprice(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BadPriceIncentive) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovBadprice(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovBadprice(uint64(l)) - } - return n -} - -func sovBadprice(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozBadprice(x uint64) (n int) { - return sovBadprice(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BadPriceIncentive) 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 ErrIntOverflowBadprice - } - 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: BadPriceIncentive: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BadPriceIncentive: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBadprice - } - 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 ErrInvalidLengthBadprice - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBadprice - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Validator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBadprice - } - 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 ErrInvalidLengthBadprice - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBadprice - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBadprice(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBadprice - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipBadprice(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowBadprice - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowBadprice - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowBadprice - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthBadprice - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupBadprice - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthBadprice - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthBadprice = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBadprice = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupBadprice = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/incentives/types/examples/badprice/incentive.go b/x/incentives/types/examples/badprice/incentive.go deleted file mode 100644 index f528db814..000000000 --- a/x/incentives/types/examples/badprice/incentive.go +++ /dev/null @@ -1,62 +0,0 @@ -package badprice - -import ( - fmt "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -const ( - // BadPriceIncentiveType is the type for the BadPriceIncentive. - BadPriceIncentiveType = "bad_price_update" -) - -// Each Incentive type must implement the types.Incentive interface. -var _ types.Incentive = (*BadPriceIncentive)(nil) - -// NewBadPriceIncentive creates a new BadPriceIncentive. -// -// NOTE: THIS SHOULD NOT BE USED IN PRODUCTION. THIS IS ONLY FOR TESTING. -func NewBadPriceIncentive(validator sdk.ValAddress, amount math.Int) *BadPriceIncentive { - return &BadPriceIncentive{ - Validator: validator.String(), - Amount: amount.String(), - } -} - -// ValidateBasic does a basic stateless validation check that -// doesn't require access to any other information. -func (b *BadPriceIncentive) ValidateBasic() error { - // You can add your custom validation logic here if needed. - _, err := sdk.ValAddressFromBech32(b.Validator) - if err != nil { - return fmt.Errorf("invalid validator address %s: %w", b.Validator, err) - } - - amount, ok := math.NewIntFromString(b.Amount) - if !ok { - return fmt.Errorf("invalid amount %s", b.Amount) - } - - if amount.IsNegative() { - return fmt.Errorf("amount %s cannot be negative", b.Amount) - } - - return nil -} - -// Type returns the type of the incentive. -func (b *BadPriceIncentive) Type() string { - return BadPriceIncentiveType -} - -// Copy returns a copy of the incentive. -func (b *BadPriceIncentive) Copy() types.Incentive { - return &BadPriceIncentive{ - Validator: b.Validator, - Amount: b.Amount, - } -} diff --git a/x/incentives/types/examples/badprice/strategy.go b/x/incentives/types/examples/badprice/strategy.go deleted file mode 100644 index 1049d7fa8..000000000 --- a/x/incentives/types/examples/badprice/strategy.go +++ /dev/null @@ -1,76 +0,0 @@ -package badprice - -import ( - fmt "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -// StakingKeeper defines the expected staking keeper interface required by -// the BadPriceIncentive strategy. -// -//go:generate mockery --name StakingKeeper --output ./../mocks --outpkg mocks --case underscore -type StakingKeeper interface { - // GetValidatorStake returns the total amount of stake that a validator - // currently has delegated to it. - GetValidatorStake(ctx sdk.Context, val sdk.ValAddress) (stake math.Int, found bool) - - // Slash attempts to slash the validator at the given address by the - // given amount. If the validator does not have sufficient stake to - // slash, the slash will fail. - Slash(ctx sdk.Context, val sdk.ValAddress, amount math.Int) error -} - -// BadPriceIncentiveStrategy is the strategy function for the BadPriceIncentive -// type. -type BadPriceIncentiveStrategy struct { - keeper StakingKeeper -} - -// NewBadPriceIncentiveStrategy returns a new BadPriceIncentiveStrategy. -func NewBadPriceIncentiveStrategy(keeper StakingKeeper) *BadPriceIncentiveStrategy { - return &BadPriceIncentiveStrategy{ - keeper: keeper, - } -} - -// GetStrategy returns the BadPriceIncentiveStrategy. -func (s *BadPriceIncentiveStrategy) GetStrategy() types.Strategy { - return func(ctx sdk.Context, incentive types.Incentive) (types.Incentive, error) { - // Cast the incentive to the concrete type. - badPriceIncentive, ok := incentive.(*BadPriceIncentive) - if !ok { - return incentive, fmt.Errorf("invalid incentive type: %T", incentive) - } - - validator, err := sdk.ValAddressFromBech32(badPriceIncentive.Validator) - if err != nil { - return incentive, nil - } - - // Get the validator's current stake. - stake, found := s.keeper.GetValidatorStake(ctx, validator) - if !found { - return incentive, nil - } - - // Check the upper bound on what we can slash - slashAmount, ok := math.NewIntFromString(badPriceIncentive.Amount) - if !ok { - return incentive, nil - } - - if slashAmount.GT(stake) { - slashAmount = stake - } - - if err := s.keeper.Slash(ctx, validator, slashAmount); err != nil { - return incentive, err - } - - return nil, nil - } -} diff --git a/x/incentives/types/examples/goodprice/goodprice.pb.go b/x/incentives/types/examples/goodprice/goodprice.pb.go deleted file mode 100644 index 179b504a6..000000000 --- a/x/incentives/types/examples/goodprice/goodprice.pb.go +++ /dev/null @@ -1,383 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/incentives/v1/examples/goodprice.proto - -package goodprice - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GoodPriceIncentive is a message that contains the information about a good -// price that was submitted by a validator. -// -// NOTE: This is an example of a good price incentive. It is not used in -// production. -type GoodPriceIncentive struct { - // Validator is the address of the validator that submitted the good price. - Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` - // Amount is the amount to reward. - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *GoodPriceIncentive) Reset() { *m = GoodPriceIncentive{} } -func (m *GoodPriceIncentive) String() string { return proto.CompactTextString(m) } -func (*GoodPriceIncentive) ProtoMessage() {} -func (*GoodPriceIncentive) Descriptor() ([]byte, []int) { - return fileDescriptor_62f4024e5946b19e, []int{0} -} -func (m *GoodPriceIncentive) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GoodPriceIncentive) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GoodPriceIncentive.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 *GoodPriceIncentive) XXX_Merge(src proto.Message) { - xxx_messageInfo_GoodPriceIncentive.Merge(m, src) -} -func (m *GoodPriceIncentive) XXX_Size() int { - return m.Size() -} -func (m *GoodPriceIncentive) XXX_DiscardUnknown() { - xxx_messageInfo_GoodPriceIncentive.DiscardUnknown(m) -} - -var xxx_messageInfo_GoodPriceIncentive proto.InternalMessageInfo - -func (m *GoodPriceIncentive) GetValidator() string { - if m != nil { - return m.Validator - } - return "" -} - -func (m *GoodPriceIncentive) GetAmount() string { - if m != nil { - return m.Amount - } - return "" -} - -func init() { - proto.RegisterType((*GoodPriceIncentive)(nil), "slinky.incentives.v1.GoodPriceIncentive") -} - -func init() { - proto.RegisterFile("slinky/incentives/v1/examples/goodprice.proto", fileDescriptor_62f4024e5946b19e) -} - -var fileDescriptor_62f4024e5946b19e = []byte{ - // 260 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2d, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0x2d, 0xd6, 0x2f, 0x33, - 0xd4, 0x4f, 0xad, 0x48, 0xcc, 0x2d, 0xc8, 0x49, 0x2d, 0xd6, 0x4f, 0xcf, 0xcf, 0x4f, 0x29, 0x28, - 0xca, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x28, 0xd7, 0x43, 0x28, - 0xd7, 0x2b, 0x33, 0x94, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x85, 0x52, - 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x91, 0x52, 0x9a, - 0xc4, 0xc8, 0x25, 0xe4, 0x9e, 0x9f, 0x9f, 0x12, 0x00, 0x32, 0xd7, 0x13, 0x66, 0x90, 0x90, 0x0c, - 0x17, 0x67, 0x59, 0x62, 0x4e, 0x66, 0x4a, 0x62, 0x49, 0x7e, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, - 0x67, 0x10, 0x42, 0x40, 0x48, 0x8c, 0x8b, 0x2d, 0x31, 0x37, 0xbf, 0x34, 0xaf, 0x44, 0x82, 0x09, - 0x2c, 0x05, 0xe5, 0x59, 0xb9, 0x9d, 0xda, 0xa2, 0x2b, 0x87, 0xcd, 0x51, 0x7a, 0x70, 0x93, 0xbb, - 0x9e, 0x6f, 0xd0, 0x92, 0x87, 0x7a, 0x33, 0xbf, 0x28, 0x31, 0x39, 0x27, 0x55, 0xdf, 0x29, 0x11, - 0xcd, 0x76, 0xa7, 0xa8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, - 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x72, 0x48, - 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f, 0xce, 0xce, 0x2c, 0xd0, 0xcd, - 0x4d, 0x2d, 0xd3, 0x87, 0x1a, 0x57, 0x81, 0x1c, 0x6e, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x58, 0x82, - 0x2e, 0x89, 0x0d, 0xec, 0x6f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0xea, 0x2a, 0x6d, - 0x6c, 0x01, 0x00, 0x00, -} - -func (m *GoodPriceIncentive) 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 *GoodPriceIncentive) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GoodPriceIncentive) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - i -= len(m.Amount) - copy(dAtA[i:], m.Amount) - i = encodeVarintGoodprice(dAtA, i, uint64(len(m.Amount))) - i-- - dAtA[i] = 0x12 - } - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintGoodprice(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGoodprice(dAtA []byte, offset int, v uint64) int { - offset -= sovGoodprice(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GoodPriceIncentive) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovGoodprice(uint64(l)) - } - l = len(m.Amount) - if l > 0 { - n += 1 + l + sovGoodprice(uint64(l)) - } - return n -} - -func sovGoodprice(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGoodprice(x uint64) (n int) { - return sovGoodprice(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GoodPriceIncentive) 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 ErrIntOverflowGoodprice - } - 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: GoodPriceIncentive: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GoodPriceIncentive: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGoodprice - } - 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 ErrInvalidLengthGoodprice - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGoodprice - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Validator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGoodprice - } - 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 ErrInvalidLengthGoodprice - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGoodprice - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGoodprice(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGoodprice - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGoodprice(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGoodprice - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGoodprice - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGoodprice - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGoodprice - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGoodprice - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGoodprice - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGoodprice = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGoodprice = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGoodprice = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/incentives/types/examples/goodprice/incentive.go b/x/incentives/types/examples/goodprice/incentive.go deleted file mode 100644 index 6c85584c9..000000000 --- a/x/incentives/types/examples/goodprice/incentive.go +++ /dev/null @@ -1,62 +0,0 @@ -package goodprice - -import ( - fmt "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -const ( - // GoodPriceIncentiveType is the type for the GoodPriceIncentive. - GoodPriceIncentiveType = "good_price_update" -) - -// Ensure that GoodPriceIncentive implements the Incentive interface -var _ types.Incentive = (*GoodPriceIncentive)(nil) - -// NewGoodPriceIncentive returns a new GoodPriceIncentive. -// -// NOTE: THIS SHOULD NOT BE USED IN PRODUCTION. THIS IS ONLY FOR TESTING. -func NewGoodPriceIncentive(validator sdk.ValAddress, amount math.Int) *GoodPriceIncentive { - return &GoodPriceIncentive{ - Validator: validator.String(), - Amount: amount.String(), - } -} - -// ValidateBasic does a basic stateless validation check that -// doesn't require access to any other information. -func (b *GoodPriceIncentive) ValidateBasic() error { - // You can add your custom validation logic here if needed. - _, err := sdk.ValAddressFromBech32(b.Validator) - if err != nil { - return fmt.Errorf("invalid validator address %s: %w", b.Validator, err) - } - - amount, ok := math.NewIntFromString(b.Amount) - if !ok { - return fmt.Errorf("invalid amount %s", b.Amount) - } - - if amount.IsNegative() { - return fmt.Errorf("amount %s cannot be negative", b.Amount) - } - - return nil -} - -// Type returns the type of the incentive. -func (b *GoodPriceIncentive) Type() string { - return GoodPriceIncentiveType -} - -// Copy returns a copy of the incentive. -func (b *GoodPriceIncentive) Copy() types.Incentive { - return &GoodPriceIncentive{ - Validator: b.Validator, - Amount: b.Amount, - } -} diff --git a/x/incentives/types/examples/goodprice/strategy.go b/x/incentives/types/examples/goodprice/strategy.go deleted file mode 100644 index ac43694af..000000000 --- a/x/incentives/types/examples/goodprice/strategy.go +++ /dev/null @@ -1,84 +0,0 @@ -package goodprice - -import ( - "context" - fmt "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -// BankKeeper defines the expected bank keeper interface required by -// the GoodPriceIncentive strategy. -// -//go:generate mockery --name BankKeeper --output ./../mocks --outpkg mocks --case underscore -type BankKeeper interface { - // Mint coins and add to the module account before distributing them - // to the recipient. - MintCoins( - ctx context.Context, - moduleName string, - amt math.Int, - ) error - - // Send coins from the module account to the recipient. - SendCoinsFromModuleToAccount( - ctx context.Context, - senderModule string, - recipientAddr sdk.ValAddress, - amt math.Int, - ) error -} - -// GoodPriceIncentiveStrategy is the strategy function for the GoodPriceIncentive -// type. -type GoodPriceIncentiveStrategy struct { - bk BankKeeper -} - -// NewBadPriceIncentiveStrategy returns a new GoodPriceIncentiveStrategy. -func NewGoodPriceIncentiveStrategy(bk BankKeeper) *GoodPriceIncentiveStrategy { - return &GoodPriceIncentiveStrategy{ - bk: bk, - } -} - -// GetStrategy returns the BadPriceIncentiveStrategy. -func (s *GoodPriceIncentiveStrategy) GetStrategy() types.Strategy { - return func(ctx sdk.Context, incentive types.Incentive) (types.Incentive, error) { - // Cast the incentive to the concrete type. - badPriceIncentive, ok := incentive.(*GoodPriceIncentive) - if !ok { - return incentive, fmt.Errorf("invalid incentive type: %T", incentive) - } - - validator, err := sdk.ValAddressFromBech32(badPriceIncentive.Validator) - if err != nil { - return nil, nil - } - - amount, ok := math.NewIntFromString(badPriceIncentive.Amount) - if !ok { - return nil, nil - } - - if amount.IsNegative() { - return nil, nil - } - - // Mint coins and add to the module account before distributing them - // to the recipient. - if err := s.bk.MintCoins(ctx, types.ModuleName, amount); err != nil { - return incentive, err - } - - // Send coins from the module account to the recipient. - if err := s.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, validator, amount); err != nil { - return incentive, err - } - - return nil, nil - } -} diff --git a/x/incentives/types/examples/mocks/bank_keeper.go b/x/incentives/types/examples/mocks/bank_keeper.go deleted file mode 100644 index 35b7d407d..000000000 --- a/x/incentives/types/examples/mocks/bank_keeper.go +++ /dev/null @@ -1,68 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - math "cosmossdk.io/math" - - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// BankKeeper is an autogenerated mock type for the BankKeeper type -type BankKeeper struct { - mock.Mock -} - -// MintCoins provides a mock function with given fields: ctx, moduleName, amt -func (_m *BankKeeper) MintCoins(ctx context.Context, moduleName string, amt math.Int) error { - ret := _m.Called(ctx, moduleName, amt) - - if len(ret) == 0 { - panic("no return value specified for MintCoins") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, math.Int) error); ok { - r0 = rf(ctx, moduleName, amt) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SendCoinsFromModuleToAccount provides a mock function with given fields: ctx, senderModule, recipientAddr, amt -func (_m *BankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types.ValAddress, amt math.Int) error { - ret := _m.Called(ctx, senderModule, recipientAddr, amt) - - if len(ret) == 0 { - panic("no return value specified for SendCoinsFromModuleToAccount") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, types.ValAddress, math.Int) error); ok { - r0 = rf(ctx, senderModule, recipientAddr, amt) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewBankKeeper creates a new instance of BankKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewBankKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *BankKeeper { - mock := &BankKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/incentives/types/examples/mocks/staking_keeper.go b/x/incentives/types/examples/mocks/staking_keeper.go deleted file mode 100644 index 80a9dfe38..000000000 --- a/x/incentives/types/examples/mocks/staking_keeper.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - math "cosmossdk.io/math" - types "github.com/cosmos/cosmos-sdk/types" - mock "github.com/stretchr/testify/mock" -) - -// StakingKeeper is an autogenerated mock type for the StakingKeeper type -type StakingKeeper struct { - mock.Mock -} - -// GetValidatorStake provides a mock function with given fields: ctx, val -func (_m *StakingKeeper) GetValidatorStake(ctx types.Context, val types.ValAddress) (math.Int, bool) { - ret := _m.Called(ctx, val) - - if len(ret) == 0 { - panic("no return value specified for GetValidatorStake") - } - - var r0 math.Int - var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) (math.Int, bool)); ok { - return rf(ctx, val) - } - if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress) math.Int); ok { - r0 = rf(ctx, val) - } else { - r0 = ret.Get(0).(math.Int) - } - - if rf, ok := ret.Get(1).(func(types.Context, types.ValAddress) bool); ok { - r1 = rf(ctx, val) - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - -// Slash provides a mock function with given fields: ctx, val, amount -func (_m *StakingKeeper) Slash(ctx types.Context, val types.ValAddress, amount math.Int) error { - ret := _m.Called(ctx, val, amount) - - if len(ret) == 0 { - panic("no return value specified for Slash") - } - - var r0 error - if rf, ok := ret.Get(0).(func(types.Context, types.ValAddress, math.Int) error); ok { - r0 = rf(ctx, val, amount) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewStakingKeeper creates a new instance of StakingKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewStakingKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *StakingKeeper { - mock := &StakingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/incentives/types/genesis.go b/x/incentives/types/genesis.go deleted file mode 100644 index 935129b17..000000000 --- a/x/incentives/types/genesis.go +++ /dev/null @@ -1,79 +0,0 @@ -package types - -import ( - "encoding/json" - "fmt" - - "github.com/cosmos/cosmos-sdk/codec" -) - -// NewDefaultGenesisState returns a default genesis state for the module. -func NewDefaultGenesisState() *GenesisState { - return &GenesisState{} -} - -// NewGenesisState returns a new genesis state for the module. -func NewGenesisState(incentives []IncentivesByType) *GenesisState { - return &GenesisState{ - Registry: incentives, - } -} - -// ValidateBasic performs basic validation of the genesis state data returning an -// error for any failed validation criteria. -func (gs GenesisState) ValidateBasic() error { - seen := make(map[string]struct{}) - for _, entry := range gs.Registry { - if _, ok := seen[entry.IncentiveType]; ok { - return fmt.Errorf("duplicate incentive name %s", entry.IncentiveType) - } - - if err := entry.ValidateBasic(); err != nil { - return err - } - - seen[entry.IncentiveType] = struct{}{} - } - - return nil -} - -// NewIncentives returns a new Incentives instance. -func NewIncentives(name string, incentives [][]byte) IncentivesByType { - return IncentivesByType{ - IncentiveType: name, - Entries: incentives, - } -} - -// ValidateBasic performs basic validation of the Incentives data returning an -// error for any failed validation criteria. -func (i IncentivesByType) ValidateBasic() error { - if len(i.IncentiveType) == 0 { - return fmt.Errorf("incentive name cannot be empty") - } - - if len(i.Entries) == 0 { - return fmt.Errorf("incentive %s must have at least one incentive", i.IncentiveType) - } - - for _, incentive := range i.Entries { - if len(incentive) == 0 { - return fmt.Errorf("incentive %s cannot be empty", i.IncentiveType) - } - } - - return nil -} - -// GetGenesisStateFromAppState returns x/incentives GenesisState given raw application -// genesis state. -func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState { - var genesisState GenesisState - - if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) - } - - return genesisState -} diff --git a/x/incentives/types/genesis.pb.go b/x/incentives/types/genesis.pb.go deleted file mode 100644 index 41ceed4a4..000000000 --- a/x/incentives/types/genesis.pb.go +++ /dev/null @@ -1,568 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/incentives/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState is the genesis-state for the x/incentives module. -type GenesisState struct { - // Registry is a list of incentives by type. The registry defined here - // should be a subset of the incentive types defined in the incentive - // module (keeper). - Registry []IncentivesByType `protobuf:"bytes,1,rep,name=registry,proto3" json:"registry"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_1313e98e0d51d196, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetRegistry() []IncentivesByType { - if m != nil { - return m.Registry - } - return nil -} - -// IncentivesByType encapsulates a list of incentives by type. Each of the -// entries here must correspond to the same incentive type defined here. -type IncentivesByType struct { - // IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - // GoodPriceIncentiveType). - IncentiveType string `protobuf:"bytes,1,opt,name=incentive_type,json=incentiveType,proto3" json:"incentive_type,omitempty"` - // Entries is a list of incentive bytes. - Entries [][]byte `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (m *IncentivesByType) Reset() { *m = IncentivesByType{} } -func (m *IncentivesByType) String() string { return proto.CompactTextString(m) } -func (*IncentivesByType) ProtoMessage() {} -func (*IncentivesByType) Descriptor() ([]byte, []int) { - return fileDescriptor_1313e98e0d51d196, []int{1} -} -func (m *IncentivesByType) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IncentivesByType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IncentivesByType.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 *IncentivesByType) XXX_Merge(src proto.Message) { - xxx_messageInfo_IncentivesByType.Merge(m, src) -} -func (m *IncentivesByType) XXX_Size() int { - return m.Size() -} -func (m *IncentivesByType) XXX_DiscardUnknown() { - xxx_messageInfo_IncentivesByType.DiscardUnknown(m) -} - -var xxx_messageInfo_IncentivesByType proto.InternalMessageInfo - -func (m *IncentivesByType) GetIncentiveType() string { - if m != nil { - return m.IncentiveType - } - return "" -} - -func (m *IncentivesByType) GetEntries() [][]byte { - if m != nil { - return m.Entries - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "slinky.incentives.v1.GenesisState") - proto.RegisterType((*IncentivesByType)(nil), "slinky.incentives.v1.IncentivesByType") -} - -func init() { - proto.RegisterFile("slinky/incentives/v1/genesis.proto", fileDescriptor_1313e98e0d51d196) -} - -var fileDescriptor_1313e98e0d51d196 = []byte{ - // 249 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0x2d, 0xd6, 0x2f, 0x33, - 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, - 0x81, 0xa8, 0xd1, 0x43, 0xa8, 0xd1, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0x95, 0x22, 0xb8, 0x78, 0xdc, 0x21, 0x9a, 0x83, 0x4b, 0x12, 0x4b, - 0x52, 0x85, 0x3c, 0xb8, 0x38, 0x8a, 0x52, 0xd3, 0x33, 0x8b, 0x4b, 0x8a, 0x2a, 0x25, 0x18, 0x15, - 0x98, 0x35, 0xb8, 0x8d, 0xd4, 0xf4, 0xb0, 0x19, 0xa7, 0xe7, 0x09, 0xe7, 0x39, 0x55, 0x86, 0x54, - 0x16, 0xa4, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd7, 0xad, 0x14, 0xcc, 0x25, 0x80, - 0xae, 0x46, 0x48, 0x95, 0x8b, 0x0f, 0x6e, 0x4a, 0x7c, 0x49, 0x65, 0x41, 0xaa, 0x04, 0xa3, 0x02, - 0xa3, 0x06, 0x67, 0x10, 0x2f, 0x5c, 0x14, 0xac, 0x4c, 0x82, 0x8b, 0x3d, 0x35, 0xaf, 0xa4, 0x28, - 0x33, 0xb5, 0x58, 0x82, 0x49, 0x81, 0x59, 0x83, 0x27, 0x08, 0xc6, 0x75, 0x72, 0x3f, 0xf1, 0x48, - 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, - 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, - 0xe4, 0xfc, 0x5c, 0xfd, 0xe2, 0xec, 0xcc, 0x02, 0xdd, 0xdc, 0xd4, 0x32, 0x7d, 0x68, 0x60, 0x55, - 0x20, 0x07, 0x17, 0xc8, 0xda, 0xe2, 0x24, 0x36, 0xb0, 0xf7, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x02, 0x11, 0x7c, 0xd0, 0x50, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Registry) > 0 { - for iNdEx := len(m.Registry) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Registry[iNdEx].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 (m *IncentivesByType) 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 *IncentivesByType) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IncentivesByType) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Entries[iNdEx]) - copy(dAtA[i:], m.Entries[iNdEx]) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Entries[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.IncentiveType) > 0 { - i -= len(m.IncentiveType) - copy(dAtA[i:], m.IncentiveType) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.IncentiveType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Registry) > 0 { - for _, e := range m.Registry { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *IncentivesByType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.IncentiveType) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.Entries) > 0 { - for _, b := range m.Entries { - l = len(b) - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Registry", 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.Registry = append(m.Registry, IncentivesByType{}) - if err := m.Registry[len(m.Registry)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 (m *IncentivesByType) 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: IncentivesByType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IncentivesByType: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncentiveType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IncentiveType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, make([]byte, postIndex-iNdEx)) - copy(m.Entries[len(m.Entries)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/incentives/types/genesis_test.go b/x/incentives/types/genesis_test.go deleted file mode 100644 index bcc1ef068..000000000 --- a/x/incentives/types/genesis_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/incentives/types" -) - -func TestGenesis(t *testing.T) { - t.Run("can create a new default genesis state", func(t *testing.T) { - gs := types.NewDefaultGenesisState() - require.NoError(t, gs.ValidateBasic()) - }) - - t.Run("can accept a valid genesis state with a single incentive type", func(t *testing.T) { - badPrice := types.NewIncentives("badprice", [][]byte{[]byte("incentive1")}) - gs := types.NewGenesisState([]types.IncentivesByType{badPrice}) - require.NoError(t, gs.ValidateBasic()) - }) - - t.Run("can accept a valid genesis state with multiple incentive types", func(t *testing.T) { - badPrice := types.NewIncentives("badprice", [][]byte{[]byte("incentive1")}) - goodPrice := types.NewIncentives("goodprice", [][]byte{[]byte("incentive1")}) - - gs := types.NewGenesisState([]types.IncentivesByType{badPrice, goodPrice}) - - require.NoError(t, gs.ValidateBasic()) - }) - - t.Run("can reject a genesis state with duplicate incentive types", func(t *testing.T) { - badPrice := types.NewIncentives("badprice", [][]byte{[]byte("incentive1")}) - goodPrice := types.NewIncentives("badprice", [][]byte{[]byte("incentive1")}) - - gs := types.NewGenesisState([]types.IncentivesByType{badPrice, goodPrice}) - - require.Error(t, gs.ValidateBasic()) - }) - - t.Run("can reject a genesis state with an empty incentive type", func(t *testing.T) { - badPrice := types.NewIncentives("", [][]byte{[]byte("incentive1")}) - - gs := types.NewGenesisState([]types.IncentivesByType{badPrice}) - - require.Error(t, gs.ValidateBasic()) - }) - - t.Run("can reject a genesis state with an empty incentive", func(t *testing.T) { - badPrice := types.NewIncentives("badprice", [][]byte{[]byte("")}) - - gs := types.NewGenesisState([]types.IncentivesByType{badPrice}) - - require.Error(t, gs.ValidateBasic()) - }) -} diff --git a/x/incentives/types/incentive.go b/x/incentives/types/incentive.go deleted file mode 100644 index 46631aa0b..000000000 --- a/x/incentives/types/incentive.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import ( - "github.com/cosmos/gogoproto/proto" -) - -type ( - // Incentive is the interface contract that must be fulfilled to allow for - // slashing/rewarding arbitrary events. To add a new incentive, implement - // this interface along with the corresponding strategy callback function. - // Each incentive type must be registered with its corresponding strategy - // function in the keeper. - Incentive interface { - proto.Message - - // ValidateBasic does a stateless check on the incentive. - ValidateBasic() error - - // Type returns the incentive type. - Type() string - - // Marshall the incentive into bytes. - Marshal() ([]byte, error) - - // Unmarshal the incentive from bytes. - Unmarshal([]byte) error - - // Copy the incentive. - Copy() Incentive - } -) diff --git a/x/incentives/types/keys.go b/x/incentives/types/keys.go deleted file mode 100644 index 7f8299298..000000000 --- a/x/incentives/types/keys.go +++ /dev/null @@ -1,41 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - // ModuleName is the name of the module. - ModuleName = "incentives" - // StoreKey is the store key string for incentives. - StoreKey = ModuleName -) - -const ( - // keyPrefixIncentive is the root key prefix under which all incentives are stored. - keyPrefixIncentive = iota - // keyPrefixCount is the key prefix used to index incentives. - keyPrefixCount -) - -var ( - // KeyPrefixIncentive is the root key prefix under which all incentives are stored. - KeyPrefixIncentive = []byte{keyPrefixIncentive} - // KeyPrefixCount is the key prefix used to index incentives. - KeyPrefixCount = []byte{keyPrefixCount} -) - -// GetIncentiveKey gets the store key for an incentive. -func GetIncentiveKey(incentive Incentive) []byte { - return append(KeyPrefixIncentive, []byte(incentive.Type())...) -} - -// GetIncentiveKeyWithIndex gets the store key for an incentive with an index. -func GetIncentiveKeyWithIndex(incentive Incentive, index uint64) []byte { - return append(GetIncentiveKey(incentive), sdk.Uint64ToBigEndian(index)...) -} - -// GetIncentiveCountKey gets the store key for the incentive count. -func GetIncentiveCountKey(incentive Incentive) []byte { - return append(KeyPrefixCount, []byte(incentive.Type())...) -} diff --git a/x/incentives/types/query.pb.go b/x/incentives/types/query.pb.go deleted file mode 100644 index 9aae966bc..000000000 --- a/x/incentives/types/query.pb.go +++ /dev/null @@ -1,945 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/incentives/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GetIncentivesByTypeRequest is the request type for the -// Query/GetIncentivesByType RPC method. -type GetIncentivesByTypeRequest struct { - // IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - // GoodPriceIncentiveType). - IncentiveType string `protobuf:"bytes,1,opt,name=incentive_type,json=incentiveType,proto3" json:"incentive_type,omitempty"` -} - -func (m *GetIncentivesByTypeRequest) Reset() { *m = GetIncentivesByTypeRequest{} } -func (m *GetIncentivesByTypeRequest) String() string { return proto.CompactTextString(m) } -func (*GetIncentivesByTypeRequest) ProtoMessage() {} -func (*GetIncentivesByTypeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ec938f9117db3eb, []int{0} -} -func (m *GetIncentivesByTypeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetIncentivesByTypeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetIncentivesByTypeRequest.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 *GetIncentivesByTypeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetIncentivesByTypeRequest.Merge(m, src) -} -func (m *GetIncentivesByTypeRequest) XXX_Size() int { - return m.Size() -} -func (m *GetIncentivesByTypeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetIncentivesByTypeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetIncentivesByTypeRequest proto.InternalMessageInfo - -func (m *GetIncentivesByTypeRequest) GetIncentiveType() string { - if m != nil { - return m.IncentiveType - } - return "" -} - -// GetIncentivesByTypeResponse is the response type for the -// Query/GetIncentivesByType RPC method. -type GetIncentivesByTypeResponse struct { - // Entries is the list of incentives of the given type. - Entries [][]byte `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (m *GetIncentivesByTypeResponse) Reset() { *m = GetIncentivesByTypeResponse{} } -func (m *GetIncentivesByTypeResponse) String() string { return proto.CompactTextString(m) } -func (*GetIncentivesByTypeResponse) ProtoMessage() {} -func (*GetIncentivesByTypeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8ec938f9117db3eb, []int{1} -} -func (m *GetIncentivesByTypeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetIncentivesByTypeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetIncentivesByTypeResponse.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 *GetIncentivesByTypeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetIncentivesByTypeResponse.Merge(m, src) -} -func (m *GetIncentivesByTypeResponse) XXX_Size() int { - return m.Size() -} -func (m *GetIncentivesByTypeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetIncentivesByTypeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetIncentivesByTypeResponse proto.InternalMessageInfo - -func (m *GetIncentivesByTypeResponse) GetEntries() [][]byte { - if m != nil { - return m.Entries - } - return nil -} - -// GetAllIncentivesRequest is the request type for the Query/GetAllIncentives -// RPC method. -type GetAllIncentivesRequest struct { -} - -func (m *GetAllIncentivesRequest) Reset() { *m = GetAllIncentivesRequest{} } -func (m *GetAllIncentivesRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllIncentivesRequest) ProtoMessage() {} -func (*GetAllIncentivesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8ec938f9117db3eb, []int{2} -} -func (m *GetAllIncentivesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetAllIncentivesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetAllIncentivesRequest.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 *GetAllIncentivesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllIncentivesRequest.Merge(m, src) -} -func (m *GetAllIncentivesRequest) XXX_Size() int { - return m.Size() -} -func (m *GetAllIncentivesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllIncentivesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllIncentivesRequest proto.InternalMessageInfo - -// GetAllIncentivesResponse is the response type for the Query/GetAllIncentives -// RPC method. -type GetAllIncentivesResponse struct { - // Registry is the list of all incentives, grouped by type. - Registry []IncentivesByType `protobuf:"bytes,1,rep,name=registry,proto3" json:"registry"` -} - -func (m *GetAllIncentivesResponse) Reset() { *m = GetAllIncentivesResponse{} } -func (m *GetAllIncentivesResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllIncentivesResponse) ProtoMessage() {} -func (*GetAllIncentivesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8ec938f9117db3eb, []int{3} -} -func (m *GetAllIncentivesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetAllIncentivesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetAllIncentivesResponse.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 *GetAllIncentivesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllIncentivesResponse.Merge(m, src) -} -func (m *GetAllIncentivesResponse) XXX_Size() int { - return m.Size() -} -func (m *GetAllIncentivesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllIncentivesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllIncentivesResponse proto.InternalMessageInfo - -func (m *GetAllIncentivesResponse) GetRegistry() []IncentivesByType { - if m != nil { - return m.Registry - } - return nil -} - -func init() { - proto.RegisterType((*GetIncentivesByTypeRequest)(nil), "slinky.incentives.v1.GetIncentivesByTypeRequest") - proto.RegisterType((*GetIncentivesByTypeResponse)(nil), "slinky.incentives.v1.GetIncentivesByTypeResponse") - proto.RegisterType((*GetAllIncentivesRequest)(nil), "slinky.incentives.v1.GetAllIncentivesRequest") - proto.RegisterType((*GetAllIncentivesResponse)(nil), "slinky.incentives.v1.GetAllIncentivesResponse") -} - -func init() { proto.RegisterFile("slinky/incentives/v1/query.proto", fileDescriptor_8ec938f9117db3eb) } - -var fileDescriptor_8ec938f9117db3eb = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0xc9, 0x2c, 0x4b, 0x2d, 0xd6, 0x2f, 0x33, - 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xa8, - 0xd0, 0x43, 0xa8, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd0, 0x07, - 0xb1, 0x20, 0x6a, 0xa5, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, - 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0xa1, 0xb2, 0x4a, 0x58, 0xed, - 0x4a, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x84, 0xaa, 0x51, 0x72, 0xe6, 0x92, 0x72, 0x4f, 0x2d, 0xf1, - 0x84, 0xab, 0x70, 0xaa, 0x0c, 0xa9, 0x2c, 0x48, 0x0d, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, - 0x52, 0xe5, 0xe2, 0x83, 0x6b, 0x8e, 0x2f, 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, 0xd4, 0xe0, - 0x0c, 0xe2, 0x85, 0x8b, 0x82, 0x54, 0x2b, 0x99, 0x73, 0x49, 0x63, 0x35, 0xa4, 0xb8, 0x20, 0x3f, - 0xaf, 0x38, 0x55, 0x48, 0x82, 0x8b, 0x3d, 0x35, 0xaf, 0xa4, 0x28, 0x33, 0xb5, 0x58, 0x82, 0x51, - 0x81, 0x59, 0x83, 0x27, 0x08, 0xc6, 0x55, 0x92, 0xe4, 0x12, 0x77, 0x4f, 0x2d, 0x71, 0xcc, 0xc9, - 0x41, 0xe8, 0x85, 0x5a, 0xad, 0x94, 0xc2, 0x25, 0x81, 0x29, 0x05, 0x35, 0xd0, 0x83, 0x8b, 0xa3, - 0x28, 0x35, 0x3d, 0xb3, 0xb8, 0xa4, 0xa8, 0x12, 0x6c, 0x22, 0xb7, 0x91, 0x9a, 0x1e, 0xb6, 0x50, - 0xd3, 0x43, 0x77, 0x92, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x70, 0xdd, 0x46, 0x1f, 0x99, - 0xb8, 0x58, 0x03, 0x41, 0x81, 0x2f, 0x74, 0x90, 0x91, 0x4b, 0x18, 0x8b, 0x27, 0x84, 0x0c, 0xb0, - 0x9b, 0x8c, 0x3b, 0xd0, 0xa4, 0x0c, 0x49, 0xd0, 0x01, 0xf1, 0x90, 0x92, 0x6b, 0xd3, 0xe5, 0x27, - 0x93, 0x99, 0xec, 0x85, 0x6c, 0xf5, 0x71, 0x44, 0x59, 0x49, 0x3c, 0x42, 0x24, 0x3e, 0xa9, 0x12, - 0x1c, 0x17, 0xfa, 0xd5, 0xa8, 0x71, 0x53, 0x2b, 0xb4, 0x98, 0x91, 0x4b, 0x00, 0x3d, 0xd0, 0x84, - 0x74, 0x71, 0x3a, 0x07, 0x5b, 0xb8, 0x4b, 0xe9, 0x11, 0xab, 0x1c, 0xea, 0x74, 0x03, 0xb0, 0xd3, - 0xb5, 0x84, 0x34, 0x70, 0x3b, 0x3d, 0x31, 0x27, 0x07, 0xc9, 0xf9, 0x4e, 0xee, 0x27, 0x1e, 0xc9, - 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, - 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9b, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, - 0x9c, 0x9f, 0xab, 0x5f, 0x9c, 0x9d, 0x59, 0xa0, 0x9b, 0x9b, 0x5a, 0x06, 0x33, 0xb6, 0x02, 0xd9, - 0x60, 0x90, 0x77, 0x8b, 0x93, 0xd8, 0xc0, 0x49, 0xd8, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x83, - 0xe9, 0x0f, 0xdd, 0x54, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // GetIncentivesByType returns all incentives of a given type. If the type is - // not registered with the module, an error is returned. - GetIncentivesByType(ctx context.Context, in *GetIncentivesByTypeRequest, opts ...grpc.CallOption) (*GetIncentivesByTypeResponse, error) - // GetAllIncentives returns all incentives. - GetAllIncentives(ctx context.Context, in *GetAllIncentivesRequest, opts ...grpc.CallOption) (*GetAllIncentivesResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) GetIncentivesByType(ctx context.Context, in *GetIncentivesByTypeRequest, opts ...grpc.CallOption) (*GetIncentivesByTypeResponse, error) { - out := new(GetIncentivesByTypeResponse) - err := c.cc.Invoke(ctx, "/slinky.incentives.v1.Query/GetIncentivesByType", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GetAllIncentives(ctx context.Context, in *GetAllIncentivesRequest, opts ...grpc.CallOption) (*GetAllIncentivesResponse, error) { - out := new(GetAllIncentivesResponse) - err := c.cc.Invoke(ctx, "/slinky.incentives.v1.Query/GetAllIncentives", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // GetIncentivesByType returns all incentives of a given type. If the type is - // not registered with the module, an error is returned. - GetIncentivesByType(context.Context, *GetIncentivesByTypeRequest) (*GetIncentivesByTypeResponse, error) - // GetAllIncentives returns all incentives. - GetAllIncentives(context.Context, *GetAllIncentivesRequest) (*GetAllIncentivesResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) GetIncentivesByType(ctx context.Context, req *GetIncentivesByTypeRequest) (*GetIncentivesByTypeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetIncentivesByType not implemented") -} -func (*UnimplementedQueryServer) GetAllIncentives(ctx context.Context, req *GetAllIncentivesRequest) (*GetAllIncentivesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllIncentives not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_GetIncentivesByType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetIncentivesByTypeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetIncentivesByType(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.incentives.v1.Query/GetIncentivesByType", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetIncentivesByType(ctx, req.(*GetIncentivesByTypeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GetAllIncentives_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllIncentivesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetAllIncentives(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.incentives.v1.Query/GetAllIncentives", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllIncentives(ctx, req.(*GetAllIncentivesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.incentives.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetIncentivesByType", - Handler: _Query_GetIncentivesByType_Handler, - }, - { - MethodName: "GetAllIncentives", - Handler: _Query_GetAllIncentives_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/incentives/v1/query.proto", -} - -func (m *GetIncentivesByTypeRequest) 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 *GetIncentivesByTypeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetIncentivesByTypeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.IncentiveType) > 0 { - i -= len(m.IncentiveType) - copy(dAtA[i:], m.IncentiveType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.IncentiveType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetIncentivesByTypeResponse) 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 *GetIncentivesByTypeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetIncentivesByTypeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Entries[iNdEx]) - copy(dAtA[i:], m.Entries[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Entries[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *GetAllIncentivesRequest) 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 *GetAllIncentivesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetAllIncentivesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *GetAllIncentivesResponse) 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 *GetAllIncentivesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetAllIncentivesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Registry) > 0 { - for iNdEx := len(m.Registry) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Registry[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GetIncentivesByTypeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.IncentiveType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *GetIncentivesByTypeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, b := range m.Entries { - l = len(b) - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *GetAllIncentivesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GetAllIncentivesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Registry) > 0 { - for _, e := range m.Registry { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetIncentivesByTypeRequest) 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 ErrIntOverflowQuery - } - 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: GetIncentivesByTypeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetIncentivesByTypeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncentiveType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IncentiveType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetIncentivesByTypeResponse) 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 ErrIntOverflowQuery - } - 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: GetIncentivesByTypeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetIncentivesByTypeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, make([]byte, postIndex-iNdEx)) - copy(m.Entries[len(m.Entries)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetAllIncentivesRequest) 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 ErrIntOverflowQuery - } - 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: GetAllIncentivesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllIncentivesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetAllIncentivesResponse) 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 ErrIntOverflowQuery - } - 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: GetAllIncentivesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllIncentivesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Registry", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Registry = append(m.Registry, IncentivesByType{}) - if err := m.Registry[len(m.Registry)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/incentives/types/query.pb.gw.go b/x/incentives/types/query.pb.gw.go deleted file mode 100644 index e25d34965..000000000 --- a/x/incentives/types/query.pb.gw.go +++ /dev/null @@ -1,254 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: slinky/incentives/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_GetIncentivesByType_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetIncentivesByTypeRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["incentive_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "incentive_type") - } - - protoReq.IncentiveType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "incentive_type", err) - } - - msg, err := client.GetIncentivesByType(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GetIncentivesByType_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetIncentivesByTypeRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["incentive_type"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "incentive_type") - } - - protoReq.IncentiveType, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "incentive_type", err) - } - - msg, err := server.GetIncentivesByType(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_GetAllIncentives_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllIncentivesRequest - var metadata runtime.ServerMetadata - - msg, err := client.GetAllIncentives(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GetAllIncentives_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllIncentivesRequest - var metadata runtime.ServerMetadata - - msg, err := server.GetAllIncentives(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_GetIncentivesByType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_GetIncentivesByType_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetIncentivesByType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GetAllIncentives_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_GetAllIncentives_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetAllIncentives_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_GetIncentivesByType_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_GetIncentivesByType_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetIncentivesByType_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GetAllIncentives_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_GetAllIncentives_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetAllIncentives_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_GetIncentivesByType_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"slinky", "incentives", "v1", "get_incentives_by_type", "incentive_type"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GetAllIncentives_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "incentives", "v1", "get_all_incentives"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_GetIncentivesByType_0 = runtime.ForwardResponseMessage - - forward_Query_GetAllIncentives_0 = runtime.ForwardResponseMessage -) diff --git a/x/incentives/types/strategy.go b/x/incentives/types/strategy.go deleted file mode 100644 index ee3042a34..000000000 --- a/x/incentives/types/strategy.go +++ /dev/null @@ -1,19 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Strategy defines the callback function that will be executed by the -// incentives module with the given context and incentive. The strategy is -// responsible for the following: -// 1. If the strategy desires to update the incentive, it must return the -// updated incentive. -// 2. If the strategy desires to delete the incentive, it must return nil. -// 3. If the strategy desires to leave the incentive unchanged, it must return -// the same incentive. -// 4. Applying any desired state transitions such as minting rewards, or -// slashing. -// -// For an example implementation, please see the examples/ directory. -type Strategy func(ctx sdk.Context, incentive Incentive) (updatedIncentive Incentive, err error) diff --git a/x/incentives/types/utils.go b/x/incentives/types/utils.go deleted file mode 100644 index 7b3238a56..000000000 --- a/x/incentives/types/utils.go +++ /dev/null @@ -1,42 +0,0 @@ -package types - -import "sort" - -// IncentivesToBytes converts a slice of Incentives to a slice of bytes. -func IncentivesToBytes(incentives ...Incentive) ([][]byte, error) { - incentiveBytes := make([][]byte, len(incentives)) - for i, incentive := range incentives { - bz, err := incentive.Marshal() - if err != nil { - return nil, err - } - - incentiveBytes[i] = bz - } - - return incentiveBytes, nil -} - -// SortIncentivesStrategiesMap sorts a map of IncentivesByType by their type. -func SortIncentivesStrategiesMap(incentiveStrategies map[Incentive]Strategy) []Incentive { - // Get all of the incentive types and sort them by name. - incentiveTypes := make([]Incentive, len(incentiveStrategies)) - i := 0 - for incentive := range incentiveStrategies { - incentiveTypes[i] = incentive - i++ - } - - // Sort the incentive types by name. - return SortIncentivesByType(incentiveTypes) -} - -// SortIncentivesByType sorts a slice of Incentives by their type. -func SortIncentivesByType(incentives []Incentive) []Incentive { - // Sort the incentive types by name. - sort.Slice(incentives, func(i, j int) bool { - return incentives[i].Type() < incentives[j].Type() - }) - - return incentives -} diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index df6e7367a..9e63fd374 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -221,13 +221,16 @@ func (k *Keeper) IsMarketValid(ctx sdk.Context, market types.Market) error { // check that all markets already exist in the keeper store: for _, providerConfig := range market.ProviderConfigs { if providerConfig.NormalizeByPair != nil { - has, err := k.markets.Has(ctx, types.TickerString(providerConfig.NormalizeByPair.String())) + norm, err := k.markets.Get(ctx, types.TickerString(providerConfig.NormalizeByPair.String())) if err != nil { - return err + return fmt.Errorf("unable to get normalize market %s for market %s: %w", + providerConfig.NormalizeByPair.String(), market.Ticker.String(), err) } - if !has { - return fmt.Errorf("currency pair %s in provider config does not exist", providerConfig.NormalizeByPair.String()) + // if the new market is enabled, its normalize by market must also be enabled + if market.Ticker.Enabled && !norm.Ticker.Enabled { + return fmt.Errorf("needed normalize market %s for market %s is not enabled", + providerConfig.NormalizeByPair.String(), market.Ticker.String()) } } } diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index e97187296..eaf4c6053 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -63,7 +63,7 @@ func (s *KeeperTestSuite) initKeeperWithHooks(hooks types.MarketMapHooks) *keepe s.ctx = testutil.DefaultContextWithKeys(keys, transientKeys, nil).WithBlockHeight(10) k := keeper.NewKeeper(mmSS, encCfg.Codec, s.authority) - s.Require().NoError(k.SetLastUpdated(s.ctx, uint64(s.ctx.BlockHeight()))) + s.Require().NoError(k.SetLastUpdated(s.ctx, uint64(s.ctx.BlockHeight()))) //nolint:gosec s.admin = sample.Address(r) s.marketAuthorities = []string{sample.Address(r), sample.Address(r), sample.Address(r)} @@ -276,6 +276,51 @@ func (s *KeeperTestSuite) TestValidUpdate() { s.Require().NoError(s.keeper.ValidateState(s.ctx, []types.Market{validMarket})) } +func (s *KeeperTestSuite) TestInvalidUpdateDisabledNormalizeBy() { + marketBTCUSDT := btcusdt + marketETHUSDT := ethusdt + + // create a valid markets + marketBTCUSDT.Ticker.Enabled = true + marketETHUSDT.Ticker.Enabled = false + + s.Require().NoError(s.keeper.CreateMarket(s.ctx, marketBTCUSDT)) + s.Require().NoError(s.keeper.CreateMarket(s.ctx, marketETHUSDT)) + + // invalid market with a normalize pair that is in state but disabled + invalidMarket := marketBTCUSDT + invalidMarket.ProviderConfigs = append(invalidMarket.ProviderConfigs, types.ProviderConfig{ + Name: "huobi", + OffChainTicker: "btc-usdt", + NormalizeByPair: &marketETHUSDT.Ticker.CurrencyPair, + }) + + s.Require().NoError(s.keeper.UpdateMarket(s.ctx, invalidMarket)) + s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) +} + +func (s *KeeperTestSuite) TestInvalidCreateDisabledNormalizeBy() { + marketBTCUSDT := btcusdt + marketETHUSDT := ethusdt + + // create a valid markets + marketBTCUSDT.Ticker.Enabled = true + marketETHUSDT.Ticker.Enabled = false + + s.Require().NoError(s.keeper.CreateMarket(s.ctx, marketETHUSDT)) + + // invalid market with a normalize pair that is in state but disabled + invalidMarket := marketBTCUSDT + invalidMarket.ProviderConfigs = append(invalidMarket.ProviderConfigs, types.ProviderConfig{ + Name: "huobi", + OffChainTicker: "btc-usdt", + NormalizeByPair: &marketETHUSDT.Ticker.CurrencyPair, + }) + + s.Require().NoError(s.keeper.CreateMarket(s.ctx, invalidMarket)) + s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) +} + func (s *KeeperTestSuite) TestDeleteMarket() { // create a valid markets btcCopy := btcusdt diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index be7e60fd8..a58f4c8c4 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -85,7 +85,7 @@ func (ms msgServer) UpsertMarkets(goCtx context.Context, msg *types.MsgUpsertMar return nil, err } - return &types.MsgUpsertMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) + return &types.MsgUpsertMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) //nolint:gosec } // CreateMarkets updates the marketmap by creating markets from the given message. All updates are made to the market @@ -126,7 +126,7 @@ func (ms msgServer) CreateMarkets(goCtx context.Context, msg *types.MsgCreateMar return nil, fmt.Errorf("invalid state resulting from update: %w", err) } - return &types.MsgCreateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) + return &types.MsgCreateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) //nolint:gosec } // UpdateMarkets updates the marketmap by updating markets from the given message. All updates are made to the market @@ -166,7 +166,7 @@ func (ms msgServer) UpdateMarkets(goCtx context.Context, msg *types.MsgUpdateMar return nil, fmt.Errorf("invalid state resulting from update: %w", err) } - return &types.MsgUpdateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) + return &types.MsgUpdateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) //nolint:gosec } // verifyMarketAuthorities verifies that the msg-submitter is a market-authority diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index de6961b6f..bd359d582 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -410,7 +410,7 @@ func (s *KeeperTestSuite) TestMsgServerUpsertMarkets() { // check that last updated is correct lastUpdated, err := s.keeper.GetLastUpdated(s.ctx) s.Require().NoError(err) - s.Require().Equal(uint64(s.ctx.BlockHeight()), lastUpdated) + s.Require().Equal(uint64(s.ctx.BlockHeight()), lastUpdated) //nolint:gosec // check that the emitted events are correct (get the last event) event := s.ctx.EventManager().Events()[len(s.ctx.EventManager().Events())-1] @@ -478,7 +478,7 @@ func (s *KeeperTestSuite) TestMsgServerUpsertMarkets() { // check that last updated is correct lastUpdated, err := s.keeper.GetLastUpdated(s.ctx) s.Require().NoError(err) - s.Require().Equal(uint64(s.ctx.BlockHeight()), lastUpdated) + s.Require().Equal(uint64(s.ctx.BlockHeight()), lastUpdated) //nolint:gosec // check that the emitted events are correct (get the last event) event := s.ctx.EventManager().Events()[len(s.ctx.EventManager().Events())-1] diff --git a/x/marketmap/keeper/query_test.go b/x/marketmap/keeper/query_test.go index 57b2b2934..6eb68212c 100644 --- a/x/marketmap/keeper/query_test.go +++ b/x/marketmap/keeper/query_test.go @@ -23,7 +23,7 @@ func (s *KeeperTestSuite) TestMarketMap() { MarketMap: types.MarketMap{ Markets: make(map[string]types.Market), }, - LastUpdated: uint64(s.ctx.BlockHeight()), + LastUpdated: uint64(s.ctx.BlockHeight()), //nolint:gosec ChainId: "test-chain", } @@ -45,7 +45,7 @@ func (s *KeeperTestSuite) TestMarketMap() { expected := &types.MarketMapResponse{ MarketMap: expectedMarketMap, - LastUpdated: uint64(s.ctx.BlockHeight()), + LastUpdated: uint64(s.ctx.BlockHeight()), //nolint:gosec ChainId: "test-chain", } @@ -131,7 +131,7 @@ func (s *KeeperTestSuite) TestLastUpdated() { resp, err := qs.LastUpdated(s.ctx, &types.LastUpdatedRequest{}) s.Require().NoError(err) - s.Require().Equal(uint64(s.ctx.BlockHeight()), resp.LastUpdated) + s.Require().Equal(uint64(s.ctx.BlockHeight()), resp.LastUpdated) //nolint:gosec }) s.Run("run invalid nil request", func() { diff --git a/x/oracle/keeper/grpc_query_test.go b/x/oracle/keeper/grpc_query_test.go index f0fa87087..9065326e3 100644 --- a/x/oracle/keeper/grpc_query_test.go +++ b/x/oracle/keeper/grpc_query_test.go @@ -229,7 +229,7 @@ func (s *KeeperTestSuite) TestGetCurrencyPairMappingGRPC() { res, err := qs.GetCurrencyPairMapping(s.ctx, nil) s.Require().Nil(err) for idx, cp := range currencyPairs { - s.Require().Equal(cp, res.CurrencyPairMapping[uint64(idx)]) + s.Require().Equal(cp, res.CurrencyPairMapping[uint64(idx)]) //nolint:gosec } }) } diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 042575850..b840572eb 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -335,13 +335,13 @@ func (k *Keeper) IterateCurrencyPairs(ctx sdk.Context, cb func(cp slinkytypes.Cu // with the x/oracle module, the legacy Decimals function is used. func (k *Keeper) GetDecimalsForCurrencyPair(ctx sdk.Context, cp slinkytypes.CurrencyPair) (decimals uint64, err error) { if k.mmKeeper == nil { - return uint64(cp.LegacyDecimals()), nil + return uint64(cp.LegacyDecimals()), nil //nolint:gosec } market, err := k.mmKeeper.GetMarket(ctx, cp.String()) if err != nil { if errors.Is(err, collections.ErrNotFound) { - return uint64(cp.LegacyDecimals()), nil + return uint64(cp.LegacyDecimals()), nil //nolint:gosec } return 0, err diff --git a/x/sla/client/cli/query.go b/x/sla/client/cli/query.go deleted file mode 100644 index 2021c6678..000000000 --- a/x/sla/client/cli/query.go +++ /dev/null @@ -1,79 +0,0 @@ -package cli - -import ( - "fmt" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// GetQueryCmd returns the parent command for all x/sla cli query commands. -func GetQueryCmd() *cobra.Command { - // create base command - cmd := &cobra.Command{ - Use: slatypes.ModuleName, - Short: fmt.Sprintf("Querying commands for the %s module", slatypes.ModuleName), - RunE: client.ValidateCmd, - } - - // add sub-commands - cmd.AddCommand( - GetAllSLAsCmd(), - GetParamsCmd(), - ) - - return cmd -} - -// GetAllSLAsCmd returns the cli-command that queries all SLAs in the store. -func GetAllSLAsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "slas", - Short: "Query for all SLAs in the store", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := slatypes.NewQueryClient(clientCtx) - resp, err := queryClient.GetAllSLAs(clientCtx.CmdContext, &slatypes.GetAllSLAsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -// GetParamsCmd returns the cli-command that queries the current SLA parameters. -func GetParamsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Query for the current SLA parameters", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := slatypes.NewQueryClient(clientCtx) - resp, err := queryClient.Params(clientCtx.CmdContext, &slatypes.ParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(resp) - }, - } - flags.AddQueryFlagsToCmd(cmd) - return cmd -} diff --git a/x/sla/keeper/begin_block.go b/x/sla/keeper/begin_block.go deleted file mode 100644 index 6e1f7ff29..000000000 --- a/x/sla/keeper/begin_block.go +++ /dev/null @@ -1,32 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// BeginBlocker is called at the start of every block. This will fetch -// all SLAs from state and execute them against the current set -// of price feeds the network is maintaining. -func (k *Keeper) BeginBlocker(ctx sdk.Context) error { - params, err := k.GetParams(ctx) - if err != nil { - return err - } - - if !params.Enabled { - return nil - } - - slas, err := k.GetSLAs(ctx) - if err != nil { - return err - } - - for _, sla := range slas { - if err := k.ExecSLA(ctx, sla); err != nil { - return err - } - } - - return nil -} diff --git a/x/sla/keeper/genesis.go b/x/sla/keeper/genesis.go deleted file mode 100644 index 69a80b956..000000000 --- a/x/sla/keeper/genesis.go +++ /dev/null @@ -1,70 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// InitGenesis initializes the store state from a genesis state. -func (k *Keeper) InitGenesis(ctx sdk.Context, gs slatypes.GenesisState) { - // Validate the genesis state. - if err := gs.ValidateBasic(); err != nil { - panic(err) - } - - // Add each price feed sla to the store. - for _, sla := range gs.SLAs { - if err := k.SetSLA(ctx, sla); err != nil { - panic(err) - } - } - - seenCPs := make(map[slinkytypes.CurrencyPair]struct{}) - for _, feed := range gs.PriceFeeds { - if err := k.SetPriceFeed(ctx, feed); err != nil { - panic(err) - } - - seenCPs[feed.CurrencyPair] = struct{}{} - } - - // Set the currency pairs. - if err := k.SetCurrencyPairs(ctx, seenCPs); err != nil { - panic(err) - } - - // Set the params. - if err := k.SetParams(ctx, gs.Params); err != nil { - panic(err) - } -} - -// ExportGenesis returns the current store state as a genesis state. -func (k *Keeper) ExportGenesis(ctx sdk.Context) *slatypes.GenesisState { - // Get the set of SLAs. - slas, err := k.GetSLAs(ctx) - if err != nil { - panic(err) - } - - // Get all price feeds. - aggFeeds := make([]slatypes.PriceFeed, 0) - for _, sla := range slas { - feeds, err := k.GetAllPriceFeeds(ctx, sla.ID) - if err != nil { - panic(err) - } - - aggFeeds = append(aggFeeds, feeds...) - } - - // Get the params. - params, err := k.GetParams(ctx) - if err != nil { - panic(err) - } - - return slatypes.NewGenesisState(slas, aggFeeds, params) -} diff --git a/x/sla/keeper/genesis_test.go b/x/sla/keeper/genesis_test.go deleted file mode 100644 index ac6f06a72..000000000 --- a/x/sla/keeper/genesis_test.go +++ /dev/null @@ -1,337 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func (s *KeeperTestSuite) TestInitGenesis() { - badSLA := slatypes.PriceFeedSLA{} - - sla1 := slatypes.NewPriceFeedSLA( - "id", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla2 := slatypes.NewPriceFeedSLA( - "id2", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "id3", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - cp1 := slinkytypes.NewCurrencyPair("BTC", "USD") - - consAddress1 := sdk.ConsAddress("consAddress1") - consAddress2 := sdk.ConsAddress("consAddress2") - - priceFeed1, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - "id1", - ) - s.Require().NoError(err) - priceFeed2, _ := slatypes.NewPriceFeed( - 10, - consAddress2, - cp1, - "id1", - ) - s.Require().NoError(err) - - s.Run("bad genesis state should panic", func() { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{badSLA}, nil, slatypes.DefaultParams()) - s.Require().Panics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - }) - - s.Run("good genesis state should not panic", func() { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{sla1, sla2, sla3}, nil, slatypes.DefaultParams()) - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(3, len(slas)) - s.Require().Equal(sla1, slas[0]) - s.Require().Equal(sla2, slas[1]) - s.Require().Equal(sla3, slas[2]) - - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(slatypes.DefaultParams(), params) - - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(0, len(cps)) - }) - - s.Run("default genesis state", func() { - gs := slatypes.NewDefaultGenesisState() - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(0, len(slas)) - - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(slatypes.DefaultParams(), params) - - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(0, len(cps)) - }) - - s.Run("can init with slas and price feeds", func() { - gs := slatypes.NewDefaultGenesisState() - gs.PriceFeeds = []slatypes.PriceFeed{priceFeed1, priceFeed2} - - sla1 := slatypes.NewPriceFeedSLA( - priceFeed1.ID, - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - gs.SLAs = []slatypes.PriceFeedSLA{sla1} - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(slas)) - s.Require().Equal(sla1, slas[0]) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, sla1.ID) - s.Require().NoError(err) - s.Require().Equal(2, len(feeds)) - - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - s.Require().Contains(cps, priceFeed1.CurrencyPair) - s.Require().Contains(cps, priceFeed2.CurrencyPair) - }) - - s.Run("can init with slas and price feeds and updated params", func() { - gs := slatypes.NewDefaultGenesisState() - gs.PriceFeeds = []slatypes.PriceFeed{priceFeed1, priceFeed2} - - sla1 := slatypes.NewPriceFeedSLA( - priceFeed1.ID, - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - gs.SLAs = []slatypes.PriceFeedSLA{sla1} - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(slas)) - s.Require().Equal(sla1, slas[0]) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, sla1.ID) - s.Require().NoError(err) - s.Require().Equal(2, len(feeds)) - - gs.Params = slatypes.Params{ - Enabled: false, - } - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(slatypes.Params{Enabled: false}, params) - - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(1, len(cps)) - s.Require().Contains(cps, priceFeed1.CurrencyPair) - s.Require().Contains(cps, priceFeed2.CurrencyPair) - }) - - s.Run("bad price feed", func() { - gs := slatypes.NewDefaultGenesisState() - gs.PriceFeeds = []slatypes.PriceFeed{priceFeed1, priceFeed2} - - sla1 := slatypes.NewPriceFeedSLA( - "", - 0, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - gs.SLAs = []slatypes.PriceFeedSLA{sla1} - - s.Require().Panics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - }) -} - -func (s *KeeperTestSuite) TestExportGenesis() { - sla1 := slatypes.NewPriceFeedSLA( - "id1", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla2 := slatypes.NewPriceFeedSLA( - "id2", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "id3", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - cp1 := slinkytypes.NewCurrencyPair("btc", "usd") - - consAddress1 := sdk.ConsAddress("consAddress1") - consAddress2 := sdk.ConsAddress("consAddress2") - - priceFeed1, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - "id1", - ) - s.Require().NoError(err) - priceFeed2, _ := slatypes.NewPriceFeed( - 10, - consAddress2, - cp1, - "id1", - ) - s.Require().NoError(err) - - s.Run("can export an empty genesis state", func() { - gs := s.keeper.ExportGenesis(s.ctx) - defaultGS := slatypes.NewDefaultGenesisState() - - s.Require().Equal(defaultGS.Params, gs.Params) - s.Require().Equal(len(defaultGS.SLAs), len(gs.SLAs)) - s.Require().Equal(len(defaultGS.PriceFeeds), len(gs.PriceFeeds)) - }) - - s.Run("can export with slas", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla1, sla2, sla3}) - s.Require().NoError(err) - - gs := s.keeper.ExportGenesis(s.ctx) - defaultGS := slatypes.NewDefaultGenesisState() - defaultGS.SLAs = []slatypes.PriceFeedSLA{sla1, sla2, sla3} - - s.Require().Equal(defaultGS.Params, gs.Params) - s.Require().Equal(len(defaultGS.SLAs), len(gs.SLAs)) - s.Require().Equal(len(defaultGS.PriceFeeds), len(gs.PriceFeeds)) - - for i := range gs.SLAs { - s.Require().Equal(defaultGS.SLAs[i], gs.SLAs[i]) - } - }) - - s.Run("can export with slas and updated params", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla1, sla2, sla3}) - s.Require().NoError(err) - - params := slatypes.Params{Enabled: false} - err = s.keeper.SetParams(s.ctx, params) - s.Require().NoError(err) - - gs := s.keeper.ExportGenesis(s.ctx) - defaultGs := slatypes.NewDefaultGenesisState() - defaultGs.SLAs = []slatypes.PriceFeedSLA{sla1, sla2, sla3} - defaultGs.Params = params - - s.Require().Equal(defaultGs.Params, gs.Params) - s.Require().Equal(len(defaultGs.SLAs), len(gs.SLAs)) - s.Require().Equal(len(defaultGs.PriceFeeds), len(gs.PriceFeeds)) - - for i := range gs.SLAs { - s.Require().Equal(defaultGs.SLAs[i], gs.SLAs[i]) - } - }) - - s.Run("can export with slas and price feeds", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla1, sla2, sla3}) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - gs := s.keeper.ExportGenesis(s.ctx) - defaultGs := slatypes.NewDefaultGenesisState() - defaultGs.SLAs = []slatypes.PriceFeedSLA{sla1, sla2, sla3} - defaultGs.PriceFeeds = []slatypes.PriceFeed{priceFeed1, priceFeed2} - - s.Require().Equal(defaultGs.Params, gs.Params) - s.Require().Equal(len(defaultGs.SLAs), len(gs.SLAs)) - s.Require().Equal(len(defaultGs.PriceFeeds), len(gs.PriceFeeds)) - - for i := range gs.SLAs { - s.Require().Equal(defaultGs.SLAs[i], gs.SLAs[i]) - } - - for i := range gs.PriceFeeds { - s.Require().Equal(defaultGs.PriceFeeds[i], gs.PriceFeeds[i]) - } - }) -} diff --git a/x/sla/keeper/keeper.go b/x/sla/keeper/keeper.go deleted file mode 100644 index 3e754b4ea..000000000 --- a/x/sla/keeper/keeper.go +++ /dev/null @@ -1,169 +0,0 @@ -package keeper - -import ( - "cosmossdk.io/collections" - "cosmossdk.io/core/store" - "cosmossdk.io/log" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// Keeper defines a new keeper for the price feed SLA module. This module -// tracks the current SLAs and the corresponding price feed updates. Each -// price feed is associated with an SLA, validator, and currency pair. The -// currency pairs utilized by the x/sla module are defined in the x/oracle -// module. -type Keeper struct { - cdc codec.BinaryCodec - - // State management variables - storeService store.KVStoreService - schema collections.Schema - - // slas is a map of (sla ID -> SLA) that is used to track the SLAs that are - // currently in the x/sla module's state. - slas collections.Map[string, slatypes.PriceFeedSLA] - - // priceFeeds is a map of (sla ID, currency pair, consensus address -> price feed) - priceFeeds collections.Map[collections.Triple[string, string, []byte], slatypes.PriceFeed] - - // currencyPairs is a map of (currency pair string -> currency pair) that is used to - // track the currency pairs that are currently in the x/sla module's state. This set - // of currency pairs is used to remove stale price feeds. - currencyPairs collections.Map[string, slinkytypes.CurrencyPair] - - // params is the module's parameters. - params collections.Item[slatypes.Params] - - // authority is the address that is authorized to add new SLAs. - authority sdk.AccAddress - - // stakingKeeper is utilized to retrieve validator information. - stakingKeeper slatypes.StakingKeeper - - // slashingKeeper is utilized to slash validators that do not meet the SLA. - slashingKeeper slatypes.SlashingKeeper -} - -// NewKeeper returns a new keeper for the price feed SLAs. The keeper is -// responsible for maintaining the current set of SLAs and the corresponding -// price feed updates. -func NewKeeper( - storeService store.KVStoreService, - cdc codec.BinaryCodec, - authority sdk.AccAddress, - stakingKeeper slatypes.StakingKeeper, - slashingKeeper slatypes.SlashingKeeper, -) *Keeper { - schemaBuilder := collections.NewSchemaBuilder(storeService) - - // Create the collections map that will track the SLAs. - slas := collections.NewMap( - schemaBuilder, - slatypes.KeyPrefixSLA, - "slas", - collections.StringKey, - codec.CollValue[slatypes.PriceFeedSLA](cdc), - ) - - // Create the price feed map that will track the price feed updates. - priceFeeds := collections.NewMap( - schemaBuilder, - slatypes.KeyPrefixPriceFeeds, - "price_feeds", - collections.TripleKeyCodec(collections.StringKey, collections.StringKey, collections.BytesKey), - codec.CollValue[slatypes.PriceFeed](cdc), - ) - - // Create the collections map that will track the currency pairs. - currencyPairs := collections.NewMap( - schemaBuilder, - slatypes.KeyPrefixCurrencyPairs, - "currency_pairs", - collections.StringKey, - codec.CollValue[slinkytypes.CurrencyPair](cdc), - ) - - // Create the collections item that will track the module parameters. - params := collections.NewItem( - schemaBuilder, - slatypes.KeyPrefixParams, - "params", - codec.CollValue[slatypes.Params](cdc), - ) - - // Build the schema and return the keeper. - schema, err := schemaBuilder.Build() - if err != nil { - panic(err) - } - - return &Keeper{ - cdc: cdc, - storeService: storeService, - schema: schema, - slas: slas, - priceFeeds: priceFeeds, - currencyPairs: currencyPairs, - params: params, - authority: authority, - stakingKeeper: stakingKeeper, - slashingKeeper: slashingKeeper, - } -} - -// Logger returns the keeper's logger. -func (k *Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/sla") -} - -// SetParams sets the x/sla module's parameters. -func (k *Keeper) SetParams(ctx sdk.Context, params slatypes.Params) error { - return k.params.Set(ctx, params) -} - -// GetParams returns the x/sla module's parameters. -func (k *Keeper) GetParams(ctx sdk.Context) (slatypes.Params, error) { - return k.params.Get(ctx) -} - -// SetCurrencyPairs sets the x/sla module's currency pairs. Note, this function -// is primarily used to remove stale price feeds. -func (k *Keeper) SetCurrencyPairs(ctx sdk.Context, currencyPairs map[slinkytypes.CurrencyPair]struct{}) error { - // Remove all currency pairs that are currently in the x/sla module's state. - if err := k.currencyPairs.Clear(ctx, nil); err != nil { - return err - } - - for cp := range currencyPairs { - if err := k.currencyPairs.Set(ctx, cp.String(), cp); err != nil { - return err - } - } - - return nil -} - -// GetCurrencyPairs returns the x/sla module's currency pairs. -func (k *Keeper) GetCurrencyPairs(ctx sdk.Context) (map[slinkytypes.CurrencyPair]struct{}, error) { - iterator, err := k.currencyPairs.Iterate(ctx, nil) - if err != nil { - return nil, err - } - defer iterator.Close() - - currencyPairs := make(map[slinkytypes.CurrencyPair]struct{}) - for ; iterator.Valid(); iterator.Next() { - cp, err := iterator.Value() - if err != nil { - return nil, err - } - - currencyPairs[cp] = struct{}{} - } - - return currencyPairs, nil -} diff --git a/x/sla/keeper/keeper_test.go b/x/sla/keeper/keeper_test.go deleted file mode 100644 index bd482b977..000000000 --- a/x/sla/keeper/keeper_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package keeper_test - -import ( - "testing" - - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/stretchr/testify/suite" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/sla/keeper" - slatypes "github.com/skip-mev/slinky/x/sla/types" - "github.com/skip-mev/slinky/x/sla/types/mocks" -) - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - - // Keeper variables - authority sdk.AccAddress - stakingKeeper *mocks.StakingKeeper - slashingKeeper *mocks.SlashingKeeper - keeper *keeper.Keeper - - // Message server variables - msgServer slatypes.MsgServer - - // Query server variables - queryServer slatypes.QueryServer -} - -func (s *KeeperTestSuite) SetupTest() { - s.keeper = s.initKeeper() - s.msgServer = keeper.NewMsgServer(*s.keeper) - s.queryServer = keeper.NewQueryServer(*s.keeper) -} - -func (s *KeeperTestSuite) SetupSubTest() { - s.keeper = s.initKeeper() - s.msgServer = keeper.NewMsgServer(*s.keeper) - s.queryServer = keeper.NewQueryServer(*s.keeper) -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -func (s *KeeperTestSuite) TestSetParams() { - params := slatypes.DefaultParams() - - s.Run("can set and get params", func() { - err := s.keeper.SetParams(s.ctx, params) - s.Require().NoError(err) - - params2, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(params, params2) - }) -} - -func (s *KeeperTestSuite) TestSetCurrencyPairs() { - cp1 := slinkytypes.NewCurrencyPair("btc", "usd") - cp2 := slinkytypes.NewCurrencyPair("eth", "usd") - - testCPs := map[slinkytypes.CurrencyPair]struct{}{ - cp1: {}, - cp2: {}, - } - - s.Run("can set and get currency pairs", func() { - err := s.keeper.SetCurrencyPairs(s.ctx, testCPs) - s.Require().NoError(err) - - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Equal(testCPs, cps) - }) -} - -func (s *KeeperTestSuite) initKeeper() *keeper.Keeper { - // Set up context - key := storetypes.NewKVStoreKey(slatypes.StoreKey) - testCtx := testutil.DefaultContextWithDB(s.T(), key, storetypes.NewTransientStoreKey("transient_test")) - s.ctx = testCtx.Ctx - - // Set up store and encoding configs - storeService := runtime.NewKVStoreService(key) - encodingConfig := moduletestutil.MakeTestEncodingConfig() - - slatypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) - - s.stakingKeeper = mocks.NewStakingKeeper(s.T()) - s.slashingKeeper = mocks.NewSlashingKeeper(s.T()) - s.authority = sdk.AccAddress("authority") - - // Set up keeper - k := keeper.NewKeeper( - storeService, - encodingConfig.Codec, - s.authority, - s.stakingKeeper, - s.slashingKeeper, - ) - - s.Require().NoError(k.SetParams(s.ctx, slatypes.DefaultParams())) - - return k -} diff --git a/x/sla/keeper/msg_server.go b/x/sla/keeper/msg_server.go deleted file mode 100644 index 48f0975d7..000000000 --- a/x/sla/keeper/msg_server.go +++ /dev/null @@ -1,69 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -var _ slatypes.MsgServer = (*MsgServer)(nil) - -// Request is a basic interface for all messages. -type Request interface { - ValidateBasic() error - GetAuthority() string -} - -// MsgServer is the server API for x/sla Msg service. -type MsgServer struct { - k Keeper -} - -// NewMsgServer returns the MsgServer implementation. -func NewMsgServer(k Keeper) slatypes.MsgServer { - return &MsgServer{k} -} - -// AddSLAs defines a method that adds a set of SLAs to the store. The SLAs provided must not already -// exist in the store and must be valid. The signer of the message must also be the module authority. -func (m *MsgServer) AddSLAs(goCtx context.Context, req *slatypes.MsgAddSLAs) (*slatypes.MsgAddSLAsResponse, error) { - // Add all SLAs in message to state. - ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.k.AddSLAs(ctx, req.SLAs); err != nil { - return nil, err - } - - return &slatypes.MsgAddSLAsResponse{}, nil -} - -// RemoveSLAs defines a method that removes a set of SLAs from the store. The SLAs provided must -// exist in the store, and the signer of the message must be the module authority. -func (m *MsgServer) RemoveSLAs(goCtx context.Context, req *slatypes.MsgRemoveSLAs) (*slatypes.MsgRemoveSLAsResponse, error) { - // Remove the SLAs in message from state. - ctx := sdk.UnwrapSDKContext(goCtx) - for _, id := range req.IDs { - if err := m.k.RemovePriceFeedsBySLA(ctx, id); err != nil { - return nil, err - } - - if err := m.k.RemoveSLA(ctx, id); err != nil { - return nil, err - } - } - - return &slatypes.MsgRemoveSLAsResponse{}, nil -} - -// Params defines a method that updates the module's parameters. The signer of the message must -// be the module authority. -func (m *MsgServer) Params(goCtx context.Context, req *slatypes.MsgParams) (*slatypes.MsgParamsResponse, error) { - // Update the module's parameters. - ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.k.SetParams(ctx, req.Params); err != nil { - return nil, err - } - - return &slatypes.MsgParamsResponse{}, nil -} diff --git a/x/sla/keeper/msg_server_test.go b/x/sla/keeper/msg_server_test.go deleted file mode 100644 index d73ef3fa3..000000000 --- a/x/sla/keeper/msg_server_test.go +++ /dev/null @@ -1,228 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func (s *KeeperTestSuite) TestMsgAddSLAs() { - sla1 := slatypes.NewPriceFeedSLA( - "id", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla2 := slatypes.NewPriceFeedSLA( - "id2", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "id3", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - s.Run("accepts a req with valid SLA", func() { - req := &slatypes.MsgAddSLAs{ - Authority: s.authority.String(), - SLAs: []slatypes.PriceFeedSLA{sla1}, - } - resp, err := s.msgServer.AddSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 1) - s.Require().Equal(sla1, slas[0]) - }) - - s.Run("accepts a req with valid SLAs", func() { - req := &slatypes.MsgAddSLAs{ - Authority: s.authority.String(), - SLAs: []slatypes.PriceFeedSLA{sla2, sla3}, - } - resp, err := s.msgServer.AddSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 2) - s.Require().Equal(sla2, slas[0]) - s.Require().Equal(sla3, slas[1]) - }) -} - -func (s *KeeperTestSuite) TestMsgRemoveSLAs() { - sla1 := slatypes.NewPriceFeedSLA( - "id", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla2 := slatypes.NewPriceFeedSLA( - "id2", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "id3", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - s.Run("accepts a req with no SLAs", func() { - req := &slatypes.MsgRemoveSLAs{ - Authority: s.authority.String(), - } - resp, err := s.msgServer.RemoveSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - }) - - s.Run("accepts a req removing one sla that does not exist", func() { - req := &slatypes.MsgRemoveSLAs{ - Authority: s.authority.String(), - IDs: []string{"does not exist"}, - } - resp, err := s.msgServer.RemoveSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - }) - - s.Run("removes a sla single sla", func() { - s.Require().NoError(s.keeper.SetSLA(s.ctx, sla1)) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 1) - s.Require().Equal(sla1, slas[0]) - - req := &slatypes.MsgRemoveSLAs{ - Authority: s.authority.String(), - IDs: []string{sla1.ID}, - } - resp, err := s.msgServer.RemoveSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - slas, err = s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 0) - }) - - s.Run("removes a sla single sla with some feeds in state", func() { - cons1 := sdk.ConsAddress("cons1") - cons2 := sdk.ConsAddress("cons2") - cp1 := slinkytypes.NewCurrencyPair("BTC", "USD") - - feed1, err := slatypes.NewPriceFeed(10, cons1, cp1, sla1.ID) - s.Require().NoError(err) - - feed2, err := slatypes.NewPriceFeed(10, cons2, cp1, sla1.ID) - s.Require().NoError(err) - - s.Require().NoError(s.keeper.SetPriceFeed(s.ctx, feed1)) - s.Require().NoError(s.keeper.SetPriceFeed(s.ctx, feed2)) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, sla1.ID) - s.Require().NoError(err) - s.Require().Len(feeds, 2) - - s.Require().NoError(s.keeper.SetSLA(s.ctx, sla1)) - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 1) - s.Require().Equal(sla1, slas[0]) - - req := &slatypes.MsgRemoveSLAs{ - Authority: s.authority.String(), - IDs: []string{sla1.ID}, - } - resp, err := s.msgServer.RemoveSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - slas, err = s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 0) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, sla1.ID) - s.Require().NoError(err) - s.Require().Len(feeds, 0) - }) - - s.Run("removes multiple slas", func() { - s.Require().NoError(s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla1, sla2, sla3})) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 3) - s.Require().Equal(sla1, slas[0]) - s.Require().Equal(sla2, slas[1]) - s.Require().Equal(sla3, slas[2]) - - req := &slatypes.MsgRemoveSLAs{ - Authority: s.authority.String(), - IDs: []string{sla1.ID, sla2.ID}, - } - resp, err := s.msgServer.RemoveSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - slas, err = s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 1) - s.Require().Equal(sla3, slas[0]) - }) -} - -func (s *KeeperTestSuite) TestMsgParams() { - s.Run("accepts a req with no params", func() { - req := &slatypes.MsgParams{ - Authority: s.authority.String(), - } - resp, err := s.msgServer.Params(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - }) - - s.Run("accepts a req with params", func() { - req := &slatypes.MsgParams{ - Authority: s.authority.String(), - Params: slatypes.DefaultParams(), - } - resp, err := s.msgServer.Params(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(req.Params, params) - }) -} diff --git a/x/sla/keeper/price_feeds.go b/x/sla/keeper/price_feeds.go deleted file mode 100644 index 7b209a235..000000000 --- a/x/sla/keeper/price_feeds.go +++ /dev/null @@ -1,116 +0,0 @@ -package keeper - -import ( - "cosmossdk.io/collections" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// PriceFeedCB is a callback function that can be used to process price feeds -// as they are received. -type PriceFeedCB func(priceFeed slatypes.PriceFeed) error - -// SetPriceFeed adds a price feed to the x/sla module's state. -func (k *Keeper) SetPriceFeed( - ctx sdk.Context, - priceFeed slatypes.PriceFeed, -) error { - key := collections.Join3(priceFeed.ID, priceFeed.CurrencyPair.String(), priceFeed.Validator) - return k.priceFeeds.Set(ctx, key, priceFeed) -} - -// GetPriceFeed returns the price feed with the given ID from the x/sla module's -// state. -func (k *Keeper) GetPriceFeed( - ctx sdk.Context, - slaID string, - cp slinkytypes.CurrencyPair, - consAddress sdk.ConsAddress, -) (slatypes.PriceFeed, error) { - key := collections.Join3(slaID, cp.String(), consAddress.Bytes()) - return k.priceFeeds.Get(ctx, key) -} - -// GetAllPriceFeeds returns the set of price feeds that are currently in the -// x/sla module's state for a given SLA. -func (k *Keeper) GetAllPriceFeeds(ctx sdk.Context, slaID string) ([]slatypes.PriceFeed, error) { - feeds := make([]slatypes.PriceFeed, 0) - cb := func(feed slatypes.PriceFeed) error { - feeds = append(feeds, feed) - return nil - } - - if err := k.iteratePriceFeeds(ctx, slaID, cb); err != nil { - return nil, err - } - - return feeds, nil -} - -// RemovePriceFeed removes a price feed from the x/sla module's state. Note, -// if the price feed does not exist, this function will not return an error. -func (k *Keeper) RemovePriceFeed( - ctx sdk.Context, - slaID string, - cp slinkytypes.CurrencyPair, - consAddress sdk.ConsAddress, -) error { - key := collections.Join3(slaID, cp.String(), consAddress.Bytes()) - return k.priceFeeds.Remove(ctx, key) -} - -// RemovePriceFeedByCurrencyPair removes all price feeds that track -// a given currency pair from the x/sla module's state for a given sla. -func (k *Keeper) RemovePriceFeedByCurrencyPair( - ctx sdk.Context, - slaID string, - cp slinkytypes.CurrencyPair, -) error { - prefix := collections.NewSuperPrefixedTripleRange[string, string, []byte](slaID, cp.String()) - return k.priceFeeds.Clear(ctx, prefix) -} - -// RemovePriceFeedsBySLA removes all price feeds that track a given SLA -// from the x/sla module's state. -func (k *Keeper) RemovePriceFeedsBySLA(ctx sdk.Context, slaID string) error { - prefix := collections.NewPrefixedTripleRange[string, string, []byte](slaID) - return k.priceFeeds.Clear(ctx, prefix) -} - -// ContainsPriceFeed returns true if the x/sla module's state contains -// a price feed with the given sla ID, currency pair, and validator. -func (k *Keeper) ContainsPriceFeed( - ctx sdk.Context, - slaID string, - cp slinkytypes.CurrencyPair, - validator sdk.ConsAddress, -) (bool, error) { - key := collections.Join3(slaID, cp.String(), validator.Bytes()) - return k.priceFeeds.Has(ctx, key) -} - -// iteratePriceFeeds iterates over the set of price feeds that -// are currently in the x/sla module's state and belong to a given SLA. -func (k *Keeper) iteratePriceFeeds(ctx sdk.Context, slaID string, cb PriceFeedCB) error { - prefix := collections.NewPrefixedTripleRange[string, string, []byte](slaID) - iterator, err := k.priceFeeds.Iterate(ctx, prefix) - if err != nil { - return err - } - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - priceFeed, err := iterator.Value() - if err != nil { - return err - } - - if err := cb(priceFeed); err != nil { - return err - } - } - - return nil -} diff --git a/x/sla/keeper/price_feeds_test.go b/x/sla/keeper/price_feeds_test.go deleted file mode 100644 index 52449e2d9..000000000 --- a/x/sla/keeper/price_feeds_test.go +++ /dev/null @@ -1,367 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/bits-and-blooms/bitset" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -const ( - id1 = "testId" -) - -func (s *KeeperTestSuite) TestSetPriceFeed() { - cp1 := slinkytypes.NewCurrencyPair("btc", "usd") - - consAddress1 := sdk.ConsAddress("consAddress1") - consAddress2 := sdk.ConsAddress("consAddress2") - - priceFeed1, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - id1, - ) - s.Require().NoError(err) - priceFeed2, _ := slatypes.NewPriceFeed( - 10, - consAddress2, - cp1, - id1, - ) - s.Require().NoError(err) - - s.Run("returns error when feed does not exist", func() { - _, err := s.keeper.GetPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().Error(err) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - }) - - s.Run("can set and get a single feed", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - feed, err := s.keeper.GetPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - checkEquality(s.T(), priceFeed1, feed) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - }) - - s.Run("can set and get multiple feeds", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - feed1, err := s.keeper.GetPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - checkEquality(s.T(), priceFeed1, feed1) - - feed2, err := s.keeper.GetPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - checkEquality(s.T(), priceFeed2, feed2) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - s.Require().True(contains) - - feed, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feed, 2) - checkEquality(s.T(), priceFeed1, feed[0]) - checkEquality(s.T(), priceFeed2, feed[1]) - }) -} - -func (s *KeeperTestSuite) TestRemovePriceFeeds() { - cp1 := slinkytypes.NewCurrencyPair("btc", "usd") - - consAddress1 := sdk.ConsAddress("consAddress1") - consAddress2 := sdk.ConsAddress("consAddress2") - - priceFeed1, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - id1, - ) - s.Require().NoError(err) - priceFeed2, _ := slatypes.NewPriceFeed( - 10, - consAddress2, - cp1, - id1, - ) - s.Require().NoError(err) - - s.Run("no error when removing a feed that does not exist", func() { - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - - err = s.keeper.RemovePriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - }) - - s.Run("can remove a feed", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - - err = s.keeper.RemovePriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Empty(feeds) - }) - - s.Run("can remove multiple feeds", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - s.Require().True(contains) - - err = s.keeper.RemovePriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - s.Require().True(contains) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 1) - checkEquality(s.T(), priceFeed2, feeds[0]) - - err = s.keeper.RemovePriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - s.Require().False(contains) - }) - - cp2 := slinkytypes.NewCurrencyPair("mog", "usd") - priceFeed3, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp2, // different currency pair - id1, - ) - s.Require().NoError(err) - - s.Run("can remove all feeds for a given currency pair", func() { - err = s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed3) - s.Require().NoError(err) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - s.Require().True(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp2, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - - err = s.keeper.RemovePriceFeedByCurrencyPair(s.ctx, id1, cp1) - s.Require().NoError(err) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress1) - s.Require().NoError(err) - s.Require().False(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp1, consAddress2) - s.Require().NoError(err) - s.Require().False(contains) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id1, cp2, consAddress1) - s.Require().NoError(err) - s.Require().True(contains) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 1) - checkEquality(s.T(), priceFeed3, feeds[0]) - }) - - cp3 := slinkytypes.NewCurrencyPair("gds", "4L") - - s.Run("different currency pairs are not affected", func() { - priceFeed1 := priceFeed1 - priceFeed2 := priceFeed2 - priceFeed3 := priceFeed3 - - priceFeed1.CurrencyPair = cp1 - priceFeed2.CurrencyPair = cp2 - priceFeed3.CurrencyPair = cp3 - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed3) - s.Require().NoError(err) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 3) - checkEquality(s.T(), priceFeed1, feeds[0]) - checkEquality(s.T(), priceFeed2, feeds[1]) - checkEquality(s.T(), priceFeed3, feeds[2]) - - err = s.keeper.RemovePriceFeedByCurrencyPair(s.ctx, id1, cp1) - s.Require().NoError(err) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 2) - checkEquality(s.T(), priceFeed2, feeds[0]) - checkEquality(s.T(), priceFeed3, feeds[1]) - - err = s.keeper.RemovePriceFeedByCurrencyPair(s.ctx, id1, cp2) - s.Require().NoError(err) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 1) - - err = s.keeper.RemovePriceFeedByCurrencyPair(s.ctx, id1, cp3) - s.Require().NoError(err) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Empty(feeds) - }) - - s.Run("can remove all feeds for a given sla", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed3) - s.Require().NoError(err) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 3) - - err = s.keeper.RemovePriceFeedsBySLA(s.ctx, id1) - s.Require().NoError(err) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Empty(feeds) - }) - - s.Run("can remove all price feeds for a given sla with other sla ids present", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - priceFeed3.ID = "testId2" - err = s.keeper.SetPriceFeed(s.ctx, priceFeed3) - s.Require().NoError(err) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 2) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, "testId2") - s.Require().NoError(err) - s.Require().Len(feeds, 1) - - err = s.keeper.RemovePriceFeedsBySLA(s.ctx, id1) - s.Require().NoError(err) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Empty(feeds) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, "testId2") - s.Require().NoError(err) - s.Require().Len(feeds, 1) - }) -} - -func checkEquality(t *testing.T, sla1, sla2 slatypes.PriceFeed) { - t.Helper() - - require.Equal(t, sla1.ID, sla2.ID) - require.Equal(t, sla1.MaximumViableWindow, sla2.MaximumViableWindow) - require.Equal(t, sla1.Index, sla2.Index) - - updateMap1 := bitset.New(uint(sla1.MaximumViableWindow)) - require.NoError(t, updateMap1.UnmarshalBinary(sla1.UpdateMap)) - - updateMap2 := bitset.New(uint(sla2.MaximumViableWindow)) - require.NoError(t, updateMap2.UnmarshalBinary(sla2.UpdateMap)) - - inclusionMap1 := bitset.New(uint(sla1.MaximumViableWindow)) - require.NoError(t, inclusionMap1.UnmarshalBinary(sla1.InclusionMap)) - - inclusionMap2 := bitset.New(uint(sla2.MaximumViableWindow)) - require.NoError(t, inclusionMap2.UnmarshalBinary(sla2.InclusionMap)) - - require.True(t, updateMap1.Equal(updateMap2)) - require.True(t, inclusionMap1.Equal(inclusionMap2)) -} diff --git a/x/sla/keeper/query_server.go b/x/sla/keeper/query_server.go deleted file mode 100644 index ddb1aee2e..000000000 --- a/x/sla/keeper/query_server.go +++ /dev/null @@ -1,57 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -var _ slatypes.QueryServer = (*QueryServer)(nil) - -// QueryServer defines the gRPC server for the x/sla module. -type QueryServer struct { - k Keeper -} - -// NewQueryServer creates a new instance of the x/sla QueryServer type. -func NewQueryServer(keeper Keeper) slatypes.QueryServer { - return &QueryServer{k: keeper} -} - -// GetAllSLAs defines a method that returns all SLAs in the store. -func (s *QueryServer) GetAllSLAs(goCtx context.Context, _ *slatypes.GetAllSLAsRequest) (*slatypes.GetAllSLAsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - slas, err := s.k.GetSLAs(ctx) - if err != nil { - return nil, err - } - - return &slatypes.GetAllSLAsResponse{SLAs: slas}, nil -} - -// GetPriceFeeds defines a method that returns all price feeds in the store with the given SLA ID. -func (s *QueryServer) GetPriceFeeds(goCtx context.Context, req *slatypes.GetPriceFeedsRequest) (*slatypes.GetPriceFeedsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - feeds, err := s.k.GetAllPriceFeeds(ctx, req.ID) - if err != nil { - return nil, err - } - - return &slatypes.GetPriceFeedsResponse{PriceFeeds: feeds}, nil -} - -// Params defines a method that returns the current SLA parameters. -func (s *QueryServer) Params(goCtx context.Context, _ *slatypes.ParamsRequest) (*slatypes.ParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - params, err := s.k.GetParams(ctx) - if err != nil { - return nil, err - } - - return &slatypes.ParamsResponse{Params: params}, nil -} diff --git a/x/sla/keeper/query_server_test.go b/x/sla/keeper/query_server_test.go deleted file mode 100644 index cf4f67bd9..000000000 --- a/x/sla/keeper/query_server_test.go +++ /dev/null @@ -1,222 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func (s *KeeperTestSuite) TestGetAllSLAsRequest() { - sla1 := slatypes.NewPriceFeedSLA( - "id", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla2 := slatypes.NewPriceFeedSLA( - "id2", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "id3", - 10, - math.LegacyMustNewDecFromStr("1.0"), - math.LegacyMustNewDecFromStr("1.0"), - 5, - 5, - ) - - s.Run("can get empty set of SLAs", func() { - req := &slatypes.GetAllSLAsRequest{} - resp, err := s.queryServer.GetAllSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - s.Require().Empty(resp.SLAs) - }) - - s.Run("can get all SLAs", func() { - s.Require().NoError(s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla1, sla2, sla3})) - - req := &slatypes.GetAllSLAsRequest{} - resp, err := s.queryServer.GetAllSLAs(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().Len(resp.SLAs, 3) - s.Require().Equal(sla1, resp.SLAs[0]) - s.Require().Equal(sla2, resp.SLAs[1]) - s.Require().Equal(sla3, resp.SLAs[2]) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 3) - - s.Require().Equal(resp.SLAs[0], slas[0]) - s.Require().Equal(resp.SLAs[1], slas[1]) - s.Require().Equal(resp.SLAs[2], slas[2]) - }) -} - -func (s *KeeperTestSuite) TestGetPriceFeedsRequest() { - cp1 := slinkytypes.NewCurrencyPair("btc", "usd") - - consAddress1 := sdk.ConsAddress("consAddress1") - consAddress2 := sdk.ConsAddress("consAddress2") - - id1 := "testId" - priceFeed1, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - id1, - ) - s.Require().NoError(err) - priceFeed2, _ := slatypes.NewPriceFeed( - 10, - consAddress2, - cp1, - id1, - ) - s.Require().NoError(err) - - s.Run("can get empty set of price feeds", func() { - req := &slatypes.GetPriceFeedsRequest{} - resp, err := s.queryServer.GetPriceFeeds(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - s.Require().Empty(resp.PriceFeeds) - }) - - s.Run("can get all price feeds", func() { - err := s.keeper.SetPriceFeed(s.ctx, priceFeed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, priceFeed2) - s.Require().NoError(err) - - req := &slatypes.GetPriceFeedsRequest{ - ID: id1, - } - resp, err := s.queryServer.GetPriceFeeds(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().Len(resp.PriceFeeds, 2) - s.Require().Equal(priceFeed1, resp.PriceFeeds[0]) - s.Require().Equal(priceFeed2, resp.PriceFeeds[1]) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 2) - - s.Require().Equal(resp.PriceFeeds[0], feeds[0]) - s.Require().Equal(resp.PriceFeeds[1], feeds[1]) - }) - - s.Run("multiple different feed IDs are set and returns only ones that correspond to it", func() { - feed1, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - id1, - ) - s.Require().NoError(err) - - feed2, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - "id2", - ) - s.Require().NoError(err) - - feed3, err := slatypes.NewPriceFeed( - 10, - consAddress1, - cp1, - "id3", - ) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed1) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed2) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed3) - s.Require().NoError(err) - - req := &slatypes.GetPriceFeedsRequest{ - ID: "id2", - } - resp, err := s.queryServer.GetPriceFeeds(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().Len(resp.PriceFeeds, 1) - s.Require().Equal(feed2, resp.PriceFeeds[0]) - - feeds, err := s.keeper.GetAllPriceFeeds(s.ctx, "id2") - s.Require().NoError(err) - s.Require().Len(feeds, 1) - s.Require().Equal(resp.PriceFeeds[0], feeds[0]) - - req = &slatypes.GetPriceFeedsRequest{ - ID: id1, - } - resp, err = s.queryServer.GetPriceFeeds(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - s.Require().Len(resp.PriceFeeds, 1) - - feeds, err = s.keeper.GetAllPriceFeeds(s.ctx, id1) - s.Require().NoError(err) - s.Require().Len(feeds, 1) - s.Require().Equal(resp.PriceFeeds[0], feeds[0]) - }) -} - -func (s *KeeperTestSuite) TestGetParamsRequest() { - s.Run("can get default params", func() { - req := &slatypes.ParamsRequest{} - resp, err := s.queryServer.Params(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().Equal(slatypes.DefaultParams(), resp.Params) - - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - - s.Require().Equal(resp.Params, params) - }) - - s.Run("can get updated params", func() { - params := slatypes.NewParams(false) - err := s.keeper.SetParams(s.ctx, params) - s.Require().NoError(err) - - req := &slatypes.ParamsRequest{} - resp, err := s.queryServer.Params(s.ctx, req) - s.Require().NoError(err) - s.Require().NotNil(resp) - - s.Require().Equal(params, resp.Params) - - params, err = s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - - s.Require().Equal(resp.Params, params) - }) -} diff --git a/x/sla/keeper/slas.go b/x/sla/keeper/slas.go deleted file mode 100644 index 2ca6844bd..000000000 --- a/x/sla/keeper/slas.go +++ /dev/null @@ -1,90 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// PriceFeedSLACB is a callback function that is executed for each SLA in the -// x/sla module's state. -type PriceFeedSLACB func(sla slatypes.PriceFeedSLA) error - -// GetSLA returns the SLA with the given ID from the x/sla module's state. -func (k *Keeper) GetSLA(ctx sdk.Context, slaID string) (slatypes.PriceFeedSLA, error) { - return k.slas.Get(ctx, slaID) -} - -// GetSLAs returns the set of SLAs that are currently in the x/sla module's state. -func (k *Keeper) GetSLAs(ctx sdk.Context) ([]slatypes.PriceFeedSLA, error) { - var slas []slatypes.PriceFeedSLA - cb := func(sla slatypes.PriceFeedSLA) error { - slas = append(slas, sla) - return nil - } - - if err := k.iterateSLAs(ctx, cb); err != nil { - return nil, err - } - - return slas, nil -} - -// AddSLAs adds a set of SLAs to the x/sla module's state. Note, this will -// overwrite any existing SLA with the same ID. -func (k *Keeper) AddSLAs(ctx sdk.Context, slas []slatypes.PriceFeedSLA) error { - for _, sla := range slas { - if err := k.SetSLA(ctx, sla); err != nil { - return err - } - } - - return nil -} - -// SetSLA sets an SLA to the x/sla module's state. Note, this will overwrite any -// existing SLA with the same ID. -func (k *Keeper) SetSLA(ctx sdk.Context, sla slatypes.PriceFeedSLA) error { - return k.slas.Set(ctx, sla.ID, sla) -} - -// RemoveSLAs removes a set of SLAs from the x/sla module's state. -func (k *Keeper) RemoveSLAs(ctx sdk.Context, slaIDs []string) error { - for _, id := range slaIDs { - if err := k.RemoveSLA(ctx, id); err != nil { - return err - } - } - - return nil -} - -// RemoveSLA removes an SLA from the x/sla module's state. If the SLA does not -// exist, the function will not error. -func (k *Keeper) RemoveSLA(ctx sdk.Context, slaID string) error { - return k.slas.Remove(ctx, slaID) -} - -// iterateSLAs iterates over the set of SLAs that are currently in the x/sla -// module's state. The function inputs a callback that will be executed for each -// SLA in the state. -func (k *Keeper) iterateSLAs(ctx sdk.Context, cb PriceFeedSLACB) error { - iterator, err := k.slas.Iterate(ctx, nil) - if err != nil { - return err - } - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - sla, err := iterator.Value() - if err != nil { - return err - } - - if err := cb(sla); err != nil { - return err - } - } - - return nil -} diff --git a/x/sla/keeper/slas_test.go b/x/sla/keeper/slas_test.go deleted file mode 100644 index 9d426ac9a..000000000 --- a/x/sla/keeper/slas_test.go +++ /dev/null @@ -1,162 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func (s *KeeperTestSuite) TestAddSLAs() { - s.Run("can set no slas", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{}) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Empty(slas) - }) - - sla1 := slatypes.NewPriceFeedSLA( - "testID", - 10, - math.LegacyMustNewDecFromStr("0.1"), - math.LegacyMustNewDecFromStr("0.1"), - 5, - 5, - ) - - s.Run("can set a single sla", func() { - err := s.keeper.SetSLA(s.ctx, sla1) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 1) - s.Require().Equal(sla1, slas[0]) - }) - - sla2 := slatypes.NewPriceFeedSLA( - "testID2", - 20, - math.LegacyMustNewDecFromStr("0.2"), - math.LegacyMustNewDecFromStr("0.2"), - 10, - 10, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "testID3", - 30, - math.LegacyMustNewDecFromStr("0.3"), - math.LegacyMustNewDecFromStr("0.3"), - 15, - 15, - ) - - s.Run("can set multiple slas", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla1, sla2, sla3}) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 3) - s.Require().Equal(sla1, slas[0]) - s.Require().Equal(sla2, slas[1]) - s.Require().Equal(sla3, slas[2]) - }) -} - -func (s *KeeperTestSuite) TestRemoveSLAs() { - s.Run("can remove no slas", func() { - err := s.keeper.RemoveSLAs(s.ctx, []string{}) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Empty(slas) - - err = s.keeper.RemoveSLA(s.ctx, "testID") - s.Require().NoError(err) - }) - - sla := slatypes.NewPriceFeedSLA( - "testID", - 10, - math.LegacyMustNewDecFromStr("0.1"), - math.LegacyMustNewDecFromStr("0.1"), - 5, - 5, - ) - - s.Run("can remove a single sla", func() { - err := s.keeper.SetSLA(s.ctx, sla) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 1) - s.Require().Equal(sla, slas[0]) - - err = s.keeper.RemoveSLAs(s.ctx, []string{sla.ID}) - s.Require().NoError(err) - - slas, err = s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Empty(slas) - - err = s.keeper.RemoveSLA(s.ctx, sla.ID) - s.Require().NoError(err) - }) - - sla2 := slatypes.NewPriceFeedSLA( - "testID2", - 20, - math.LegacyMustNewDecFromStr("0.2"), - math.LegacyMustNewDecFromStr("0.2"), - 10, - 10, - ) - - sla3 := slatypes.NewPriceFeedSLA( - "testID3", - 30, - math.LegacyMustNewDecFromStr("0.3"), - math.LegacyMustNewDecFromStr("0.3"), - 15, - 15, - ) - - s.Run("can add several slas and remove one", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla, sla2, sla3}) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 3) - - err = s.keeper.RemoveSLAs(s.ctx, []string{sla.ID}) - s.Require().NoError(err) - - slas, err = s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 2) - s.Require().Equal(sla2, slas[0]) - s.Require().Equal(sla3, slas[1]) - }) - - s.Run("can add several slas and remove all", func() { - err := s.keeper.AddSLAs(s.ctx, []slatypes.PriceFeedSLA{sla, sla2, sla3}) - s.Require().NoError(err) - - slas, err := s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Len(slas, 3) - - err = s.keeper.RemoveSLAs(s.ctx, []string{sla.ID, sla2.ID, sla3.ID}) - s.Require().NoError(err) - - slas, err = s.keeper.GetSLAs(s.ctx) - s.Require().NoError(err) - s.Require().Empty(slas) - }) -} diff --git a/x/sla/keeper/strategy.go b/x/sla/keeper/strategy.go deleted file mode 100644 index 5065ff607..000000000 --- a/x/sla/keeper/strategy.go +++ /dev/null @@ -1,151 +0,0 @@ -package keeper - -import ( - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -// ExecSLA enforces the SLA criteria for all price feeds that it is maintaining. -// This function is called at the beginning of every block and already assumes that -// all price feeds have been updated for the current block via the pre-block hook. -func (k *Keeper) ExecSLA(ctx sdk.Context, sla slatypes.PriceFeedSLA) error { - // Ensure that the SLA should be checked for the current block height. - height := ctx.BlockHeight() - if height == 0 || height%int64(sla.Frequency) != 0 { - return nil - } - - // Fetch all price feeds for the given SLA. - feeds, err := k.GetAllPriceFeeds(ctx, sla.ID) - if err != nil { - k.Logger(ctx).Error( - "failed to get price feeds for SLA", - "sla", sla.ID, - "err", err, - ) - - return err - } - - // Iterate through all price feeds and check if the price feed - // qualifies for an SLA check + meets the SLA criteria. - for _, priceFeed := range feeds { - qualifies, err := sla.Qualifies(priceFeed) - if err != nil { - k.Logger(ctx).Error( - "unable to determine if price feed qualifies for SLA", - "sla", sla.ID, - "err", err, - ) - - return err - } - if !qualifies { - k.Logger(ctx).Info("price feed does not qualify for SLA check") - continue - } - - if err := k.EnforceSLA(ctx, sla, priceFeed); err != nil { - k.Logger(ctx).Error( - "failed to check SLA", - "sla", sla.ID, - "err", err, - ) - - return err - } - } - - return nil -} - -// EnforceSLA checks whether the given price feed meets the criteria for -// the given SLA. If the price feed has met the expected uptime, then no action is -// taken. Otherwise, the validator is slashed by the deviation from the -// expected uptime. -func (k *Keeper) EnforceSLA(ctx sdk.Context, sla slatypes.PriceFeedSLA, priceFeed slatypes.PriceFeed) error { - // Ensure that the validator exists. In the event that the validator - // does not exist, we will delete the price feed from the store. - validator := sdk.ValAddress(priceFeed.Validator) - power, err := k.stakingKeeper.GetLastValidatorPower(ctx, validator) - if err != nil { - k.Logger(ctx).Error( - "failed to get last validator power; removing incentive for validator", - "validator", validator.String(), - "err", err, - ) - - return k.RemovePriceFeed(ctx, sla.ID, priceFeed.CurrencyPair, priceFeed.Validator) - } - - // Determine the uptime for the price feed. - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - if err != nil { - k.Logger(ctx).Error( - "unable to get uptime from SLA", - "err", err, - ) - - return err - } - - // Check if the validator is subject to slashing. - if uptime.GTE(sla.ExpectedUptime) { - k.Logger(ctx).Info( - "validator met SLA", - "validator", validator.String(), - "uptime", uptime, - "expected_uptime", sla.ExpectedUptime, - ) - - return nil - } - - // deviation = ((expected_uptime - uptime) / expected_uptime) * K - deviation := (sla.ExpectedUptime.Sub(uptime)).Quo(sla.ExpectedUptime) - slashFactor := deviation.Mul(sla.SlashConstant) - - k.Logger(ctx).Info( - "validator did not meet SLA", - "validator", validator.String(), - "uptime", uptime, - "deviation", deviation, - "expected_uptime", sla.ExpectedUptime, - "slash_factor", slashFactor, - ) - - return k.Slash(ctx, validator, power, slashFactor) -} - -// Slash will slash the validator with the given power and slash factor. -func (k *Keeper) Slash( - ctx sdk.Context, - validator sdk.ValAddress, - power int64, - slashFactor math.LegacyDec, -) error { - // We do height - ValidatorUpdateDelay because the vote extensions included in this block - // were constructed in the previous block. - height := ctx.BlockHeight() - sdk.ValidatorUpdateDelay - amount, err := k.slashingKeeper.Slash(ctx, sdk.ConsAddress(validator), height, power, slashFactor) - if err != nil { - k.Logger(ctx).Error( - "failed to slash validator", - "validator", validator.String(), - "err", err, - ) - - return err - } - - k.Logger(ctx).Info( - "slashed validator", - "validator", validator.String(), - "amount", amount.String(), - ) - - return nil -} diff --git a/x/sla/keeper/strategy_test.go b/x/sla/keeper/strategy_test.go deleted file mode 100644 index a710b00ec..000000000 --- a/x/sla/keeper/strategy_test.go +++ /dev/null @@ -1,613 +0,0 @@ -package keeper_test - -import ( - "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/mock" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func (s *KeeperTestSuite) TestExecSLA() { - // Strategy inputs - id := "testID" - maximumViableWindow := 20 - expectedUptime := math.LegacyMustNewDecFromStr("0.8") - k := math.LegacyMustNewDecFromStr("1.0") - frequency := 10 - minimumBlockUpdates := 10 - - sla := slatypes.NewPriceFeedSLA( - id, - uint64(maximumViableWindow), - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - // Price feed parameters - validator := sdk.ConsAddress([]byte("validator")) - cp := slinkytypes.CurrencyPair{ - Base: "BTC", - Quote: "ETH", - } - - s.Run("returns incentive when sla should not be checked", func() { - s.ctx = s.ctx.WithBlockHeight(1) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) - - s.Run("returns when the validator does not exist", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - for i := 0; i < 20; i++ { - priceFeed.SetUpdate(slatypes.VoteWithPrice) - } - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.stakingKeeper.On("GetLastValidatorPower", s.ctx, sdk.ValAddress(validator.Bytes())).Return(int64(0), fmt.Errorf("validator does not exist")) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - - // Check that the price feed was deleted - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id, cp, validator) - s.Require().NoError(err) - s.Require().False(contains) - }) - - s.Run("validator did not vote on enough blocks to be considered", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) - - s.Run("price feed with same size window as sla has not met SLA (0 uptime)", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - for i := 0; i < 20; i++ { - priceFeed.SetUpdate(slatypes.VoteWithoutPrice) - } - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.stakingKeeper.On("GetLastValidatorPower", s.ctx, sdk.ValAddress(validator)).Return(int64(100), nil) - - expectedSlashFactor := k - s.slashingKeeper.On( - "Slash", - s.ctx, - validator, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) - - s.Run("price feed with same size window as sla and has met SLA", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - for i := 0; i < 16; i++ { - priceFeed.SetUpdate(slatypes.VoteWithPrice) - } - for i := 0; i < 4; i++ { - priceFeed.SetUpdate(slatypes.VoteWithoutPrice) - } - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.stakingKeeper.On("GetLastValidatorPower", mock.Anything, sdk.ValAddress(validator)).Return(int64(100), nil) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) - - s.Run("price feed with same size window as sla and has exceeded SLA", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - for i := 0; i < 20; i++ { - priceFeed.SetUpdate(slatypes.VoteWithPrice) - } - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.stakingKeeper.On("GetLastValidatorPower", mock.Anything, sdk.ValAddress(validator)).Return(int64(100), nil) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) - - s.Run("price feed with same size window as sla has not met SLA (half uptime)", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - for i := 0; i < 5; i++ { - priceFeed.SetUpdate(slatypes.VoteWithoutPrice) - } - for i := 0; i < 5; i++ { - priceFeed.SetUpdate(slatypes.VoteWithPrice) - } - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.stakingKeeper.On("GetLastValidatorPower", mock.Anything, sdk.ValAddress(validator)).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.5"))).Quo(expectedUptime) - expectedSlashFactor := k.Mul(expectedDevation) - s.slashingKeeper.On( - "Slash", - mock.Anything, - validator, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) - - s.Run("price feed with same size window as sla has not met SLA (half uptime)", func() { - s.ctx = s.ctx.WithBlockHeight(int64(frequency)) - - priceFeed, err := slatypes.NewPriceFeed(uint(maximumViableWindow), validator, cp, id) - s.Require().NoError(err) - for i := 0; i < 10; i++ { - priceFeed.SetUpdate(slatypes.VoteWithoutPrice) - } - for i := 0; i < 10; i++ { - priceFeed.SetUpdate(slatypes.VoteWithPrice) - } - err = s.keeper.SetPriceFeed(s.ctx, priceFeed) - s.Require().NoError(err) - - s.stakingKeeper.On("GetLastValidatorPower", mock.Anything, sdk.ValAddress(validator)).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.5"))).Quo(expectedUptime) - expectedSlashFactor := k.Mul(expectedDevation) - s.slashingKeeper.On( - "Slash", - mock.Anything, - validator, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - s.keeper.SetSLA(s.ctx, sla) - err = s.keeper.ExecSLA(s.ctx, sla) - s.Require().NoError(err) - }) -} - -func (s *KeeperTestSuite) TestEnforceSLA() { - id := "testID" - expectedUptime := math.LegacyMustNewDecFromStr("0.8") - slashConstant := math.LegacyMustNewDecFromStr("0.25") - sla := slatypes.NewPriceFeedSLA( - id, - uint64(20), - expectedUptime, - slashConstant, - uint64(10), - uint64(10), - ) - - consAddress := sdk.ConsAddress([]byte("validator")) - cp := slinkytypes.NewCurrencyPair("mog", "usd") - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - s.Run("returns when the validator does not exist", func() { - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(0), fmt.Errorf("validator does not exist")) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("will remove price feed when validator does not exist", func() { - err := s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - contains, err := s.keeper.ContainsPriceFeed(s.ctx, id, cp, consAddress) - s.Require().NoError(err) - s.Require().True(contains) - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(0), fmt.Errorf("validator does not exist")) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - - contains, err = s.keeper.ContainsPriceFeed(s.ctx, id, cp, consAddress) - s.Require().NoError(err) - s.Require().False(contains) - }) - - s.Run("does not slash on price feed with no updates", func() { - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("100% uptime with minimum number of blocks", func() { - for i := 0; i < 10; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("100% uptime with maximum number of blocks", func() { - for i := 0; i < 20; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("50% uptime with minimum number of blocks", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 5; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - for i := 0; i < 5; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.5"))).Quo(expectedUptime) - expectedSlashFactor := slashConstant.Mul(expectedDevation) - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("50% uptime with maximum number of blocks", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 10; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - for i := 0; i < 10; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.5"))).Quo(expectedUptime) - expectedSlashFactor := slashConstant.Mul(expectedDevation) - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("0% uptime with minimum number of blocks", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 10; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedSlashFactor := slashConstant - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("0% uptime with maximum number of blocks", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 20; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedSlashFactor := slashConstant - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("75% uptime", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 15; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - for i := 0; i < 5; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.75"))).Quo(expectedUptime) - expectedSlashFactor := slashConstant.Mul(expectedDevation) - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("75% uptime with wrap around", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 20; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - for i := 0; i < 5; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.75"))).Quo(expectedUptime) - expectedSlashFactor := slashConstant.Mul(expectedDevation) - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) - - s.Run("75% uptime with many wrap arounds", func() { - feed, err := slatypes.NewPriceFeed( - uint(20), - consAddress, - cp, - id, - ) - s.Require().NoError(err) - - for i := 0; i < 50; i++ { - feed.SetUpdate(slatypes.VoteWithPrice) - } - - for i := 0; i < 5; i++ { - feed.SetUpdate(slatypes.VoteWithoutPrice) - } - - s.stakingKeeper.On( - "GetLastValidatorPower", - mock.Anything, - sdk.ValAddress(consAddress.Bytes()), - ).Return(int64(100), nil) - - expectedDevation := (expectedUptime.Sub(math.LegacyMustNewDecFromStr("0.75"))).Quo(expectedUptime) - expectedSlashFactor := slashConstant.Mul(expectedDevation) - - s.slashingKeeper.On( - "Slash", - mock.Anything, - consAddress, - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - int64(100), - expectedSlashFactor, - ).Return(math.NewInt(10), nil) - - err = s.keeper.EnforceSLA(s.ctx, sla, feed) - s.Require().NoError(err) - }) -} - -func (s *KeeperTestSuite) TestSlash() { - validator := sdk.ValAddress([]byte("validator")) - power := int64(100) - slashFactor := math.LegacyMustNewDecFromStr("0.1") - - s.Run("slash validator", func() { - s.slashingKeeper.On( - "Slash", - mock.Anything, - sdk.ConsAddress(validator.Bytes()), - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - power, - slashFactor, - ).Return(math.NewInt(10), nil) - - err := s.keeper.Slash(s.ctx, validator, power, slashFactor) - s.Require().NoError(err) - }) - - s.Run("returns error when slashing fails", func() { - s.slashingKeeper.On( - "Slash", - mock.Anything, - sdk.ConsAddress(validator.Bytes()), - s.ctx.BlockHeight()-sdk.ValidatorUpdateDelay, - power, - slashFactor, - ).Return(math.NewInt(0), fmt.Errorf("failed to slash validator")) - - err := s.keeper.Slash(s.ctx, validator, power, slashFactor) - s.Require().Error(err) - }) -} diff --git a/x/sla/keeper/update.go b/x/sla/keeper/update.go deleted file mode 100644 index a2421ff98..000000000 --- a/x/sla/keeper/update.go +++ /dev/null @@ -1,162 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -type ( - // PriceFeedUpdates is utilized to track price feed updates as they are received in the - // SLA module's preblock handler. - PriceFeedUpdates struct { - // ValidatorUpdates is a map of validator updates. The key is the validator's consensus - // address and the value is the validator's price feed updates. - ValidatorUpdates map[string]ValidatorUpdate - - // CurrencyPairs is a set of currency pairs that are supported by the network. - CurrencyPairs map[slinkytypes.CurrencyPair]struct{} - } - - // ValidatorUpdate is utilized to map a validator's price feed updates. - ValidatorUpdate struct { - // ConsAddress is the validator's consensus address. - ConsAddress sdk.ConsAddress - - // Updates is a map of price feed updates. The key is the currency pair and the value is - Updates map[slinkytypes.CurrencyPair]slatypes.UpdateStatus - } -) - -// NewPriceFeedUpdates returns a new PriceFeedUpdates. -func NewPriceFeedUpdates() PriceFeedUpdates { - return PriceFeedUpdates{ - ValidatorUpdates: make(map[string]ValidatorUpdate), - CurrencyPairs: make(map[slinkytypes.CurrencyPair]struct{}), - } -} - -// NewValidatorUpdate returns a new ValidatorUpdate. -func NewValidatorUpdate(consAddress sdk.ConsAddress) ValidatorUpdate { - return ValidatorUpdate{ - ConsAddress: consAddress, - Updates: make(map[slinkytypes.CurrencyPair]slatypes.UpdateStatus), - } -} - -// UpdatePriceFeeds will update the price feed incentives for all given updates. The -// updates parameter is constructed in the preblock handler and contains all price feed -// updates for the current block for every validator and currency pair. The validators included -// are the ones in the active set from the previous block. There are a few cases that need to be -// handled: -// 1. A new validator is added to the active set. -// 2. A validator is removed from the active set. -// 3. A new currency pair is added to the network. -// 4. A currency pair is removed from the network. -// 5. A currency pair is updated. -func (k *Keeper) UpdatePriceFeeds(ctx sdk.Context, updates PriceFeedUpdates) error { - slas, err := k.GetSLAs(ctx) - if err != nil { - return err - } - - // Determine the set of currency pairs that are currently stored in the x/sla module's state. - // but are not supported by the network anymore. - cpsToRemove, err := k.GetCurrencyPairs(ctx) - if err != nil { - return err - } - for cp := range cpsToRemove { - if _, ok := updates.CurrencyPairs[cp]; ok { - delete(cpsToRemove, cp) - } - } - - // Update the currency pairs that are currently stored in the x/sla module's state. - if err := k.SetCurrencyPairs(ctx, updates.CurrencyPairs); err != nil { - return err - } - - // Update the price feeds for each SLA. - for _, sla := range slas { - for cp := range cpsToRemove { - if err := k.RemovePriceFeedByCurrencyPair(ctx, sla.ID, cp); err != nil { - return err - } - } - - if err := k.UpdatePriceFeedsForSLA(ctx, sla, updates); err != nil { - return err - } - } - - return nil -} - -// UpdatePriceFeedsForSLA will update the price feeds for given SLA. -func (k *Keeper) UpdatePriceFeedsForSLA(ctx sdk.Context, sla slatypes.PriceFeedSLA, updates PriceFeedUpdates) error { - for _, validator := range updates.ValidatorUpdates { - for cp, status := range validator.Updates { - contains, err := k.ContainsPriceFeed(ctx, sla.ID, cp, validator.ConsAddress) - if err != nil { - return err - } - - if contains { - if err := k.updatePriceFeedWithStatus(ctx, sla, cp, validator.ConsAddress, status); err != nil { - return err - } - } else { - if err := k.initPriceFeedWithStatus(ctx, sla, cp, validator.ConsAddress, status); err != nil { - return err - } - } - - } - } - - return nil -} - -// updatePriceFeedWithStatus will update the price feed with the given status and add it to the -// x/sla module's state. -func (k *Keeper) updatePriceFeedWithStatus( - ctx sdk.Context, - sla slatypes.PriceFeedSLA, - cp slinkytypes.CurrencyPair, - validator sdk.ConsAddress, - status slatypes.UpdateStatus, -) error { - feed, err := k.GetPriceFeed(ctx, sla.ID, cp, validator) - if err != nil { - return err - } - - if err := feed.SetUpdate(status); err != nil { - return err - } - - return k.SetPriceFeed(ctx, feed) -} - -// initPriceFeedWithStatus will initialize a price feed with the given status and add it to the -// x/sla module's state. -func (k *Keeper) initPriceFeedWithStatus( - ctx sdk.Context, - sla slatypes.PriceFeedSLA, - cp slinkytypes.CurrencyPair, - validator sdk.ConsAddress, - status slatypes.UpdateStatus, -) error { - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), validator, cp, sla.ID) - if err != nil { - return err - } - - if err := feed.SetUpdate(status); err != nil { - return err - } - - return k.SetPriceFeed(ctx, feed) -} diff --git a/x/sla/keeper/update_test.go b/x/sla/keeper/update_test.go deleted file mode 100644 index 0a5540175..000000000 --- a/x/sla/keeper/update_test.go +++ /dev/null @@ -1,525 +0,0 @@ -package keeper_test - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slakeeper "github.com/skip-mev/slinky/x/sla/keeper" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func (s *KeeperTestSuite) TestUpdatePriceFeeds() { - id := "id" - sla := slatypes.NewPriceFeedSLA(id, 10, math.LegacyMustNewDecFromStr("1.0"), math.LegacyMustNewDecFromStr("1.0"), 5, 5) - - consAddress1 := sdk.ConsAddress("consAddress1") - - cp := slinkytypes.NewCurrencyPair("btc", "usd") - - priceFeedUpdates := slakeeper.NewPriceFeedUpdates() - priceFeedUpdates.CurrencyPairs[cp] = struct{}{} - - validatorUpdates := slakeeper.NewValidatorUpdate(consAddress1) - validatorUpdates.Updates[cp] = slatypes.VoteWithPrice - - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = validatorUpdates - - cps := make(map[slinkytypes.CurrencyPair]struct{}) - cps[cp] = struct{}{} - - s.Run("correctly updates price feeds with updates", func() { - err := s.keeper.SetSLA(s.ctx, sla) - s.Require().NoError(err) - - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Len(cps, 0) - - err = s.keeper.UpdatePriceFeeds(s.ctx, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the new price feed was added. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - // Check that the currency pair was added. - cps, err = s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Len(cps, 1) - s.Require().Contains(cps, cp) - }) - - s.Run("correctly updates price feeds with no updates", func() { - err := s.keeper.SetSLA(s.ctx, sla) - s.Require().NoError(err) - - err = s.keeper.UpdatePriceFeeds(s.ctx, slakeeper.NewPriceFeedUpdates()) - s.Require().NoError(err) - - // check that there are no price feeds. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 0) - - // Check that no currency pair was added. - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Len(cps, 0) - }) - - s.Run("can remove price feeds", func() { - err := s.keeper.SetSLA(s.ctx, sla) - s.Require().NoError(err) - - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), consAddress1, cp, sla.ID) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - err = s.keeper.SetCurrencyPairs(s.ctx, cps) - s.Require().NoError(err) - - err = s.keeper.UpdatePriceFeeds(s.ctx, slakeeper.NewPriceFeedUpdates()) - s.Require().NoError(err) - - // Check that the price feed was removed. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 0) - - // Check that the currency pair was removed. - cps, err := s.keeper.GetCurrencyPairs(s.ctx) - s.Require().NoError(err) - s.Require().Len(cps, 0) - }) - - s.Run("can update price feeds", func() { - err := s.keeper.SetSLA(s.ctx, sla) - s.Require().NoError(err) - - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), consAddress1, cp, sla.ID) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - err = s.keeper.SetCurrencyPairs(s.ctx, cps) - s.Require().NoError(err) - - validatorUpdates.Updates[cp] = slatypes.VoteWithoutPrice - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = validatorUpdates - - err = s.keeper.UpdatePriceFeeds(s.ctx, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was updated. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed = priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - }) -} - -func (s *KeeperTestSuite) TestUpdatePriceFeedsForSLA() { - id := "id" - sla := slatypes.NewPriceFeedSLA(id, 10, math.LegacyMustNewDecFromStr("1.0"), math.LegacyMustNewDecFromStr("1.0"), 5, 5) - - consAddress1 := sdk.ConsAddress("consAddress1") - consAddress2 := sdk.ConsAddress("consAddress2") - - cp1 := slinkytypes.NewCurrencyPair("btc", "usd") - cp2 := slinkytypes.NewCurrencyPair("eth", "usd") - - s.Run("correctly updates price feeds with no updates", func() { - updates := slakeeper.NewPriceFeedUpdates() - err := s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, updates) - s.Require().NoError(err) - - // Check that no price feeds were added or removed. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 0) - }) - - priceFeedUpdates := slakeeper.NewPriceFeedUpdates() - priceFeedUpdates.CurrencyPairs[cp1] = struct{}{} - - valUpdates := slakeeper.NewValidatorUpdate(consAddress1) - valUpdates.Updates[cp1] = slatypes.VoteWithPrice - - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - s.Run("correctly can create a new price feed with price update", func() { - err := s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was added. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed := priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp1, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - }) - - s.Run("correctly can create a new price feed with vote but no price update", func() { - valUpdates.Updates[cp1] = slatypes.VoteWithoutPrice - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - err := s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was added. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed := priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp1, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - }) - - s.Run("correctly can create a new price feed with no vote", func() { - valUpdates.Updates[cp1] = slatypes.NoVote - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - err := s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was added. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed := priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp1, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - }) - - s.Run("correctly can update an existing price feed with price update", func() { - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), consAddress1, cp1, sla.ID) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithoutPrice) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - valUpdates.Updates[cp1] = slatypes.VoteWithPrice - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - err = s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was updated. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed = priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp1, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - - numVotes, err = feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), numVotes) - - numPriceUpdates, err = feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), numPriceUpdates) - - numVotes, err = feed.GetNumVotesWithWindow(3) - s.Require().NoError(err) - s.Require().Equal(uint(3), numVotes) - - numPriceUpdates, err = feed.GetNumPriceUpdatesWithWindow(3) - s.Require().NoError(err) - s.Require().Equal(uint(2), numPriceUpdates) - }) - - s.Run("correctly can update an existing price feed with only a vote and no price update", func() { - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), consAddress1, cp1, sla.ID) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithoutPrice) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - valUpdates.Updates[cp1] = slatypes.VoteWithoutPrice - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - err = s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was updated. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed = priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp1, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - - numVotes, err = feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), numVotes) - - numPriceUpdates, err = feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - - numVotes, err = feed.GetNumVotesWithWindow(3) - s.Require().NoError(err) - s.Require().Equal(uint(3), numVotes) - - numPriceUpdates, err = feed.GetNumPriceUpdatesWithWindow(3) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - }) - - s.Run("correctly can update an existing price feed with no vote", func() { - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), consAddress1, cp1, sla.ID) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithoutPrice) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - valUpdates.Updates[cp1] = slatypes.NoVote - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - err = s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was updated. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 1) - - feed = priceFeeds[0] - s.Require().Equal(consAddress1, sdk.ConsAddress(feed.Validator)) - s.Require().Equal(cp1, feed.CurrencyPair) - s.Require().Equal(sla.ID, feed.ID) - s.Require().Equal(sla.MaximumViableWindow, feed.MaximumViableWindow) - - // Check that the status was correctly set. - numVotes, err := feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numVotes) - - numPriceUpdates, err := feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - - numVotes, err = feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err = feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - - numVotes, err = feed.GetNumVotesWithWindow(3) - s.Require().NoError(err) - s.Require().Equal(uint(2), numVotes) - - numPriceUpdates, err = feed.GetNumPriceUpdatesWithWindow(3) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - }) - - s.Run("can correctly create a new price feed with different currency pairs", func() { - priceFeedUpdates.CurrencyPairs[cp2] = struct{}{} - - valUpdates.Updates[cp1] = slatypes.VoteWithoutPrice - valUpdates.Updates[cp2] = slatypes.VoteWithPrice - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = valUpdates - - err := s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was added. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 2) - - feedCP1 := priceFeeds[0] - feedCP2 := priceFeeds[1] - if feedCP1.CurrencyPair.String() != cp1.String() { - feedCP1 = priceFeeds[1] - feedCP2 = priceFeeds[0] - } - - // Check that the statuses were correctly set. - numVotes, err := feedCP1.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := feedCP1.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - - numVotes, err = feedCP2.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err = feedCP2.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - }) - - s.Run("can correctly create a new price feed and update an existing one", func() { - priceFeedUpdates := slakeeper.NewPriceFeedUpdates() - priceFeedUpdates.CurrencyPairs[cp1] = struct{}{} - - validatorUpdates := slakeeper.NewValidatorUpdate(consAddress1) - validatorUpdates.Updates[cp1] = slatypes.VoteWithPrice - - feed, err := slatypes.NewPriceFeed(uint(sla.MaximumViableWindow), consAddress1, cp1, sla.ID) - s.Require().NoError(err) - - err = feed.SetUpdate(slatypes.VoteWithPrice) - s.Require().NoError(err) - - err = s.keeper.SetPriceFeed(s.ctx, feed) - s.Require().NoError(err) - - priceFeedUpdates = slakeeper.NewPriceFeedUpdates() - priceFeedUpdates.CurrencyPairs[cp1] = struct{}{} - - validatorUpdates = slakeeper.NewValidatorUpdate(consAddress1) - validatorUpdates.Updates[cp1] = slatypes.VoteWithoutPrice - priceFeedUpdates.ValidatorUpdates[consAddress1.String()] = validatorUpdates - - validatorUpdates2 := slakeeper.NewValidatorUpdate(consAddress2) - validatorUpdates2.Updates[cp1] = slatypes.VoteWithPrice - priceFeedUpdates.ValidatorUpdates[consAddress2.String()] = validatorUpdates2 - - err = s.keeper.UpdatePriceFeedsForSLA(s.ctx, sla, priceFeedUpdates) - s.Require().NoError(err) - - // Check that the price feed was updated. - priceFeeds, err := s.keeper.GetAllPriceFeeds(s.ctx, id) - s.Require().NoError(err) - s.Require().Len(priceFeeds, 2) - - val1Feed := priceFeeds[0] - val2Feed := priceFeeds[1] - if !sdk.ConsAddress(feed.Validator).Equals(sdk.ConsAddress(val1Feed.Validator)) { - val1Feed = priceFeeds[1] - val2Feed = priceFeeds[0] - } - - // Check that the statuses were correctly set. - numVotes, err := val1Feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err := val1Feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(0), numPriceUpdates) - - numVotes, err = val2Feed.GetNumVotesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numVotes) - - numPriceUpdates, err = val2Feed.GetNumPriceUpdatesWithWindow(1) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - - numVotes, err = val1Feed.GetNumVotesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(2), numVotes) - - numPriceUpdates, err = val1Feed.GetNumPriceUpdatesWithWindow(2) - s.Require().NoError(err) - s.Require().Equal(uint(1), numPriceUpdates) - }) -} diff --git a/x/sla/module.go b/x/sla/module.go deleted file mode 100644 index 89ec7c9ab..000000000 --- a/x/sla/module.go +++ /dev/null @@ -1,206 +0,0 @@ -package sla - -import ( - "context" - "encoding/json" - - "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" - "cosmossdk.io/depinject" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - slamodulev1 "github.com/skip-mev/slinky/api/slinky/sla/module/v1" - "github.com/skip-mev/slinky/x/sla/client/cli" - "github.com/skip-mev/slinky/x/sla/keeper" - "github.com/skip-mev/slinky/x/sla/types" -) - -// ConsensusVersion is the x/sla module's consensus version identifier. -const ConsensusVersion = 1 - -var ( - _ module.HasName = AppModule{} - _ module.HasGenesis = AppModule{} - _ module.AppModuleBasic = AppModule{} - _ module.HasServices = AppModule{} - - _ appmodule.AppModule = AppModule{} - _ appmodule.HasBeginBlocker = AppModule{} - _ appmodule.HasEndBlocker = AppModule{} -) - -// AppModuleBasic defines the base interface that the x/sla module exposes to the application. -type AppModuleBasic struct { - cdc codec.Codec -} - -// Name returns the name of x/sla module. -func (amb AppModuleBasic) Name() string { return types.ModuleName } - -// RegisterLegacyAminoCodec registers the necessary types from the x/sla module for amino -// serialization. -func (amb AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// RegisterInterfaces registers the necessary implementations / interfaces in the x/sla -// module w/ the interface-registry. -func (amb AppModuleBasic) RegisterInterfaces(ir codectypes.InterfaceRegistry) { - types.RegisterInterfaces(ir) -} - -// RegisterGRPCGatewayRoutes registers the necessary REST routes for the GRPC-gateway to -// the x/sla module QueryService on mux. This method panics on failure. -func (amb AppModuleBasic) RegisterGRPCGatewayRoutes(cliCtx client.Context, mux *runtime.ServeMux) { - // Register the gate-way routes w/ the provided mux. - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(cliCtx)); err != nil { - panic(err) - } -} - -// GetTxCmd is a no-op, as no txs are registered for submission (apart from messages that -// can only be executed by governance). -func (amb AppModuleBasic) GetTxCmd() *cobra.Command { - return nil -} - -// GetQueryCmd returns the x/sla module base query cli-command. -func (amb AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// AppModule represents an application module for the x/sla module. -type AppModule struct { - AppModuleBasic - - k keeper.Keeper -} - -// NewAppModule returns an application module for the x/sla module. -func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{ - cdc: cdc, - }, - k: k, - } -} - -// BeginBlock returns a beginblocker for the x/sla module. -func (am AppModule) BeginBlock(goCtx context.Context) error { - ctx := sdk.UnwrapSDKContext(goCtx) - return am.k.BeginBlocker(ctx) -} - -// EndBlock is a no-op for x/sla. -func (am AppModule) EndBlock(_ context.Context) error { - return nil -} - -// IsAppModule implements the appmodule.AppModule interface. -func (am AppModule) IsAppModule() {} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (am AppModule) IsOnePerModuleType() {} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } - -// RegisterServices registers the module's services. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(am.k)) - types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.k)) -} - -// DefaultGenesis returns default genesis state as raw bytes for the sla -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.NewDefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the sla module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var gs types.GenesisState - if err := cdc.UnmarshalJSON(bz, &gs); err != nil { - return err - } - - return gs.ValidateBasic() -} - -// InitGenesis performs the genesis initialization for the x/sla module. This method returns -// no validator set updates. This method panics on any errors. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) { - var gs types.GenesisState - cdc.MustUnmarshalJSON(bz, &gs) - - am.k.InitGenesis(ctx, gs) -} - -// ExportGenesis returns the sla module's exported genesis state as raw -// JSON bytes. This method panics on any error. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.k.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -func init() { - appmodule.Register( - &slamodulev1.Module{}, - appmodule.Provide(ProvideModule), - ) -} - -type Inputs struct { - depinject.In - - Config *slamodulev1.Module - Cdc codec.Codec - StoreService store.KVStoreService - - StakingKeeper types.StakingKeeper - SlashingKeeper types.SlashingKeeper -} - -type Outputs struct { - depinject.Out - - SLAKeeper keeper.Keeper - Module appmodule.AppModule -} - -func ProvideModule(in Inputs) Outputs { - var ( - authority sdk.AccAddress - err error - ) - if in.Config.Authority != "" { - authority, err = sdk.AccAddressFromBech32(in.Config.Authority) - if err != nil { - panic(err) - } - } else { - authority = authtypes.NewModuleAddress(govtypes.ModuleName) - } - - slaKeeper := keeper.NewKeeper( - in.StoreService, - in.Cdc, - authority, - in.StakingKeeper, - in.SlashingKeeper, - ) - - m := NewAppModule(in.Cdc, *slaKeeper) - - return Outputs{SLAKeeper: *slaKeeper, Module: m} -} diff --git a/x/sla/types/README.md b/x/sla/types/README.md deleted file mode 100644 index ac81e9534..000000000 --- a/x/sla/types/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Price Feed Service Level Agreements (SLA) - -## Overview - -The price feed service level agreement (SLA) is a set of rules that govern how often validators must post price updates to the oracle. The specific set of rules is configurable by the application and chain developers and is enforced by the protocol. The SLA enforces that validators maintain a minimum uptime, with slashing conditions for downtime. - -## SLA Parameters - -There are five key parameters that govern the SLA: - -### MaximumViableWindow - -This determines the previous number of blocks from the given height that are considered for the SLA. This parameter acts as a sliding window. - -For example, if the `maximumViableWindow` is set to 100, then the SLA will only consider the previous 100 blocks from the current block height. - -### MinimumBlockUpdates - -This determines the minimum number of blocks that the validator had to have voted on in the `maximumViableWindow` in order to be considered. This value must be strictly less than the `maximumViableWindow`. If a validator has not voted on at least `minimumBlockUpdates` blocks in the `maximumViableWindow`, they will not be considered for the SLA. - -For example, if the `maximumViableWindow` is set to 100 and the `minimumBlockUpdates` is set to 50, then the SLA will only consider validators that have voted on at least 50 blocks in the previous 100 blocks. - -### ExpectedUptime - -Given the validator has voted on at least `minimumBlockUpdates` blocks within the `maximumViableWindow`, this determines the minimum percentage of the blocks that had to have included a price update in the validator's vote extension. - -For example, if the `expectedUptime` is set to 0.9, then the validator must have included price updates in their votes on at least 90% of the blocks they have voted on. If they underperform, they will be slashed. - -### SlashConstant - -This constant determines the how much the validator will be slashed if they deviate from the expected uptime. The formula for slashing is: - -```go -slashPercentage := ((expectedUptime - actualUptime) / expectedUptime) * slashConstant -``` - -This formula will slash the validator proportionally to how much they deviate from the expected uptime. - -### Frequency - -Frequency defines how often the criteria of an SLA should be checked. This is a parameter that is set by the chain developer and/or chain governance. The frequency is set in terms of blocks. For example, if the frequency is set to 10, then the SLA will be checked every 10 blocks. This parameter should be less than the `maximumViableWindow` - otherwise the SLA will not be able to be enforced. - -## Slashing - -As described above, slashing is variable to how far the validator's uptime deviates from the expected uptime. Slashing is proportional to the each validator's power and therefore is relative. The larger the validator, the more they will be slashed. This is expected as larger validators have a larger say in the final aggregated price that is posted on chain to the `x/oracle` module. diff --git a/x/sla/types/codec.go b/x/sla/types/codec.go deleted file mode 100644 index cfd3ff3bf..000000000 --- a/x/sla/types/codec.go +++ /dev/null @@ -1,29 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -// RegisterLegacyAminoCodec registers the necessary x/sla interfaces (messages) on the -// provided LegacyAmino codec. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgAddSLAs{}, "sla/MsgAddSLAs") - legacy.RegisterAminoMsg(cdc, &MsgRemoveSLAs{}, "sla/MsgRemoveSLAs") - legacy.RegisterAminoMsg(cdc, &MsgParams{}, "sla/MsgParams") -} - -// RegisterInterfaces registers the x/sla interfaces (messages + msg server) on the -// provided InterfaceRegistry. -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgAddSLAs{}, - &MsgRemoveSLAs{}, - &MsgParams{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} diff --git a/x/sla/types/genesis.go b/x/sla/types/genesis.go deleted file mode 100644 index f033b83a8..000000000 --- a/x/sla/types/genesis.go +++ /dev/null @@ -1,86 +0,0 @@ -package types - -import ( - "encoding/json" - "fmt" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// NewDefaultGenesisState returns a default genesis state for the module. -func NewDefaultGenesisState() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - SLAs: make([]PriceFeedSLA, 0), - PriceFeeds: make([]PriceFeed, 0), - } -} - -// NewGenesisState returns a new genesis state for the module. -func NewGenesisState(slas []PriceFeedSLA, priceFeeds []PriceFeed, params Params) *GenesisState { - return &GenesisState{ - SLAs: slas, - PriceFeeds: priceFeeds, - Params: params, - } -} - -// ValidateBasic performs basic validation of the genesis state data returning an -// error for any failed validation criteria. -func (gs *GenesisState) ValidateBasic() error { - seen := make(map[string]struct{}) - slaLength := make(map[string]uint64) - for _, sla := range gs.SLAs { - if _, ok := seen[sla.ID]; ok { - return fmt.Errorf("duplicate price feed sla id %s", sla.ID) - } - - if err := sla.ValidateBasic(); err != nil { - return err - } - - seen[sla.ID] = struct{}{} - slaLength[sla.ID] = sla.MaximumViableWindow - } - - seenFeeds := make(map[string]struct{}) - for _, priceFeed := range gs.PriceFeeds { - // The SLA must exist for the given price feed. - if _, ok := seen[priceFeed.ID]; !ok { - return fmt.Errorf("sla %s does not exist for the given price feed", priceFeed.ID) - } - - // The SLA must have the same maximum viable window as the price feed. - if slaLength[priceFeed.ID] != priceFeed.MaximumViableWindow { - return fmt.Errorf("sla %s has a different maximum viable window than the price feed with same id", priceFeed.ID) - } - - // There cannot be duplicate feeds. - feedTuple := priceFeed.ID + sdk.ConsAddress(priceFeed.Validator).String() + priceFeed.CurrencyPair.String() - if _, ok := seenFeeds[feedTuple]; ok { - return fmt.Errorf( - "duplicate sla id %s validator address %s and currency pair %s", - priceFeed.ID, - priceFeed.Validator, - priceFeed.CurrencyPair, - ) - } - - if err := priceFeed.ValidateBasic(); err != nil { - return err - } - - seenFeeds[feedTuple] = struct{}{} - } - - return nil -} - -// GetGenesisStateFromAppState returns x/sla GenesisState given raw application -// genesis state. -func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) GenesisState { - var gs GenesisState - cdc.MustUnmarshalJSON(appState[ModuleName], &gs) - return gs -} diff --git a/x/sla/types/genesis.pb.go b/x/sla/types/genesis.pb.go deleted file mode 100644 index d140d979d..000000000 --- a/x/sla/types/genesis.pb.go +++ /dev/null @@ -1,1488 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/sla/v1/genesis.proto - -package types - -import ( - cosmossdk_io_math "cosmossdk.io/math" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - types "github.com/skip-mev/slinky/pkg/types" - _ "github.com/skip-mev/slinky/x/oracle/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the sla module's genesis state. -type GenesisState struct { - // SLAs are the SLAs that are currently active. - SLAs []PriceFeedSLA `protobuf:"bytes,1,rep,name=slas,proto3" json:"slas"` - // PrceFeeds are the price feeds that are currently active. - PriceFeeds []PriceFeed `protobuf:"bytes,2,rep,name=price_feeds,json=priceFeeds,proto3" json:"price_feeds"` - // Params are the parameters for the sla module. - Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_017e50c7677a1cf4, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetSLAs() []PriceFeedSLA { - if m != nil { - return m.SLAs - } - return nil -} - -func (m *GenesisState) GetPriceFeeds() []PriceFeed { - if m != nil { - return m.PriceFeeds - } - return nil -} - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// Params defines the parameters for the sla module. -type Params struct { - // Enabled is a flag to enable or disable the sla module. - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_017e50c7677a1cf4, []int{1} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -// PriceFeedSLA defines the the desired SLA for a given set of price feeds. A -// price feed is defined to be a set of price prices for the same (currency -// pair, validator). -type PriceFeedSLA struct { - // MaximumViableWindow is the maximum time window that we are interested - // for the SLA. This is used to determine the moving window of blocks that - // we are interested in. - MaximumViableWindow uint64 `protobuf:"varint,1,opt,name=maximum_viable_window,json=maximumViableWindow,proto3" json:"maximum_viable_window,omitempty"` - // ExpectedUptime is the expected uptime for the given validator and price - // feed. - ExpectedUptime cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=expected_uptime,json=expectedUptime,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"expected_uptime"` - // SlashConstant is the constant by which we will multiply the deviation from - // the expected uptime. - SlashConstant cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=slash_constant,json=slashConstant,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slash_constant"` - // MinimumBlockUpdates is the minimum number of blocks that the - // validator had to have voted on in the maximum viable window - // in order to be considered for the SLA. - MinimumBlockUpdates uint64 `protobuf:"varint,4,opt,name=minimum_block_updates,json=minimumBlockUpdates,proto3" json:"minimum_block_updates,omitempty"` - // Frequency is the frequency at which we will check the SLA. - Frequency uint64 `protobuf:"varint,5,opt,name=frequency,proto3" json:"frequency,omitempty"` - // ID is the unique identifier for the SLA. - ID string `protobuf:"bytes,6,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *PriceFeedSLA) Reset() { *m = PriceFeedSLA{} } -func (m *PriceFeedSLA) String() string { return proto.CompactTextString(m) } -func (*PriceFeedSLA) ProtoMessage() {} -func (*PriceFeedSLA) Descriptor() ([]byte, []int) { - return fileDescriptor_017e50c7677a1cf4, []int{2} -} -func (m *PriceFeedSLA) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PriceFeedSLA) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PriceFeedSLA.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 *PriceFeedSLA) XXX_Merge(src proto.Message) { - xxx_messageInfo_PriceFeedSLA.Merge(m, src) -} -func (m *PriceFeedSLA) XXX_Size() int { - return m.Size() -} -func (m *PriceFeedSLA) XXX_DiscardUnknown() { - xxx_messageInfo_PriceFeedSLA.DiscardUnknown(m) -} - -var xxx_messageInfo_PriceFeedSLA proto.InternalMessageInfo - -func (m *PriceFeedSLA) GetMaximumViableWindow() uint64 { - if m != nil { - return m.MaximumViableWindow - } - return 0 -} - -func (m *PriceFeedSLA) GetMinimumBlockUpdates() uint64 { - if m != nil { - return m.MinimumBlockUpdates - } - return 0 -} - -func (m *PriceFeedSLA) GetFrequency() uint64 { - if m != nil { - return m.Frequency - } - return 0 -} - -func (m *PriceFeedSLA) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -// PriceFeed defines the object type that will be utilized to monitor how -// frequently validators are voting with price updates across the network. -type PriceFeed struct { - // UpdateMap represents the relevant moving window of price feed updates. - UpdateMap []byte `protobuf:"bytes,1,opt,name=update_map,json=updateMap,proto3" json:"update_map,omitempty"` - // InclusionMap represents the relevant moving window of blocks that the - // validator has voted on. - InclusionMap []byte `protobuf:"bytes,2,opt,name=inclusion_map,json=inclusionMap,proto3" json:"inclusion_map,omitempty"` - // Index corresponds to the current index into the bitmap. - Index uint64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` - // Validator represents the validator that this SLA corresponds to. - Validator []byte `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty"` - // CurrencyPair represents the currency pair that this SLA corresponds to. - CurrencyPair types.CurrencyPair `protobuf:"bytes,5,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair"` - // MaximumViableWindow represents the maximum number of blocks that can be - // represented by the bit map. - MaximumViableWindow uint64 `protobuf:"varint,6,opt,name=maximum_viable_window,json=maximumViableWindow,proto3" json:"maximum_viable_window,omitempty"` - // ID corresponds to the SLA ID that this price feed corresponds to. - ID string `protobuf:"bytes,7,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *PriceFeed) Reset() { *m = PriceFeed{} } -func (m *PriceFeed) String() string { return proto.CompactTextString(m) } -func (*PriceFeed) ProtoMessage() {} -func (*PriceFeed) Descriptor() ([]byte, []int) { - return fileDescriptor_017e50c7677a1cf4, []int{3} -} -func (m *PriceFeed) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PriceFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PriceFeed.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 *PriceFeed) XXX_Merge(src proto.Message) { - xxx_messageInfo_PriceFeed.Merge(m, src) -} -func (m *PriceFeed) XXX_Size() int { - return m.Size() -} -func (m *PriceFeed) XXX_DiscardUnknown() { - xxx_messageInfo_PriceFeed.DiscardUnknown(m) -} - -var xxx_messageInfo_PriceFeed proto.InternalMessageInfo - -func (m *PriceFeed) GetUpdateMap() []byte { - if m != nil { - return m.UpdateMap - } - return nil -} - -func (m *PriceFeed) GetInclusionMap() []byte { - if m != nil { - return m.InclusionMap - } - return nil -} - -func (m *PriceFeed) GetIndex() uint64 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *PriceFeed) GetValidator() []byte { - if m != nil { - return m.Validator - } - return nil -} - -func (m *PriceFeed) GetCurrencyPair() types.CurrencyPair { - if m != nil { - return m.CurrencyPair - } - return types.CurrencyPair{} -} - -func (m *PriceFeed) GetMaximumViableWindow() uint64 { - if m != nil { - return m.MaximumViableWindow - } - return 0 -} - -func (m *PriceFeed) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "slinky.sla.v1.GenesisState") - proto.RegisterType((*Params)(nil), "slinky.sla.v1.Params") - proto.RegisterType((*PriceFeedSLA)(nil), "slinky.sla.v1.PriceFeedSLA") - proto.RegisterType((*PriceFeed)(nil), "slinky.sla.v1.PriceFeed") -} - -func init() { proto.RegisterFile("slinky/sla/v1/genesis.proto", fileDescriptor_017e50c7677a1cf4) } - -var fileDescriptor_017e50c7677a1cf4 = []byte{ - // 626 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcb, 0x4e, 0xdb, 0x40, - 0x14, 0x8d, 0x4d, 0x08, 0xcd, 0xc4, 0xa1, 0xd2, 0x14, 0x2a, 0x17, 0x8a, 0x13, 0x05, 0xa9, 0xca, - 0x06, 0x5b, 0x84, 0x75, 0xd5, 0x12, 0x50, 0x1f, 0x12, 0x95, 0x90, 0x11, 0x6d, 0xc5, 0xc6, 0x9a, - 0x8c, 0x87, 0x30, 0x8a, 0xed, 0x71, 0x3d, 0x76, 0x48, 0xfe, 0xa2, 0xdb, 0xfe, 0x47, 0xff, 0xa0, - 0x1b, 0x96, 0xa8, 0xab, 0xaa, 0x8b, 0xa8, 0x32, 0x3f, 0x52, 0xf9, 0x8e, 0xc3, 0xab, 0x62, 0xd3, - 0x5d, 0xe6, 0x9e, 0x73, 0x4f, 0xee, 0x3d, 0x73, 0xc6, 0x68, 0x5d, 0x06, 0x3c, 0x1a, 0x4d, 0x1d, - 0x19, 0x10, 0x67, 0xbc, 0xed, 0x0c, 0x59, 0xc4, 0x24, 0x97, 0x76, 0x9c, 0x88, 0x54, 0xe0, 0xa6, - 0x02, 0x6d, 0x19, 0x10, 0x7b, 0xbc, 0xbd, 0xb6, 0x32, 0x14, 0x43, 0x01, 0x88, 0x53, 0xfc, 0x52, - 0xa4, 0xb5, 0x67, 0x54, 0xc8, 0x50, 0x48, 0x4f, 0x01, 0xea, 0x50, 0x42, 0x56, 0x29, 0x2e, 0x12, - 0x42, 0x03, 0xf6, 0x8f, 0xfe, 0xda, 0x66, 0x89, 0xa7, 0xd3, 0x98, 0xc9, 0x02, 0xa6, 0x59, 0x92, - 0xb0, 0x88, 0x4e, 0xbd, 0x98, 0xf0, 0x44, 0x91, 0x3a, 0x3f, 0x34, 0x64, 0xbc, 0x55, 0x6d, 0x47, - 0x29, 0x49, 0x19, 0x7e, 0x89, 0xaa, 0x32, 0x20, 0xd2, 0xd4, 0xda, 0x0b, 0xdd, 0x46, 0x6f, 0xdd, - 0xbe, 0x33, 0xa4, 0x7d, 0x98, 0x70, 0xca, 0xde, 0x30, 0xe6, 0x1f, 0x1d, 0xec, 0xf6, 0x8d, 0x8b, - 0x59, 0xab, 0x92, 0xcf, 0x5a, 0xd5, 0xa3, 0x83, 0x5d, 0xe9, 0x42, 0x1b, 0x7e, 0x85, 0x1a, 0x71, - 0xc1, 0xf1, 0x4e, 0x19, 0xf3, 0xa5, 0xa9, 0x83, 0x8a, 0xf9, 0x90, 0x4a, 0xbf, 0x5a, 0x48, 0xb8, - 0x28, 0x9e, 0x17, 0x24, 0xde, 0x41, 0xb5, 0x98, 0x24, 0x24, 0x94, 0xe6, 0x42, 0x5b, 0xeb, 0x36, - 0x7a, 0xab, 0xf7, 0x7b, 0x01, 0x2c, 0x1b, 0x4b, 0x6a, 0xa7, 0x83, 0x6a, 0xaa, 0x8e, 0x4d, 0xb4, - 0xc4, 0x22, 0x32, 0x08, 0x98, 0x6f, 0x6a, 0x6d, 0xad, 0xfb, 0xc8, 0x9d, 0x1f, 0x3b, 0xb9, 0x8e, - 0x8c, 0xdb, 0xe3, 0xe3, 0x1e, 0x5a, 0x0d, 0xc9, 0x84, 0x87, 0x59, 0xe8, 0x8d, 0x79, 0xc1, 0xf1, - 0xce, 0x79, 0xe4, 0x8b, 0x73, 0x68, 0xac, 0xba, 0x4f, 0x4a, 0xf0, 0x23, 0x60, 0x9f, 0x00, 0xc2, - 0x27, 0xe8, 0x31, 0x9b, 0xc4, 0x8c, 0xa6, 0xcc, 0xf7, 0xb2, 0x38, 0xe5, 0x21, 0x33, 0xf5, 0xb6, - 0xd6, 0xad, 0xf7, 0xb7, 0x8b, 0x79, 0x7e, 0xcf, 0x5a, 0xeb, 0xea, 0x8a, 0xa4, 0x3f, 0xb2, 0xb9, - 0x70, 0x42, 0x92, 0x9e, 0xd9, 0x07, 0x6c, 0x48, 0xe8, 0x74, 0x9f, 0xd1, 0x9f, 0xdf, 0xb7, 0x50, - 0x79, 0x83, 0xfb, 0x8c, 0xba, 0xcb, 0x73, 0xa5, 0x63, 0x10, 0xc2, 0x9f, 0xd1, 0x72, 0x61, 0xe1, - 0x99, 0x47, 0x45, 0x24, 0x53, 0x12, 0xa5, 0xe0, 0xc0, 0x7f, 0x49, 0x37, 0x41, 0x68, 0xaf, 0xd4, - 0x81, 0x4d, 0x79, 0x04, 0x9b, 0x0e, 0x02, 0x41, 0x47, 0x5e, 0x16, 0xfb, 0x24, 0x65, 0xd2, 0xac, - 0x96, 0x9b, 0x2a, 0xb0, 0x5f, 0x60, 0xc7, 0x0a, 0xc2, 0xcf, 0x51, 0xfd, 0x34, 0x61, 0x5f, 0xb2, - 0x22, 0x30, 0xe6, 0x22, 0xf0, 0x6e, 0x0a, 0xf8, 0x29, 0xd2, 0xb9, 0x6f, 0xd6, 0x60, 0xbe, 0x5a, - 0x3e, 0x6b, 0xe9, 0xef, 0xf7, 0x5d, 0x9d, 0xfb, 0x9d, 0x6f, 0x3a, 0xaa, 0x5f, 0x9b, 0x8c, 0x37, - 0x10, 0x52, 0xff, 0xe4, 0x85, 0x24, 0x06, 0x5b, 0x0d, 0xb7, 0xae, 0x2a, 0x1f, 0x48, 0x8c, 0x37, - 0x51, 0x93, 0x47, 0x34, 0xc8, 0x24, 0x17, 0x11, 0x30, 0x74, 0x60, 0x18, 0xd7, 0xc5, 0x82, 0xb4, - 0x82, 0x16, 0x79, 0xe4, 0xb3, 0x09, 0x98, 0x51, 0x75, 0xd5, 0xa1, 0x98, 0x6e, 0x4c, 0x02, 0xee, - 0x93, 0x54, 0x24, 0xb0, 0x85, 0xe1, 0xde, 0x14, 0xf0, 0x3b, 0xd4, 0xbc, 0x93, 0x75, 0x98, 0xbf, - 0xd1, 0xdb, 0x98, 0x47, 0x09, 0x5e, 0x44, 0x11, 0xa6, 0xbd, 0x92, 0x75, 0x48, 0x78, 0x52, 0x46, - 0xca, 0xa0, 0xb7, 0x6a, 0x0f, 0x67, 0xa4, 0xf6, 0x70, 0x46, 0x94, 0x37, 0x4b, 0xf7, 0xbd, 0xe9, - 0xbf, 0xbe, 0xc8, 0x2d, 0xed, 0x32, 0xb7, 0xb4, 0x3f, 0xb9, 0xa5, 0x7d, 0xbd, 0xb2, 0x2a, 0x97, - 0x57, 0x56, 0xe5, 0xd7, 0x95, 0x55, 0x39, 0x79, 0x31, 0xe4, 0xe9, 0x59, 0x36, 0xb0, 0xa9, 0x08, - 0x1d, 0x39, 0xe2, 0xf1, 0x56, 0xc8, 0xc6, 0x4e, 0xf9, 0x7a, 0x27, 0xf0, 0xf1, 0x80, 0x89, 0x07, - 0x35, 0x78, 0xb3, 0x3b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x17, 0xc9, 0x21, 0x24, 0x57, 0x04, - 0x00, 0x00, -} - -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.PriceFeeds) > 0 { - for iNdEx := len(m.PriceFeeds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PriceFeeds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.SLAs) > 0 { - for iNdEx := len(m.SLAs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SLAs[iNdEx].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 (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PriceFeedSLA) 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 *PriceFeedSLA) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PriceFeedSLA) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x32 - } - if m.Frequency != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Frequency)) - i-- - dAtA[i] = 0x28 - } - if m.MinimumBlockUpdates != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MinimumBlockUpdates)) - i-- - dAtA[i] = 0x20 - } - { - size := m.SlashConstant.Size() - i -= size - if _, err := m.SlashConstant.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.ExpectedUptime.Size() - i -= size - if _, err := m.ExpectedUptime.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.MaximumViableWindow != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MaximumViableWindow)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *PriceFeed) 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 *PriceFeed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PriceFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0x3a - } - if m.MaximumViableWindow != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MaximumViableWindow)) - i-- - dAtA[i] = 0x30 - } - { - size, err := m.CurrencyPair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0x22 - } - if m.Index != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) - i-- - dAtA[i] = 0x18 - } - if len(m.InclusionMap) > 0 { - i -= len(m.InclusionMap) - copy(dAtA[i:], m.InclusionMap) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.InclusionMap))) - i-- - dAtA[i] = 0x12 - } - if len(m.UpdateMap) > 0 { - i -= len(m.UpdateMap) - copy(dAtA[i:], m.UpdateMap) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.UpdateMap))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SLAs) > 0 { - for _, e := range m.SLAs { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.PriceFeeds) > 0 { - for _, e := range m.PriceFeeds { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Enabled { - n += 2 - } - return n -} - -func (m *PriceFeedSLA) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaximumViableWindow != 0 { - n += 1 + sovGenesis(uint64(m.MaximumViableWindow)) - } - l = m.ExpectedUptime.Size() - n += 1 + l + sovGenesis(uint64(l)) - l = m.SlashConstant.Size() - n += 1 + l + sovGenesis(uint64(l)) - if m.MinimumBlockUpdates != 0 { - n += 1 + sovGenesis(uint64(m.MinimumBlockUpdates)) - } - if m.Frequency != 0 { - n += 1 + sovGenesis(uint64(m.Frequency)) - } - l = len(m.ID) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func (m *PriceFeed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.UpdateMap) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.InclusionMap) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if m.Index != 0 { - n += 1 + sovGenesis(uint64(m.Index)) - } - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = m.CurrencyPair.Size() - n += 1 + l + sovGenesis(uint64(l)) - if m.MaximumViableWindow != 0 { - n += 1 + sovGenesis(uint64(m.MaximumViableWindow)) - } - l = len(m.ID) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SLAs", 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.SLAs = append(m.SLAs, PriceFeedSLA{}) - if err := m.SLAs[len(m.SLAs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PriceFeeds", 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.PriceFeeds = append(m.PriceFeeds, PriceFeed{}) - if err := m.PriceFeeds[len(m.PriceFeeds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - 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 (m *Params) 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - 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 (m *PriceFeedSLA) 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: PriceFeedSLA: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PriceFeedSLA: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaximumViableWindow", wireType) - } - m.MaximumViableWindow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaximumViableWindow |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpectedUptime", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExpectedUptime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SlashConstant", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SlashConstant.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimumBlockUpdates", wireType) - } - m.MinimumBlockUpdates = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinimumBlockUpdates |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Frequency", wireType) - } - m.Frequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Frequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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 (m *PriceFeed) 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: PriceFeed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PriceFeed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdateMap", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UpdateMap = append(m.UpdateMap[:0], dAtA[iNdEx:postIndex]...) - if m.UpdateMap == nil { - m.UpdateMap = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InclusionMap", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InclusionMap = append(m.InclusionMap[:0], dAtA[iNdEx:postIndex]...) - if m.InclusionMap == nil { - m.InclusionMap = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Validator = append(m.Validator[:0], dAtA[iNdEx:postIndex]...) - if m.Validator == nil { - m.Validator = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", 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.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaximumViableWindow", wireType) - } - m.MaximumViableWindow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaximumViableWindow |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/sla/types/genesis_test.go b/x/sla/types/genesis_test.go deleted file mode 100644 index 4127dc9fc..000000000 --- a/x/sla/types/genesis_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package types_test - -import ( - "testing" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func TestGenesisState(t *testing.T) { - t.Run("default genesis state is valid", func(t *testing.T) { - gs := slatypes.NewDefaultGenesisState() - err := gs.ValidateBasic() - require.NoError(t, err) - }) - - validSLA := slatypes.NewPriceFeedSLA( - "test", - 10, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 5, - 5, - ) - - invalidSLA := slatypes.NewPriceFeedSLA( - "test2", - 0, - math.LegacyMustNewDecFromStr("0.0"), - math.LegacyMustNewDecFromStr("0.0"), - 0, - 0, - ) - - validSLA2 := slatypes.NewPriceFeedSLA( - "test2", - 10, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 5, - 5, - ) - - val1 := sdk.ConsAddress("val1") - - cp1 := slinkytypes.NewCurrencyPair("BTC", "USD") - - goodFeed1, err := slatypes.NewPriceFeed(10, val1, cp1, "test") - require.NoError(t, err) - - goodFeed2, err := slatypes.NewPriceFeed(10, val1, cp1, "test2") - require.NoError(t, err) - - badPriceFeed1, err := slatypes.NewPriceFeed(10, val1, cp1, "no match sla") - require.NoError(t, err) - - badPriceFeed2, err := slatypes.NewPriceFeed(11, val1, cp1, "test") - require.NoError(t, err) - - t.Run("genesis state with duplicate ids should be rejected", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA, validSLA}, nil, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.Error(t, err) - }) - - t.Run("genesis state with invalid sla should be rejected", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{invalidSLA}, nil, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.Error(t, err) - }) - - t.Run("genesis state with valid slas should be accepted", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA, validSLA2}, nil, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.NoError(t, err) - }) - - t.Run("genesis state with valid price feed", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA}, []slatypes.PriceFeed{goodFeed1}, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.NoError(t, err) - }) - - t.Run("genesis state with invalid price feed that has no matching SLA", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA}, []slatypes.PriceFeed{badPriceFeed1}, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.Error(t, err) - }) - - t.Run("sla has a different maximum viable window than the price feed with same id", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA}, []slatypes.PriceFeed{badPriceFeed2}, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.Error(t, err) - }) - - t.Run("duplicate price feeds", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA}, []slatypes.PriceFeed{goodFeed1, goodFeed1}, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.Error(t, err) - }) - - t.Run("same (val, cp) pair for different SLAs", func(t *testing.T) { - gs := slatypes.NewGenesisState([]slatypes.PriceFeedSLA{validSLA, validSLA2}, []slatypes.PriceFeed{goodFeed1, goodFeed2}, slatypes.DefaultParams()) - err := gs.ValidateBasic() - require.NoError(t, err) - }) -} diff --git a/x/sla/types/interfaces.go b/x/sla/types/interfaces.go deleted file mode 100644 index f711487e4..000000000 --- a/x/sla/types/interfaces.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - "context" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// SlashingKeeper defines the interface that must be fulfilled by the slashing keeper. -// -//go:generate mockery --name SlashingKeeper --filename mock_slashing_keeper.go -type SlashingKeeper interface { - // Slash attempts to slash a validator. The slash is delegated to the staking - // module to make the necessary validator changes. It specifies no interaction reason. - Slash( - ctx context.Context, - consAddr sdk.ConsAddress, - infractionHeight, - power int64, - slashFactor math.LegacyDec, - ) (amount math.Int, err error) -} - -// StakingKeeper defines the interface that must be fulfilled by the staking keeper. -// -//go:generate mockery --name StakingKeeper --filename mock_staking_keeper.go -type StakingKeeper interface { - // GetLastValidatorPower returns the last recorded power of a validator. Returns zero if - // the operator was not a validator last block. - GetLastValidatorPower(ctx context.Context, operator sdk.ValAddress) (power int64, err error) -} diff --git a/x/sla/types/keys.go b/x/sla/types/keys.go deleted file mode 100644 index 6adb2d1f4..000000000 --- a/x/sla/types/keys.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -const ( - // ModuleName is the name of the module. - ModuleName = "sla" - // StoreKey is the store key string for the sla module. - StoreKey = ModuleName -) - -const ( - // keyPrefixSLA is the key prefix under which all SLAs are stored. - keyPrefixSLA = iota - // keyPrefixParams is the key prefix used to index the SLA params. - keyPrefixParams - // keyPrefixPriceFeeds is the key prefix used to index the price feed incentives. - keyPrefixPriceFeeds - // keyPrefixCurrencyPairs is the key prefix used to index the currency pairs. - keyPrefixCurrencyPairs -) - -var ( - // KeyPrefixSLA is the root key prefix under which all SLAs are stored. - KeyPrefixSLA = []byte{keyPrefixSLA} - // KeyPrefixParams is the root key prefix used to index the SLA params. - KeyPrefixParams = []byte{keyPrefixParams} - // KeyPrefixPriceFeeds is the root key prefix used to index the price feed incentives. - KeyPrefixPriceFeeds = []byte{keyPrefixPriceFeeds} - // KeyPrefixCurrencyPairs is the root key prefix used to index the currency pairs. - KeyPrefixCurrencyPairs = []byte{keyPrefixCurrencyPairs} -) diff --git a/x/sla/types/mocks/mock_slashing_keeper.go b/x/sla/types/mocks/mock_slashing_keeper.go deleted file mode 100644 index 007e6a3ec..000000000 --- a/x/sla/types/mocks/mock_slashing_keeper.go +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - math "cosmossdk.io/math" - - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// SlashingKeeper is an autogenerated mock type for the SlashingKeeper type -type SlashingKeeper struct { - mock.Mock -} - -// Slash provides a mock function with given fields: ctx, consAddr, infractionHeight, power, slashFactor -func (_m *SlashingKeeper) Slash(ctx context.Context, consAddr types.ConsAddress, infractionHeight int64, power int64, slashFactor math.LegacyDec) (math.Int, error) { - ret := _m.Called(ctx, consAddr, infractionHeight, power, slashFactor) - - if len(ret) == 0 { - panic("no return value specified for Slash") - } - - var r0 math.Int - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress, int64, int64, math.LegacyDec) (math.Int, error)); ok { - return rf(ctx, consAddr, infractionHeight, power, slashFactor) - } - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress, int64, int64, math.LegacyDec) math.Int); ok { - r0 = rf(ctx, consAddr, infractionHeight, power, slashFactor) - } else { - r0 = ret.Get(0).(math.Int) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.ConsAddress, int64, int64, math.LegacyDec) error); ok { - r1 = rf(ctx, consAddr, infractionHeight, power, slashFactor) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewSlashingKeeper creates a new instance of SlashingKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewSlashingKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *SlashingKeeper { - mock := &SlashingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/sla/types/mocks/mock_staking_keeper.go b/x/sla/types/mocks/mock_staking_keeper.go deleted file mode 100644 index 185d2369c..000000000 --- a/x/sla/types/mocks/mock_staking_keeper.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by mockery v2.46.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// StakingKeeper is an autogenerated mock type for the StakingKeeper type -type StakingKeeper struct { - mock.Mock -} - -// GetLastValidatorPower provides a mock function with given fields: ctx, operator -func (_m *StakingKeeper) GetLastValidatorPower(ctx context.Context, operator types.ValAddress) (int64, error) { - ret := _m.Called(ctx, operator) - - if len(ret) == 0 { - panic("no return value specified for GetLastValidatorPower") - } - - var r0 int64 - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) (int64, error)); ok { - return rf(ctx, operator) - } - if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) int64); ok { - r0 = rf(ctx, operator) - } else { - r0 = ret.Get(0).(int64) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.ValAddress) error); ok { - r1 = rf(ctx, operator) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewStakingKeeper creates a new instance of StakingKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewStakingKeeper(t interface { - mock.TestingT - Cleanup(func()) -}) *StakingKeeper { - mock := &StakingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/sla/types/msgs.go b/x/sla/types/msgs.go deleted file mode 100644 index 287765ee3..000000000 --- a/x/sla/types/msgs.go +++ /dev/null @@ -1,126 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -const ( - MaxSLAIDLength = 200 - MaxSLAsPerMessage = 100 -) - -var ( - _ sdk.Msg = &MsgAddSLAs{} - _ sdk.Msg = &MsgRemoveSLAs{} - _ sdk.Msg = &MsgParams{} -) - -// NewMsgAddSLAs returns a new message from a set of SLAs and an authority address. -func NewMsgAddSLAs(authority string, slas []PriceFeedSLA) MsgAddSLAs { - return MsgAddSLAs{ - Authority: authority, - SLAs: slas, - } -} - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the authority is a valid acc-address, and that each SLA in the message is formatted correctly. -func (m *MsgAddSLAs) ValidateBasic() error { - // validate authority address - _, err := sdk.AccAddressFromBech32(m.Authority) - if err != nil { - return err - } - - if len(m.SLAs) == 0 { - return fmt.Errorf("message must contain at least one SLA") - } - - if len(m.SLAs) > MaxSLAsPerMessage { - return fmt.Errorf("maximum number of SLAs of %d exceeded: got %d", MaxSLAsPerMessage, len(m.SLAs)) - } - - // validate SLAs - seen := make(map[string]struct{}) - for _, sla := range m.SLAs { - if _, ok := seen[sla.ID]; ok { - return fmt.Errorf("duplicate price feed sla id %s", sla.ID) - } - - if err := sla.ValidateBasic(); err != nil { - return err - } - - seen[sla.ID] = struct{}{} - - if len(sla.ID) > MaxSLAIDLength { - return fmt.Errorf("maximum length of %d for SLA ID exceeded: got %d", MaxSLAIDLength, len(sla.ID)) - } - } - - return nil -} - -// NewMsgRemoveSLAs returns a new message to remove a set of SLAs from the x/sla module's state. -func NewMsgRemoveSLAs(authority string, slaIDs []string) MsgRemoveSLAs { - return MsgRemoveSLAs{ - Authority: authority, - IDs: slaIDs, - } -} - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the authority is a valid acc-address, and that each SLA ID in the message is not empty. -func (m *MsgRemoveSLAs) ValidateBasic() error { - // validate authority address - _, err := sdk.AccAddressFromBech32(m.Authority) - if err != nil { - return err - } - - if len(m.IDs) == 0 { - return fmt.Errorf("message must contain at least one SLA") - } - - if len(m.IDs) > MaxSLAsPerMessage { - return fmt.Errorf("maximum number of SLAs of %d exceeded: got %d", MaxSLAsPerMessage, len(m.IDs)) - } - - // validate SLA IDs - seen := make(map[string]struct{}) - for _, id := range m.IDs { - if _, ok := seen[id]; ok { - return fmt.Errorf("duplicate price feed sla id %s", id) - } - - if len(id) == 0 { - return fmt.Errorf("sla id cannot be empty") - } - - seen[id] = struct{}{} - } - - return nil -} - -// NewMsgParams returns a new message to update the x/sla module's parameters. -func NewMsgParams(authority string, params Params) MsgParams { - return MsgParams{ - Authority: authority, - Params: params, - } -} - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the authority is a valid acc-address. -func (m *MsgParams) ValidateBasic() error { - // validate authority address - _, err := sdk.AccAddressFromBech32(m.Authority) - if err != nil { - return err - } - - return nil -} diff --git a/x/sla/types/msgs_test.go b/x/sla/types/msgs_test.go deleted file mode 100644 index abdc15f02..000000000 --- a/x/sla/types/msgs_test.go +++ /dev/null @@ -1,168 +0,0 @@ -package types_test - -import ( - "fmt" - "math/rand" - "testing" - - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/sla/types" -) - -func TestMsgAddSLAs(t *testing.T) { - t.Run("should reject a msg with an invalid authority address", func(t *testing.T) { - msg := types.NewMsgAddSLAs("invalid", []types.PriceFeedSLA{}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - invalidSLA := types.NewPriceFeedSLA( - "test", - 0, - math.LegacyMustNewDecFromStr("0.0"), - math.LegacyMustNewDecFromStr("0.0"), - 0, - 0, - ) - - validSLA := types.NewPriceFeedSLA( - "test", - 10, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 5, - 5, - ) - - validSLA2 := types.NewPriceFeedSLA( - "test2", - 10, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 5, - 5, - ) - - t.Run("should reject a message with an invalid sla", func(t *testing.T) { - msg := types.NewMsgAddSLAs(sdk.AccAddress("test").String(), []types.PriceFeedSLA{invalidSLA}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with duplicate slas", func(t *testing.T) { - msg := types.NewMsgAddSLAs(sdk.AccAddress("test").String(), []types.PriceFeedSLA{validSLA, validSLA}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with invalid SLA ID length", func(t *testing.T) { - msg := types.NewMsgAddSLAs(sdk.AccAddress("test").String(), []types.PriceFeedSLA{validSLA, validSLA2}) - msg.SLAs[0].ID = randomString(types.MaxSLAIDLength + 1) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with invalid amount of SLA - too many", func(t *testing.T) { - msg := types.NewMsgAddSLAs(sdk.AccAddress("test").String(), createSLAs(types.MaxSLAsPerMessage+1)) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with invalid amount of SLA - none", func(t *testing.T) { - msg := types.NewMsgAddSLAs(sdk.AccAddress("test").String(), []types.PriceFeedSLA{}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should accept a message with valid slas", func(t *testing.T) { - msg := types.NewMsgAddSLAs(sdk.AccAddress("test").String(), []types.PriceFeedSLA{validSLA, validSLA2}) - err := msg.ValidateBasic() - require.NoError(t, err) - }) -} - -func TestMsgRemoveSLAs(t *testing.T) { - t.Run("should reject a msg with an invalid authority address", func(t *testing.T) { - msg := types.NewMsgRemoveSLAs("invalid", []string{}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with duplicate ids", func(t *testing.T) { - msg := types.NewMsgRemoveSLAs(sdk.AccAddress("test").String(), []string{"test", "test"}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with invalid amount of SLA - too many", func(t *testing.T) { - msg := types.NewMsgRemoveSLAs(sdk.AccAddress("test").String(), createSLAIDs(types.MaxSLAsPerMessage+1)) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should reject a message with invalid amount of SLA - none", func(t *testing.T) { - msg := types.NewMsgRemoveSLAs(sdk.AccAddress("test").String(), []string{}) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should accept a message with valid ids", func(t *testing.T) { - msg := types.NewMsgRemoveSLAs(sdk.AccAddress("test").String(), []string{"test", "test2"}) - err := msg.ValidateBasic() - require.NoError(t, err) - }) -} - -func TestMsgParams(t *testing.T) { - t.Run("should reject a message with an invalid authority address", func(t *testing.T) { - msg := types.NewMsgParams("invalid", types.DefaultParams()) - err := msg.ValidateBasic() - require.Error(t, err) - }) - - t.Run("should accept an empty message with a valid authority address", func(t *testing.T) { - msg := types.NewMsgParams(sdk.AccAddress("test").String(), types.DefaultParams()) - err := msg.ValidateBasic() - require.NoError(t, err) - }) -} - -func randomString(length int) string { - const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - result := make([]byte, length) - for i := range result { - result[i] = charset[rand.Intn(len(charset))] - } - return string(result) -} - -func createSLAs(length int) []types.PriceFeedSLA { - slas := make([]types.PriceFeedSLA, length) - - for i := range slas { - slas[i] = types.PriceFeedSLA{ - MaximumViableWindow: 10, - ExpectedUptime: math.LegacyMustNewDecFromStr("0.5"), - SlashConstant: math.LegacyMustNewDecFromStr("0.5"), - MinimumBlockUpdates: 5, - Frequency: 5, - ID: fmt.Sprintf("%d", i), - } - } - - return slas -} - -func createSLAIDs(length int) []string { - slas := make([]string, length) - - for i := range slas { - slas[i] = fmt.Sprintf("%d", i) - } - - return slas -} diff --git a/x/sla/types/params.go b/x/sla/types/params.go deleted file mode 100644 index f4ce37035..000000000 --- a/x/sla/types/params.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -// DefaultParams returns default incentive parameters. -func DefaultParams() Params { - return Params{ - Enabled: true, - } -} - -// NewParams returns a new Params instance. -func NewParams(enabled bool) Params { - return Params{ - Enabled: enabled, - } -} diff --git a/x/sla/types/price_feed.go b/x/sla/types/price_feed.go deleted file mode 100644 index 5645def85..000000000 --- a/x/sla/types/price_feed.go +++ /dev/null @@ -1,261 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/bits-and-blooms/bitset" - sdk "github.com/cosmos/cosmos-sdk/types" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" -) - -const ( - // NoVote indicates that the validator did not vote on the current block. - NoVote UpdateStatus = iota - - // VoteWithPrice indicates that the validator voted with a price update. i.e. the - // vote extension included any price update for the given currency pair. - VoteWithPrice - - // VoteWithoutPrice indicates that the validator voted without a price update. i.e. the - // vote extension did not include any price update for the given currency pair. - VoteWithoutPrice -) - -// UpdateStatus is an enum that represents the status of a price update. -type UpdateStatus int - -// NewPriceFeed returns a new price feed for the given parameters. This is meant to be -// called every time a new SLA is created, new currency pair is added, or a new validator -// is added to the network. -func NewPriceFeed( - maximumViableWindow uint, - validator sdk.ConsAddress, - currencyPair slinkytypes.CurrencyPair, - id string, -) (PriceFeed, error) { - updateMap := bitset.New(maximumViableWindow) - updateMapBz, err := updateMap.MarshalBinary() - if err != nil { - return PriceFeed{}, err - } - - inclusionMap := bitset.New(maximumViableWindow) - inclusionMapBz, err := inclusionMap.MarshalBinary() - if err != nil { - return PriceFeed{}, err - } - - return PriceFeed{ - MaximumViableWindow: uint64(maximumViableWindow), - Validator: validator.Bytes(), - CurrencyPair: currencyPair, - UpdateMap: updateMapBz, - InclusionMap: inclusionMapBz, - ID: id, - }, nil -} - -// SetUpdate updates the state of the SLA given the status of the update. -func (feed *PriceFeed) SetUpdate(status UpdateStatus) error { - index := uint(feed.Index) - - inclusionMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := inclusionMap.UnmarshalBinary(feed.InclusionMap); err != nil { - return err - } - - updateMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := updateMap.UnmarshalBinary(feed.UpdateMap); err != nil { - return err - } - - switch status { - case VoteWithPrice: - // Vote + price update - inclusionMap.Set(index) - updateMap.Set(index) - case VoteWithoutPrice: - // Vote without price update - inclusionMap.Set(index) - updateMap.Clear(index) - default: - // Vote was not included in previous block - inclusionMap.Clear(index) - updateMap.Clear(index) - } - - feed.Index = (feed.Index + 1) % feed.MaximumViableWindow - - // Marshal the bitsets. - var err error - feed.UpdateMap, err = updateMap.MarshalBinary() - if err != nil { - return err - } - - feed.InclusionMap, err = inclusionMap.MarshalBinary() - if err != nil { - return err - } - - return nil -} - -// GetInclusionBit returns the bit at the given index in the inclusion map. -func (feed *PriceFeed) GetInclusionBit(index uint) (bool, error) { - inclusionMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := inclusionMap.UnmarshalBinary(feed.InclusionMap); err != nil { - return false, err - } - - return inclusionMap.Test(index), nil -} - -// GetInclusionCount returns the total number of votes in the maximum viable window. -func (feed *PriceFeed) GetInclusionCount() (uint, error) { - inclusionMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := inclusionMap.UnmarshalBinary(feed.InclusionMap); err != nil { - return 0, err - } - - return inclusionMap.Count(), nil -} - -// GetUpdateBit returns the bit at the given index in the update map. -func (feed *PriceFeed) GetUpdateBit(index uint) (bool, error) { - updateMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := updateMap.UnmarshalBinary(feed.UpdateMap); err != nil { - return false, err - } - - return updateMap.Test(index), nil -} - -// GetUpdateCount returns the number of updates in the maximum viable window. -func (feed *PriceFeed) GetUpdateCount() (uint, error) { - updateMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := updateMap.UnmarshalBinary(feed.UpdateMap); err != nil { - return 0, err - } - - return updateMap.Count(), nil -} - -// GetNumPriceUpdatesWithWindow returns the number of price updates in the moving window. This -// corresponds to the number of blocks that the validator has voted on and included -// a price update in the previous n blocks. -func (feed *PriceFeed) GetNumPriceUpdatesWithWindow(n uint) (uint, error) { - bitRange, err := feed.getBitRange(n) - if err != nil { - return 0, err - } - - updateMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := updateMap.UnmarshalBinary(feed.UpdateMap); err != nil { - return 0, err - } - - return updateMap.Intersection(bitRange).Count(), nil -} - -// GetNumVotesWithWindow returns the number of blocks the validator has voted on -// in the previous n blocks. -func (feed *PriceFeed) GetNumVotesWithWindow(n uint) (uint, error) { - bitRange, err := feed.getBitRange(n) - if err != nil { - return 0, err - } - - inclusionMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := inclusionMap.UnmarshalBinary(feed.InclusionMap); err != nil { - return 0, err - } - - return inclusionMap.Intersection(bitRange).Count(), nil -} - -// Stringify returns a string representation of the price feed. Primarily used for -// debugging purposes. -func (feed *PriceFeed) Stringify() string { - inclusionMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := inclusionMap.UnmarshalBinary(feed.InclusionMap); err != nil { - panic(err) - } - - updateMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := updateMap.UnmarshalBinary(feed.UpdateMap); err != nil { - panic(err) - } - - return fmt.Sprintf(`Price Feed: - Maximum Viable Window: %d - Validator: %s - Currency Pair: %s - Update Map: %s - Inclusion Map: %s - Index: %d - ID: %s`, - feed.MaximumViableWindow, - feed.Validator, - feed.CurrencyPair, - updateMap.DumpAsBits(), - inclusionMap.DumpAsBits(), - feed.Index, - feed.ID, - ) -} - -// ValidateBasic performs basic validation of the price feed. -func (feed *PriceFeed) ValidateBasic() error { - if len(feed.ID) == 0 { - return fmt.Errorf("sla id cannot be empty") - } - - if feed.MaximumViableWindow == 0 { - return fmt.Errorf("sla %s must have a non-zero maximum viable window", feed.ID) - } - - inclusionMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := inclusionMap.UnmarshalBinary(feed.InclusionMap); err != nil { - return err - } - - updateMap := bitset.New(uint(feed.MaximumViableWindow)) - if err := updateMap.UnmarshalBinary(feed.UpdateMap); err != nil { - return err - } - - if feed.Validator == nil { - return fmt.Errorf("validator cannot be nil") - } - - return feed.CurrencyPair.ValidateBasic() -} - -// getBitRange returns a bitset that represents the range of bits in the moving -// window that we are interested in. This returns a bitset with all bits set to -// 1 if the range is valid. -func (feed *PriceFeed) getBitRange(previousNumBlocks uint) (*bitset.BitSet, error) { - maximumViableWindow := uint(feed.MaximumViableWindow) - if previousNumBlocks > maximumViableWindow { - return nil, fmt.Errorf( - "previousNumBlocks cannot be greater than the maximum viable window; got %d, expected %d", - previousNumBlocks, - feed.MaximumViableWindow, - ) - } - - bitRange := bitset.New(maximumViableWindow) - index := uint(feed.Index) - if previousNumBlocks < index { - lowerBound := index - previousNumBlocks - bitRange = bitRange.FlipRange(lowerBound, index) - } else { - lowerBound := maximumViableWindow - (previousNumBlocks - index) - bitRange = bitRange.FlipRange(lowerBound, maximumViableWindow) - bitRange = bitRange.FlipRange(0, index) - } - - return bitRange, nil -} diff --git a/x/sla/types/price_feed_test.go b/x/sla/types/price_feed_test.go deleted file mode 100644 index e674e2a6d..000000000 --- a/x/sla/types/price_feed_test.go +++ /dev/null @@ -1,391 +0,0 @@ -package types_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -var ( - val = sdk.ConsAddress("validator1") - cp = slinkytypes.NewCurrencyPair("BTC", "ETH") - id = "testID" -) - -func TestSetUpdate(t *testing.T) { - t.Run("vote with price", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - - count, err := priceFeed.GetUpdateCount() - require.NoError(t, err) - require.Equal(t, uint(1), count) - - count, err = priceFeed.GetInclusionCount() - require.NoError(t, err) - require.Equal(t, uint(1), count) - - bit, err := priceFeed.GetInclusionBit(0) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetUpdateBit(0) - require.NoError(t, err) - require.Equal(t, true, bit) - - require.Equal(t, uint(1), uint(priceFeed.Index)) - }) - - t.Run("vote without price", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - count, err := priceFeed.GetUpdateCount() - require.NoError(t, err) - require.Equal(t, uint(0), count) - - count, err = priceFeed.GetInclusionCount() - require.NoError(t, err) - require.Equal(t, uint(1), count) - - bit, err := priceFeed.GetInclusionBit(0) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetUpdateBit(0) - require.NoError(t, err) - require.Equal(t, false, bit) - - require.Equal(t, uint(1), uint(priceFeed.Index)) - }) - - t.Run("multiple votes", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - count, err := priceFeed.GetUpdateCount() - require.NoError(t, err) - require.Equal(t, uint(2), count) - - count, err = priceFeed.GetInclusionCount() - require.NoError(t, err) - require.Equal(t, uint(4), count) - - bit, err := priceFeed.GetInclusionBit(0) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetInclusionBit(1) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetInclusionBit(2) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetInclusionBit(3) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetUpdateBit(0) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetUpdateBit(1) - require.NoError(t, err) - require.Equal(t, false, bit) - - bit, err = priceFeed.GetUpdateBit(2) - require.NoError(t, err) - require.Equal(t, true, bit) - - bit, err = priceFeed.GetUpdateBit(3) - require.NoError(t, err) - require.Equal(t, false, bit) - - require.Equal(t, uint(4), uint(priceFeed.Index)) - }) - - t.Run("multiple votes with wraparound", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - count, err := priceFeed.GetUpdateCount() - require.NoError(t, err) - require.Equal(t, uint(2), count) - - count, err = priceFeed.GetInclusionCount() - require.NoError(t, err) - require.Equal(t, uint(4), count) - - require.Equal(t, uint(0), uint(priceFeed.Index)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - count, err = priceFeed.GetUpdateCount() - require.NoError(t, err) - require.Equal(t, uint(1), count) - }) - - t.Run("no vote", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - - count, err := priceFeed.GetUpdateCount() - require.NoError(t, err) - require.Equal(t, uint(0), count) - - count, err = priceFeed.GetInclusionCount() - require.NoError(t, err) - require.Equal(t, uint(0), count) - - require.Equal(t, uint(1), uint(priceFeed.Index)) - }) -} - -func TestGetNumberOfPriceUpdates(t *testing.T) { - t.Run("correctly set all bits and returns correct number of updates", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - - numUpdates, err := priceFeed.GetNumPriceUpdatesWithWindow(1) - require.NoError(t, err) - require.Equal(t, uint(1), numUpdates) - - numUpdates, err = priceFeed.GetNumPriceUpdatesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(1), numUpdates) - - numUpdates, err = priceFeed.GetNumPriceUpdatesWithWindow(3) - require.NoError(t, err) - require.Equal(t, uint(2), numUpdates) - - numUpdates, err = priceFeed.GetNumPriceUpdatesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(2), numUpdates) - - _, err = priceFeed.GetNumPriceUpdatesWithWindow(5) - require.Error(t, err) - }) - - t.Run("correctly set all bits and returns correct number of updates with wrap around", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - numUpdates, err := priceFeed.GetNumPriceUpdatesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(1), numUpdates) - - numUpdates, err = priceFeed.GetNumPriceUpdatesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(2), numUpdates) - - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - - numUpdates, err = priceFeed.GetNumPriceUpdatesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(1), numUpdates) - - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - - numUpdates, err = priceFeed.GetNumPriceUpdatesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(1), numUpdates) - }) -} - -func TestGetNumVotesWithWindow(t *testing.T) { - t.Run("correctly returns no votes with no sets", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - numVotes, err := priceFeed.GetNumVotesWithWindow(1) - require.NoError(t, err) - require.Equal(t, uint(0), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(0), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(3) - require.NoError(t, err) - require.Equal(t, uint(0), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(0), numVotes) - - _, err = priceFeed.GetNumVotesWithWindow(5) - require.Error(t, err) - }) - - t.Run("correctly returns with one set", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - - numVotes, err := priceFeed.GetNumVotesWithWindow(1) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(3) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - _, err = priceFeed.GetNumVotesWithWindow(5) - require.Error(t, err) - }) - - t.Run("correctly returns with two sets", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - numVotes, err := priceFeed.GetNumVotesWithWindow(1) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(2), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(3) - require.NoError(t, err) - require.Equal(t, uint(2), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(2), numVotes) - - _, err = priceFeed.GetNumVotesWithWindow(5) - require.Error(t, err) - }) - - t.Run("correctly returns after some sets with wrap around", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(4, val, cp, id) - require.NoError(t, err) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - - numVotes, err := priceFeed.GetNumVotesWithWindow(1) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(2), numVotes) - - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - - numVotes, err = priceFeed.GetNumVotesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(1) - require.NoError(t, err) - require.Equal(t, uint(0), numVotes) - - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - - numVotes, err = priceFeed.GetNumVotesWithWindow(2) - require.NoError(t, err) - require.Equal(t, uint(1), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(3) - require.NoError(t, err) - require.Equal(t, uint(2), numVotes) - - numVotes, err = priceFeed.GetNumVotesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(3), numVotes) - - // Now we have a wrap around - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - - numVotes, err = priceFeed.GetNumVotesWithWindow(4) - require.NoError(t, err) - require.Equal(t, uint(2), numVotes) - }) -} - -func TestPriceFeedValidateBasic(t *testing.T) { - t.Run("valid price feed", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - require.NoError(t, priceFeed.ValidateBasic()) - }) - - t.Run("missing a price feed id", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "") - require.NoError(t, err) - require.Error(t, priceFeed.ValidateBasic()) - }) - - t.Run("invalid max window", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(0, val, cp, id) - require.NoError(t, err) - require.Error(t, priceFeed.ValidateBasic()) - }) - - t.Run("invalid inclusion map", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - priceFeed.InclusionMap = []byte("invalid") - require.Error(t, priceFeed.ValidateBasic()) - }) - - t.Run("invalid update map", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, id) - require.NoError(t, err) - priceFeed.UpdateMap = []byte("invalid") - require.Error(t, priceFeed.ValidateBasic()) - }) - - t.Run("invalid validator address", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, nil, cp, id) - require.NoError(t, err) - require.Error(t, priceFeed.ValidateBasic()) - }) - - t.Run("invalid currency pair", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, slinkytypes.CurrencyPair{}, id) - require.NoError(t, err) - require.Error(t, priceFeed.ValidateBasic()) - }) -} diff --git a/x/sla/types/query.pb.go b/x/sla/types/query.pb.go deleted file mode 100644 index e2a3c8db7..000000000 --- a/x/sla/types/query.pb.go +++ /dev/null @@ -1,1283 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/sla/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// QueryAllSLAsRequest is the request type for the Query/GetAllSLAs RPC method. -type GetAllSLAsRequest struct { -} - -func (m *GetAllSLAsRequest) Reset() { *m = GetAllSLAsRequest{} } -func (m *GetAllSLAsRequest) String() string { return proto.CompactTextString(m) } -func (*GetAllSLAsRequest) ProtoMessage() {} -func (*GetAllSLAsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7e0a991cdb10d68d, []int{0} -} -func (m *GetAllSLAsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetAllSLAsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetAllSLAsRequest.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 *GetAllSLAsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllSLAsRequest.Merge(m, src) -} -func (m *GetAllSLAsRequest) XXX_Size() int { - return m.Size() -} -func (m *GetAllSLAsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllSLAsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllSLAsRequest proto.InternalMessageInfo - -// QueryAllSLAsResponse is the response type for the Query/GetAllSLAs RPC -// method. -type GetAllSLAsResponse struct { - SLAs []PriceFeedSLA `protobuf:"bytes,1,rep,name=slas,proto3" json:"slas"` -} - -func (m *GetAllSLAsResponse) Reset() { *m = GetAllSLAsResponse{} } -func (m *GetAllSLAsResponse) String() string { return proto.CompactTextString(m) } -func (*GetAllSLAsResponse) ProtoMessage() {} -func (*GetAllSLAsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7e0a991cdb10d68d, []int{1} -} -func (m *GetAllSLAsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetAllSLAsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetAllSLAsResponse.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 *GetAllSLAsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllSLAsResponse.Merge(m, src) -} -func (m *GetAllSLAsResponse) XXX_Size() int { - return m.Size() -} -func (m *GetAllSLAsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllSLAsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllSLAsResponse proto.InternalMessageInfo - -func (m *GetAllSLAsResponse) GetSLAs() []PriceFeedSLA { - if m != nil { - return m.SLAs - } - return nil -} - -// QueryGetPriceFeedsRequest is the request type for the Query/GetPriceFeeds RPC -// method. -type GetPriceFeedsRequest struct { - // ID defines the SLA to query price feeds for. - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *GetPriceFeedsRequest) Reset() { *m = GetPriceFeedsRequest{} } -func (m *GetPriceFeedsRequest) String() string { return proto.CompactTextString(m) } -func (*GetPriceFeedsRequest) ProtoMessage() {} -func (*GetPriceFeedsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7e0a991cdb10d68d, []int{2} -} -func (m *GetPriceFeedsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetPriceFeedsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetPriceFeedsRequest.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 *GetPriceFeedsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetPriceFeedsRequest.Merge(m, src) -} -func (m *GetPriceFeedsRequest) XXX_Size() int { - return m.Size() -} -func (m *GetPriceFeedsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetPriceFeedsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetPriceFeedsRequest proto.InternalMessageInfo - -func (m *GetPriceFeedsRequest) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -// QueryGetPriceFeedsResponse is the response type for the Query/GetPriceFeeds -// RPC method. -type GetPriceFeedsResponse struct { - // PriceFeeds defines the price feeds for the given SLA. - PriceFeeds []PriceFeed `protobuf:"bytes,1,rep,name=price_feeds,json=priceFeeds,proto3" json:"price_feeds"` -} - -func (m *GetPriceFeedsResponse) Reset() { *m = GetPriceFeedsResponse{} } -func (m *GetPriceFeedsResponse) String() string { return proto.CompactTextString(m) } -func (*GetPriceFeedsResponse) ProtoMessage() {} -func (*GetPriceFeedsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7e0a991cdb10d68d, []int{3} -} -func (m *GetPriceFeedsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GetPriceFeedsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetPriceFeedsResponse.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 *GetPriceFeedsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetPriceFeedsResponse.Merge(m, src) -} -func (m *GetPriceFeedsResponse) XXX_Size() int { - return m.Size() -} -func (m *GetPriceFeedsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetPriceFeedsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetPriceFeedsResponse proto.InternalMessageInfo - -func (m *GetPriceFeedsResponse) GetPriceFeeds() []PriceFeed { - if m != nil { - return m.PriceFeeds - } - return nil -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -type ParamsRequest struct { -} - -func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } -func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } -func (*ParamsRequest) ProtoMessage() {} -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7e0a991cdb10d68d, []int{4} -} -func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsRequest.Merge(m, src) -} -func (m *ParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *ParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type ParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } -func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } -func (*ParamsResponse) ProtoMessage() {} -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7e0a991cdb10d68d, []int{5} -} -func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsResponse.Merge(m, src) -} -func (m *ParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *ParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo - -func (m *ParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*GetAllSLAsRequest)(nil), "slinky.sla.v1.GetAllSLAsRequest") - proto.RegisterType((*GetAllSLAsResponse)(nil), "slinky.sla.v1.GetAllSLAsResponse") - proto.RegisterType((*GetPriceFeedsRequest)(nil), "slinky.sla.v1.GetPriceFeedsRequest") - proto.RegisterType((*GetPriceFeedsResponse)(nil), "slinky.sla.v1.GetPriceFeedsResponse") - proto.RegisterType((*ParamsRequest)(nil), "slinky.sla.v1.ParamsRequest") - proto.RegisterType((*ParamsResponse)(nil), "slinky.sla.v1.ParamsResponse") -} - -func init() { proto.RegisterFile("slinky/sla/v1/query.proto", fileDescriptor_7e0a991cdb10d68d) } - -var fileDescriptor_7e0a991cdb10d68d = []byte{ - // 455 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x41, 0x6f, 0x12, 0x41, - 0x18, 0x65, 0x57, 0x24, 0xf1, 0x43, 0x34, 0x4e, 0x8b, 0xe2, 0x42, 0x17, 0x5c, 0x8d, 0xe9, 0xc5, - 0x9d, 0x94, 0x9e, 0x8d, 0x42, 0xd4, 0xc6, 0xa4, 0x87, 0x0a, 0x17, 0xe3, 0xc5, 0x4c, 0xcb, 0xb8, - 0x4e, 0xba, 0xec, 0x4c, 0x99, 0x81, 0xc8, 0xc5, 0x83, 0xbf, 0xc0, 0xc4, 0x3f, 0xd5, 0x63, 0x13, - 0x2f, 0x5e, 0x24, 0x66, 0xf1, 0x87, 0x98, 0x9d, 0x9d, 0xc5, 0xee, 0xd2, 0x72, 0x23, 0xef, 0xbd, - 0x79, 0xef, 0xf1, 0xbe, 0x85, 0x87, 0x32, 0x64, 0xd1, 0xe9, 0x1c, 0xcb, 0x90, 0xe0, 0xd9, 0x1e, - 0x3e, 0x9b, 0xd2, 0xc9, 0xdc, 0x17, 0x13, 0xae, 0x38, 0xaa, 0xa5, 0x94, 0x2f, 0x43, 0xe2, 0xcf, - 0xf6, 0x9c, 0xed, 0x80, 0x07, 0x5c, 0x33, 0x38, 0xf9, 0x95, 0x8a, 0x9c, 0x56, 0xc0, 0x79, 0x10, - 0x52, 0x4c, 0x04, 0xc3, 0x24, 0x8a, 0xb8, 0x22, 0x8a, 0xf1, 0x48, 0x1a, 0xb6, 0x99, 0x77, 0x0f, - 0x68, 0x44, 0x25, 0x33, 0xa4, 0xb7, 0x05, 0xf7, 0x0e, 0xa8, 0xea, 0x85, 0xe1, 0xf0, 0xb0, 0x27, - 0x07, 0xf4, 0x6c, 0x4a, 0xa5, 0xf2, 0x86, 0x80, 0x2e, 0x83, 0x52, 0xf0, 0x48, 0x52, 0xf4, 0x1c, - 0xca, 0x32, 0x24, 0xb2, 0x61, 0x75, 0x6e, 0xec, 0x56, 0xbb, 0x4d, 0x3f, 0xd7, 0xcc, 0x3f, 0x9a, - 0xb0, 0x13, 0xfa, 0x86, 0xd2, 0xd1, 0xf0, 0xb0, 0xd7, 0xbf, 0x7d, 0xbe, 0x68, 0x97, 0xe2, 0x45, - 0xbb, 0xac, 0x0d, 0xf4, 0x33, 0xcf, 0x87, 0xed, 0x03, 0xaa, 0x56, 0xb2, 0x2c, 0x0c, 0xdd, 0x07, - 0x9b, 0x8d, 0x1a, 0x56, 0xc7, 0xda, 0xbd, 0xd5, 0xaf, 0xc4, 0x8b, 0xb6, 0xfd, 0xf6, 0xd5, 0xc0, - 0x66, 0x23, 0xef, 0x3d, 0xd4, 0x0b, 0x7a, 0xd3, 0xe3, 0x05, 0x54, 0x45, 0x82, 0x7e, 0xfc, 0x94, - 0xc0, 0xa6, 0x4e, 0xe3, 0xba, 0x3a, 0xfd, 0x72, 0xd2, 0x65, 0x00, 0x62, 0x65, 0xe4, 0xdd, 0x85, - 0xda, 0x11, 0x99, 0x90, 0xf1, 0xea, 0xff, 0xbe, 0x86, 0x3b, 0x19, 0x60, 0x32, 0xf6, 0xa1, 0x22, - 0x34, 0xa2, 0x8b, 0x55, 0xbb, 0xf5, 0xa2, 0xbd, 0x26, 0x8d, 0xb7, 0x91, 0x76, 0x7f, 0xdb, 0x70, - 0xf3, 0x5d, 0x72, 0x3b, 0x14, 0x01, 0xfc, 0x1f, 0x10, 0x75, 0x0a, 0x8f, 0xd7, 0x06, 0x77, 0x1e, - 0x6d, 0x50, 0xa4, 0x8d, 0xbc, 0xe6, 0xb7, 0x9f, 0x7f, 0x7f, 0xd8, 0x75, 0xb4, 0x85, 0xf3, 0xe7, - 0x4c, 0xb6, 0x45, 0x5f, 0xa1, 0x96, 0xdb, 0x0a, 0x3d, 0x5e, 0x37, 0x5c, 0x5b, 0xde, 0x79, 0xb2, - 0x59, 0x64, 0x82, 0x3d, 0x1d, 0xdc, 0x42, 0x4e, 0x21, 0xf8, 0xd2, 0x0d, 0xd0, 0x08, 0x2a, 0xe9, - 0x22, 0xa8, 0x75, 0xe5, 0x50, 0x59, 0xe2, 0xce, 0x35, 0xac, 0x89, 0xda, 0xd1, 0x51, 0x0f, 0x50, - 0xbd, 0x18, 0x95, 0xae, 0xfd, 0xf2, 0x3c, 0x76, 0xad, 0x8b, 0xd8, 0xb5, 0xfe, 0xc4, 0xae, 0xf5, - 0x7d, 0xe9, 0x96, 0x2e, 0x96, 0x6e, 0xe9, 0xd7, 0xd2, 0x2d, 0x7d, 0x78, 0x1a, 0x30, 0xf5, 0x79, - 0x7a, 0xec, 0x9f, 0xf0, 0x31, 0x96, 0xa7, 0x4c, 0x3c, 0x1b, 0xd3, 0x59, 0xe6, 0xf1, 0x45, 0xbb, - 0xa8, 0xb9, 0xa0, 0xf2, 0xb8, 0xa2, 0x3f, 0xfa, 0xfd, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7c, - 0xb2, 0xc8, 0x7d, 0x71, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // GetAllSLAs returns all SLAs that the module is currently enforcing. - GetAllSLAs(ctx context.Context, in *GetAllSLAsRequest, opts ...grpc.CallOption) (*GetAllSLAsResponse, error) - // GetPriceFeeds returns all price feeds that the module is currently - // tracking. This request type inputs the SLA ID to query price feeds for. - GetPriceFeeds(ctx context.Context, in *GetPriceFeedsRequest, opts ...grpc.CallOption) (*GetPriceFeedsResponse, error) - // Params returns the current SLA module parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) GetAllSLAs(ctx context.Context, in *GetAllSLAsRequest, opts ...grpc.CallOption) (*GetAllSLAsResponse, error) { - out := new(GetAllSLAsResponse) - err := c.cc.Invoke(ctx, "/slinky.sla.v1.Query/GetAllSLAs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) GetPriceFeeds(ctx context.Context, in *GetPriceFeedsRequest, opts ...grpc.CallOption) (*GetPriceFeedsResponse, error) { - out := new(GetPriceFeedsResponse) - err := c.cc.Invoke(ctx, "/slinky.sla.v1.Query/GetPriceFeeds", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, "/slinky.sla.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // GetAllSLAs returns all SLAs that the module is currently enforcing. - GetAllSLAs(context.Context, *GetAllSLAsRequest) (*GetAllSLAsResponse, error) - // GetPriceFeeds returns all price feeds that the module is currently - // tracking. This request type inputs the SLA ID to query price feeds for. - GetPriceFeeds(context.Context, *GetPriceFeedsRequest) (*GetPriceFeedsResponse, error) - // Params returns the current SLA module parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) GetAllSLAs(ctx context.Context, req *GetAllSLAsRequest) (*GetAllSLAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllSLAs not implemented") -} -func (*UnimplementedQueryServer) GetPriceFeeds(ctx context.Context, req *GetPriceFeedsRequest) (*GetPriceFeedsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPriceFeeds not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_GetAllSLAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllSLAsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetAllSLAs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.sla.v1.Query/GetAllSLAs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetAllSLAs(ctx, req.(*GetAllSLAsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_GetPriceFeeds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPriceFeedsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).GetPriceFeeds(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.sla.v1.Query/GetPriceFeeds", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).GetPriceFeeds(ctx, req.(*GetPriceFeedsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.sla.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.sla.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetAllSLAs", - Handler: _Query_GetAllSLAs_Handler, - }, - { - MethodName: "GetPriceFeeds", - Handler: _Query_GetPriceFeeds_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/sla/v1/query.proto", -} - -func (m *GetAllSLAsRequest) 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 *GetAllSLAsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetAllSLAsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *GetAllSLAsResponse) 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 *GetAllSLAsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetAllSLAsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SLAs) > 0 { - for iNdEx := len(m.SLAs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SLAs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *GetPriceFeedsRequest) 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 *GetPriceFeedsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetPriceFeedsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ID) > 0 { - i -= len(m.ID) - copy(dAtA[i:], m.ID) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ID))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetPriceFeedsResponse) 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 *GetPriceFeedsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetPriceFeedsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PriceFeeds) > 0 { - for iNdEx := len(m.PriceFeeds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PriceFeeds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GetAllSLAsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GetAllSLAsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SLAs) > 0 { - for _, e := range m.SLAs { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *GetPriceFeedsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ID) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *GetPriceFeedsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PriceFeeds) > 0 { - for _, e := range m.PriceFeeds { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *ParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetAllSLAsRequest) 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 ErrIntOverflowQuery - } - 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: GetAllSLAsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllSLAsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetAllSLAsResponse) 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 ErrIntOverflowQuery - } - 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: GetAllSLAsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetAllSLAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SLAs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SLAs = append(m.SLAs, PriceFeedSLA{}) - if err := m.SLAs[len(m.SLAs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetPriceFeedsRequest) 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 ErrIntOverflowQuery - } - 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: GetPriceFeedsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetPriceFeedsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetPriceFeedsResponse) 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 ErrIntOverflowQuery - } - 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: GetPriceFeedsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetPriceFeedsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PriceFeeds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PriceFeeds = append(m.PriceFeeds, PriceFeed{}) - if err := m.PriceFeeds[len(m.PriceFeeds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsRequest) 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 ErrIntOverflowQuery - } - 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: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsResponse) 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 ErrIntOverflowQuery - } - 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: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/sla/types/query.pb.gw.go b/x/sla/types/query.pb.gw.go deleted file mode 100644 index 0809570f4..000000000 --- a/x/sla/types/query.pb.gw.go +++ /dev/null @@ -1,301 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: slinky/sla/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_GetAllSLAs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllSLAsRequest - var metadata runtime.ServerMetadata - - msg, err := client.GetAllSLAs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GetAllSLAs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetAllSLAsRequest - var metadata runtime.ServerMetadata - - msg, err := server.GetAllSLAs(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_GetPriceFeeds_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_GetPriceFeeds_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetPriceFeedsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetPriceFeeds_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetPriceFeeds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_GetPriceFeeds_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetPriceFeedsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_GetPriceFeeds_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.GetPriceFeeds(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_GetAllSLAs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_GetAllSLAs_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetAllSLAs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GetPriceFeeds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_GetPriceFeeds_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetPriceFeeds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_GetAllSLAs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_GetAllSLAs_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetAllSLAs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_GetPriceFeeds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_GetPriceFeeds_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_GetPriceFeeds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_GetAllSLAs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "sla", "v1", "slas"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_GetPriceFeeds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "sla", "v1", "price_feeds"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "sla", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_GetAllSLAs_0 = runtime.ForwardResponseMessage - - forward_Query_GetPriceFeeds_0 = runtime.ForwardResponseMessage - - forward_Query_Params_0 = runtime.ForwardResponseMessage -) diff --git a/x/sla/types/sla.go b/x/sla/types/sla.go deleted file mode 100644 index 05485beee..000000000 --- a/x/sla/types/sla.go +++ /dev/null @@ -1,123 +0,0 @@ -package types - -import ( - "fmt" - - "cosmossdk.io/math" -) - -// NewPriceFeedSLA returns a new PriceFeedSLA instance. -func NewPriceFeedSLA( - id string, - maximumViableWindow uint64, - expectedUptime math.LegacyDec, - slashConstant math.LegacyDec, - minimumBlockUpdates uint64, - frequency uint64, -) PriceFeedSLA { - return PriceFeedSLA{ - ID: id, - MaximumViableWindow: maximumViableWindow, - ExpectedUptime: expectedUptime, - SlashConstant: slashConstant, - MinimumBlockUpdates: minimumBlockUpdates, - Frequency: frequency, - } -} - -// Qualifies determines whether the inputted price feed qualifies for -// an SLA check. A price feed qualifies to be checked if the following -// conditions are met: -// 1. Price feed has the same ID / time window as the SLA. -// 2. The price feed has met the threshold for minimum block updates within -// the maximum viable window. -func (sla *PriceFeedSLA) Qualifies(priceFeed PriceFeed) (bool, error) { - if priceFeed.ID != sla.ID { - return false, nil - } - - if priceFeed.MaximumViableWindow != sla.MaximumViableWindow { - return false, fmt.Errorf("price feed %s has a different maximum viable window than the sla with same id", priceFeed.ID) - } - - // Ensure that the price feed has an acceptable minimum block updates. - numVotes, err := priceFeed.GetNumVotesWithWindow(uint(sla.MaximumViableWindow)) - if err != nil { - return false, err - } - - // Ensure that the price feed has seen enough votes. - if uint(sla.MinimumBlockUpdates) > numVotes { - return false, nil - } - - return true, nil -} - -// GetUptimeFromPriceFeed returns the uptime for the given SLA. The calculation for uptime is -// down below: -// -// uptime = (number of price updates / number of blocks voted on) -// -// This is all done in the context of the maximum viable window. -func (sla *PriceFeedSLA) GetUptimeFromPriceFeed(priceFeed PriceFeed) (math.LegacyDec, error) { - numUpdates, err := priceFeed.GetNumPriceUpdatesWithWindow(uint(sla.MaximumViableWindow)) - if err != nil { - return math.LegacyZeroDec(), err - } - - numVotes, err := priceFeed.GetNumVotesWithWindow(uint(sla.MaximumViableWindow)) - if err != nil { - return math.LegacyZeroDec(), err - } - - updates := math.NewIntFromUint64(uint64(numUpdates)) - votes := math.NewIntFromUint64(uint64(numVotes)) - - if votes.IsZero() { - return math.LegacyOneDec(), nil - } - - // uptime = number of price updates / number of blocks voted on - uptime := math.LegacyNewDecFromInt(updates).Quo(math.LegacyNewDecFromInt(votes)) - - return uptime, nil -} - -// ValidateBasic performs basic validation of the PriceFeedSLA returning an -// error for any failed validation criteria. -func (sla *PriceFeedSLA) ValidateBasic() error { - if len(sla.ID) == 0 { - return fmt.Errorf("sla id cannot be empty") - } - - if sla.MaximumViableWindow == 0 { - return fmt.Errorf("sla %s must have a non-zero maximum viable window", sla.ID) - } - - if sla.ExpectedUptime.LTE(math.LegacyZeroDec()) { - return fmt.Errorf("sla %s must have a non-negative expected uptime", sla.ID) - } - - if sla.SlashConstant.LTE(math.LegacyZeroDec()) { - return fmt.Errorf("sla %s must have a non-negative slashing constant k", sla.ID) - } - - if sla.MinimumBlockUpdates == 0 { - return fmt.Errorf("sla %s must have a non-zero minimum block updates", sla.ID) - } - - if sla.MinimumBlockUpdates >= sla.MaximumViableWindow { - return fmt.Errorf("sla %s must have a minimum block updates less than the maximum viable window", sla.ID) - } - - if sla.Frequency == 0 { - return fmt.Errorf("sla %s must have a non-zero frequency", sla.ID) - } - - if sla.Frequency > sla.MaximumViableWindow { - return fmt.Errorf("sla %s must have a frequency less than the maximum viable window", sla.ID) - } - - return nil -} diff --git a/x/sla/types/sla_test.go b/x/sla/types/sla_test.go deleted file mode 100644 index 96ca7a904..000000000 --- a/x/sla/types/sla_test.go +++ /dev/null @@ -1,544 +0,0 @@ -package types_test - -import ( - "testing" - - "cosmossdk.io/math" - "github.com/stretchr/testify/require" - - slatypes "github.com/skip-mev/slinky/x/sla/types" -) - -func TestSLAValidateBasic(t *testing.T) { - t.Run("empty id should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "", - 1, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("maximum viable window of 0 should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 0, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("equal viable windows should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("expected uptime of 0 or less should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("0"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - - sla = slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("-1"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 1, - ) - err = sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("slashing constant of 0 or less should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0"), - 1, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - - sla = slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("-1"), - 1, - 1, - ) - err = sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("minimum block updates of 0 should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 0, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("minimum block updates greater than maximum viable window should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 1, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 2, - 1, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("frequency of 0 should be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 2, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 0, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("frequency that is greater than the maximum viable window must be rejected", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 2, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 1, - 3, - ) - err := sla.ValidateBasic() - require.Error(t, err) - }) - - t.Run("valid sla should be accepted", func(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 10, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 5, - 5, - ) - err := sla.ValidateBasic() - require.NoError(t, err) - }) -} - -func TestQualifies(t *testing.T) { - sla := slatypes.NewPriceFeedSLA( - "test", - 10, - math.LegacyMustNewDecFromStr("0.5"), - math.LegacyMustNewDecFromStr("0.5"), - 5, - 5, - ) - - t.Run("does not qualify when the SLA ID is different from price feed ID", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "differentID") - require.NoError(t, err) - - qualifies, err := sla.Qualifies(priceFeed) - require.NoError(t, err) - require.False(t, qualifies) - }) - - t.Run("errors when the IDs are the same but the maximum viable window is different", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(20, val, cp, "test") - require.NoError(t, err) - - qualifies, err := sla.Qualifies(priceFeed) - require.Error(t, err) - require.False(t, qualifies) - }) - - t.Run("does not qualify when price feed has not seen enough votes", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "test") - require.NoError(t, err) - - qualifies, err := sla.Qualifies(priceFeed) - require.NoError(t, err) - require.False(t, qualifies) - }) - - t.Run("qualifies when price feed has seen enough votes", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "test") - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - qualifies, err := sla.Qualifies(priceFeed) - require.NoError(t, err) - require.True(t, qualifies) - }) - - t.Run("qualifies when price feed has seen enough votes with wraparound", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "test") - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - } - - qualifies, err := sla.Qualifies(priceFeed) - require.NoError(t, err) - require.True(t, qualifies) - }) - - t.Run("does not qualify when price feed has not seen enough votes with wraparound", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "test") - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote with price for 5 blocks - for i := 0; i < 6; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - } - - qualifies, err := sla.Qualifies(priceFeed) - require.NoError(t, err) - require.False(t, qualifies) - }) - - t.Run("qualifies when there is a large wrap around", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(10, val, cp, "test") - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote with price for 5 blocks - for i := 0; i < 15; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - } - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - qualifies, err := sla.Qualifies(priceFeed) - require.NoError(t, err) - require.True(t, qualifies) - }) -} - -func TestGetUptimeFromPriceFeed(t *testing.T) { - // Strategy inputs - id := "testID" - maximumViableWindow := uint(20) - expectedUptime := math.LegacyMustNewDecFromStr("0.8") - k := math.LegacyMustNewDecFromStr("1.0") - frequency := 10 - minimumBlockUpdates := uint(10) - - sla := slatypes.NewPriceFeedSLA( - id, - uint64(maximumViableWindow), - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - t.Run("returns valid uptime", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(maximumViableWindow, val, cp, id) - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote without price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("0.5"), uptime) - }) - - t.Run("returns valid uptime with no votes in between", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(maximumViableWindow, val, cp, id) - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote without price for 15 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - } - - // Vote without price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("0.5"), uptime) - }) - - t.Run("returns valid uptime with wraparound", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(maximumViableWindow, val, cp, id) - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - for i := 0; i < 15; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - } - - // Vote without price for 5 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("0.0"), uptime) - }) - - t.Run("returns valid uptime where every other block is a vote", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(maximumViableWindow, val, cp, id) - require.NoError(t, err) - - for i := 0; i < 10; i++ { - if i%2 == 0 { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } else { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - } - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("0.5"), uptime) - }) - - t.Run("returns a valid uptime when price feed has longer window", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(40, val, cp, id) - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote without price for 5 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - - // vote yes for 10 blocks - for i := 0; i < 20; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("1.0"), uptime) - - // create different strategy that has 40 block window - strategy := slatypes.NewPriceFeedSLA( - id, - 40, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err = strategy.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("0.75"), uptime) - }) - - t.Run("same price feed for different strategies", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(100, val, cp, id) - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote without price for 5 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - - // vote yes for 10 blocks - for i := 0; i < 20; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // create different strategy that has 40 block window - sla := slatypes.NewPriceFeedSLA( - id, - 10, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("1.0"), uptime) - - // create different strategy that has 40 block window - sla = slatypes.NewPriceFeedSLA( - id, - 20, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err = sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("1.0"), uptime) - - // create different strategy that has 40 block window - sla = slatypes.NewPriceFeedSLA( - id, - 30, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err = sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyNewDec(2).Quo(math.LegacyNewDec(3)), uptime) - }) - - t.Run("wrap around updates with multiple slas", func(t *testing.T) { - priceFeed, err := slatypes.NewPriceFeed(20, val, cp, id) - require.NoError(t, err) - - // Vote with price for 5 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // Vote without price for 5 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithoutPrice)) - } - - // vote yes for 10 blocks - for i := 0; i < 10; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.VoteWithPrice)) - } - - // no vote for 10 blocks - for i := 0; i < 5; i++ { - require.NoError(t, priceFeed.SetUpdate(slatypes.NoVote)) - } - - sla := slatypes.NewPriceFeedSLA( - id, - 10, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err := sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("1.0"), uptime) - - sla = slatypes.NewPriceFeedSLA( - id, - 20, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err = sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyNewDec(2).Quo(math.LegacyNewDec(3)), uptime) - - sla = slatypes.NewPriceFeedSLA( - id, - 6, - expectedUptime, - k, - uint64(minimumBlockUpdates), - uint64(frequency), - ) - - uptime, err = sla.GetUptimeFromPriceFeed(priceFeed) - require.NoError(t, err) - require.Equal(t, math.LegacyMustNewDecFromStr("1.0"), uptime) - }) -} diff --git a/x/sla/types/tx.pb.go b/x/sla/types/tx.pb.go deleted file mode 100644 index 297d96bed..000000000 --- a/x/sla/types/tx.pb.go +++ /dev/null @@ -1,1386 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/sla/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgAddSLAs defines the Msg/AddSLAs request type. It contains the -// SLAs to be added to the store. -type MsgAddSLAs struct { - // SLAs defines the SLAs to be added to the store. - SLAs []PriceFeedSLA `protobuf:"bytes,1,rep,name=slas,proto3" json:"slas"` - // Authority defines the authority that is adding the SLAs. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (m *MsgAddSLAs) Reset() { *m = MsgAddSLAs{} } -func (m *MsgAddSLAs) String() string { return proto.CompactTextString(m) } -func (*MsgAddSLAs) ProtoMessage() {} -func (*MsgAddSLAs) Descriptor() ([]byte, []int) { - return fileDescriptor_92e35178383738b0, []int{0} -} -func (m *MsgAddSLAs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddSLAs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddSLAs.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 *MsgAddSLAs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddSLAs.Merge(m, src) -} -func (m *MsgAddSLAs) XXX_Size() int { - return m.Size() -} -func (m *MsgAddSLAs) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddSLAs.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddSLAs proto.InternalMessageInfo - -func (m *MsgAddSLAs) GetSLAs() []PriceFeedSLA { - if m != nil { - return m.SLAs - } - return nil -} - -func (m *MsgAddSLAs) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -// MsgAddSLAsResponse defines the Msg/AddSLAs response type. -type MsgAddSLAsResponse struct { -} - -func (m *MsgAddSLAsResponse) Reset() { *m = MsgAddSLAsResponse{} } -func (m *MsgAddSLAsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddSLAsResponse) ProtoMessage() {} -func (*MsgAddSLAsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_92e35178383738b0, []int{1} -} -func (m *MsgAddSLAsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddSLAsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddSLAsResponse.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 *MsgAddSLAsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddSLAsResponse.Merge(m, src) -} -func (m *MsgAddSLAsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddSLAsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddSLAsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddSLAsResponse proto.InternalMessageInfo - -// MsgRemoveSLAs defines the Msg/RemoveSLAs request type. It contains the -// IDs of the SLAs to be removed from the store. -type MsgRemoveSLAs struct { - // IDs defines the IDs of the SLAs to be removed from the store. - IDs []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` - // Authority defines the authority that is removing the SLAs. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (m *MsgRemoveSLAs) Reset() { *m = MsgRemoveSLAs{} } -func (m *MsgRemoveSLAs) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveSLAs) ProtoMessage() {} -func (*MsgRemoveSLAs) Descriptor() ([]byte, []int) { - return fileDescriptor_92e35178383738b0, []int{2} -} -func (m *MsgRemoveSLAs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveSLAs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveSLAs.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 *MsgRemoveSLAs) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveSLAs.Merge(m, src) -} -func (m *MsgRemoveSLAs) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveSLAs) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveSLAs.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveSLAs proto.InternalMessageInfo - -func (m *MsgRemoveSLAs) GetIDs() []string { - if m != nil { - return m.IDs - } - return nil -} - -func (m *MsgRemoveSLAs) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -// MsgRemoveSLAsResponse defines the Msg/RemoveSLAs response type. -type MsgRemoveSLAsResponse struct { -} - -func (m *MsgRemoveSLAsResponse) Reset() { *m = MsgRemoveSLAsResponse{} } -func (m *MsgRemoveSLAsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveSLAsResponse) ProtoMessage() {} -func (*MsgRemoveSLAsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_92e35178383738b0, []int{3} -} -func (m *MsgRemoveSLAsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveSLAsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveSLAsResponse.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 *MsgRemoveSLAsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveSLAsResponse.Merge(m, src) -} -func (m *MsgRemoveSLAsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveSLAsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveSLAsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveSLAsResponse proto.InternalMessageInfo - -// MsgParams defines the Msg/Params request type. It contains the -// new parameters for the SLA module. -type MsgParams struct { - // Params defines the new parameters for the SLA module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // Authority defines the authority that is updating the SLA module parameters. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (m *MsgParams) Reset() { *m = MsgParams{} } -func (m *MsgParams) String() string { return proto.CompactTextString(m) } -func (*MsgParams) ProtoMessage() {} -func (*MsgParams) Descriptor() ([]byte, []int) { - return fileDescriptor_92e35178383738b0, []int{4} -} -func (m *MsgParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgParams.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 *MsgParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgParams.Merge(m, src) -} -func (m *MsgParams) XXX_Size() int { - return m.Size() -} -func (m *MsgParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgParams proto.InternalMessageInfo - -func (m *MsgParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *MsgParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -// MsgParamsResponse defines the Msg/Params response type. -type MsgParamsResponse struct { -} - -func (m *MsgParamsResponse) Reset() { *m = MsgParamsResponse{} } -func (m *MsgParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgParamsResponse) ProtoMessage() {} -func (*MsgParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_92e35178383738b0, []int{5} -} -func (m *MsgParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgParamsResponse.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 *MsgParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgParamsResponse.Merge(m, src) -} -func (m *MsgParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgParamsResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgAddSLAs)(nil), "slinky.sla.v1.MsgAddSLAs") - proto.RegisterType((*MsgAddSLAsResponse)(nil), "slinky.sla.v1.MsgAddSLAsResponse") - proto.RegisterType((*MsgRemoveSLAs)(nil), "slinky.sla.v1.MsgRemoveSLAs") - proto.RegisterType((*MsgRemoveSLAsResponse)(nil), "slinky.sla.v1.MsgRemoveSLAsResponse") - proto.RegisterType((*MsgParams)(nil), "slinky.sla.v1.MsgParams") - proto.RegisterType((*MsgParamsResponse)(nil), "slinky.sla.v1.MsgParamsResponse") -} - -func init() { proto.RegisterFile("slinky/sla/v1/tx.proto", fileDescriptor_92e35178383738b0) } - -var fileDescriptor_92e35178383738b0 = []byte{ - // 471 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x31, 0x6b, 0xdb, 0x40, - 0x14, 0xc7, 0x7d, 0xb5, 0xeb, 0xe0, 0x97, 0x64, 0x88, 0xea, 0x34, 0xb2, 0x52, 0x64, 0xd7, 0x94, - 0x62, 0x02, 0x91, 0x88, 0x03, 0x1d, 0x0a, 0x85, 0x5a, 0x84, 0x96, 0x42, 0x0d, 0x46, 0xd9, 0xba, - 0x04, 0xc5, 0xba, 0x5e, 0x8e, 0xf8, 0x7c, 0x42, 0x4f, 0x36, 0xf1, 0x56, 0xba, 0x76, 0xe9, 0xd4, - 0xcf, 0x91, 0xa1, 0x1f, 0x22, 0x63, 0xe8, 0xd4, 0xc9, 0x14, 0x79, 0xc8, 0xd4, 0xef, 0x50, 0xa4, - 0x93, 0xad, 0x3a, 0x21, 0x99, 0xbc, 0xe9, 0xbd, 0xff, 0xff, 0xff, 0xf4, 0xe3, 0x1d, 0x0f, 0x9e, - 0xe2, 0x80, 0x0f, 0xcf, 0x27, 0x36, 0x0e, 0x3c, 0x7b, 0x7c, 0x60, 0x47, 0x17, 0x56, 0x10, 0xca, - 0x48, 0x6a, 0x9b, 0xaa, 0x6f, 0xe1, 0xc0, 0xb3, 0xc6, 0x07, 0xc6, 0xee, 0xb2, 0x8d, 0xd1, 0x21, - 0x45, 0x8e, 0xca, 0x6b, 0xd4, 0xfa, 0x12, 0x85, 0xc4, 0x93, 0xb4, 0xb2, 0x55, 0x91, 0x49, 0x3b, - 0xaa, 0xb2, 0x05, 0xb2, 0x24, 0x27, 0x90, 0x65, 0x42, 0x95, 0x49, 0x26, 0x55, 0x20, 0xf9, 0x52, - 0xdd, 0xe6, 0x0f, 0x02, 0xd0, 0x45, 0xd6, 0xf1, 0xfd, 0xe3, 0x8f, 0x1d, 0xd4, 0xde, 0x40, 0x09, - 0x07, 0x1e, 0xea, 0xa4, 0x51, 0x6c, 0xad, 0xb7, 0x77, 0xad, 0x25, 0x26, 0xab, 0x17, 0xf2, 0x3e, - 0x7d, 0x47, 0x69, 0xe2, 0x75, 0x36, 0xae, 0xa6, 0xf5, 0x42, 0x3c, 0xad, 0x97, 0x92, 0xa0, 0x9b, - 0xc6, 0xb4, 0x57, 0x50, 0xf1, 0x46, 0xd1, 0x99, 0x0c, 0x79, 0x34, 0xd1, 0x1f, 0x35, 0x48, 0xab, - 0xe2, 0xe8, 0xbf, 0x7e, 0xee, 0x57, 0x33, 0xc2, 0x8e, 0xef, 0x87, 0x14, 0xf1, 0x38, 0x0a, 0xf9, - 0x90, 0xb9, 0xb9, 0xf5, 0xf5, 0xd6, 0xd7, 0x9b, 0xcb, 0xbd, 0x8d, 0xcf, 0xa1, 0x14, 0x27, 0x9e, - 0xf2, 0x34, 0xab, 0xa0, 0xe5, 0x5c, 0x2e, 0xc5, 0x40, 0x0e, 0x91, 0x36, 0x47, 0xb0, 0xd9, 0x45, - 0xe6, 0x52, 0x21, 0xc7, 0x34, 0x05, 0xae, 0x41, 0x91, 0xfb, 0x8a, 0xb7, 0xe2, 0xac, 0xc5, 0xd3, - 0x7a, 0xf1, 0xc3, 0x11, 0xba, 0x49, 0x6f, 0x95, 0x30, 0x3b, 0xb0, 0xbd, 0xf4, 0xdb, 0x05, 0xcf, - 0x37, 0x02, 0x95, 0x2e, 0xb2, 0x9e, 0x17, 0x7a, 0x02, 0xb5, 0x43, 0x28, 0x07, 0xe9, 0x97, 0x4e, - 0x1a, 0xa4, 0xb5, 0xde, 0xde, 0xbe, 0xbd, 0xbf, 0x54, 0x74, 0x4a, 0xc9, 0xe6, 0xdc, 0xcc, 0xba, - 0x4a, 0xcc, 0x27, 0xb0, 0xb5, 0x80, 0x99, 0x23, 0xb6, 0xff, 0x12, 0x28, 0x76, 0x91, 0x69, 0xef, - 0x61, 0x6d, 0xfe, 0xca, 0xb5, 0x5b, 0x5c, 0xf9, 0xa2, 0x8d, 0xe7, 0xf7, 0x4a, 0xf3, 0x81, 0x5a, - 0x0f, 0xe0, 0xbf, 0x07, 0x78, 0x76, 0x37, 0x90, 0xab, 0xc6, 0x8b, 0x87, 0xd4, 0xc5, 0xc4, 0x23, - 0x28, 0x67, 0x1b, 0xd4, 0xef, 0xfa, 0x95, 0x62, 0x34, 0xee, 0x53, 0xe6, 0x53, 0x8c, 0xc7, 0x5f, - 0x6e, 0x2e, 0xf7, 0x88, 0xf3, 0xf6, 0x2a, 0x36, 0xc9, 0x75, 0x6c, 0x92, 0x3f, 0xb1, 0x49, 0xbe, - 0xcf, 0xcc, 0xc2, 0xf5, 0xcc, 0x2c, 0xfc, 0x9e, 0x99, 0x85, 0x4f, 0x2f, 0x19, 0x8f, 0xce, 0x46, - 0xa7, 0x56, 0x5f, 0x0a, 0x1b, 0xcf, 0x79, 0xb0, 0x2f, 0xe8, 0xd8, 0xce, 0xce, 0xec, 0x22, 0x3d, - 0xb4, 0x68, 0x12, 0x50, 0x3c, 0x2d, 0xa7, 0xa7, 0x71, 0xf8, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xdf, - 0x2c, 0x80, 0x9c, 0xaa, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // AddSLA defines a method for adding a new SLAs to the store. Note, this will - // overwrite any existing SLA with the same ID. - AddSLAs(ctx context.Context, in *MsgAddSLAs, opts ...grpc.CallOption) (*MsgAddSLAsResponse, error) - // RemoveSLA defines a method for removing existing SLAs from the store. Note, - // this will not panic if the SLA does not exist. - RemoveSLAs(ctx context.Context, in *MsgRemoveSLAs, opts ...grpc.CallOption) (*MsgRemoveSLAsResponse, error) - // Params defines a method for updating the SLA module parameters. - Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) AddSLAs(ctx context.Context, in *MsgAddSLAs, opts ...grpc.CallOption) (*MsgAddSLAsResponse, error) { - out := new(MsgAddSLAsResponse) - err := c.cc.Invoke(ctx, "/slinky.sla.v1.Msg/AddSLAs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RemoveSLAs(ctx context.Context, in *MsgRemoveSLAs, opts ...grpc.CallOption) (*MsgRemoveSLAsResponse, error) { - out := new(MsgRemoveSLAsResponse) - err := c.cc.Invoke(ctx, "/slinky.sla.v1.Msg/RemoveSLAs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) { - out := new(MsgParamsResponse) - err := c.cc.Invoke(ctx, "/slinky.sla.v1.Msg/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // AddSLA defines a method for adding a new SLAs to the store. Note, this will - // overwrite any existing SLA with the same ID. - AddSLAs(context.Context, *MsgAddSLAs) (*MsgAddSLAsResponse, error) - // RemoveSLA defines a method for removing existing SLAs from the store. Note, - // this will not panic if the SLA does not exist. - RemoveSLAs(context.Context, *MsgRemoveSLAs) (*MsgRemoveSLAsResponse, error) - // Params defines a method for updating the SLA module parameters. - Params(context.Context, *MsgParams) (*MsgParamsResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) AddSLAs(ctx context.Context, req *MsgAddSLAs) (*MsgAddSLAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddSLAs not implemented") -} -func (*UnimplementedMsgServer) RemoveSLAs(ctx context.Context, req *MsgRemoveSLAs) (*MsgRemoveSLAsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveSLAs not implemented") -} -func (*UnimplementedMsgServer) Params(ctx context.Context, req *MsgParams) (*MsgParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_AddSLAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddSLAs) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddSLAs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.sla.v1.Msg/AddSLAs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddSLAs(ctx, req.(*MsgAddSLAs)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RemoveSLAs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveSLAs) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RemoveSLAs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.sla.v1.Msg/RemoveSLAs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveSLAs(ctx, req.(*MsgRemoveSLAs)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.sla.v1.Msg/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Params(ctx, req.(*MsgParams)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.sla.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddSLAs", - Handler: _Msg_AddSLAs_Handler, - }, - { - MethodName: "RemoveSLAs", - Handler: _Msg_RemoveSLAs_Handler, - }, - { - MethodName: "Params", - Handler: _Msg_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/sla/v1/tx.proto", -} - -func (m *MsgAddSLAs) 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 *MsgAddSLAs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddSLAs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0x12 - } - if len(m.SLAs) > 0 { - for iNdEx := len(m.SLAs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SLAs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgAddSLAsResponse) 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 *MsgAddSLAsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddSLAsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgRemoveSLAs) 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 *MsgRemoveSLAs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveSLAs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0x12 - } - if len(m.IDs) > 0 { - for iNdEx := len(m.IDs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.IDs[iNdEx]) - copy(dAtA[i:], m.IDs[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.IDs[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgRemoveSLAsResponse) 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 *MsgRemoveSLAsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveSLAsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgParams) 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 *MsgParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgParamsResponse) 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 *MsgParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgAddSLAs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SLAs) > 0 { - for _, e := range m.SLAs { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgAddSLAsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgRemoveSLAs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IDs) > 0 { - for _, s := range m.IDs { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRemoveSLAsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgAddSLAs) 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 ErrIntOverflowTx - } - 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: MsgAddSLAs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddSLAs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SLAs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SLAs = append(m.SLAs, PriceFeedSLA{}) - if err := m.SLAs[len(m.SLAs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgAddSLAsResponse) 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 ErrIntOverflowTx - } - 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: MsgAddSLAsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddSLAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRemoveSLAs) 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 ErrIntOverflowTx - } - 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: MsgRemoveSLAs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveSLAs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IDs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IDs = append(m.IDs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgRemoveSLAsResponse) 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 ErrIntOverflowTx - } - 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: MsgRemoveSLAsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveSLAsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgParams) 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 ErrIntOverflowTx - } - 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: MsgParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgParamsResponse) 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 ErrIntOverflowTx - } - 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: MsgParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -)