From 9564a37c27bfc4ce3d8ac0357df4609bfe73fd36 Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 22 Feb 2024 14:35:04 -0500 Subject: [PATCH 01/31] delete unused files --- x/oracle/mocks/AppOptions.go | 41 ------ x/oracle/mocks/DistrKeeper.go | 46 ------ x/oracle/mocks/ExchangeQueryHandler.go | 81 ----------- x/oracle/mocks/ExchangeToMarketPrices.go | 74 ---------- x/oracle/mocks/GrpcClient.go | 91 ------------ x/oracle/mocks/Logger.go | 70 --------- x/oracle/mocks/OracleKeeper.go | 57 -------- .../mocks/PriceFeedMutableMarketConfigs.go | 108 -------------- x/oracle/mocks/QueryClient.go | 69 --------- x/oracle/mocks/RequestHandler.go | 53 ------- x/oracle/mocks/SlashingKeeper.go | 87 ----------- x/oracle/mocks/StakingKeeper.go | 135 ------------------ x/oracle/mocks/TimeProvider.go | 43 ------ 13 files changed, 955 deletions(-) delete mode 100644 x/oracle/mocks/AppOptions.go delete mode 100644 x/oracle/mocks/DistrKeeper.go delete mode 100644 x/oracle/mocks/ExchangeQueryHandler.go delete mode 100644 x/oracle/mocks/ExchangeToMarketPrices.go delete mode 100644 x/oracle/mocks/GrpcClient.go delete mode 100644 x/oracle/mocks/Logger.go delete mode 100644 x/oracle/mocks/OracleKeeper.go delete mode 100644 x/oracle/mocks/PriceFeedMutableMarketConfigs.go delete mode 100644 x/oracle/mocks/QueryClient.go delete mode 100644 x/oracle/mocks/RequestHandler.go delete mode 100644 x/oracle/mocks/SlashingKeeper.go delete mode 100644 x/oracle/mocks/StakingKeeper.go delete mode 100644 x/oracle/mocks/TimeProvider.go diff --git a/x/oracle/mocks/AppOptions.go b/x/oracle/mocks/AppOptions.go deleted file mode 100644 index a53be4095..000000000 --- a/x/oracle/mocks/AppOptions.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// AppOptions is an autogenerated mock type for the AppOptions type -type AppOptions struct { - mock.Mock -} - -// Get provides a mock function with given fields: _a0 -func (_m *AppOptions) Get(_a0 string) interface{} { - ret := _m.Called(_a0) - - var r0 interface{} - if rf, ok := ret.Get(0).(func(string) interface{}); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} - -type mockConstructorTestingTNewAppOptions interface { - mock.TestingT - Cleanup(func()) -} - -// NewAppOptions creates a new instance of AppOptions. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewAppOptions(t mockConstructorTestingTNewAppOptions) *AppOptions { - mock := &AppOptions{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/DistrKeeper.go b/x/oracle/mocks/DistrKeeper.go deleted file mode 100644 index 553a4c712..000000000 --- a/x/oracle/mocks/DistrKeeper.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// DistrKeeper is an autogenerated mock type for the DistrKeeper type -type DistrKeeper struct { - mock.Mock -} - -// AllocateTokensToValidator provides a mock function with given fields: ctx, val, tokens -func (_m *DistrKeeper) AllocateTokensToValidator(ctx context.Context, val types.ValidatorI, tokens cosmos_sdktypes.DecCoins) error { - ret := _m.Called(ctx, val, tokens) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ValidatorI, cosmos_sdktypes.DecCoins) error); ok { - r0 = rf(ctx, val, tokens) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -type mockConstructorTestingTNewDistrKeeper interface { - mock.TestingT - Cleanup(func()) -} - -// NewDistrKeeper creates a new instance of DistrKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDistrKeeper(t mockConstructorTestingTNewDistrKeeper) *DistrKeeper { - mock := &DistrKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/ExchangeQueryHandler.go b/x/oracle/mocks/ExchangeQueryHandler.go deleted file mode 100644 index 5c3b0ef4f..000000000 --- a/x/oracle/mocks/ExchangeQueryHandler.go +++ /dev/null @@ -1,81 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - daemonstypes "github.com/tellor-io/layer/daemons/types" - - mock "github.com/stretchr/testify/mock" - - time "time" - - types "github.com/tellor-io/layer/daemons/pricefeed/client/types" -) - -// ExchangeQueryHandler is an autogenerated mock type for the ExchangeQueryHandler type -type ExchangeQueryHandler struct { - mock.Mock -} - -// Now provides a mock function with given fields: -func (_m *ExchangeQueryHandler) Now() time.Time { - ret := _m.Called() - - var r0 time.Time - if rf, ok := ret.Get(0).(func() time.Time); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(time.Time) - } - - return r0 -} - -// Query provides a mock function with given fields: ctx, exchangeQueryDetails, exchangeConfig, marketIds, requestHandler, marketPriceExponent -func (_m *ExchangeQueryHandler) Query(ctx context.Context, exchangeQueryDetails *types.ExchangeQueryDetails, exchangeConfig *types.MutableExchangeMarketConfig, marketIds []uint32, requestHandler daemonstypes.RequestHandler, marketPriceExponent map[uint32]int32) ([]*types.MarketPriceTimestamp, map[uint32]error, error) { - ret := _m.Called(ctx, exchangeQueryDetails, exchangeConfig, marketIds, requestHandler, marketPriceExponent) - - var r0 []*types.MarketPriceTimestamp - if rf, ok := ret.Get(0).(func(context.Context, *types.ExchangeQueryDetails, *types.MutableExchangeMarketConfig, []uint32, daemonstypes.RequestHandler, map[uint32]int32) []*types.MarketPriceTimestamp); ok { - r0 = rf(ctx, exchangeQueryDetails, exchangeConfig, marketIds, requestHandler, marketPriceExponent) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*types.MarketPriceTimestamp) - } - } - - var r1 map[uint32]error - if rf, ok := ret.Get(1).(func(context.Context, *types.ExchangeQueryDetails, *types.MutableExchangeMarketConfig, []uint32, daemonstypes.RequestHandler, map[uint32]int32) map[uint32]error); ok { - r1 = rf(ctx, exchangeQueryDetails, exchangeConfig, marketIds, requestHandler, marketPriceExponent) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(map[uint32]error) - } - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, *types.ExchangeQueryDetails, *types.MutableExchangeMarketConfig, []uint32, daemonstypes.RequestHandler, map[uint32]int32) error); ok { - r2 = rf(ctx, exchangeQueryDetails, exchangeConfig, marketIds, requestHandler, marketPriceExponent) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -type mockConstructorTestingTNewExchangeQueryHandler interface { - mock.TestingT - Cleanup(func()) -} - -// NewExchangeQueryHandler creates a new instance of ExchangeQueryHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewExchangeQueryHandler(t mockConstructorTestingTNewExchangeQueryHandler) *ExchangeQueryHandler { - mock := &ExchangeQueryHandler{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/ExchangeToMarketPrices.go b/x/oracle/mocks/ExchangeToMarketPrices.go deleted file mode 100644 index 7e481c554..000000000 --- a/x/oracle/mocks/ExchangeToMarketPrices.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - time "time" - - mock "github.com/stretchr/testify/mock" - pricefeedtypes "github.com/tellor-io/layer/daemons/pricefeed/types" - - types "github.com/tellor-io/layer/daemons/pricefeed/client/types" -) - -// ExchangeToMarketPrices is an autogenerated mock type for the ExchangeToMarketPrices type -type ExchangeToMarketPrices struct { - mock.Mock -} - -// GetAllPrices provides a mock function with given fields: -func (_m *ExchangeToMarketPrices) GetAllPrices() map[string][]types.MarketPriceTimestamp { - ret := _m.Called() - - var r0 map[string][]types.MarketPriceTimestamp - if rf, ok := ret.Get(0).(func() map[string][]types.MarketPriceTimestamp); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string][]types.MarketPriceTimestamp) - } - } - - return r0 -} - -// GetIndexPrice provides a mock function with given fields: marketId, cutoffTime, resolver -func (_m *ExchangeToMarketPrices) GetIndexPrice(marketId uint32, cutoffTime time.Time, resolver pricefeedtypes.Resolver) (uint64, int) { - ret := _m.Called(marketId, cutoffTime, resolver) - - var r0 uint64 - if rf, ok := ret.Get(0).(func(uint32, time.Time, pricefeedtypes.Resolver) uint64); ok { - r0 = rf(marketId, cutoffTime, resolver) - } else { - r0 = ret.Get(0).(uint64) - } - - var r1 int - if rf, ok := ret.Get(1).(func(uint32, time.Time, pricefeedtypes.Resolver) int); ok { - r1 = rf(marketId, cutoffTime, resolver) - } else { - r1 = ret.Get(1).(int) - } - - return r0, r1 -} - -// UpdatePrice provides a mock function with given fields: exchangeId, marketPriceTimestamp -func (_m *ExchangeToMarketPrices) UpdatePrice(exchangeId string, marketPriceTimestamp *types.MarketPriceTimestamp) { - _m.Called(exchangeId, marketPriceTimestamp) -} - -type mockConstructorTestingTNewExchangeToMarketPrices interface { - mock.TestingT - Cleanup(func()) -} - -// NewExchangeToMarketPrices creates a new instance of ExchangeToMarketPrices. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewExchangeToMarketPrices(t mockConstructorTestingTNewExchangeToMarketPrices) *ExchangeToMarketPrices { - mock := &ExchangeToMarketPrices{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/GrpcClient.go b/x/oracle/mocks/GrpcClient.go deleted file mode 100644 index eb6a39dae..000000000 --- a/x/oracle/mocks/GrpcClient.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" -) - -// GrpcClient is an autogenerated mock type for the GrpcClient type -type GrpcClient struct { - mock.Mock -} - -// CloseConnection provides a mock function with given fields: grpcConn -func (_m *GrpcClient) CloseConnection(grpcConn *grpc.ClientConn) error { - ret := _m.Called(grpcConn) - - var r0 error - if rf, ok := ret.Get(0).(func(*grpc.ClientConn) error); ok { - r0 = rf(grpcConn) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewGrpcConnection provides a mock function with given fields: ctx, socketAddress -func (_m *GrpcClient) NewGrpcConnection(ctx context.Context, socketAddress string) (*grpc.ClientConn, error) { - ret := _m.Called(ctx, socketAddress) - - var r0 *grpc.ClientConn - if rf, ok := ret.Get(0).(func(context.Context, string) *grpc.ClientConn); ok { - r0 = rf(ctx, socketAddress) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*grpc.ClientConn) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, socketAddress) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewTcpConnection provides a mock function with given fields: ctx, endpoint -func (_m *GrpcClient) NewTcpConnection(ctx context.Context, endpoint string) (*grpc.ClientConn, error) { - ret := _m.Called(ctx, endpoint) - - var r0 *grpc.ClientConn - if rf, ok := ret.Get(0).(func(context.Context, string) *grpc.ClientConn); ok { - r0 = rf(ctx, endpoint) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*grpc.ClientConn) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, endpoint) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -type mockConstructorTestingTNewGrpcClient interface { - mock.TestingT - Cleanup(func()) -} - -// NewGrpcClient creates a new instance of GrpcClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewGrpcClient(t mockConstructorTestingTNewGrpcClient) *GrpcClient { - mock := &GrpcClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/Logger.go b/x/oracle/mocks/Logger.go deleted file mode 100644 index e9e736c5f..000000000 --- a/x/oracle/mocks/Logger.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - log "github.com/cometbft/cometbft/libs/log" - mock "github.com/stretchr/testify/mock" -) - -// Logger is an autogenerated mock type for the Logger type -type Logger struct { - mock.Mock -} - -// Debug provides a mock function with given fields: msg, keyvals -func (_m *Logger) Debug(msg string, keyvals ...interface{}) { - var _ca []interface{} - _ca = append(_ca, msg) - _ca = append(_ca, keyvals...) - _m.Called(_ca...) -} - -// Error provides a mock function with given fields: msg, keyvals -func (_m *Logger) Error(msg string, keyvals ...interface{}) { - var _ca []interface{} - _ca = append(_ca, msg) - _ca = append(_ca, keyvals...) - _m.Called(_ca...) -} - -// Info provides a mock function with given fields: msg, keyvals -func (_m *Logger) Info(msg string, keyvals ...interface{}) { - var _ca []interface{} - _ca = append(_ca, msg) - _ca = append(_ca, keyvals...) - _m.Called(_ca...) -} - -// With provides a mock function with given fields: keyvals -func (_m *Logger) With(keyvals ...interface{}) log.Logger { - var _ca []interface{} - _ca = append(_ca, keyvals...) - ret := _m.Called(_ca...) - - var r0 log.Logger - if rf, ok := ret.Get(0).(func(...interface{}) log.Logger); ok { - r0 = rf(keyvals...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(log.Logger) - } - } - - return r0 -} - -type mockConstructorTestingTNewLogger interface { - mock.TestingT - Cleanup(func()) -} - -// NewLogger creates a new instance of Logger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewLogger(t mockConstructorTestingTNewLogger) *Logger { - mock := &Logger{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/OracleKeeper.go b/x/oracle/mocks/OracleKeeper.go deleted file mode 100644 index 8f81d10a1..000000000 --- a/x/oracle/mocks/OracleKeeper.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by mockery v2.37.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - oracletypes "github.com/tellor-io/layer/x/oracle/types" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// OracleKeeper is an autogenerated mock type for the OracleKeeper type -type OracleKeeper struct { - mock.Mock -} - -// GetTotalTips provides a mock function with given fields: ctx -func (_m *OracleKeeper) GetTotalTips(ctx types.Context) types.Coin { - ret := _m.Called(ctx) - - var r0 types.Coin - if rf, ok := ret.Get(0).(func(types.Context) types.Coin); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(types.Coin) - } - - return r0 -} - -// GetUserTips provides a mock function with given fields: ctx, tipper -func (_m *OracleKeeper) GetUserTips(ctx types.Context, tipper types.AccAddress) oracletypes.UserTipTotal { - ret := _m.Called(ctx, tipper) - - var r0 oracletypes.UserTipTotal - if rf, ok := ret.Get(0).(func(types.Context, types.AccAddress) oracletypes.UserTipTotal); ok { - r0 = rf(ctx, tipper) - } else { - r0 = ret.Get(0).(oracletypes.UserTipTotal) - } - - 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/oracle/mocks/PriceFeedMutableMarketConfigs.go b/x/oracle/mocks/PriceFeedMutableMarketConfigs.go deleted file mode 100644 index 8564520b7..000000000 --- a/x/oracle/mocks/PriceFeedMutableMarketConfigs.go +++ /dev/null @@ -1,108 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - pricestypes "github.com/tellor-io/layer/daemons/pricefeed/client/types" - types "github.com/tellor-io/layer/daemons/pricefeed/client/types" -) - -// PricefeedMutableMarketConfigs is an autogenerated mock type for the PricefeedMutableMarketConfigs type -type PricefeedMutableMarketConfigs struct { - mock.Mock -} - -// AddPriceEncoder provides a mock function with given fields: updater -func (_m *PricefeedMutableMarketConfigs) AddPriceEncoder(updater types.ExchangeConfigUpdater) { - _m.Called(updater) -} - -// AddPriceFetcher provides a mock function with given fields: updater -func (_m *PricefeedMutableMarketConfigs) AddPriceFetcher(updater types.ExchangeConfigUpdater) { - _m.Called(updater) -} - -// GetExchangeMarketConfigCopy provides a mock function with given fields: id -func (_m *PricefeedMutableMarketConfigs) GetExchangeMarketConfigCopy(id string) (*types.MutableExchangeMarketConfig, error) { - ret := _m.Called(id) - - var r0 *types.MutableExchangeMarketConfig - if rf, ok := ret.Get(0).(func(string) *types.MutableExchangeMarketConfig); ok { - r0 = rf(id) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.MutableExchangeMarketConfig) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(id) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetMarketConfigCopies provides a mock function with given fields: markets -func (_m *PricefeedMutableMarketConfigs) GetMarketConfigCopies(markets []uint32) ([]*types.MutableMarketConfig, error) { - ret := _m.Called(markets) - - var r0 []*types.MutableMarketConfig - if rf, ok := ret.Get(0).(func([]uint32) []*types.MutableMarketConfig); ok { - r0 = rf(markets) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*types.MutableMarketConfig) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func([]uint32) error); ok { - r1 = rf(markets) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateMarkets provides a mock function with given fields: marketParams -func (_m *PricefeedMutableMarketConfigs) UpdateMarkets(marketParams []pricestypes.MarketParam) (map[uint32]error, error) { - ret := _m.Called(marketParams) - - var r0 map[uint32]error - if rf, ok := ret.Get(0).(func([]pricestypes.MarketParam) map[uint32]error); ok { - r0 = rf(marketParams) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[uint32]error) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func([]pricestypes.MarketParam) error); ok { - r1 = rf(marketParams) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -type mockConstructorTestingTNewPricefeedMutableMarketConfigs interface { - mock.TestingT - Cleanup(func()) -} - -// NewPricefeedMutableMarketConfigs creates a new instance of PricefeedMutableMarketConfigs. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewPricefeedMutableMarketConfigs(t mockConstructorTestingTNewPricefeedMutableMarketConfigs) *PricefeedMutableMarketConfigs { - mock := &PricefeedMutableMarketConfigs{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/QueryClient.go b/x/oracle/mocks/QueryClient.go deleted file mode 100644 index 82db44be0..000000000 --- a/x/oracle/mocks/QueryClient.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by mockery v2.40.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" - - types "github.com/tellor-io/layer/daemons/server/types" -) - -// QueryClient is an autogenerated mock type for the PriceFeedServiceClient type -type QueryClient struct { - mock.Mock -} - -// UpdateMarketPrices provides a mock function with given fields: ctx, in, opts -func (_m *QueryClient) UpdateMarketPrices(ctx context.Context, in *types.UpdateMarketPricesRequest, opts ...grpc.CallOption) (*types.UpdateMarketPricesResponse, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, in) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateMarketPrices") - } - - var r0 *types.UpdateMarketPricesResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.UpdateMarketPricesRequest, ...grpc.CallOption) (*types.UpdateMarketPricesResponse, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *types.UpdateMarketPricesRequest, ...grpc.CallOption) *types.UpdateMarketPricesResponse); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.UpdateMarketPricesResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *types.UpdateMarketPricesRequest, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// NewQueryClient creates a new instance of QueryClient. 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 NewQueryClient(t interface { - mock.TestingT - Cleanup(func()) -}) *QueryClient { - mock := &QueryClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/RequestHandler.go b/x/oracle/mocks/RequestHandler.go deleted file mode 100644 index 6996f58d2..000000000 --- a/x/oracle/mocks/RequestHandler.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - http "net/http" - - mock "github.com/stretchr/testify/mock" -) - -// RequestHandler is an autogenerated mock type for the RequestHandler type -type RequestHandler struct { - mock.Mock -} - -// Get provides a mock function with given fields: ctx, url -func (_m *RequestHandler) Get(ctx context.Context, url string) (*http.Response, error) { - ret := _m.Called(ctx, url) - - var r0 *http.Response - if rf, ok := ret.Get(0).(func(context.Context, string) *http.Response); ok { - r0 = rf(ctx, url) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, url) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -type mockConstructorTestingTNewRequestHandler interface { - mock.TestingT - Cleanup(func()) -} - -// NewRequestHandler creates a new instance of RequestHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRequestHandler(t mockConstructorTestingTNewRequestHandler) *RequestHandler { - mock := &RequestHandler{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/SlashingKeeper.go b/x/oracle/mocks/SlashingKeeper.go deleted file mode 100644 index bab87edc6..000000000 --- a/x/oracle/mocks/SlashingKeeper.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - - time "time" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// SlashingKeeper is an autogenerated mock type for the SlashingKeeper type -type SlashingKeeper struct { - mock.Mock -} - -// GetValidatorSigningInfo provides a mock function with given fields: ctx, address -func (_m *SlashingKeeper) GetValidatorSigningInfo(ctx context.Context, address types.ConsAddress) (slashingtypes.ValidatorSigningInfo, error) { - ret := _m.Called(ctx, address) - - var r0 slashingtypes.ValidatorSigningInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress) (slashingtypes.ValidatorSigningInfo, error)); ok { - return rf(ctx, address) - } - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress) slashingtypes.ValidatorSigningInfo); ok { - r0 = rf(ctx, address) - } else { - r0 = ret.Get(0).(slashingtypes.ValidatorSigningInfo) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.ConsAddress) error); ok { - r1 = rf(ctx, address) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// JailUntil provides a mock function with given fields: ctx, consAddr, jailTime -func (_m *SlashingKeeper) JailUntil(ctx context.Context, consAddr types.ConsAddress, jailTime time.Time) error { - ret := _m.Called(ctx, consAddr, jailTime) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress, time.Time) error); ok { - r0 = rf(ctx, consAddr, jailTime) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetValidatorSigningInfo provides a mock function with given fields: ctx, address, info -func (_m *SlashingKeeper) SetValidatorSigningInfo(ctx context.Context, address types.ConsAddress, info slashingtypes.ValidatorSigningInfo) error { - ret := _m.Called(ctx, address, info) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress, slashingtypes.ValidatorSigningInfo) error); ok { - r0 = rf(ctx, address, info) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -type mockConstructorTestingTNewSlashingKeeper interface { - mock.TestingT - Cleanup(func()) -} - -// 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. -func NewSlashingKeeper(t mockConstructorTestingTNewSlashingKeeper) *SlashingKeeper { - mock := &SlashingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/StakingKeeper.go b/x/oracle/mocks/StakingKeeper.go deleted file mode 100644 index f6e42ca6b..000000000 --- a/x/oracle/mocks/StakingKeeper.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - math "cosmossdk.io/math" - - mock "github.com/stretchr/testify/mock" - - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// StakingKeeper is an autogenerated mock type for the StakingKeeper type -type StakingKeeper struct { - mock.Mock -} - -// GetAllDelegatorDelegations provides a mock function with given fields: ctx, delegator -func (_m *StakingKeeper) GetAllDelegatorDelegations(ctx context.Context, delegator types.AccAddress) ([]stakingtypes.Delegation, error) { - ret := _m.Called(ctx, delegator) - - var r0 []stakingtypes.Delegation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) ([]stakingtypes.Delegation, error)); ok { - return rf(ctx, delegator) - } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) []stakingtypes.Delegation); ok { - r0 = rf(ctx, delegator) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]stakingtypes.Delegation) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress) error); ok { - r1 = rf(ctx, delegator) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetDelegation provides a mock function with given fields: ctx, delAddr, valAddr -func (_m *StakingKeeper) GetDelegation(ctx context.Context, delAddr types.AccAddress, valAddr types.ValAddress) (stakingtypes.Delegation, error) { - ret := _m.Called(ctx, delAddr, valAddr) - - var r0 stakingtypes.Delegation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) (stakingtypes.Delegation, error)); ok { - return rf(ctx, delAddr, valAddr) - } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) stakingtypes.Delegation); ok { - r0 = rf(ctx, delAddr, valAddr) - } else { - r0 = ret.Get(0).(stakingtypes.Delegation) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, types.ValAddress) error); ok { - r1 = rf(ctx, delAddr, valAddr) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetLastTotalPower provides a mock function with given fields: ctx -func (_m *StakingKeeper) GetLastTotalPower(ctx context.Context) (math.Int, error) { - ret := _m.Called(ctx) - - var r0 math.Int - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (math.Int, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) math.Int); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(math.Int) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Validator provides a mock function with given fields: ctx, address -func (_m *StakingKeeper) Validator(ctx context.Context, address types.ValAddress) (stakingtypes.ValidatorI, error) { - ret := _m.Called(ctx, address) - - var r0 stakingtypes.ValidatorI - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) (stakingtypes.ValidatorI, error)); ok { - return rf(ctx, address) - } - if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) stakingtypes.ValidatorI); ok { - r0 = rf(ctx, address) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(stakingtypes.ValidatorI) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.ValAddress) error); ok { - r1 = rf(ctx, address) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -type mockConstructorTestingTNewStakingKeeper interface { - mock.TestingT - Cleanup(func()) -} - -// 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. -func NewStakingKeeper(t mockConstructorTestingTNewStakingKeeper) *StakingKeeper { - mock := &StakingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/oracle/mocks/TimeProvider.go b/x/oracle/mocks/TimeProvider.go deleted file mode 100644 index c5db9b121..000000000 --- a/x/oracle/mocks/TimeProvider.go +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - time "time" - - mock "github.com/stretchr/testify/mock" -) - -// TimeProvider is an autogenerated mock type for the TimeProvider type -type TimeProvider struct { - mock.Mock -} - -// Now provides a mock function with given fields: -func (_m *TimeProvider) Now() time.Time { - ret := _m.Called() - - var r0 time.Time - if rf, ok := ret.Get(0).(func() time.Time); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(time.Time) - } - - return r0 -} - -type mockConstructorTestingTNewTimeProvider interface { - mock.TestingT - Cleanup(func()) -} - -// NewTimeProvider creates a new instance of TimeProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewTimeProvider(t mockConstructorTestingTNewTimeProvider) *TimeProvider { - mock := &TimeProvider{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} From 5aece5fae66e065b882d7007e4f88a3f4ac44f8b Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 22 Feb 2024 22:36:00 -0500 Subject: [PATCH 02/31] add mocks --- x/oracle/mocks/BankKeeper.go | 82 ++------------------------------ x/oracle/mocks/Makefile | 3 +- x/oracle/mocks/RegistryKeeper.go | 55 +++++++++++++++++++++ x/oracle/mocks/ReporterKeeper.go | 73 ++++++++++++++++++++++++++++ 4 files changed, 134 insertions(+), 79 deletions(-) create mode 100644 x/oracle/mocks/RegistryKeeper.go create mode 100644 x/oracle/mocks/ReporterKeeper.go diff --git a/x/oracle/mocks/BankKeeper.go b/x/oracle/mocks/BankKeeper.go index 47b91a237..371be6938 100644 --- a/x/oracle/mocks/BankKeeper.go +++ b/x/oracle/mocks/BankKeeper.go @@ -5,8 +5,6 @@ package mocks import ( context "context" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" @@ -17,13 +15,13 @@ type BankKeeper struct { mock.Mock } -// BurnCoins provides a mock function with given fields: ctx, moduleName, amt -func (_m *BankKeeper) BurnCoins(ctx context.Context, moduleName string, amt types.Coins) error { - ret := _m.Called(ctx, moduleName, amt) +// 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) var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, types.Coins) error); ok { - r0 = rf(ctx, moduleName, amt) + r0 = rf(ctx, moduleName, amounts) } else { r0 = ret.Error(0) } @@ -45,48 +43,6 @@ func (_m *BankKeeper) GetBalance(ctx context.Context, addr types.AccAddress, den return r0 } -// GetSupply provides a mock function with given fields: ctx, denom -func (_m *BankKeeper) GetSupply(ctx context.Context, denom string) types.Coin { - ret := _m.Called(ctx, denom) - - var r0 types.Coin - if rf, ok := ret.Get(0).(func(context.Context, string) types.Coin); ok { - r0 = rf(ctx, denom) - } else { - r0 = ret.Get(0).(types.Coin) - } - - return r0 -} - -// HasBalance provides a mock function with given fields: ctx, addr, amt -func (_m *BankKeeper) HasBalance(ctx context.Context, addr types.AccAddress, amt types.Coin) bool { - ret := _m.Called(ctx, addr, amt) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.Coin) bool); ok { - r0 = rf(ctx, addr, amt) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// InputOutputCoins provides a mock function with given fields: ctx, inputs, outputs -func (_m *BankKeeper) InputOutputCoins(ctx context.Context, inputs banktypes.Input, outputs []banktypes.Output) error { - ret := _m.Called(ctx, inputs, outputs) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, banktypes.Input, []banktypes.Output) error); ok { - r0 = rf(ctx, inputs, outputs) - } 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) @@ -101,20 +57,6 @@ func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAd 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) - - 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 -} - // SendCoinsFromModuleToModule provides a mock function with given fields: ctx, senderModule, recipientModule, amt func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientModule, amt) @@ -129,22 +71,6 @@ func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderMod return r0 } -// SpendableCoins provides a mock function with given fields: ctx, addr -func (_m *BankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddress) types.Coins { - ret := _m.Called(ctx, addr) - - var r0 types.Coins - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) types.Coins); ok { - r0 = rf(ctx, addr) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(types.Coins) - } - } - - return r0 -} - type mockConstructorTestingTNewBankKeeper interface { mock.TestingT Cleanup(func()) diff --git a/x/oracle/mocks/Makefile b/x/oracle/mocks/Makefile index e8f605743..959d4c034 100644 --- a/x/oracle/mocks/Makefile +++ b/x/oracle/mocks/Makefile @@ -4,5 +4,6 @@ mock-clean: mock-gen: @go run github.com/vektra/mockery/v2 --name=AccountKeeper --dir=../types --recursive --output=. @go run github.com/vektra/mockery/v2 --name=BankKeeper --dir=../types --recursive --output=. - @go run github.com/vektra/mockery/v2 --name=DistrKeeper --dir=../types --recursive --output=. + @go run github.com/vektra/mockery/v2 --name=RegistryKeeper --dir=../types --recursive --output=. + @go run github.com/vektra/mockery/v2 --name=ReporterKeeper --dir=../types --recursive --output=. diff --git a/x/oracle/mocks/RegistryKeeper.go b/x/oracle/mocks/RegistryKeeper.go new file mode 100644 index 000000000..653f7ed97 --- /dev/null +++ b/x/oracle/mocks/RegistryKeeper.go @@ -0,0 +1,55 @@ +// Code generated by mockery v2.23.1. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + registrytypes "github.com/tellor-io/layer/x/registry/types" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// RegistryKeeper is an autogenerated mock type for the RegistryKeeper type +type RegistryKeeper struct { + mock.Mock +} + +// GetSpec provides a mock function with given fields: ctx, queryType +func (_m *RegistryKeeper) GetSpec(ctx types.Context, queryType string) (registrytypes.DataSpec, error) { + ret := _m.Called(ctx, queryType) + + var r0 registrytypes.DataSpec + var r1 error + if rf, ok := ret.Get(0).(func(types.Context, string) (registrytypes.DataSpec, error)); ok { + return rf(ctx, queryType) + } + if rf, ok := ret.Get(0).(func(types.Context, string) registrytypes.DataSpec); ok { + r0 = rf(ctx, queryType) + } else { + r0 = ret.Get(0).(registrytypes.DataSpec) + } + + if rf, ok := ret.Get(1).(func(types.Context, string) error); ok { + r1 = rf(ctx, queryType) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewRegistryKeeper interface { + mock.TestingT + Cleanup(func()) +} + +// NewRegistryKeeper creates a new instance of RegistryKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewRegistryKeeper(t mockConstructorTestingTNewRegistryKeeper) *RegistryKeeper { + mock := &RegistryKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/oracle/mocks/ReporterKeeper.go b/x/oracle/mocks/ReporterKeeper.go new file mode 100644 index 000000000..3bca0223e --- /dev/null +++ b/x/oracle/mocks/ReporterKeeper.go @@ -0,0 +1,73 @@ +// Code generated by mockery v2.23.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + reportertypes "github.com/tellor-io/layer/x/reporter/types" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// ReporterKeeper is an autogenerated mock type for the ReporterKeeper type +type ReporterKeeper struct { + mock.Mock +} + +// AllocateTokensToReporter provides a mock function with given fields: ctx, reporterAddr, tokens +func (_m *ReporterKeeper) AllocateTokensToReporter(ctx context.Context, reporterAddr types.ValAddress, tokens types.DecCoins) error { + ret := _m.Called(ctx, reporterAddr, tokens) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress, types.DecCoins) error); ok { + r0 = rf(ctx, reporterAddr, tokens) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Reporter provides a mock function with given fields: ctx, repAddress +func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddress types.AccAddress) (*reportertypes.OracleReporter, error) { + ret := _m.Called(ctx, repAddress) + + var r0 *reportertypes.OracleReporter + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) (*reportertypes.OracleReporter, error)); ok { + return rf(ctx, repAddress) + } + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) *reportertypes.OracleReporter); ok { + r0 = rf(ctx, repAddress) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reportertypes.OracleReporter) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress) error); ok { + r1 = rf(ctx, repAddress) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewReporterKeeper interface { + mock.TestingT + Cleanup(func()) +} + +// NewReporterKeeper creates a new instance of ReporterKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewReporterKeeper(t mockConstructorTestingTNewReporterKeeper) *ReporterKeeper { + mock := &ReporterKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} From c8fd3b5030167a54200cf5b063b4111d28669e54 Mon Sep 17 00:00:00 2001 From: akrem Date: Fri, 23 Feb 2024 17:31:34 -0500 Subject: [PATCH 03/31] add reporter module/ fix x/oracle tests --- api/layer/oracle/aggregate.pulsar.go | 22 +- api/layer/oracle/params.pulsar.go | 118 ++++++- app/app.go | 6 +- proto/layer/oracle/aggregate.proto | 20 +- proto/layer/oracle/params.proto | 9 +- testutil/keeper/oracle.go | 44 +-- testutil/sample/sample.go | 6 +- x/oracle/genesis.go | 6 +- x/oracle/genesis_test.go | 2 +- x/oracle/keeper/aggregate.go | 44 ++- x/oracle/keeper/cycle_list.go | 27 +- x/oracle/keeper/keeper.go | 41 +-- x/oracle/keeper/keeper_test.go | 102 +----- x/oracle/keeper/msg_server_commit_report.go | 38 +- .../keeper/msg_server_commit_report_test.go | 328 +++++++++++------- x/oracle/keeper/msg_server_submit_value.go | 23 +- .../keeper/msg_server_submit_value_test.go | 302 +++++++++------- x/oracle/keeper/params.go | 20 +- x/oracle/keeper/params_test.go | 6 +- x/oracle/keeper/query.go | 10 +- .../keeper/query_current_cyclelist_query.go | 9 +- x/oracle/keeper/query_get_reports.go | 6 +- x/oracle/keeper/query_get_reports_test.go | 39 ++- x/oracle/keeper/query_params.go | 8 +- x/oracle/keeper/query_params_test.go | 13 +- x/oracle/keeper/submit_value.go | 44 --- x/oracle/keeper/time_based_rewards.go | 23 +- x/oracle/keeper/weighted_median_test.go | 90 ++--- x/oracle/keeper/weighted_mode_test.go | 56 ++- x/oracle/module.go | 25 +- x/oracle/types/aggregate.pb.go | 60 ++-- x/oracle/types/errors.go | 3 + x/oracle/types/expected_keepers.go | 28 +- x/oracle/types/message_commit_report.go | 14 + x/oracle/types/message_submit_value.go | 17 + x/oracle/types/params.go | 65 +++- x/oracle/types/params.pb.go | 79 ++++- 37 files changed, 972 insertions(+), 781 deletions(-) diff --git a/api/layer/oracle/aggregate.pulsar.go b/api/layer/oracle/aggregate.pulsar.go index 6e9ce208f..e8e69cb80 100644 --- a/api/layer/oracle/aggregate.pulsar.go +++ b/api/layer/oracle/aggregate.pulsar.go @@ -201,8 +201,8 @@ func (x *fastReflection_Aggregate) Range(f func(protoreflect.FieldDescriptor, pr return } } - if x.Nonce != int64(0) { - value := protoreflect.ValueOfInt64(x.Nonce) + if x.Nonce != uint64(0) { + value := protoreflect.ValueOfUint64(x.Nonce) if !f(fd_Aggregate_nonce, value) { return } @@ -243,7 +243,7 @@ func (x *fastReflection_Aggregate) Has(fd protoreflect.FieldDescriptor) bool { case "layer.oracle.Aggregate.flagged": return x.Flagged != false case "layer.oracle.Aggregate.nonce": - return x.Nonce != int64(0) + return x.Nonce != uint64(0) case "layer.oracle.Aggregate.aggregateReportIndex": return x.AggregateReportIndex != int64(0) default: @@ -277,7 +277,7 @@ func (x *fastReflection_Aggregate) Clear(fd protoreflect.FieldDescriptor) { case "layer.oracle.Aggregate.flagged": x.Flagged = false case "layer.oracle.Aggregate.nonce": - x.Nonce = int64(0) + x.Nonce = uint64(0) case "layer.oracle.Aggregate.aggregateReportIndex": x.AggregateReportIndex = int64(0) default: @@ -322,7 +322,7 @@ func (x *fastReflection_Aggregate) Get(descriptor protoreflect.FieldDescriptor) return protoreflect.ValueOfBool(value) case "layer.oracle.Aggregate.nonce": value := x.Nonce - return protoreflect.ValueOfInt64(value) + return protoreflect.ValueOfUint64(value) case "layer.oracle.Aggregate.aggregateReportIndex": value := x.AggregateReportIndex return protoreflect.ValueOfInt64(value) @@ -363,7 +363,7 @@ func (x *fastReflection_Aggregate) Set(fd protoreflect.FieldDescriptor, value pr case "layer.oracle.Aggregate.flagged": x.Flagged = value.Bool() case "layer.oracle.Aggregate.nonce": - x.Nonce = value.Int() + x.Nonce = value.Uint() case "layer.oracle.Aggregate.aggregateReportIndex": x.AggregateReportIndex = value.Int() default: @@ -437,7 +437,7 @@ func (x *fastReflection_Aggregate) NewField(fd protoreflect.FieldDescriptor) pro case "layer.oracle.Aggregate.flagged": return protoreflect.ValueOfBool(false) case "layer.oracle.Aggregate.nonce": - return protoreflect.ValueOfInt64(int64(0)) + return protoreflect.ValueOfUint64(uint64(0)) case "layer.oracle.Aggregate.aggregateReportIndex": return protoreflect.ValueOfInt64(int64(0)) default: @@ -882,7 +882,7 @@ func (x *fastReflection_Aggregate) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.Nonce |= int64(b&0x7F) << shift + x.Nonce |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1460,7 +1460,7 @@ type Aggregate struct { StandardDeviation float64 `protobuf:"fixed64,5,opt,name=standardDeviation,proto3" json:"standardDeviation,omitempty"` Reporters []*AggregateReporter `protobuf:"bytes,6,rep,name=reporters,proto3" json:"reporters,omitempty"` Flagged bool `protobuf:"varint,7,opt,name=flagged,proto3" json:"flagged,omitempty"` - Nonce int64 `protobuf:"varint,8,opt,name=nonce,proto3" json:"nonce,omitempty"` + Nonce uint64 `protobuf:"varint,8,opt,name=nonce,proto3" json:"nonce,omitempty"` AggregateReportIndex int64 `protobuf:"varint,9,opt,name=aggregateReportIndex,proto3" json:"aggregateReportIndex,omitempty"` } @@ -1533,7 +1533,7 @@ func (x *Aggregate) GetFlagged() bool { return false } -func (x *Aggregate) GetNonce() int64 { +func (x *Aggregate) GetNonce() uint64 { if x != nil { return x.Nonce } @@ -1613,7 +1613,7 @@ var file_layer_oracle_aggregate_proto_rawDesc = []byte{ 0x52, 0x09, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x6c, 0x61, 0x67, 0x67, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x66, 0x6c, 0x61, 0x67, 0x67, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x14, 0x61, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x14, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, diff --git a/api/layer/oracle/params.pulsar.go b/api/layer/oracle/params.pulsar.go index 568410d49..ab081996a 100644 --- a/api/layer/oracle/params.pulsar.go +++ b/api/layer/oracle/params.pulsar.go @@ -3,6 +3,7 @@ package oracle import ( 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" @@ -60,14 +61,16 @@ func (x *_Params_1_list) IsValid() bool { } var ( - md_Params protoreflect.MessageDescriptor - fd_Params_cycle_list protoreflect.FieldDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_cycle_list protoreflect.FieldDescriptor + fd_Params_minStakeAmount protoreflect.FieldDescriptor ) func init() { file_layer_oracle_params_proto_init() md_Params = File_layer_oracle_params_proto.Messages().ByName("Params") fd_Params_cycle_list = md_Params.Fields().ByName("cycle_list") + fd_Params_minStakeAmount = md_Params.Fields().ByName("minStakeAmount") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -141,6 +144,12 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.MinStakeAmount != "" { + value := protoreflect.ValueOfString(x.MinStakeAmount) + if !f(fd_Params_minStakeAmount, value) { + return + } + } } // Has reports whether a field is populated. @@ -158,6 +167,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "layer.oracle.Params.cycle_list": return len(x.CycleList) != 0 + case "layer.oracle.Params.minStakeAmount": + return x.MinStakeAmount != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Params")) @@ -176,6 +187,8 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "layer.oracle.Params.cycle_list": x.CycleList = nil + case "layer.oracle.Params.minStakeAmount": + x.MinStakeAmount = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Params")) @@ -198,6 +211,9 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro } listValue := &_Params_1_list{list: &x.CycleList} return protoreflect.ValueOfList(listValue) + case "layer.oracle.Params.minStakeAmount": + value := x.MinStakeAmount + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Params")) @@ -222,6 +238,8 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto lv := value.List() clv := lv.(*_Params_1_list) x.CycleList = *clv.list + case "layer.oracle.Params.minStakeAmount": + x.MinStakeAmount = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Params")) @@ -248,6 +266,8 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore } value := &_Params_1_list{list: &x.CycleList} return protoreflect.ValueOfList(value) + case "layer.oracle.Params.minStakeAmount": + panic(fmt.Errorf("field minStakeAmount of message layer.oracle.Params is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Params")) @@ -264,6 +284,8 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor case "layer.oracle.Params.cycle_list": list := []string{} return protoreflect.ValueOfList(&_Params_1_list{list: &list}) + case "layer.oracle.Params.minStakeAmount": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Params")) @@ -339,6 +361,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } } + l = len(x.MinStakeAmount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -368,6 +394,13 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.MinStakeAmount) > 0 { + i -= len(x.MinStakeAmount) + copy(dAtA[i:], x.MinStakeAmount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinStakeAmount))) + i-- + dAtA[i] = 0x12 + } if len(x.CycleList) > 0 { for iNdEx := len(x.CycleList) - 1; iNdEx >= 0; iNdEx-- { i -= len(x.CycleList[iNdEx]) @@ -458,6 +491,38 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } x.CycleList = append(x.CycleList, 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 MinStakeAmount", 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.MinStakeAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -512,7 +577,8 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CycleList []string `protobuf:"bytes,1,rep,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` + CycleList []string `protobuf:"bytes,1,rep,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` + MinStakeAmount string `protobuf:"bytes,2,opt,name=minStakeAmount,proto3" json:"minStakeAmount,omitempty"` } func (x *Params) Reset() { @@ -542,26 +608,42 @@ func (x *Params) GetCycleList() []string { return nil } +func (x *Params) GetMinStakeAmount() string { + if x != nil { + return x.MinStakeAmount + } + return "" +} + var File_layer_oracle_params_proto protoreflect.FileDescriptor var file_layer_oracle_params_proto_rawDesc = []byte{ 0x0a, 0x19, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x33, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x0a, 0x63, 0x79, 0x63, - 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x3a, 0x04, - 0x98, 0xa0, 0x1f, 0x00, 0x42, 0x8f, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x5f, 0x6c, + 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6e, 0x0a, 0x0e, 0x6d, 0x69, + 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, + 0x74, 0xf2, 0xde, 0x1f, 0x17, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd2, 0xb4, 0x2d, 0x0a, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x53, + 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, + 0x42, 0x8f, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/app/app.go b/app/app.go index a5a4545e4..cfef967db 100644 --- a/app/app.go +++ b/app/app.go @@ -552,13 +552,11 @@ func New( app.OracleKeeper = oraclemodulekeeper.NewKeeper( appCodec, - keys[oraclemoduletypes.StoreKey], - keys[oraclemoduletypes.MemStoreKey], + runtime.NewKVStoreService(keys[oraclemoduletypes.StoreKey]), app.AccountKeeper, app.BankKeeper, - app.DistrKeeper, - app.StakingKeeper, app.RegistryKeeper, + app.ReporterKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) oracleModule := oraclemodule.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper) diff --git a/proto/layer/oracle/aggregate.proto b/proto/layer/oracle/aggregate.proto index 5a24132c8..85b292beb 100644 --- a/proto/layer/oracle/aggregate.proto +++ b/proto/layer/oracle/aggregate.proto @@ -8,18 +8,20 @@ import "layer/oracle/aggregate_reporter.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; message Aggregate { - - string queryId = 1; - string aggregateValue = 2; - string aggregateReporter = 3; - int64 reporterPower = 4; + string queryId = 1; + string aggregateValue = 2; + string aggregateReporter = 3; + int64 reporterPower = 4; double standardDeviation = 5; - repeated AggregateReporter reporters = 6; + repeated AggregateReporter reporters = 6; bool flagged = 7; - int64 nonce = 8; + uint64 nonce = 8; int64 aggregateReportIndex = 9; } message AvailableTimestamps { - repeated google.protobuf.Timestamp timestamps = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} \ No newline at end of file + repeated google.protobuf.Timestamp timestamps = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; +} diff --git a/proto/layer/oracle/params.proto b/proto/layer/oracle/params.proto index a1c956c39..e25f3447a 100644 --- a/proto/layer/oracle/params.proto +++ b/proto/layer/oracle/params.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package layer.oracle; +import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; @@ -9,5 +10,11 @@ option go_package = "github.com/tellor-io/layer/x/oracle/types"; message Params { option (gogoproto.goproto_stringer) = false; repeated string cycle_list = 1 [(gogoproto.nullable) = false]; - + + string minStakeAmount = 2 [ + (gogoproto.moretags) = "yaml:\"min_stake_amount\"", + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } diff --git a/testutil/keeper/oracle.go b/testutil/keeper/oracle.go index 22ca50905..e05709d21 100644 --- a/testutil/keeper/oracle.go +++ b/testutil/keeper/oracle.go @@ -3,7 +3,6 @@ package keeper import ( "testing" - "github.com/tellor-io/layer/app/config" "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/types" @@ -22,56 +21,39 @@ import ( "github.com/stretchr/testify/require" "github.com/tellor-io/layer/x/oracle/mocks" - rkeeper "github.com/tellor-io/layer/x/registry/keeper" - r "github.com/tellor-io/layer/x/registry/module" - registrytypes "github.com/tellor-io/layer/x/registry/types" ) -func OracleKeeper(t testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks.AccountKeeper, sdk.Context) { - config.SetupConfig() +func OracleKeeper(t testing.TB) (keeper.Keeper, *mocks.ReporterKeeper, *mocks.RegistryKeeper, *mocks.AccountKeeper, *mocks.BankKeeper, sdk.Context) { storeKey := storetypes.NewKVStoreKey(types.StoreKey) - rStoreKey := storetypes.NewKVStoreKey(registrytypes.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) db := tmdb.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), storemetrics.NewNoOpMetrics()) stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(rStoreKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - sk := new(mocks.StakingKeeper) - ak := new(mocks.AccountKeeper) - - rk := rkeeper.NewKeeper( - cdc, - runtime.NewKVStoreService(rStoreKey), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + accountKeeper := new(mocks.AccountKeeper) + bankKeeper := new(mocks.BankKeeper) + registryKeeper := new(mocks.RegistryKeeper) + reporterKeeper := new(mocks.ReporterKeeper) k := keeper.NewKeeper( cdc, - storeKey, - memStoreKey, - ak, - nil, - nil, - sk, - rk, + runtime.NewKVStoreService(storeKey), + accountKeeper, + bankKeeper, + registryKeeper, + reporterKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - genesisState := registrytypes.GenesisState{ - Params: registrytypes.DefaultParams(), - Dataspec: registrytypes.GenesisDataSpec(), - } - r.InitGenesis(ctx, rk, genesisState) + // Initialize params k.SetParams(ctx, types.DefaultParams()) - return k, sk, ak, ctx + return k, reporterKeeper, registryKeeper, accountKeeper, bankKeeper, ctx } diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 98f2153ed..247dc6f67 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -7,7 +7,11 @@ import ( // AccAddress returns a sample account address func AccAddress() string { + return AccAddressBytes().String() +} + +func AccAddressBytes() sdk.AccAddress { pk := ed25519.GenPrivKey().PubKey() addr := pk.Address() - return sdk.AccAddress(addr).String() + return sdk.AccAddress(addr) } diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index f12cfdc14..add8fcfee 100644 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -15,7 +15,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the module's exported genesis func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) + params, err := k.GetParams(ctx) + if err != nil { + panic(err) + } + genesis.Params = params // this line is used by starport scaffolding # genesis/module/export diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 81f32c034..d560490a9 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -17,7 +17,7 @@ func TestGenesis(t *testing.T) { // this line is used by starport scaffolding # genesis/test/state } - k, _, _, ctx := keepertest.OracleKeeper(t) + k, _, _, _, _, ctx := keepertest.OracleKeeper(t) oracle.InitGenesis(ctx, k, genesisState) got := oracle.ExportGenesis(ctx, k) require.NotNil(t, got) diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 7c6b4cd08..1fb9dccdd 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -3,6 +3,7 @@ package keeper import ( "context" "encoding/hex" + "errors" "fmt" "time" @@ -21,7 +22,7 @@ import ( // TODO: Add support for other aggregation methods. // Rewards are allocated to the reporters based on the query tip amount, and time-based rewards are also // allocated to the reporters. -func (k Keeper) SetAggregatedReport(ctx sdk.Context) error { +func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { // Get the current block height of the blockchain. currentHeight := ctx.BlockHeight() @@ -63,7 +64,10 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) error { tip := k.GetQueryTip(ctx, []byte(queryIdStr)) // Allocate rewards if there is a tip. if !tip.Amount.IsZero() { - k.AllocateRewards(ctx, report.Reporters, tip) + err = k.AllocateRewards(ctx, report.Reporters, tip) + if err != nil { + return err + } } // Add reporters to the tbr payment list. reportersToPay = append(reportersToPay, report.Reporters...) @@ -77,7 +81,10 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) error { tip := k.GetQueryTip(ctx, []byte(queryIdStr)) // Allocate rewards if there is a tip. if !tip.Amount.IsZero() { - k.AllocateRewards(ctx, report.Reporters, tip) + err = k.AllocateRewards(ctx, report.Reporters, tip) + if err != nil { + return err + } } // Add reporters to the tbr payment list. reportersToPay = append(reportersToPay, report.Reporters...) @@ -87,32 +94,29 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) error { // Process time-based rewards for reporters. tbr := k.getTimeBasedRewards(ctx) // Allocate time-based rewards to all eligible reporters. - k.AllocateRewards(ctx, reportersToPay, tbr) - return nil + return k.AllocateRewards(ctx, reportersToPay, tbr) } -func (k Keeper) SetAggregate(ctx sdk.Context, report *types.Aggregate) { +func (k Keeper) SetAggregate(ctx sdk.Context, report *types.Aggregate) error { report.QueryId = regtypes.Remove0xPrefix(report.QueryId) queryId, err := utils.QueryIDFromString(report.QueryId) if err != nil { - panic(err) + return err + } + nonce, err := k.Nonces.Get(ctx, queryId) + if err != nil && !errors.Is(err, collections.ErrNotFound) { + return err } - nonce, _ := k.Nonces.Get(ctx, queryId) nonce++ err = k.Nonces.Set(ctx, queryId, nonce) if err != nil { - panic(err) + return err } - report.Nonce = nonce // TODO: do we want to use int64 for nonce? + report.Nonce = nonce // TODO: do we want to use int64 for nonce? ***Done switch to uint64*** currentTimestamp := ctx.BlockTime().Unix() - // TODO: handle error - err = k.Aggregates.Set(ctx, collections.Join(queryId, currentTimestamp), *report) - if err != nil { - panic(err) - } - + return k.Aggregates.Set(ctx, collections.Join(queryId, currentTimestamp), *report) } // getDataBefore returns the last aggregate before or at the given timestamp for the given query id. @@ -122,11 +126,15 @@ func (k Keeper) getDataBefore(ctx sdk.Context, queryId []byte, timestamp time.Ti var mostRecent *types.Aggregate // This should get us the most recent aggregate, as they are walked in descending order err := k.Aggregates.Walk(ctx, rng, func(key collections.Pair[[]byte, int64], value types.Aggregate) (stop bool, err error) { - mostRecent = &value - return true, nil + if !value.Flagged { + mostRecent = &value + return true, nil + } + return false, nil }) if err != nil { + // why panic here? should we return an error instead? panic(err) } diff --git a/x/oracle/keeper/cycle_list.go b/x/oracle/keeper/cycle_list.go index 9079f6504..f1f10ed74 100644 --- a/x/oracle/keeper/cycle_list.go +++ b/x/oracle/keeper/cycle_list.go @@ -7,14 +7,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) GetCycleList(ctx sdk.Context) []string { - return k.GetParams(ctx).CycleList -} - // rotation what query is next func (k Keeper) RotateQueries(ctx sdk.Context) error { - queries := k.GetCycleList(ctx) - + params, err := k.Params.Get(ctx) + if err != nil { + return err + } currentIndex, err := k.CycleIndex.Get(ctx) if err != nil { if errors.Is(err, collections.ErrNotFound) { @@ -26,10 +24,10 @@ func (k Keeper) RotateQueries(ctx sdk.Context) error { } return err } - if currentIndex >= int64(len(queries)) { + if currentIndex >= int64(len(params.CycleList)) { currentIndex = 0 } - i := (currentIndex + 1) % int64(len(queries)) + i := (currentIndex + 1) % int64(len(params.CycleList)) err = k.CycleIndex.Set(ctx, i) if err != nil { return err @@ -37,11 +35,14 @@ func (k Keeper) RotateQueries(ctx sdk.Context) error { return nil } -func (k Keeper) GetCurrentQueryInCycleList(ctx sdk.Context) string { - queries := k.GetCycleList(ctx) +func (k Keeper) GetCurrentQueryInCycleList(ctx sdk.Context) (string, error) { currentIndex, err := k.CycleIndex.Get(ctx) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - panic(err) + if err != nil { + return "", err + } + params, err := k.Params.Get(ctx) + if err != nil { + return "", err } - return queries[currentIndex] + return params.CycleList[currentIndex], nil } diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 9b20f7611..110bee7e1 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -4,11 +4,10 @@ import ( "fmt" "cosmossdk.io/collections" + "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/crypto" "github.com/tellor-io/layer/x/oracle/types" @@ -17,13 +16,12 @@ import ( type ( Keeper struct { cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey + storeService store.KVStoreService + Params collections.Item[types.Params] accountKeeper types.AccountKeeper bankKeeper types.BankKeeper - distrKeeper types.DistrKeeper - stakingKeeper types.StakingKeeper registryKeeper types.RegistryKeeper + reporterKeeper types.ReporterKeeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. Schema collections.Schema @@ -31,7 +29,7 @@ type ( Tips *collections.IndexedMap[collections.Pair[[]byte, []byte], math.Int, tipsIndex] // key: queryId, tipper TotalTips collections.Item[math.Int] // keep track of the total tips Aggregates collections.Map[collections.Pair[[]byte, int64], types.Aggregate] // key: queryId, timestamp - Nonces collections.Map[[]byte, int64] // key: queryId + Nonces collections.Map[[]byte, uint64] // key: queryId Reports *collections.IndexedMap[collections.Triple[[]byte, []byte, int64], types.MicroReport, reportsIndex] // key: queryId, reporter, blockHeight CycleIndex collections.Item[int64] // keep track of the current cycle @@ -41,41 +39,30 @@ type ( func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, + storeService store.KVStoreService, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, - distrKeeper types.DistrKeeper, - stakingKeeper types.StakingKeeper, registryKeeper types.RegistryKeeper, + reporterKeeper types.ReporterKeeper, authority string, ) Keeper { if _, err := sdk.AccAddressFromBech32(authority); err != nil { panic(fmt.Sprintf("invalid authority address: %s", authority)) } - if storeKey == nil { - panic("storeKey cannot be nil") - } - - if memKey == nil { - panic("memKey cannot be nil") - } - - storeService := runtime.NewKVStoreService(storeKey.(*storetypes.KVStoreKey)) sb := collections.NewSchemaBuilder(storeService) k := Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, + cdc: cdc, + storeService: storeService, + Params: collections.NewItem(sb, types.ParamsKeyPrefix(), "params", codec.CollValue[types.Params](cdc)), accountKeeper: accountKeeper, bankKeeper: bankKeeper, - distrKeeper: distrKeeper, - stakingKeeper: stakingKeeper, registryKeeper: registryKeeper, - authority: authority, + reporterKeeper: reporterKeeper, + + authority: authority, Commits: collections.NewMap(sb, types.CommitsPrefix, "commits", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), codec.CollValue[types.CommitReport](cdc)), Tips: collections.NewIndexedMap(sb, @@ -87,7 +74,7 @@ func NewKeeper( ), TotalTips: collections.NewItem(sb, types.TotalTipsPrefix, "total_tips", sdk.IntValue), Aggregates: collections.NewMap(sb, types.AggregatesPrefix, "aggregates", collections.PairKeyCodec(collections.BytesKey, collections.Int64Key), codec.CollValue[types.Aggregate](cdc)), - Nonces: collections.NewMap(sb, types.NoncesPrefix, "nonces", collections.BytesKey, collections.Int64Value), + Nonces: collections.NewMap(sb, types.NoncesPrefix, "nonces", collections.BytesKey, collections.Uint64Value), Reports: collections.NewIndexedMap(sb, types.ReportsPrefix, "reports", diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index 1812c25aa..7be724ed7 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -3,38 +3,15 @@ package keeper_test import ( "testing" - "cosmossdk.io/log" - "cosmossdk.io/math" - "cosmossdk.io/store" - storemetrics "cosmossdk.io/store/metrics" - storetypes "cosmossdk.io/store/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmdb "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "github.com/tellor-io/layer/app/config" "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/mocks" "github.com/tellor-io/layer/x/oracle/types" - registryk "github.com/tellor-io/layer/x/registry/keeper" - r "github.com/tellor-io/layer/x/registry/module" - registrytypes "github.com/tellor-io/layer/x/registry/types" -) -var ( - PrivKey cryptotypes.PrivKey - PubKey cryptotypes.PubKey - Addr sdk.AccAddress + keepertest "github.com/tellor-io/layer/testutil/keeper" ) type KeeperTestSuite struct { @@ -42,82 +19,31 @@ type KeeperTestSuite struct { ctx sdk.Context oracleKeeper keeper.Keeper - registryKeeper registryk.Keeper bankKeeper *mocks.BankKeeper - stakingKeeper *mocks.StakingKeeper accountKeeper *mocks.AccountKeeper - distrKeeper *mocks.DistrKeeper - queryClient types.QueryClient - msgServer types.MsgServer + registryKeeper *mocks.RegistryKeeper + reporterKeeper *mocks.ReporterKeeper + + queryClient types.QueryServer + msgServer types.MsgServer } func (s *KeeperTestSuite) SetupTest() { - require := s.Require() - config.SetupConfig() - storeKey := storetypes.NewKVStoreKey(types.StoreKey) - rStoreKey := storetypes.NewKVStoreKey(registrytypes.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - // sdk.DefaultBondDenom = "loya" - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), storemetrics.NewNoOpMetrics()) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(rStoreKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - s.stakingKeeper = new(mocks.StakingKeeper) - s.accountKeeper = new(mocks.AccountKeeper) - s.distrKeeper = new(mocks.DistrKeeper) - - s.bankKeeper = new(mocks.BankKeeper) - s.registryKeeper = registryk.NewKeeper( - cdc, - runtime.NewKVStoreService(rStoreKey), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + config.SetupConfig() - s.oracleKeeper = keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, + s.oracleKeeper, + s.reporterKeeper, + s.registryKeeper, s.accountKeeper, s.bankKeeper, - s.distrKeeper, - s.stakingKeeper, - s.registryKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + s.ctx = keepertest.OracleKeeper(s.T()) - s.ctx = sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - genesisState := registrytypes.GenesisState{ - Params: registrytypes.DefaultParams(), - Dataspec: registrytypes.GenesisDataSpec(), - } - r.InitGenesis(s.ctx, s.registryKeeper, genesisState) - // Initialize params - s.oracleKeeper.SetParams(s.ctx, types.DefaultParams()) s.msgServer = keeper.NewMsgServerImpl(s.oracleKeeper) - s.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - KeyTestPubAddr() - val, _ := stakingtypes.NewValidator(Addr.String(), PubKey, stakingtypes.Description{Moniker: "test"}) - val.Jailed = false - val.Status = stakingtypes.Bonded - val.Tokens = math.NewInt(1000000000000000000) - s.stakingKeeper.On("Validator", mock.Anything, mock.Anything).Return(val, nil) - account := authtypes.NewBaseAccount(Addr, PubKey, 0, 0) - s.accountKeeper.On("GetAccount", mock.Anything, mock.Anything).Return(account, nil) - s.bankKeeper.On("BurnCoins", mock.Anything, mock.Anything, mock.Anything).Return(nil) -} + s.queryClient = keeper.NewQuerier(s.oracleKeeper) -func KeyTestPubAddr() { - PrivKey = secp256k1.GenPrivKey() - PubKey = PrivKey.PubKey() - Addr = sdk.AccAddress(PubKey.Address()) + // Initialize params + s.oracleKeeper.SetParams(s.ctx, types.DefaultParams()) } func TestKeeperTestSuite(t *testing.T) { diff --git a/x/oracle/keeper/msg_server_commit_report.go b/x/oracle/keeper/msg_server_commit_report.go index 9e3f32b2c..7f98578e6 100644 --- a/x/oracle/keeper/msg_server_commit_report.go +++ b/x/oracle/keeper/msg_server_commit_report.go @@ -5,6 +5,7 @@ import ( "fmt" "cosmossdk.io/collections" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" @@ -14,30 +15,45 @@ import ( func (k msgServer) CommitReport(goCtx context.Context, msg *types.MsgCommitReport) (*types.MsgCommitReportResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + + reporterAddr, err := msg.GetSignerAndValidateMsg() + if err != nil { + return nil, err + } + queryId, err := utils.QueryIDFromDataString(msg.QueryData) if err != nil { return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid query data: %s", err)) } - currentCycleQuery := k.GetCurrentQueryInCycleList(ctx) + currentCycleQuery, err := k.GetCurrentQueryInCycleList(ctx) + if err != nil { + return nil, err + } tip := k.GetQueryTip(ctx, queryId) + if currentCycleQuery != msg.QueryData && tip.Amount.IsZero() { - return nil, status.Error(codes.Unavailable, "query data does not have tips/not in cycle") + return nil, status.Error(codes.Unavailable, "query does not have tips and is not in cycle") } - reporter := sdk.MustAccAddressFromBech32(msg.Creator) - - // get delegation info - validator, err := k.stakingKeeper.Validator(ctx, sdk.ValAddress(reporter)) + reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) if err != nil { return nil, err } - if validator.IsJailed() { - return nil, status.Error(codes.Unavailable, "validator is jailed") + + if reporter.Jailed { + return nil, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", reporterAddr) + } + + params, err := k.Params.Get(ctx) + if err != nil { + return nil, err } - if !validator.IsBonded() { - return nil, status.Error(codes.Unavailable, "validator is not bonded") + + if reporter.TotalTokens.LT(params.MinStakeAmount) { + return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required %s", reporter.TotalTokens, params.MinStakeAmount) } + report := types.CommitReport{ Report: &types.Commit{ Creator: msg.Creator, @@ -46,7 +62,7 @@ func (k msgServer) CommitReport(goCtx context.Context, msg *types.MsgCommitRepor }, Block: ctx.BlockHeight(), } - err = k.Commits.Set(ctx, collections.Join(reporter.Bytes(), queryId), report) + err = k.Commits.Set(ctx, collections.Join(reporterAddr.Bytes(), queryId), report) if err != nil { return nil, err } diff --git a/x/oracle/keeper/msg_server_commit_report_test.go b/x/oracle/keeper/msg_server_commit_report_test.go index ecd602650..48f58c1f2 100644 --- a/x/oracle/keeper/msg_server_commit_report_test.go +++ b/x/oracle/keeper/msg_server_commit_report_test.go @@ -2,90 +2,133 @@ package keeper_test import ( "encoding/hex" - "fmt" "cosmossdk.io/collections" "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/mock" + + "github.com/tellor-io/layer/testutil/sample" + "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/types" - utils "github.com/tellor-io/layer/x/oracle/utils" + "github.com/tellor-io/layer/x/oracle/utils" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -func (s *KeeperTestSuite) TestCommitValue() string { - require := s.Require() - - queryData := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) +func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, string) { + // get the current query in cycle list + queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) + // value 100000000000000000000 in hex value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport - // Commit report transaction salt, err := utils.Salt(32) - require.Nil(err) + s.Nil(err) hash := utils.CalculateCommitment(value, salt) - require.Nil(err) - commitreq.Creator = Addr.String() - commitreq.QueryData = queryData - commitreq.Hash = hash + + addr := sample.AccAddressBytes() + + stakedReporter := reportertypes.NewOracleReporter( + addr.String(), + math.NewInt(1_000_000), + nil, + ) + + _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + + var commitreq = types.MsgCommitReport{ + Creator: addr.String(), + QueryData: queryData, + Hash: hash, + } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) s.NoError(err) - _hexxy, _ := hex.DecodeString(queryData) - commitValue, err := s.oracleKeeper.Commits.Get(s.ctx, collections.Join(Addr.Bytes(), keeper.HashQueryData(_hexxy))) + + _hexxy, err := hex.DecodeString(queryData) + s.Nil(err) + + commitValue, err := s.oracleKeeper.Commits.Get(s.ctx, collections.Join(addr.Bytes(), keeper.HashQueryData(_hexxy))) s.NoError(err) - require.Equal(true, s.oracleKeeper.VerifyCommit(s.ctx, Addr.String(), value, salt, hash)) - require.Equal(commitValue.Report.Creator, Addr.String()) - return salt + s.Equal(true, s.oracleKeeper.VerifyCommit(s.ctx, addr.String(), value, salt, hash)) + s.Equal(commitValue.Report.Creator, addr.String()) + return stakedReporter, salt } func (s *KeeperTestSuite) TestCommitQueryNotInCycleList() { - require := s.Require() queryData := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005737465746800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport + // Commit report transaction - valueDecoded, err := hex.DecodeString(value) - require.Nil(err) salt, err := utils.Salt(32) - require.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - commitreq.Creator = Addr.String() - commitreq.QueryData = queryData - commitreq.Hash = hash + s.Nil(err) + hash := utils.CalculateCommitment(value, salt) + + addr := sample.AccAddressBytes() + + stakedReporter := reportertypes.NewOracleReporter( + addr.String(), + math.NewInt(1_000_000), + nil, + ) + _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + + var commitreq = types.MsgCommitReport{ + Creator: addr.String(), + QueryData: queryData, + Hash: hash, + } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - require.ErrorContains(err, "query data does not have tips/not in cycle") + s.ErrorContains(err, "query does not have tips and is not in cycle") } func (s *KeeperTestSuite) TestCommitQueryInCycleListPlusTippedQuery() { // commit query in cycle list - queryData1 := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + queryData1, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport + // Commit report transaction - valueDecoded, err := hex.DecodeString(value) - s.Nil(err) salt, err := utils.Salt(32) s.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - commitreq.Creator = Addr.String() - commitreq.QueryData = queryData1 - commitreq.Hash = hash + hash := utils.CalculateCommitment(value, salt) + + addr := sample.AccAddressBytes() + + stakedReporter := reportertypes.NewOracleReporter( + addr.String(), + math.NewInt(1_000_000), + nil, + ) + _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + + var commitreq = types.MsgCommitReport{ + Creator: addr.String(), + QueryData: queryData1, + Hash: hash, + } + _, err = s.msgServer.CommitReport(s.ctx, &commitreq) s.NoError(err) // commit for query that was tipped queryData2 := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005737465746800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" tip := sdk.NewCoin("loya", math.NewInt(1000)) + _ = s.bankKeeper.On("SendCoinsFromAccountToModule", s.ctx, addr, types.ModuleName, sdk.NewCoins(tip)).Return(nil) + // mock the 2% burn + burnAmount := tip.Amount.MulRaw(2).QuoRaw(100) + burned := sdk.NewCoin("loya", burnAmount) + _ = s.bankKeeper.On("BurnCoins", s.ctx, types.ModuleName, sdk.NewCoins(burned)).Return(nil) + msg := types.MsgTip{ - Tipper: Addr.String(), + Tipper: addr.String(), QueryData: queryData2, Amount: tip, } _, err = s.msgServer.Tip(s.ctx, &msg) s.NoError(err) - commitreq.Creator = Addr.String() + // commir for tipped query + commitreq.Creator = addr.String() commitreq.QueryData = queryData2 commitreq.Hash = hash _, err = s.msgServer.CommitReport(s.ctx, &commitreq) @@ -94,134 +137,149 @@ func (s *KeeperTestSuite) TestCommitQueryInCycleListPlusTippedQuery() { } func (s *KeeperTestSuite) TestCommitWithBadQueryData() { - require := s.Require() // try to commit bad query data queryData := "stupidQueryData" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport - valueDecoded, err := hex.DecodeString(value) - require.Nil(err) + salt, err := utils.Salt(32) - require.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - commitreq.Creator = Addr.String() - commitreq.QueryData = queryData - commitreq.Hash = hash + s.Nil(err) + hash := utils.CalculateCommitment(value, salt) + + addr := sample.AccAddressBytes() + + stakedReporter := reportertypes.NewOracleReporter( + addr.String(), + math.NewInt(1_000_000), + nil, + ) + _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + + var commitreq = types.MsgCommitReport{ + Creator: addr.String(), + QueryData: queryData, + Hash: hash, + } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - require.ErrorContains(err, "invalid query data") + s.ErrorContains(err, "invalid query data") } -func (s *KeeperTestSuite) TestCommitWithUnbondedValidator() { - require := s.Require() - - // try to commit from unbonded validator - queryData := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) +func (s *KeeperTestSuite) TestCommitWithReporterWithLowStake() { + // try to commit from unbonded reporter + queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport - valueDecoded, err := hex.DecodeString(value) - require.Nil(err) + salt, err := utils.Salt(32) - require.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - randomPrivKey := secp256k1.GenPrivKey() - randomPubKey := randomPrivKey.PubKey() - randomAddr := sdk.AccAddress(randomPubKey.Address()) - badValidator, _ := stakingtypes.NewValidator(randomAddr.String(), randomPubKey, stakingtypes.Description{Moniker: "unbonded badguy"}) - badValidator.Jailed = false - badValidator.Status = stakingtypes.Unbonded - badValidator.Tokens = math.NewInt(1000000000000000000) - require.Equal(false, badValidator.IsBonded()) - require.Equal(false, badValidator.IsJailed()) - s.stakingKeeper.ExpectedCalls = []*mock.Call{} - s.stakingKeeper.On("Validator", mock.Anything, mock.Anything).Return(badValidator, nil) - s.stakingKeeper.Validator(s.ctx, sdk.ValAddress(randomAddr)) - commitreq.Creator = randomAddr.String() - commitreq.QueryData = queryData - commitreq.Hash = hash + s.Nil(err) + hash := utils.CalculateCommitment(value, salt) + + randomAddr := sample.AccAddressBytes() + + stakedReporter := reportertypes.NewOracleReporter( + randomAddr.String(), + math.NewInt(1), // below the min stake amount + nil, + ) + _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) + + var commitreq = types.MsgCommitReport{ + Creator: randomAddr.String(), + QueryData: queryData, + Hash: hash, + } + _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - require.ErrorContains(err, "validator is not bonded") + s.ErrorContains(err, "reporter has 1, required 1000000: not enough stake") } func (s *KeeperTestSuite) TestCommitWithJailedValidator() { - require := s.Require() - - // try to commit from jailed validator - queryData := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + // try to commit from jailed reporter + queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport - valueDecoded, err := hex.DecodeString(value) - require.Nil(err) + salt, err := utils.Salt(32) - require.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - randomPrivKey := secp256k1.GenPrivKey() - randomPubKey := randomPrivKey.PubKey() - randomAddr := sdk.AccAddress(randomPubKey.Address()) - badValidator, _ := stakingtypes.NewValidator(randomAddr.String(), randomPubKey, stakingtypes.Description{Moniker: "jailed badguy"}) - badValidator.Jailed = true - badValidator.Status = stakingtypes.Bonded - badValidator.Tokens = math.NewInt(1000000000000000000) - s.stakingKeeper.ExpectedCalls = []*mock.Call{} - s.stakingKeeper.On("Validator", mock.Anything, mock.Anything).Return(badValidator, nil) - s.stakingKeeper.Validator(s.ctx, sdk.ValAddress(badValidator.OperatorAddress)) - require.Equal(true, badValidator.IsJailed()) - require.Equal(true, badValidator.IsBonded()) - commitreq.Creator = randomAddr.String() - commitreq.QueryData = queryData - commitreq.Hash = hash + s.Nil(err) + hash := utils.CalculateCommitment(value, salt) + + randomAddr := sample.AccAddressBytes() + + stakedReporter := reportertypes.NewOracleReporter( + randomAddr.String(), + math.NewInt(1_000_000), + nil, + ) + stakedReporter.Jailed = true + _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) + + s.Equal(true, stakedReporter.Jailed) + + var commitreq = types.MsgCommitReport{ + Creator: randomAddr.String(), + QueryData: queryData, + Hash: hash, + } + _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - require.ErrorContains(err, "validator is jailed") + s.ErrorContains(err, "reporter is jailed") } func (s *KeeperTestSuite) TestCommitWithMissingCreator() { - require := s.Require() - // commit with no creator - queryData := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport - valueDecoded, err := hex.DecodeString(value) - require.Nil(err) + salt, err := utils.Salt(32) - require.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - require.Nil(err) - commitreq.QueryData = queryData - commitreq.Hash = hash - require.Panics(func() { s.msgServer.CommitReport(s.ctx, &commitreq) }, "empty address string is not allowed") + s.Nil(err) + hash := utils.CalculateCommitment(value, salt) + s.Nil(err) + + var commitreq = types.MsgCommitReport{ + QueryData: queryData, + Hash: hash, + } + + _, err = s.msgServer.CommitReport(s.ctx, &commitreq) + s.ErrorContains(err, "invalid creator address") } -// Should ppl be allowed to commit with no query data and/or no hash ? func (s *KeeperTestSuite) TestCommitWithMissingQueryData() { - require := s.Require() - // commit with no query data value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - var commitreq types.MsgCommitReport - valueDecoded, err := hex.DecodeString(value) - require.Nil(err) + salt, err := utils.Salt(32) - require.Nil(err) - hash := utils.CalculateCommitment(string(valueDecoded), salt) - require.Nil(err) - commitreq.Creator = Addr.String() - commitreq.Hash = hash - _, err = s.msgServer.CommitReport(s.ctx, &commitreq) // no error - fmt.Println(err) + s.Nil(err) + hash := utils.CalculateCommitment(value, salt) + s.Nil(err) + + addr := sample.AccAddressBytes() + + var commitreq = types.MsgCommitReport{ + Creator: addr.String(), + Hash: hash, + } + + _, err = s.msgServer.CommitReport(s.ctx, &commitreq) + s.ErrorContains(err, "query data field cannot be empty") } func (s *KeeperTestSuite) TestCommitWithMissingHash() { - // commit with no hash - queryData := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) - var commitreq types.MsgCommitReport - commitreq.QueryData = queryData - commitreq.Creator = Addr.String() - _, err := s.msgServer.CommitReport(s.ctx, &commitreq) // no error - fmt.Println(err) + queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) + + addr := sample.AccAddressBytes() + + var commitreq = types.MsgCommitReport{ + Creator: addr.String(), + QueryData: queryData, + } + _, err = s.msgServer.CommitReport(s.ctx, &commitreq) // no error + s.ErrorContains(err, "hash field cannot be empty") } -// todo: check emitted events +// // todo: check emitted events diff --git a/x/oracle/keeper/msg_server_submit_value.go b/x/oracle/keeper/msg_server_submit_value.go index 5202285f4..17e7f2486 100644 --- a/x/oracle/keeper/msg_server_submit_value.go +++ b/x/oracle/keeper/msg_server_submit_value.go @@ -18,12 +18,18 @@ import ( func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) (*types.MsgSubmitValueResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - reporter := sdk.MustAccAddressFromBech32(msg.Creator) - // check if validator is bonded and active - votingPower, isBonded := k.IsReporterStaked(ctx, sdk.ValAddress(reporter)) - if !isBonded { - return nil, types.ErrValidatorNotBonded + + reporterAddr, err := msg.GetSignerAndValidateMsg() + if err != nil { + return nil, err + } + // get reporter + reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) + if err != nil { + return nil, err } + + votingPower := reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64() // check if querydata has prefix 0x msg.QueryData = regtypes.Remove0xPrefix(msg.QueryData) // decode query data hex string to bytes @@ -32,7 +38,7 @@ func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("failed to decode query data string: %v", err)) } // get commit from store - commitValue, err := k.Commits.Get(ctx, collections.Join(reporter.Bytes(), HashQueryData(qDataBytes))) + commitValue, err := k.Commits.Get(ctx, collections.Join(reporterAddr.Bytes(), HashQueryData(qDataBytes))) if err != nil { if errors.Is(err, collections.ErrNotFound) { return nil, status.Error(codes.NotFound, "no commits to reveal found") @@ -41,6 +47,9 @@ func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) } currentBlock := ctx.BlockHeight() // check if value is being revealed in the one block after commit + if currentBlock == commitValue.Block { + return nil, types.ErrCommitRevealWindowEarly + } if currentBlock-1 != commitValue.Block { return nil, types.ErrMissedCommitRevealWindow } @@ -54,7 +63,7 @@ func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) } // set value - if err := k.setValue(ctx, reporter, msg.Value, qDataBytes, votingPower, currentBlock); err != nil { + if err := k.setValue(ctx, reporterAddr, msg.Value, qDataBytes, votingPower, currentBlock); err != nil { return nil, err } // emit event diff --git a/x/oracle/keeper/msg_server_submit_value_test.go b/x/oracle/keeper/msg_server_submit_value_test.go index 7e82dfbfa..ad6fbcfe4 100644 --- a/x/oracle/keeper/msg_server_submit_value_test.go +++ b/x/oracle/keeper/msg_server_submit_value_test.go @@ -3,42 +3,49 @@ package keeper_test import ( "encoding/hex" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" - utils "github.com/tellor-io/layer/utils" + "github.com/tellor-io/layer/testutil/sample" + "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" + oracleutils "github.com/tellor-io/layer/x/oracle/utils" + registrytypes "github.com/tellor-io/layer/x/registry/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -func (s *KeeperTestSuite) TestSubmitValue() string { - require := s.Require() +func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, string) { queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" // Commit value transaction first - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - var submitres types.MsgSubmitValueResponse + stakedReporter, salt := s.TestCommitValue() // forward block by 1 and reveal value - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + // Submit value transaction with value revealed, this checks if the value is correctly hashed - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = salt + _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: queryData, + Value: value, + Salt: salt, + } res, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.Equal(&submitres, res) - require.Nil(err) + s.Equal(&types.MsgSubmitValueResponse{}, res) + s.Nil(err) queryId, err := utils.QueryIDFromDataString(queryData) - require.NoError(err) + s.NoError(err) queryIdStr := hex.EncodeToString(queryId) - report, err := s.oracleKeeper.GetReportsbyQid(s.ctx, &types.QueryGetReportsbyQidRequest{QueryId: queryIdStr}) - require.Nil(err) + report, err := s.queryClient.GetReportsbyQid(s.ctx, &types.QueryGetReportsbyQidRequest{QueryId: queryIdStr}) + s.Nil(err) + microReport := types.MicroReport{ - Reporter: Addr.String(), - Power: 1000000000000, + Reporter: stakedReporter.GetReporter(), + Power: stakedReporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), QueryType: "SpotPrice", QueryId: queryIdStr, AggregateMethod: "weighted-median", @@ -51,198 +58,233 @@ func (s *KeeperTestSuite) TestSubmitValue() string { MicroReports: []*types.MicroReport{µReport}, }, } - require.Equal(&expectedReport, report) + s.Equal(&expectedReport, report) - return queryIdStr + return stakedReporter, queryIdStr } func (s *KeeperTestSuite) TestSubmitFromWrongAddr() { - require := s.Require() // submit from different address than commit - randomPrivKey := secp256k1.GenPrivKey() - randomPubKey := randomPrivKey.PubKey() - randomAddr := sdk.AccAddress(randomPubKey.Address()) + randomAddr := sample.AccAddressBytes() + queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = randomAddr.String() - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = salt + + stakedReporter, salt := s.TestCommitValue() + stakedReporter.Reporter = randomAddr.String() + + var submitreq = types.MsgSubmitValue{ + Creator: randomAddr.String(), + QueryData: queryData, + Value: value, + Salt: salt, + } + + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + + _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.Error(err) + s.Error(err) } func (s *KeeperTestSuite) TestSubmitWithBadQueryData() { - require := s.Require() // submit value with bad query data badQueryData := "stupidQueryData" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = badQueryData - submitreq.Value = value - submitreq.Salt = salt + + stakedReporter, salt := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: badQueryData, + Value: value, + Salt: salt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + + _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "failed to decode query data string") + s.ErrorContains(err, "failed to decode query data string") } func (s *KeeperTestSuite) TestSubmitWithBadValue() { - require := s.Require() // submit wrong value but correct salt queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" badValue := "00000F4240" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = badValue - submitreq.Salt = salt + + stakedReporter, salt := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: queryData, + Value: badValue, + Salt: salt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + + _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") + s.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") } func (s *KeeperTestSuite) TestSubmitWithWrongSalt() { - require := s.Require() // submit correct value but wrong salt queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - _ = s.TestCommitValue() + + stakedReporter, _ := s.TestCommitValue() + badSalt, err := oracleutils.Salt(32) - require.Nil(err) - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = badSalt + s.Nil(err) + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: queryData, + Value: value, + Salt: badSalt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + + _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") + s.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") } func (s *KeeperTestSuite) TestSubmitAtWrongBlock() { - require := s.Require() // try to submit value in same block as commit queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = salt + + stakedReporter, salt := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: queryData, + Value: value, + Salt: salt, + } + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "missed commit reveal window") + s.ErrorContains(err, "commit reveal window is too early") // try to submit value 2 blocks after commit - height := s.ctx.BlockHeight() + 10 - s.ctx = s.ctx.WithBlockHeight(height) - salt = s.TestCommitValue() - height = s.ctx.BlockHeight() + 2 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = salt + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 2) + _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(stakedReporter.GetReporter())).Return(&stakedReporter, nil) // submitreq.Salt = salt + _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "missed commit reveal window") + s.ErrorContains(err, "missed commit reveal window") } func (s *KeeperTestSuite) TestSubmitWithNoCommit() { - require := s.Require() // try to submit value without commit queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" salt, err := oracleutils.Salt(32) - require.Nil(err) - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = salt + s.Nil(err) + + addr := sample.AccAddressBytes() + + var submitreq = types.MsgSubmitValue{ + Creator: addr.String(), + QueryData: queryData, + Value: value, + Salt: salt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + + stakedReporter := reportertypes.NewOracleReporter( + addr.String(), + math.NewInt(1_000_000), + nil, + ) + _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "no commits to reveal found") + s.ErrorContains(err, "no commits to reveal found") } func (s *KeeperTestSuite) TestSubmitWithNoCreator() { - require := s.Require() // submit value with no creator queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.QueryData = queryData - submitreq.Value = value - submitreq.Salt = salt - require.Panics(func() { s.msgServer.SubmitValue(s.ctx, &submitreq) }, "empty address string is not allowed") + + _, salt := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + QueryData: queryData, + Value: value, + Salt: salt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) + s.ErrorContains(err, "invalid creator address") } func (s *KeeperTestSuite) TestSubmitWithNoQueryData() { - require := s.Require() // submit value with no query data value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.Value = value - submitreq.Salt = salt + + stakedReporter, salt := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + Value: value, + Salt: salt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "no commits to reveal found") + s.ErrorContains(err, "query data cannot be empty") } func (s *KeeperTestSuite) TestSubmitWithNoValue() { - require := s.Require() // submit value with no value queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - salt := s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Salt = salt + + stakedReporter, salt := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: queryData, + Salt: salt, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") + s.ErrorContains(err, "value cannot be empty") } func (s *KeeperTestSuite) TestSubmitWithNoSalt() { - require := s.Require() // submit value with no salt queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - _ = s.TestCommitValue() - var submitreq types.MsgSubmitValue - height := s.ctx.BlockHeight() + 1 - s.ctx = s.ctx.WithBlockHeight(height) - submitreq.Creator = Addr.String() - submitreq.QueryData = queryData - submitreq.Value = value + + stakedReporter, _ := s.TestCommitValue() + + var submitreq = types.MsgSubmitValue{ + Creator: stakedReporter.GetReporter(), + QueryData: queryData, + Value: value, + } + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - require.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") + s.ErrorContains(err, "salt cannot be empty") } diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go index cc32fcf3c..97cc0e305 100644 --- a/x/oracle/keeper/params.go +++ b/x/oracle/keeper/params.go @@ -16,24 +16,14 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { query = regtypes.Remove0xPrefix(query) params.CycleList[i] = query } - store := ctx.KVStore(k.storeKey) - bz, err := k.cdc.Marshal(¶ms) - if err != nil { + // initially set the cycle index to 0 + if err := k.CycleIndex.Set(ctx, 0); err != nil { return err } - store.Set(types.ParamsKeyPrefix(), bz) - - return nil + return k.Params.Set(ctx, params) } // GetParams sets the x/oracle module parameters. -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ParamsKeyPrefix()) - if bz == nil { - return params - } - - k.cdc.MustUnmarshal(bz, ¶ms) - return params +func (k Keeper) GetParams(ctx sdk.Context) (types.Params, error) { + return k.Params.Get(ctx) } diff --git a/x/oracle/keeper/params_test.go b/x/oracle/keeper/params_test.go index de1f9ab8a..b03492e04 100644 --- a/x/oracle/keeper/params_test.go +++ b/x/oracle/keeper/params_test.go @@ -5,10 +5,10 @@ import ( ) func (s *KeeperTestSuite) TestGetParams() { - require := s.Require() params := types.DefaultParams() s.oracleKeeper.SetParams(s.ctx, params) - - require.EqualValues(params, s.oracleKeeper.GetParams(s.ctx)) + p, err := s.oracleKeeper.GetParams(s.ctx) + s.NoError(err) + s.EqualValues(params, p) } diff --git a/x/oracle/keeper/query.go b/x/oracle/keeper/query.go index 304959a32..ff9312909 100644 --- a/x/oracle/keeper/query.go +++ b/x/oracle/keeper/query.go @@ -4,4 +4,12 @@ import ( "github.com/tellor-io/layer/x/oracle/types" ) -var _ types.QueryServer = Keeper{} +var _ types.QueryServer = Querier{} + +type Querier struct { + Keeper +} + +func NewQuerier(keeper Keeper) Querier { + return Querier{Keeper: keeper} +} diff --git a/x/oracle/keeper/query_current_cyclelist_query.go b/x/oracle/keeper/query_current_cyclelist_query.go index f132d35ec..9668e088c 100644 --- a/x/oracle/keeper/query_current_cyclelist_query.go +++ b/x/oracle/keeper/query_current_cyclelist_query.go @@ -9,12 +9,15 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) CurrentCyclelistQuery(goCtx context.Context, req *types.QueryCurrentCyclelistQueryRequest) (*types.QueryCurrentCyclelistQueryResponse, error) { +func (k Querier) CurrentCyclelistQuery(goCtx context.Context, req *types.QueryCurrentCyclelistQueryRequest) (*types.QueryCurrentCyclelistQueryResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - - return &types.QueryCurrentCyclelistQueryResponse{Querydata: k.GetCurrentQueryInCycleList(ctx)}, nil + querydata, err := k.GetCurrentQueryInCycleList(ctx) + if err != nil { + return nil, err + } + return &types.QueryCurrentCyclelistQueryResponse{Querydata: querydata}, nil } diff --git a/x/oracle/keeper/query_get_reports.go b/x/oracle/keeper/query_get_reports.go index d9268a63a..f2467ba24 100644 --- a/x/oracle/keeper/query_get_reports.go +++ b/x/oracle/keeper/query_get_reports.go @@ -13,7 +13,7 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) GetReportsbyQid(goCtx context.Context, req *types.QueryGetReportsbyQidRequest) (*types.QueryGetReportsbyQidResponse, error) { +func (k Querier) GetReportsbyQid(goCtx context.Context, req *types.QueryGetReportsbyQidRequest) (*types.QueryGetReportsbyQidResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -34,7 +34,7 @@ func (k Keeper) GetReportsbyQid(goCtx context.Context, req *types.QueryGetReport return &types.QueryGetReportsbyQidResponse{Reports: reports}, nil } -func (k Keeper) GetReportsbyReporter(goCtx context.Context, req *types.QueryGetReportsbyReporterRequest) (*types.QueryGetReportsbyReporterResponse, error) { +func (k Querier) GetReportsbyReporter(goCtx context.Context, req *types.QueryGetReportsbyReporterRequest) (*types.QueryGetReportsbyReporterResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -55,7 +55,7 @@ func (k Keeper) GetReportsbyReporter(goCtx context.Context, req *types.QueryGetR return &types.QueryGetReportsbyReporterResponse{MicroReports: reports}, nil } -func (k Keeper) GetReportsbyReporterQid(goCtx context.Context, req *types.QueryGetReportsbyReporterQidRequest) (*types.QueryGetReportsbyQidResponse, error) { +func (k Querier) GetReportsbyReporterQid(goCtx context.Context, req *types.QueryGetReportsbyReporterQidRequest) (*types.QueryGetReportsbyQidResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/oracle/keeper/query_get_reports_test.go b/x/oracle/keeper/query_get_reports_test.go index ac8fae495..012ca2310 100644 --- a/x/oracle/keeper/query_get_reports_test.go +++ b/x/oracle/keeper/query_get_reports_test.go @@ -1,20 +1,25 @@ package keeper_test import ( + // "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestGetReportsByQueryId() { - require := s.Require() - s.TestCommitValue() - queryIdStr := s.TestSubmitValue() + + stakedReporter, queryIdStr := s.TestSubmitValue() + value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - report, err := s.oracleKeeper.GetReportsbyQid(s.ctx, &types.QueryGetReportsbyQidRequest{QueryId: queryIdStr}) - require.Nil(err) + req := &types.QueryGetReportsbyQidRequest{QueryId: queryIdStr} + + report, err := s.queryClient.GetReportsbyQid(s.ctx, req) + s.Nil(err) + MicroReport := &types.MicroReport{ - Reporter: Addr.String(), - Power: 1000000000000, + Reporter: stakedReporter.GetReporter(), + Power: stakedReporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), QueryType: "SpotPrice", QueryId: queryIdStr, AggregateMethod: "weighted-median", @@ -26,17 +31,17 @@ func (s *KeeperTestSuite) TestGetReportsByQueryId() { MicroReports: []*types.MicroReport{MicroReport}, } - require.Equal(expectedReports, report.Reports) + s.Equal(expectedReports, report.Reports) - report2, err := s.oracleKeeper.GetReportsbyReporter(s.ctx, &types.QueryGetReportsbyReporterRequest{Reporter: Addr.String()}) - require.NoError(err) - require.Equal(*expectedReports.MicroReports[0], report2.MicroReports[0]) + report2, err := s.queryClient.GetReportsbyReporter(s.ctx, &types.QueryGetReportsbyReporterRequest{Reporter: stakedReporter.GetReporter()}) + s.NoError(err) + s.Equal(*expectedReports.MicroReports[0], report2.MicroReports[0]) - report3, err := s.oracleKeeper.GetReportsbyReporterQid(s.ctx, &types.QueryGetReportsbyReporterQidRequest{Reporter: Addr.String(), QueryId: queryIdStr}) - require.NoError(err) - require.EqualValues(expectedReports.MicroReports, report3.Reports.MicroReports) + report3, err := s.queryClient.GetReportsbyReporterQid(s.ctx, &types.QueryGetReportsbyReporterQidRequest{Reporter: stakedReporter.GetReporter(), QueryId: queryIdStr}) + s.NoError(err) + s.EqualValues(expectedReports.MicroReports, report3.Reports.MicroReports) - report, err = s.oracleKeeper.GetReportsbyQid(s.ctx, &types.QueryGetReportsbyQidRequest{QueryId: queryIdStr}) - require.NoError(err) - require.Equal(expectedReports, report.Reports) + report, err = s.queryClient.GetReportsbyQid(s.ctx, &types.QueryGetReportsbyQidRequest{QueryId: queryIdStr}) + s.NoError(err) + s.Equal(expectedReports, report.Reports) } diff --git a/x/oracle/keeper/query_params.go b/x/oracle/keeper/query_params.go index 907310524..ccf4301d4 100644 --- a/x/oracle/keeper/query_params.go +++ b/x/oracle/keeper/query_params.go @@ -9,11 +9,15 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) + params, err := k.Keeper.GetParams(ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + return &types.QueryParamsResponse{Params: params}, nil } diff --git a/x/oracle/keeper/query_params_test.go b/x/oracle/keeper/query_params_test.go index 9c22471b5..9b97fbfe3 100644 --- a/x/oracle/keeper/query_params_test.go +++ b/x/oracle/keeper/query_params_test.go @@ -1,17 +1,14 @@ package keeper_test import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestParamsQuery() { - require := s.Require() - wctx := sdk.WrapSDKContext(s.ctx) - params := types.DefaultParams() - s.oracleKeeper.SetParams(s.ctx, params) + q := keeper.NewQuerier(s.oracleKeeper) - response, err := s.oracleKeeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(err) - require.Equal(&types.QueryParamsResponse{Params: params}, response) + response, err := q.Params(s.ctx, &types.QueryParamsRequest{}) + s.NoError(err) + s.Equal(&types.QueryParamsResponse{Params: types.DefaultParams()}, response) } diff --git a/x/oracle/keeper/submit_value.go b/x/oracle/keeper/submit_value.go index 30cacd941..3759db977 100644 --- a/x/oracle/keeper/submit_value.go +++ b/x/oracle/keeper/submit_value.go @@ -45,50 +45,6 @@ func (k Keeper) setValue(ctx sdk.Context, reporter sdk.AccAddress, val string, q return k.Reports.Set(ctx, collections.Join3(queryId, reporter.Bytes(), ctx.BlockHeight()), report) } -func (k Keeper) IsReporterStaked(ctx sdk.Context, reporter sdk.ValAddress) (int64, bool) { - - validator, err := k.stakingKeeper.Validator(ctx, reporter) - if err != nil { - // TODO: return errors - panic(err) - } - if validator == nil { - return 0, false - } - // check if validator is active - if validator.IsJailed() || validator.IsUnbonding() || validator.IsUnbonded() { - return 0, false - } - // get voting power - votingPower := validator.GetConsensusPower(sdk.DefaultPowerReduction) - - return votingPower, validator.IsBonded() -} - -// tODO: double check this -func (k Keeper) VerifySignature(ctx sdk.Context, reporter string, value, signature string) bool { - addr, err := sdk.AccAddressFromBech32(reporter) - if err != nil { - return false - } - reporterAccount := k.accountKeeper.GetAccount(ctx, addr) - pubKey := reporterAccount.GetPubKey() - sigBytes, err := hex.DecodeString(signature) - if err != nil { - return false - } - // decode value from hex string - valBytes, err := hex.DecodeString(value) - if err != nil { - return false - } - // verify signature - if !pubKey.VerifySignature(valBytes, sigBytes) { - return false - } - return true -} - func (k Keeper) VerifyCommit(ctx sdk.Context, reporter string, value, salt, hash string) bool { // calculate commitment calculatedCommit := utils.CalculateCommitment(value, salt) diff --git a/x/oracle/keeper/time_based_rewards.go b/x/oracle/keeper/time_based_rewards.go index b97491cc1..fe51bca50 100644 --- a/x/oracle/keeper/time_based_rewards.go +++ b/x/oracle/keeper/time_based_rewards.go @@ -2,7 +2,6 @@ package keeper import ( "cosmossdk.io/math" - cosmosmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -18,7 +17,7 @@ type ValidatorReportCount struct { // AllocateRewards distributes rewards to reporters based on their power and number of reports. // It calculates the reward amount for each reporter and allocates the rewards to the corresponding validator. // Finally, it sends the allocated rewards to the distribution module. -func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) { +func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) error { // Initialize totalPower to keep track of the total power of all reporters. totalPower := int64(0) // reportCounts maps reporter's address to their ValidatorReportCount. @@ -47,22 +46,26 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep rewards[r] = sdk.NewDecCoins(sdk.NewDecCoin(tip.Denom, amount)) } toDistr := sdk.NewCoins() - // Allocate calculated rewards to the corresponding validators. - for reporter, reward := range rewards { - validator, err := k.stakingKeeper.Validator(ctx, sdk.ValAddress(sdk.MustAccAddressFromBech32(reporter))) - // TODO: return error instead of panic + var err error + // Allocate calculated rewards to the corresponding reporters. + for rep, reward := range rewards { + repoterAddr, err := sdk.AccAddressFromBech32(rep) if err != nil { - panic(err) + return err + } + err = k.reporterKeeper.AllocateTokensToReporter(ctx, repoterAddr.Bytes(), reward) + if err != nil { + return err } - k.distrKeeper.AllocateTokensToValidator(ctx, validator, reward) coin, _ := reward.TruncateDecimal() toDistr = toDistr.Add(coin...) } // If there are rewards to distribute, send them to the distribution module. if !toDistr.IsZero() { // Once rewards are allocated, send them to the distribution module. - k.bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.TimeBasedRewards, distrtypes.ModuleName, toDistr) + err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.TimeBasedRewards, distrtypes.ModuleName, toDistr) } + return err } func (k Keeper) getTimeBasedRewards(ctx sdk.Context) sdk.Coin { @@ -74,7 +77,7 @@ func (k Keeper) getTimeBasedRewardsAccount(ctx sdk.Context) authtypes.ModuleAcco return k.accountKeeper.GetModuleAccount(ctx, minttypes.TimeBasedRewards) } -func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward cosmosmath.Int) cosmosmath.Int { +func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward math.Int) math.Int { power := math.LegacyNewDec(reporterPower * reportsCount) amount := power.Quo(math.LegacyNewDec(totalPower)).MulTruncate(math.LegacyNewDecFromBigInt(reward.BigInt())) return amount.RoundInt() diff --git a/x/oracle/keeper/weighted_median_test.go b/x/oracle/keeper/weighted_median_test.go index 92e718471..01bb9e4a0 100644 --- a/x/oracle/keeper/weighted_median_test.go +++ b/x/oracle/keeper/weighted_median_test.go @@ -1,17 +1,13 @@ package keeper_test import ( - "cosmossdk.io/math" - cosmosmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/stretchr/testify/mock" "github.com/tellor-io/layer/testutil" "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestWeightedMedian() { - require := s.Require() + qId := "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992" reporters := make([]sdk.AccAddress, 18) for i := 0; i < 18; i++ { @@ -26,30 +22,24 @@ func (s *KeeperTestSuite) TestWeightedMedian() { expectedValue := values[expectedIndex] expectedReporter := reporters[expectedIndex].String() expectedPower := powers[expectedIndex] - totalPowers := testutil.SumArray(powers) currentReporters := reporters[:5] reports := testutil.GenerateReports(currentReporters, values, powers, qId) - s.stakingKeeper.On("GetLastTotalPower", mock.Anything, mock.Anything).Return(cosmosmath.NewInt(totalPowers)) - s.distrKeeper.On("GetFeePoolCommunityCoins", mock.Anything).Return(sdk.DecCoins{sdk.NewDecCoinFromDec("loya", math.LegacyNewDec(100))}) - s.distrKeeper.On("AllocateTokensToValidator", mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.distrKeeper.On("GetFeePool", mock.Anything).Return(distrtypes.FeePool{CommunityPool: sdk.DecCoins{sdk.NewDecCoinFromDec("loya", math.LegacyNewDec(1000))}}) - s.distrKeeper.On("SetFeePool", mock.Anything, mock.Anything).Return(nil) _, err := s.oracleKeeper.WeightedMedian(s.ctx, reports) - require.NoError(err) + s.NoError(err) res, err := s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) - require.Nil(err) - require.Equal(res.Report.QueryId, qId, "query id is not correct") - require.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") - require.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") - require.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") - require.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") + s.Nil(err) + s.Equal(res.Report.QueryId, qId, "query id is not correct") + s.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") + s.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") + s.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") + s.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") // check list of reporters in the aggregate report for i, reporter := range currentReporters { - require.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") + s.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") } weightedMean := testutil.CalculateWeightedMean(valuesInt, powers) - require.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") + s.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") // // special case A -- lower weighted median and upper weighted median are equal, powers are equal // // calculates lower median @@ -58,28 +48,26 @@ func (s *KeeperTestSuite) TestWeightedMedian() { valuesInt = []int{10, 10, 20, 20} values = testutil.IntToHex(valuesInt) powers = []int64{1, 1, 1, 1} - totalPowers = testutil.SumArray(powers) expectedIndex = 1 expectedReporter = currentReporters[expectedIndex].String() expectedValue = values[expectedIndex] expectedPower = 1 reports = testutil.GenerateReports(currentReporters, values, powers, qId) - s.stakingKeeper.On("GetLastTotalPower", mock.Anything, mock.Anything).Return(cosmosmath.NewInt(totalPowers)) s.oracleKeeper.WeightedMedian(s.ctx, reports) res, err = s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) - require.Nil(err) - require.Nil(err) - require.Equal(res.Report.QueryId, qId, "query id is not correct") - require.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") - require.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") - require.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") - require.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") + s.Nil(err) + s.Nil(err) + s.Equal(res.Report.QueryId, qId, "query id is not correct") + s.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") + s.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") + s.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") + s.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") // // check list of reporters in the aggregate report for i, reporter := range currentReporters { - require.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") + s.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") } weightedMean = testutil.CalculateWeightedMean(valuesInt, powers) - require.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") + s.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") // special case B -- lower weighted median and upper weighted median are equal, powers are not all equal // calculates lower median @@ -88,28 +76,26 @@ func (s *KeeperTestSuite) TestWeightedMedian() { valuesInt = []int{10, 10, 20, 20} values = testutil.IntToHex(valuesInt) powers = []int64{1, 2, 1, 2} - totalPowers = testutil.SumArray(powers) expectedIndex = 1 expectedReporter = currentReporters[expectedIndex].String() expectedValue = values[expectedIndex] expectedPower = powers[expectedIndex] reports = testutil.GenerateReports(currentReporters, values, powers, qId) - s.stakingKeeper.On("GetLastTotalPower", mock.Anything, mock.Anything).Return(cosmosmath.NewInt(totalPowers)) s.oracleKeeper.WeightedMedian(s.ctx, reports) res, err = s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) - require.Nil(err) - require.Nil(err) - require.Equal(res.Report.QueryId, qId, "query id is not correct") - require.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") - require.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") - require.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") - require.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") + s.Nil(err) + s.Nil(err) + s.Equal(res.Report.QueryId, qId, "query id is not correct") + s.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") + s.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") + s.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") + s.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") // // check list of reporters in the aggregate report for i, reporter := range currentReporters { - require.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") + s.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") } weightedMean = testutil.CalculateWeightedMean(valuesInt, powers) - require.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") + s.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") // // 5 reporters with even weights, should be equal to normal median qId = "907154958baee4fb0ce2bbe50728141ac76eb2dc1731b3d40f0890746dd07e62" @@ -117,26 +103,24 @@ func (s *KeeperTestSuite) TestWeightedMedian() { valuesInt = []int{10, 20, 30, 40, 50} values = testutil.IntToHex(valuesInt) powers = []int64{5, 5, 5, 5, 5} - totalPowers = testutil.SumArray(powers) expectedIndex = 2 expectedReporter = currentReporters[expectedIndex].String() expectedValue = values[expectedIndex] expectedPower = powers[expectedIndex] reports = testutil.GenerateReports(currentReporters, values, powers, qId) - s.stakingKeeper.On("GetLastTotalPower", mock.Anything, mock.Anything).Return(cosmosmath.NewInt(totalPowers)) s.oracleKeeper.WeightedMedian(s.ctx, reports) res, err = s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) - require.Nil(err) - require.Nil(err) - require.Equal(res.Report.QueryId, qId, "query id is not correct") - require.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") - require.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") - require.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") - require.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") + s.Nil(err) + s.Nil(err) + s.Equal(res.Report.QueryId, qId, "query id is not correct") + s.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") + s.Equal(res.Report.AggregateValue, expectedValue, "aggregate value is not correct") + s.Equal(res.Report.ReporterPower, expectedPower, "reporter power is not correct") + s.Equal(res.Report.AggregateReportIndex, int64(expectedIndex), "report index is not correct") // // check list of reporters in the aggregate report for i, reporter := range currentReporters { - require.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") + s.Equal(res.Report.Reporters[i].Reporter, reporter.String(), "reporter is not correct") } weightedMean = testutil.CalculateWeightedMean(valuesInt, powers) - require.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") + s.Equal(res.Report.StandardDeviation, testutil.CalculateStandardDeviation(valuesInt, powers, weightedMean), "std deviation is not correct") } diff --git a/x/oracle/keeper/weighted_mode_test.go b/x/oracle/keeper/weighted_mode_test.go index dddf00a86..b12d61083 100644 --- a/x/oracle/keeper/weighted_mode_test.go +++ b/x/oracle/keeper/weighted_mode_test.go @@ -1,16 +1,12 @@ package keeper_test import ( - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/stretchr/testify/mock" "github.com/tellor-io/layer/testutil" "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestWeightedMode() { - require := s.Require() reporters := make([]sdk.AccAddress, 18) for i := 0; i < 10; i++ { reporters[i] = testutil.GenerateRandomAddress() @@ -51,25 +47,21 @@ func (s *KeeperTestSuite) TestWeightedMode() { QueryId: qId, }, } - s.stakingKeeper.On("GetLastTotalPower", mock.Anything, mock.Anything).Return(math.NewInt(1000)) - s.distrKeeper.On("GetFeePoolCommunityCoins", mock.Anything).Return(sdk.DecCoins{sdk.NewDecCoinFromDec("loya", math.LegacyNewDec(100))}) - s.distrKeeper.On("AllocateTokensToValidator", mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.distrKeeper.On("GetFeePool", mock.Anything).Return(distrtypes.FeePool{CommunityPool: sdk.DecCoins{sdk.NewDecCoinFromDec("loya", math.LegacyNewDec(1000))}}) - s.distrKeeper.On("SetFeePool", mock.Anything, mock.Anything).Return(nil) - s.oracleKeeper.WeightedMode(s.ctx, reports) + aggregates := s.oracleKeeper.WeightedMode(s.ctx, reports) + s.NotNil(aggregates) res, err := s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) - require.Nil(err) - require.Equal(res.Report.QueryId, qId, "query id is not correct") - require.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") - require.Equal(res.Report.AggregateValue, "aaa", "aggregate value is not correct") - require.Equal(res.Report.ReporterPower, int64(20), "aggregate reporter power is not correct") + s.Nil(err) + s.Equal(res.Report.QueryId, qId, "query id is not correct") + s.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") + s.Equal(res.Report.AggregateValue, "aaa", "aggregate value is not correct") + s.Equal(res.Report.ReporterPower, int64(20), "aggregate reporter power is not correct") // check list of reporters in the aggregate report - require.Equal(res.Report.Reporters[0].Reporter, reporters[0].String(), "reporter is not correct") - require.Equal(res.Report.Reporters[1].Reporter, reporters[1].String(), "reporter is not correct") - require.Equal(res.Report.Reporters[2].Reporter, reporters[2].String(), "reporter is not correct") - require.Equal(res.Report.Reporters[3].Reporter, expectedReporter, "reporter is not correct") - require.Equal(res.Report.Reporters[4].Reporter, reporters[4].String(), "reporter is not correct") - require.Equal(res.Report.AggregateReportIndex, int64(3), "report index is not correct") + s.Equal(res.Report.Reporters[0].Reporter, reporters[0].String(), "reporter is not correct") + s.Equal(res.Report.Reporters[1].Reporter, reporters[1].String(), "reporter is not correct") + s.Equal(res.Report.Reporters[2].Reporter, reporters[2].String(), "reporter is not correct") + s.Equal(res.Report.Reporters[3].Reporter, expectedReporter, "reporter is not correct") + s.Equal(res.Report.Reporters[4].Reporter, reporters[4].String(), "reporter is not correct") + s.Equal(res.Report.AggregateReportIndex, int64(3), "report index is not correct") // scenario where mode is not decided by most powerful reporter qId2 := "a6f013ee236804827b77696d350e9f0ac3e879328f2a3021d473a0b778ad78ac" @@ -109,17 +101,17 @@ func (s *KeeperTestSuite) TestWeightedMode() { s.oracleKeeper.WeightedMode(s.ctx, reports) res, err = s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId2}) - require.Nil(err) - require.Equal(res.Report.QueryId, qId2, "query id is not correct") - require.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") - require.Equal(res.Report.AggregateValue, "ccc", "aggregate value is not correct") - require.Equal(res.Report.ReporterPower, int64(2), "aggregate reporter power is not correct") + s.Nil(err) + s.Equal(res.Report.QueryId, qId2, "query id is not correct") + s.Equal(res.Report.AggregateReporter, expectedReporter, "aggregate reporter is not correct") + s.Equal(res.Report.AggregateValue, "ccc", "aggregate value is not correct") + s.Equal(res.Report.ReporterPower, int64(2), "aggregate reporter power is not correct") // check list of reporters in the aggregate report - require.Equal(res.Report.Reporters[0].Reporter, reporters[5].String(), "reporter is not correct") - require.Equal(res.Report.Reporters[1].Reporter, expectedReporter, "reporter is not correct") - require.Equal(res.Report.Reporters[2].Reporter, reporters[7].String(), "reporter is not correct") - require.Equal(res.Report.Reporters[3].Reporter, reporters[8].String(), "reporter is not correct") - require.Equal(res.Report.Reporters[4].Reporter, reporters[9].String(), "reporter is not correct") - require.Equal(res.Report.AggregateReportIndex, int64(1), "report index is not correct") + s.Equal(res.Report.Reporters[0].Reporter, reporters[5].String(), "reporter is not correct") + s.Equal(res.Report.Reporters[1].Reporter, expectedReporter, "reporter is not correct") + s.Equal(res.Report.Reporters[2].Reporter, reporters[7].String(), "reporter is not correct") + s.Equal(res.Report.Reporters[3].Reporter, reporters[8].String(), "reporter is not correct") + s.Equal(res.Report.Reporters[4].Reporter, reporters[9].String(), "reporter is not correct") + s.Equal(res.Report.AggregateReportIndex, int64(1), "report index is not correct") } diff --git a/x/oracle/module.go b/x/oracle/module.go index 8d9ca3754..7ce898867 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -8,8 +8,8 @@ import ( // this line is used by starport scaffolding # 1 "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" "cosmossdk.io/depinject" - storetypes "cosmossdk.io/store/types" abci "github.com/cometbft/cometbft/abci/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -125,7 +125,7 @@ func NewAppModule( // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper)) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) @@ -175,16 +175,15 @@ func AppWiringSetup() { type OracleInputs struct { depinject.In - KvStoreKey *storetypes.KVStoreKey - MemStoreKey *storetypes.MemoryStoreKey - Cdc codec.Codec - Config *oraclemodulev1.Module + StoreService store.KVStoreService + Cdc codec.Codec + Config *oraclemodulev1.Module + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper - AccountKeeper types.AccountKeeper - BankKeeper types.BankKeeper - Distr types.DistrKeeper - StakingKeeper types.StakingKeeper RegistryKeeper types.RegistryKeeper + ReporterKeeper types.ReporterKeeper } type OracleOutputs struct { @@ -201,13 +200,11 @@ func ProvideModule(in OracleInputs) OracleOutputs { } k := keeper.NewKeeper( in.Cdc, - in.KvStoreKey, - in.MemStoreKey, + in.StoreService, in.AccountKeeper, in.BankKeeper, - in.Distr, - in.StakingKeeper, in.RegistryKeeper, + in.ReporterKeeper, authority.String(), ) m := NewAppModule( diff --git a/x/oracle/types/aggregate.pb.go b/x/oracle/types/aggregate.pb.go index 970608f5d..518582aa2 100644 --- a/x/oracle/types/aggregate.pb.go +++ b/x/oracle/types/aggregate.pb.go @@ -36,7 +36,7 @@ type Aggregate struct { StandardDeviation float64 `protobuf:"fixed64,5,opt,name=standardDeviation,proto3" json:"standardDeviation,omitempty"` Reporters []*AggregateReporter `protobuf:"bytes,6,rep,name=reporters,proto3" json:"reporters,omitempty"` Flagged bool `protobuf:"varint,7,opt,name=flagged,proto3" json:"flagged,omitempty"` - Nonce int64 `protobuf:"varint,8,opt,name=nonce,proto3" json:"nonce,omitempty"` + Nonce uint64 `protobuf:"varint,8,opt,name=nonce,proto3" json:"nonce,omitempty"` AggregateReportIndex int64 `protobuf:"varint,9,opt,name=aggregateReportIndex,proto3" json:"aggregateReportIndex,omitempty"` } @@ -122,7 +122,7 @@ func (m *Aggregate) GetFlagged() bool { return false } -func (m *Aggregate) GetNonce() int64 { +func (m *Aggregate) GetNonce() uint64 { if m != nil { return m.Nonce } @@ -188,33 +188,33 @@ func init() { func init() { proto.RegisterFile("layer/oracle/aggregate.proto", fileDescriptor_788ad347f505f8a6) } var fileDescriptor_788ad347f505f8a6 = []byte{ - // 401 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcd, 0x8e, 0xd3, 0x30, - 0x18, 0x8c, 0xb7, 0xec, 0x6e, 0x63, 0x7e, 0x24, 0x4c, 0x0f, 0x56, 0x85, 0x92, 0x68, 0x05, 0x28, - 0x48, 0xe0, 0x48, 0xcb, 0x99, 0x43, 0x97, 0xbd, 0xec, 0x0d, 0x45, 0x88, 0x03, 0x1c, 0x90, 0xd3, - 0x7c, 0x6b, 0x22, 0xb9, 0x71, 0x70, 0x9c, 0xa5, 0x7d, 0x8b, 0x3e, 0x56, 0x8f, 0x3d, 0x72, 0x02, - 0xd4, 0xbe, 0x01, 0x4f, 0x80, 0xea, 0xd4, 0xa1, 0xb4, 0xbd, 0x65, 0xbe, 0x99, 0xf1, 0x37, 0xf1, - 0x18, 0x3f, 0x95, 0x7c, 0x06, 0x3a, 0x51, 0x9a, 0x8f, 0x25, 0x24, 0x5c, 0x08, 0x0d, 0x82, 0x1b, - 0x60, 0x95, 0x56, 0x46, 0x91, 0x07, 0x96, 0x65, 0x2d, 0x3b, 0x1c, 0x08, 0x25, 0x94, 0x25, 0x92, - 0xcd, 0x57, 0xab, 0x19, 0x86, 0x42, 0x29, 0x21, 0x21, 0xb1, 0x28, 0x6b, 0x6e, 0x13, 0x53, 0x4c, - 0xa0, 0x36, 0x7c, 0x52, 0x6d, 0x05, 0xcf, 0x8f, 0xaf, 0xf8, 0xa2, 0xa1, 0x52, 0xda, 0x80, 0x6e, - 0x65, 0x17, 0x7f, 0x4e, 0xb0, 0x3f, 0x72, 0x24, 0xa1, 0xf8, 0xfc, 0x5b, 0x03, 0x7a, 0x76, 0x93, - 0x53, 0x14, 0xa1, 0xd8, 0x4f, 0x1d, 0x24, 0x2f, 0xf0, 0xa3, 0xee, 0x8c, 0x8f, 0x5c, 0x36, 0x40, - 0x4f, 0xac, 0x60, 0x6f, 0x4a, 0x5e, 0xe1, 0xc7, 0xdd, 0x24, 0xdd, 0xae, 0xa2, 0x3d, 0x2b, 0x3d, - 0x24, 0xc8, 0x33, 0xfc, 0xd0, 0xe5, 0x79, 0xaf, 0xbe, 0x83, 0xa6, 0xf7, 0x22, 0x14, 0xf7, 0xd2, - 0xff, 0x87, 0x9b, 0x33, 0x6b, 0xc3, 0xcb, 0x9c, 0xeb, 0xfc, 0x1a, 0xee, 0x0a, 0x6e, 0x0a, 0x55, - 0xd2, 0xd3, 0x08, 0xc5, 0x28, 0x3d, 0x24, 0xc8, 0x5b, 0xec, 0x3b, 0x7b, 0x4d, 0xcf, 0xa2, 0x5e, - 0x7c, 0xff, 0x32, 0x64, 0xbb, 0x37, 0xca, 0x46, 0xfb, 0x39, 0xd2, 0x7f, 0x8e, 0xcd, 0x15, 0xdc, - 0x4a, 0x2e, 0x04, 0xe4, 0xf4, 0x3c, 0x42, 0x71, 0x3f, 0x75, 0x90, 0x0c, 0xf0, 0x69, 0xa9, 0xca, - 0x31, 0xd0, 0xbe, 0x0d, 0xd9, 0x02, 0x72, 0x89, 0x07, 0x7b, 0xff, 0x75, 0x53, 0xe6, 0x30, 0xa5, - 0xbe, 0x15, 0x1d, 0xe5, 0x2e, 0x3e, 0xe3, 0x27, 0xa3, 0x3b, 0x5e, 0x48, 0x9e, 0x49, 0xf8, 0xe0, - 0x7a, 0xab, 0xc9, 0x35, 0xc6, 0x5d, 0x8b, 0x35, 0x45, 0x36, 0xfa, 0x90, 0xb5, 0x45, 0x33, 0x57, - 0x34, 0xeb, 0x0c, 0x57, 0xfd, 0xc5, 0xcf, 0xd0, 0x9b, 0xff, 0x0a, 0x51, 0xba, 0xe3, 0xbb, 0x7a, - 0xb7, 0x58, 0x05, 0x68, 0xb9, 0x0a, 0xd0, 0xef, 0x55, 0x80, 0xe6, 0xeb, 0xc0, 0x5b, 0xae, 0x03, - 0xef, 0xc7, 0x3a, 0xf0, 0x3e, 0xbd, 0x14, 0x85, 0xf9, 0xda, 0x64, 0x6c, 0xac, 0x26, 0x89, 0x01, - 0x29, 0x95, 0x7e, 0x5d, 0xa8, 0xa4, 0x7d, 0x27, 0x53, 0xf7, 0x52, 0xcc, 0xac, 0x82, 0x3a, 0x3b, - 0xb3, 0xeb, 0xde, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x16, 0x91, 0x50, 0x3a, 0xa9, 0x02, 0x00, - 0x00, + // 405 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcb, 0x6e, 0xd4, 0x30, + 0x14, 0x8d, 0x3b, 0x7d, 0x4c, 0xcc, 0x43, 0xc2, 0xcc, 0xc2, 0x1a, 0xa1, 0x24, 0xaa, 0x00, 0x05, + 0x09, 0x1c, 0xa9, 0xac, 0x59, 0x4c, 0xe9, 0xa6, 0x3b, 0x64, 0x21, 0x16, 0xb0, 0x40, 0xce, 0xe4, + 0xd6, 0x44, 0xf2, 0xc4, 0xc1, 0x71, 0x4a, 0xe7, 0x2f, 0xfa, 0x59, 0x5d, 0x76, 0xc9, 0x0a, 0xd0, + 0xcc, 0x1f, 0xf0, 0x05, 0x68, 0x9c, 0x3a, 0x4c, 0x67, 0x66, 0xe7, 0x73, 0xcf, 0x39, 0xbe, 0xd7, + 0x3e, 0x17, 0x3f, 0x53, 0x62, 0x0e, 0x26, 0xd3, 0x46, 0x4c, 0x15, 0x64, 0x42, 0x4a, 0x03, 0x52, + 0x58, 0x60, 0xb5, 0xd1, 0x56, 0x93, 0x87, 0x8e, 0x65, 0x1d, 0x3b, 0x1e, 0x49, 0x2d, 0xb5, 0x23, + 0xb2, 0xd5, 0xa9, 0xd3, 0x8c, 0x63, 0xa9, 0xb5, 0x54, 0x90, 0x39, 0x94, 0xb7, 0x17, 0x99, 0x2d, + 0x67, 0xd0, 0x58, 0x31, 0xab, 0xef, 0x04, 0x2f, 0x76, 0xb7, 0xf8, 0x6a, 0xa0, 0xd6, 0xc6, 0x82, + 0xe9, 0x64, 0xc7, 0x7f, 0xf7, 0x70, 0x38, 0xf1, 0x24, 0xa1, 0xf8, 0xe8, 0x7b, 0x0b, 0x66, 0x7e, + 0x5e, 0x50, 0x94, 0xa0, 0x34, 0xe4, 0x1e, 0x92, 0x97, 0xf8, 0x71, 0x7f, 0xc7, 0x27, 0xa1, 0x5a, + 0xa0, 0x7b, 0x4e, 0xb0, 0x51, 0x25, 0xaf, 0xf1, 0x93, 0xbe, 0xc2, 0xef, 0x5a, 0xd1, 0x81, 0x93, + 0x6e, 0x13, 0xe4, 0x39, 0x7e, 0xe4, 0xe7, 0xf9, 0xa0, 0x7f, 0x80, 0xa1, 0xfb, 0x09, 0x4a, 0x07, + 0xfc, 0x7e, 0x71, 0x75, 0x67, 0x63, 0x45, 0x55, 0x08, 0x53, 0x9c, 0xc1, 0x65, 0x29, 0x6c, 0xa9, + 0x2b, 0x7a, 0x90, 0xa0, 0x14, 0xf1, 0x6d, 0x82, 0xbc, 0xc3, 0xa1, 0xb7, 0x37, 0xf4, 0x30, 0x19, + 0xa4, 0x0f, 0x4e, 0x62, 0xb6, 0xfe, 0xa3, 0x6c, 0xb2, 0x39, 0x07, 0xff, 0xef, 0x58, 0x7d, 0xc1, + 0x85, 0x12, 0x52, 0x42, 0x41, 0x8f, 0x12, 0x94, 0x0e, 0xb9, 0x87, 0x64, 0x84, 0x0f, 0x2a, 0x5d, + 0x4d, 0x81, 0x0e, 0x13, 0x94, 0xee, 0xf3, 0x0e, 0x90, 0x13, 0x3c, 0xda, 0x78, 0xd7, 0x79, 0x55, + 0xc0, 0x15, 0x0d, 0xdd, 0x4b, 0x76, 0x72, 0xc7, 0x5f, 0xf0, 0xd3, 0xc9, 0xa5, 0x28, 0x95, 0xc8, + 0x15, 0x7c, 0xf4, 0xb9, 0x35, 0xe4, 0x0c, 0xe3, 0x3e, 0xc5, 0x86, 0x22, 0x37, 0xfa, 0x98, 0x75, + 0x41, 0x33, 0x1f, 0x34, 0xeb, 0x0d, 0xa7, 0xc3, 0x9b, 0x5f, 0x71, 0x70, 0xfd, 0x3b, 0x46, 0x7c, + 0xcd, 0x77, 0xfa, 0xfe, 0x66, 0x11, 0xa1, 0xdb, 0x45, 0x84, 0xfe, 0x2c, 0x22, 0x74, 0xbd, 0x8c, + 0x82, 0xdb, 0x65, 0x14, 0xfc, 0x5c, 0x46, 0xc1, 0xe7, 0x57, 0xb2, 0xb4, 0xdf, 0xda, 0x9c, 0x4d, + 0xf5, 0x2c, 0xb3, 0xa0, 0x94, 0x36, 0x6f, 0x4a, 0x9d, 0x75, 0x7b, 0x72, 0xe5, 0x37, 0xc5, 0xce, + 0x6b, 0x68, 0xf2, 0x43, 0xd7, 0xee, 0xed, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x37, 0x35, 0x51, + 0x8e, 0xa9, 0x02, 0x00, 0x00, } func (m *Aggregate) Marshal() (dAtA []byte, err error) { @@ -638,7 +638,7 @@ func (m *Aggregate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Nonce |= int64(b&0x7F) << shift + m.Nonce |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index 902bf148c..96ce7aa68 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -13,4 +13,7 @@ var ( ErrValidatorNotBonded = sdkerrors.Register(ModuleName, 1101, "validator is not staked") ErrSignatureVerificationFailed = sdkerrors.Register(ModuleName, 1102, "signature verification failed") ErrMissedCommitRevealWindow = sdkerrors.Register(ModuleName, 1103, "missed commit reveal window") + ErrNotEnoughStake = sdkerrors.Register(ModuleName, 1104, "not enough stake") + ErrCommitRevealWindowEarly = sdkerrors.Register(ModuleName, 1105, "commit reveal window is too early") + ErrReporterJailed = sdkerrors.Register(ModuleName, 1106, "reporter is jailed") ) diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index c52a35719..cd0da1ac1 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -3,24 +3,12 @@ package types import ( context "context" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + rktypes "github.com/tellor-io/layer/x/registry/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -type RegistryKeeper interface { - // Methods imported from registry should be defined here - GetSpec(ctx sdk.Context, queryType string) (rktypes.DataSpec, error) -} -type StakingKeeper interface { - // Methods imported from staking should be defined here - GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (stakingtypes.Delegation, error) - Validator(ctx context.Context, address sdk.ValAddress) (stakingtypes.ValidatorI, error) - GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]stakingtypes.Delegation, error) - GetLastTotalPower(ctx context.Context) (math.Int, error) -} - // AccountKeeper defines the expected account keeper used for simulations (noalias) type AccountKeeper interface { GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI @@ -37,7 +25,13 @@ type BankKeeper interface { // Methods imported from bank should be defined here } -// DistributionKeeper defines the expected interface needed to retrieve community pool funds. -type DistrKeeper interface { - AllocateTokensToValidator(ctx context.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) error +type RegistryKeeper interface { + // Methods imported from registry should be defined here + GetSpec(ctx sdk.Context, queryType string) (rktypes.DataSpec, error) +} + +type ReporterKeeper interface { + // Methods imported from reporter should be defined here + AllocateTokensToReporter(ctx context.Context, reporterAddr sdk.ValAddress, tokens sdk.DecCoins) error + Reporter(ctx context.Context, repAddress sdk.AccAddress) (*reportertypes.OracleReporter, error) } diff --git a/x/oracle/types/message_commit_report.go b/x/oracle/types/message_commit_report.go index bd8b97d5c..558f01df6 100644 --- a/x/oracle/types/message_commit_report.go +++ b/x/oracle/types/message_commit_report.go @@ -46,3 +46,17 @@ func (msg *MsgCommitReport) ValidateBasic() error { } return nil } + +func (msg *MsgCommitReport) GetSignerAndValidateMsg() (sdk.AccAddress, error) { + addr, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if msg.QueryData == "" { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "query data field cannot be empty") + } + if msg.Hash == "" { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "hash field cannot be empty") + } + return addr, nil +} diff --git a/x/oracle/types/message_submit_value.go b/x/oracle/types/message_submit_value.go index 0a3fea338..75c291c94 100644 --- a/x/oracle/types/message_submit_value.go +++ b/x/oracle/types/message_submit_value.go @@ -47,3 +47,20 @@ func (msg *MsgSubmitValue) ValidateBasic() error { } return nil } + +func (msg *MsgSubmitValue) GetSignerAndValidateMsg() (sdk.AccAddress, error) { + addr, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return nil, errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + if msg.QueryData == "" { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "query data cannot be empty") + } + if msg.Value == "" { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "value cannot be empty") + } + if msg.Salt == "" { + return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "salt cannot be empty") + } + return addr, nil +} diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index 047dc5e61..d04aa238b 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -1,39 +1,55 @@ package types import ( + "encoding/hex" + "fmt" + + "cosmossdk.io/math" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "gopkg.in/yaml.v2" ) var _ paramtypes.ParamSet = (*Params)(nil) +var ( + KeyCycleList = []byte("CycleList") + KeyMinStakeAmount = []byte("MinStakeAmount") + // TODO: Determine the default value + DefaultMinStakeAmount = math.NewInt(1_000_000) // one TRB + InitialCycleList = []string{ + //ETH/USD + "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", + //BTC/USD + "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", + //TRB/USD + "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", + } +) + // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } // NewParams creates a new Params instance -func NewParams() Params { +func NewParams(cycleList []string, minStakeAmount math.Int) Params { return Params{ - CycleList: []string{ - //ETH/USD - "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", - //BTC/USD - "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", - //TRB/USD - "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", - }, + CycleList: cycleList, + MinStakeAmount: minStakeAmount, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return NewParams(InitialCycleList, DefaultMinStakeAmount) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyCycleList, &p.CycleList, validateCycleList), + paramtypes.NewParamSetPair(KeyMinStakeAmount, &p.MinStakeAmount, validateMinStakeAmount), + } } // Validate validates the set of params @@ -46,3 +62,30 @@ func (p Params) String() string { out, _ := yaml.Marshal(p) return string(out) } + +// validate cycleList queries param +func validateCycleList(v interface{}) error { + cycleList, ok := v.([]string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + for _, query := range cycleList { + // try encoding the query to ensure it's valid + _, err := hex.DecodeString(query) + if err != nil { + return fmt.Errorf("invalid query in cyclelist: %s", err) + } + } + return nil +} + +// validateMinStakeAmount validates the MinStakeAmount param +func validateMinStakeAmount(v interface{}) error { + _, ok := v.(math.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + return nil +} diff --git a/x/oracle/types/params.pb.go b/x/oracle/types/params.pb.go index 30fc38cca..4070c1d04 100644 --- a/x/oracle/types/params.pb.go +++ b/x/oracle/types/params.pb.go @@ -4,7 +4,9 @@ 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" io "io" @@ -25,7 +27,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - CycleList []string `protobuf:"bytes,1,rep,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` + CycleList []string `protobuf:"bytes,1,rep,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` + MinStakeAmount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=minStakeAmount,proto3,customtype=cosmossdk.io/math.Int" json:"minStakeAmount" yaml:"min_stake_amount"` } func (m *Params) Reset() { *m = Params{} } @@ -74,19 +77,25 @@ func init() { func init() { proto.RegisterFile("layer/oracle/params.proto", fileDescriptor_ac0e3bcb871977fd) } var fileDescriptor_ac0e3bcb871977fd = []byte{ - // 184 bytes of a gzipped FileDescriptorProto + // 284 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x4b, 0xe9, 0x41, 0xa4, 0xa4, 0x44, 0xd2, 0xf3, - 0xd3, 0xf3, 0xc1, 0x12, 0xfa, 0x20, 0x16, 0x44, 0x8d, 0x92, 0x31, 0x17, 0x5b, 0x00, 0x58, 0x8f, - 0x90, 0x32, 0x17, 0x57, 0x72, 0x65, 0x72, 0x4e, 0x6a, 0x7c, 0x4e, 0x66, 0x71, 0x89, 0x04, 0xa3, - 0x02, 0xb3, 0x06, 0xa7, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, 0x9c, 0x60, 0x71, 0x9f, 0xcc, - 0xe2, 0x12, 0x2b, 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x9c, 0x9c, 0x4f, 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, 0x4a, 0x33, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, - 0xbf, 0x24, 0x35, 0x27, 0x27, 0xbf, 0x48, 0x37, 0x33, 0x5f, 0x1f, 0xe2, 0xc4, 0x0a, 0x98, 0x23, - 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x0e, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, - 0x6c, 0xf2, 0xa3, 0xbd, 0xc1, 0x00, 0x00, 0x00, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x4b, 0xe9, 0x41, 0xa4, 0xa4, 0x24, 0x93, 0xf3, + 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0x72, 0xfa, 0x10, 0x0e, 0x44, 0xa1, 0x94, 0x48, 0x7a, 0x7e, + 0x7a, 0x3e, 0x44, 0x1c, 0xc4, 0x82, 0x88, 0x2a, 0x2d, 0x66, 0xe4, 0x62, 0x0b, 0x00, 0x9b, 0x27, + 0xa4, 0xcc, 0xc5, 0x95, 0x5c, 0x99, 0x9c, 0x93, 0x1a, 0x9f, 0x93, 0x59, 0x5c, 0x22, 0xc1, 0xa8, + 0xc0, 0xac, 0xc1, 0xe9, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x27, 0x58, 0xdc, 0x27, 0xb3, + 0xb8, 0x44, 0x28, 0x8f, 0x8b, 0x2f, 0x37, 0x33, 0x2f, 0xb8, 0x24, 0x31, 0x3b, 0xd5, 0x31, 0x37, + 0xbf, 0x34, 0xaf, 0x44, 0x82, 0x49, 0x81, 0x51, 0x83, 0xd3, 0xc9, 0x0d, 0xa4, 0xf0, 0xd6, 0x3d, + 0x79, 0x51, 0x88, 0x9d, 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, + 0x9e, 0x79, 0x25, 0x9f, 0xee, 0xc9, 0x8b, 0x57, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xe5, 0x66, 0xe6, + 0xc5, 0x17, 0x83, 0x74, 0xc7, 0x27, 0x82, 0xb5, 0x2b, 0x5d, 0xda, 0xa2, 0xcb, 0x05, 0x75, 0xa7, + 0x67, 0x5e, 0x49, 0x10, 0x9a, 0xe9, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x39, 0x9f, 0x78, + 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, + 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x66, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, + 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x49, 0x6a, 0x4e, 0x4e, 0x7e, 0x91, 0x6e, 0x66, 0xbe, 0x3e, 0x24, + 0xb8, 0x2a, 0x60, 0x01, 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xb1, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0x7e, 0x9e, 0xb5, 0xf2, 0x4d, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -109,6 +118,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.MinStakeAmount.Size() + i -= size + if _, err := m.MinStakeAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 if len(m.CycleList) > 0 { for iNdEx := len(m.CycleList) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.CycleList[iNdEx]) @@ -144,6 +163,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } + l = m.MinStakeAmount.Size() + n += 1 + l + sovParams(uint64(l)) return n } @@ -214,6 +235,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.CycleList = append(m.CycleList, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStakeAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinStakeAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 9ad0156c6b8d4710b6929c34cd77e9f876442dd8 Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 26 Feb 2024 10:48:10 -0500 Subject: [PATCH 04/31] cleanup --- testutil/keeper/reporter.go | 3 ++- x/reporter/keeper/msg_update_params.go | 2 +- x/reporter/keeper/msg_update_params_test.go | 2 +- x/reporter/keeper/params.go | 15 --------------- x/reporter/keeper/params_test.go | 4 ++-- x/reporter/keeper/query_params.go | 2 +- x/reporter/keeper/query_params_test.go | 2 +- x/reporter/module/genesis.go | 7 +++++-- 8 files changed, 13 insertions(+), 24 deletions(-) diff --git a/testutil/keeper/reporter.go b/testutil/keeper/reporter.go index defdf2ce2..5431a25fe 100644 --- a/testutil/keeper/reporter.go +++ b/testutil/keeper/reporter.go @@ -47,7 +47,8 @@ func ReporterKeeper(t testing.TB) (keeper.Keeper, *mocks.StakingKeeper, *mocks.B ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + err := k.Params.Set(ctx, types.DefaultParams()) + require.NoError(t, err) return k, sk, bk, ctx } diff --git a/x/reporter/keeper/msg_update_params.go b/x/reporter/keeper/msg_update_params.go index 7fccc7936..6a9df693c 100644 --- a/x/reporter/keeper/msg_update_params.go +++ b/x/reporter/keeper/msg_update_params.go @@ -15,7 +15,7 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam } ctx := sdk.UnwrapSDKContext(goCtx) - if err := k.SetParams(ctx, req.Params); err != nil { + if err := k.Params.Set(ctx, req.Params); err != nil { return nil, err } diff --git a/x/reporter/keeper/msg_update_params_test.go b/x/reporter/keeper/msg_update_params_test.go index bac1c1c3f..5de37bbdc 100644 --- a/x/reporter/keeper/msg_update_params_test.go +++ b/x/reporter/keeper/msg_update_params_test.go @@ -12,7 +12,7 @@ import ( func TestMsgUpdateParams(t *testing.T) { k, _, _, ms, ctx := setupMsgServer(t) params := types.DefaultParams() - require.NoError(t, k.SetParams(ctx, params)) + require.NoError(t, k.Params.Set(ctx, params)) wctx := sdk.UnwrapSDKContext(ctx) // default params diff --git a/x/reporter/keeper/params.go b/x/reporter/keeper/params.go index 6a3c3c6d5..42d870f5a 100644 --- a/x/reporter/keeper/params.go +++ b/x/reporter/keeper/params.go @@ -4,23 +4,8 @@ import ( "context" "cosmossdk.io/math" - "github.com/tellor-io/layer/x/reporter/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx context.Context) (types.Params, error) { - params, err := k.Params.Get(ctx) - if err != nil { - return params, err - } - return params, nil -} - -// SetParams set the params -func (k Keeper) SetParams(ctx context.Context, params types.Params) error { - return k.Params.Set(ctx, params) -} - func (k Keeper) MinCommissionRate(ctx context.Context) (math.LegacyDec, error) { params, err := k.Params.Get(ctx) return params.MinCommissionRate, err diff --git a/x/reporter/keeper/params_test.go b/x/reporter/keeper/params_test.go index c6aaffd0f..e6f553b12 100644 --- a/x/reporter/keeper/params_test.go +++ b/x/reporter/keeper/params_test.go @@ -13,8 +13,8 @@ func TestGetParams(t *testing.T) { k, _, _, ctx := keepertest.ReporterKeeper(t) params := types.DefaultParams() querier := keeper.NewQuerier(k) - require.NoError(t, k.SetParams(ctx, params)) - p, err := querier.GetParams(ctx) + require.NoError(t, k.Params.Set(ctx, params)) + p, err := querier.Keeper.Params.Get(ctx) require.NoError(t, err) require.EqualValues(t, params, p) } diff --git a/x/reporter/keeper/query_params.go b/x/reporter/keeper/query_params.go index 83bb5425f..0bad4c2fa 100644 --- a/x/reporter/keeper/query_params.go +++ b/x/reporter/keeper/query_params.go @@ -15,7 +15,7 @@ func (k Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (* return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - params, err := k.GetParams(ctx) + params, err := k.Keeper.Params.Get(ctx) if err != nil { return nil, err } diff --git a/x/reporter/keeper/query_params_test.go b/x/reporter/keeper/query_params_test.go index 4e5fb26b4..de02c935e 100644 --- a/x/reporter/keeper/query_params_test.go +++ b/x/reporter/keeper/query_params_test.go @@ -13,7 +13,7 @@ func TestParamsQuery(t *testing.T) { k, _, _, ctx := keepertest.ReporterKeeper(t) querier := keeper.NewQuerier(k) params := types.DefaultParams() - require.NoError(t, k.SetParams(ctx, params)) + require.NoError(t, k.Params.Set(ctx, params)) response, err := querier.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) diff --git a/x/reporter/module/genesis.go b/x/reporter/module/genesis.go index f6f939d4e..ee6c7d282 100644 --- a/x/reporter/module/genesis.go +++ b/x/reporter/module/genesis.go @@ -10,13 +10,16 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + err := k.Params.Set(ctx, genState.Params) + if err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - params, err := k.GetParams(ctx) + params, err := k.Params.Get(ctx) if err != nil { panic(err) } From 4d1e39c3fbec7b2b0ce8b0a6877263b76655c47b Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 26 Feb 2024 11:22:12 -0500 Subject: [PATCH 05/31] cleanup and fix tests --- tests/integration/dispute_keeper_test.go | 47 ++--- tests/integration/keeper_test.go | 62 ++---- tests/integration/oracle_keeper_test.go | 245 ++++++++++++++-------- tests/integration/reporter_keeper_test.go | 42 +++- tests/setup.go | 1 + x/dispute/module.go | 2 +- x/oracle/module.go | 2 +- 7 files changed, 233 insertions(+), 168 deletions(-) diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index dc4eff11e..ff4e71be5 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -5,23 +5,14 @@ import ( "cosmossdk.io/math" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tellor-io/layer/x/dispute/keeper" "github.com/tellor-io/layer/x/dispute/types" ) -func (s *IntegrationTestSuite) disputeKeeper() (queryClient types.QueryClient, msgServer types.MsgServer) { - types.RegisterQueryServer(s.queryHelper, s.disputekeeper) - types.RegisterInterfaces(s.interfaceRegistry) - queryClient = types.NewQueryClient(s.queryHelper) - msgServer = keeper.NewMsgServerImpl(s.disputekeeper) - - return -} - func (s *IntegrationTestSuite) TestVotingOnDispute() { - _, msgServer := s.disputeKeeper() + + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{1000, 20}) val, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) s.NoError(err) @@ -82,7 +73,7 @@ func (s *IntegrationTestSuite) TestVotingOnDispute() { } func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) require := s.Require() ctx := s.ctx addrs, valAddrs := s.createValidators([]int64{100}) @@ -127,7 +118,7 @@ func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { } func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{200, 300, 400, 500}) reporterAddr := addrs[0].String() disputerAcc := addrs[1] @@ -203,23 +194,8 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { s.Equal(disputerBalanceBeforeExecuteVote, disputerBalanceAfterExecuteVote) } -func (suite *IntegrationTestSuite) getTestMetadata() banktypes.Metadata { - return banktypes.Metadata{ - Name: "Tellor Layer Tributes", - Symbol: "TRB", - Description: "The native staking token of the TellorLayer.", - DenomUnits: []*banktypes.DenomUnit{ - {Denom: "loya", Exponent: uint32(0), Aliases: nil}, - {Denom: "mloya", Exponent: uint32(3), Aliases: []string{"milliloya"}}, - {Denom: "trb", Exponent: uint32(6), Aliases: nil}, - }, - Base: "loya", - Display: "trb", - } -} - func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) @@ -272,7 +248,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { } func (s *IntegrationTestSuite) TestExecuteVoteSupport() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{200, 300, 400, 500}) reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) s.NoError(err) @@ -360,7 +336,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { } func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{200, 300, 400, 500}) reporterBefore, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) s.NoError(err) @@ -441,7 +417,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { } func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) bal0, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) @@ -592,11 +568,13 @@ func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { // check reporter stake reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + s.NoError(err) s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} s.ctx = s.ctx.WithBlockHeader(header) _, err = s.app.BeginBlocker(s.ctx) + s.NoError(err) // voting that doesn't reach quorum votes = []types.MsgVote{ @@ -745,6 +723,7 @@ func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} s.ctx = s.ctx.WithBlockHeader(header) _, err = s.app.BeginBlocker(s.ctx) + s.NoError(err) // check reporter stake, stake should be restored due to invalid vote final result reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) @@ -770,7 +749,7 @@ func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { } func (s *IntegrationTestSuite) TestNoQorumSingleRound() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) s.NoError(err) @@ -828,7 +807,7 @@ func (s *IntegrationTestSuite) TestNoQorumSingleRound() { } func (s *IntegrationTestSuite) TestDisputeButNoVotes() { - _, msgServer := s.disputeKeeper() + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) s.NoError(err) diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index 3ff396aa3..fe377d5a6 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/depinject" "cosmossdk.io/math" + "github.com/tellor-io/layer/testutil/sample" authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" "github.com/cosmos/cosmos-sdk/codec" @@ -18,7 +19,6 @@ import ( storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/configurator" - "github.com/cosmos/cosmos-sdk/testutil/sims" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/auth" @@ -30,7 +30,6 @@ import ( "cosmossdk.io/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -50,9 +49,7 @@ import ( registrykeeper "github.com/tellor-io/layer/x/registry/keeper" reporterkeeper "github.com/tellor-io/layer/x/reporter/keeper" - _ "github.com/cosmos/cosmos-sdk/x/auth" _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - _ "github.com/cosmos/cosmos-sdk/x/bank" _ "github.com/cosmos/cosmos-sdk/x/consensus" _ "github.com/cosmos/cosmos-sdk/x/distribution" _ "github.com/cosmos/cosmos-sdk/x/genutil" @@ -60,21 +57,21 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/mint" _ "github.com/cosmos/cosmos-sdk/x/params" _ "github.com/cosmos/cosmos-sdk/x/slashing" - _ "github.com/cosmos/cosmos-sdk/x/staking" + _ "github.com/tellor-io/layer/x/dispute" + _ "github.com/tellor-io/layer/x/oracle" _ "github.com/tellor-io/layer/x/registry/module" _ "github.com/tellor-io/layer/x/reporter/module" - "github.com/tellor-io/layer/x/dispute" disputetypes "github.com/tellor-io/layer/x/dispute/types" - "github.com/tellor-io/layer/x/oracle" oracletypes "github.com/tellor-io/layer/x/oracle/types" registrytypes "github.com/tellor-io/layer/x/registry/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" "testing" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/ethereum/go-ethereum/accounts/abi" integration "github.com/tellor-io/layer/tests" ) @@ -103,7 +100,6 @@ type IntegrationTestSuite struct { appCodec codec.Codec authConfig *authmodulev1.Module - queryHelper *baseapp.QueryServiceTestHelper interfaceRegistry codectypes.InterfaceRegistry fetchStoreKey func(string) storetypes.StoreKey @@ -168,8 +164,13 @@ func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[str suite.distrKeeper = distrkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(distrtypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.stakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + + suite.reporterkeeper = reporterkeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(reportertypes.StoreKey).(*storetypes.KVStoreKey)), log.NewNopLogger(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), suite.stakingKeeper, suite.bankKeeper, + ) + suite.oraclekeeper = oraclekeeper.NewKeeper( - appCodec, suite.fetchStoreKey(oracletypes.StoreKey), suite.fetchStoreKey(oracletypes.StoreKey), suite.accountKeeper, suite.bankKeeper, suite.distrKeeper, suite.stakingKeeper, suite.registrykeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(oracletypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.registrykeeper, suite.reporterkeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) suite.disputekeeper = disputekeeper.NewKeeper( @@ -178,12 +179,10 @@ func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[str } func (s *IntegrationTestSuite) SetupTest() { - dispute.AppWiringSetup() - oracle.AppWiringSetup() sdk.DefaultBondDenom = "loya" config.SetupConfig() - app, err := sims.SetupWithConfiguration( + app, err := simtestutil.SetupWithConfiguration( depinject.Configs( configurator.NewAppConfig( integration.AuthModule(), @@ -210,7 +209,6 @@ func (s *IntegrationTestSuite) SetupTest() { s.ctx = sdk.UnwrapSDKContext(app.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()})) s.fetchStoreKey = app.UnsafeFindStoreKey - s.queryHelper = baseapp.NewQueryServerTestHelper(s.ctx, s.interfaceRegistry) s.denom = sdk.DefaultBondDenom s.initKeepersWithmAccPerms(make(map[string]bool)) s.app = app @@ -224,28 +222,11 @@ func (s *IntegrationTestSuite) mintTokens(addr sdk.AccAddress, amount sdk.Coin) } func (s *IntegrationTestSuite) newKeysWithTokens() sdk.AccAddress { - PrivKey := secp256k1.GenPrivKey() - PubKey := PrivKey.PubKey() - Addr := sdk.AccAddress(PubKey.Address()) + Addr := sample.AccAddressBytes() s.mintTokens(Addr, sdk.NewCoin(s.denom, math.NewInt(1000000))) return Addr } -func (s *IntegrationTestSuite) microReport() (disputetypes.MicroReport, sdk.ValAddress) { - vals, err := s.stakingKeeper.GetAllValidators(s.ctx) - s.Require().NoError(err) - valAddr, err := sdk.ValAddressFromBech32(vals[0].OperatorAddress) - s.Require().NoError(err) - return disputetypes.MicroReport{ - Reporter: sdk.AccAddress(valAddr).String(), - Power: vals[0].GetConsensusPower(vals[0].GetBondedTokens()), - QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", - Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, - }, valAddr - -} - func (s *IntegrationTestSuite) createValidators(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { ctx := s.ctx acctNum := len(powers) @@ -284,8 +265,8 @@ func (s *IntegrationTestSuite) addTestAddrs(accNum int, accAmt math.Int, testAdd } type ModuleAccs struct { - staking authtypes.AccountI - dispute authtypes.AccountI + staking sdk.AccountI + dispute sdk.AccountI } func (s *IntegrationTestSuite) ModuleAccs() ModuleAccs { @@ -295,16 +276,16 @@ func (s *IntegrationTestSuite) ModuleAccs() ModuleAccs { } } -func CreateRandomPrivateKeys(accNum int) []secp256k1.PrivKey { - testAddrs := make([]secp256k1.PrivKey, accNum) +func CreateRandomPrivateKeys(accNum int) []ed25519.PrivKey { + testAddrs := make([]ed25519.PrivKey, accNum) for i := 0; i < accNum; i++ { - pk := secp256k1.GenPrivKey() + pk := ed25519.GenPrivKey() testAddrs[i] = *pk } return testAddrs } -func (s *IntegrationTestSuite) convertToAccAddress(priv []secp256k1.PrivKey) []sdk.AccAddress { +func (s *IntegrationTestSuite) convertToAccAddress(priv []ed25519.PrivKey) []sdk.AccAddress { testAddrs := make([]sdk.AccAddress, len(priv)) for i, pk := range priv { testAddrs[i] = sdk.AccAddress(pk.PubKey().Address()) @@ -312,7 +293,7 @@ func (s *IntegrationTestSuite) convertToAccAddress(priv []secp256k1.PrivKey) []s return testAddrs } -func (s *IntegrationTestSuite) createValidatorAccs(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress, []secp256k1.PrivKey) { +func (s *IntegrationTestSuite) createValidatorAccs(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress, []ed25519.PrivKey) { ctx := s.ctx acctNum := len(powers) base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) @@ -341,8 +322,11 @@ func (s *IntegrationTestSuite) createValidatorAccs(powers []int64) ([]sdk.AccAdd panic(err) } err = s.distrKeeper.Hooks().AfterValidatorCreated(ctx, valBz) + s.NoError(err) err = s.distrKeeper.Hooks().BeforeDelegationCreated(ctx, addrs[i], valBz) + s.NoError(err) err = s.distrKeeper.Hooks().AfterDelegationModified(ctx, addrs[i], valBz) + s.NoError(err) } _, err := s.stakingKeeper.EndBlocker(ctx) diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index d537d5aa9..77d05aadf 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -25,17 +25,12 @@ import ( oracleutils "github.com/tellor-io/layer/x/oracle/utils" ) -func (s *IntegrationTestSuite) oracleKeeper() (queryClient types.QueryClient, msgServer types.MsgServer) { - types.RegisterQueryServer(s.queryHelper, s.oraclekeeper) - types.RegisterInterfaces(s.interfaceRegistry) - queryClient = types.NewQueryClient(s.queryHelper) - msgServer = keeper.NewMsgServerImpl(s.oraclekeeper) - return -} - func (s *IntegrationTestSuite) TestTipping() { - _, msgServer := s.oracleKeeper() + + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + addr := s.newKeysWithTokens() + tip := sdk.NewCoin(s.denom, math.NewInt(1000)) twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ @@ -86,8 +81,10 @@ func (s *IntegrationTestSuite) TestTipping() { } func (s *IntegrationTestSuite) TestGetCurrentTip() { - _, msgServer := s.oracleKeeper() + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + addr := s.newKeysWithTokens() + tip := sdk.NewCoin(s.denom, math.NewInt(1000)) twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ @@ -105,8 +102,10 @@ func (s *IntegrationTestSuite) TestGetCurrentTip() { } func (s *IntegrationTestSuite) TestGetUserTipTotal() { - _, msgServer := s.oracleKeeper() + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + addr := s.newKeysWithTokens() + tip := sdk.NewCoin(s.denom, math.NewInt(1000)) twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ @@ -128,8 +127,10 @@ func (s *IntegrationTestSuite) TestGetUserTipTotal() { } func (s *IntegrationTestSuite) TestSmallTip() { - _, msgServer := s.oracleKeeper() + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + addr := s.newKeysWithTokens() + tip := sdk.NewCoin(s.denom, math.NewInt(10)) twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ @@ -148,48 +149,66 @@ func (s *IntegrationTestSuite) TestSmallTip() { } func (s *IntegrationTestSuite) TestMedianReports() { - _, msgServer := s.oracleKeeper() - accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + tipper := s.newKeysWithTokens() s.ctx = s.ctx.WithBlockHeight(2) + reporters := []struct { name string reporterIndex int value string + stakeAmount math.Int + power int64 }{ { name: "reporter 1", reporterIndex: 0, value: encodeValue(162926), + stakeAmount: math.NewInt(1_000_000), + power: 1, }, { name: "reporter 2", reporterIndex: 1, value: encodeValue(362926), + stakeAmount: math.NewInt(2_000_000), + power: 2, }, { name: "reporter 3", reporterIndex: 2, value: encodeValue(262926), + stakeAmount: math.NewInt(3_000_000), + power: 3, }, { name: "reporter 4", reporterIndex: 3, value: encodeValue(562926), + stakeAmount: math.NewInt(4_000_000), + power: 4, }, { name: "reporter 5", reporterIndex: 4, value: encodeValue(462926), + stakeAmount: math.NewInt(5_000_000), + power: 5, }, } - msgServer.Tip(s.ctx, &types.MsgTip{Tipper: accs[0].String(), QueryData: ethQueryData, Amount: sdk.NewCoin(s.denom, math.NewInt(1000))}) + msgServer.Tip(s.ctx, &types.MsgTip{Tipper: tipper.String(), QueryData: ethQueryData, Amount: sdk.NewCoin(s.denom, math.NewInt(1000))}) + addr := make([]sdk.AccAddress, len(reporters)) for _, r := range reporters { s.T().Run(r.name, func(t *testing.T) { + // create reporter + newReporter, err := createReporter(s.ctx, r.power, s.reporterkeeper) + s.Nil(err) + addr[r.reporterIndex] = newReporter salt, err := oracleutils.Salt(32) s.Nil(err) hash := oracleutils.CalculateCommitment(r.value, salt) s.Nil(err) - commit, reveal := report(accs[r.reporterIndex].String(), r.value, salt, hash, ethQueryData) + commit, reveal := report(newReporter.String(), r.value, salt, hash, ethQueryData) _, err = msgServer.CommitReport(s.ctx, &commit) s.Nil(err) _, err = msgServer.SubmitValue(s.ctx.WithBlockHeight(s.ctx.BlockHeight()+1), &reveal) @@ -203,7 +222,7 @@ func (s *IntegrationTestSuite) TestMedianReports() { res, err := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) s.Nil(err) expectedMedianReporterIndex := 4 - expectedMedianReporter := accs[expectedMedianReporterIndex].String() + expectedMedianReporter := addr[expectedMedianReporterIndex].String() s.Equal(expectedMedianReporter, res.Report.AggregateReporter) s.Equal(reporters[expectedMedianReporterIndex].value, res.Report.AggregateValue) } @@ -224,11 +243,11 @@ func report(creator, value, salt, hash, qdata string) (types.MsgCommitReport, ty } func (s *IntegrationTestSuite) TestGetCylceListQueries() { - s.oracleKeeper() accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) // Get supported queries - resp := s.oraclekeeper.GetCycleList(s.ctx) - s.Equal(resp, []string{ethQueryData[2:], btcQueryData[2:], trbQueryData[2:]}) + resp, err := s.oraclekeeper.Params.Get(s.ctx) + s.NoError(err) + s.Equal(resp.CycleList, []string{ethQueryData[2:], btcQueryData[2:], trbQueryData[2:]}) fakeQueryData := "000001" msgContent := &types.MsgUpdateParams{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), @@ -258,79 +277,112 @@ func (s *IntegrationTestSuite) TestGetCylceListQueries() { proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal1.Id) s.NoError(err) s.True(proposal1.Status == v1.StatusPassed) - resp = s.oraclekeeper.GetCycleList(s.ctx) - s.Equal(resp, []string{fakeQueryData}) + resp, err = s.oraclekeeper.Params.Get(s.ctx) + s.NoError(err) + s.Equal(resp.CycleList, []string{fakeQueryData}) } func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { - powers := []int64{100, 200, 300, 400} - accs, vals, _ := s.createValidatorAccs(powers) - // transfer tokens to distribution module + // send timebasedrewards tokens to oracle module to pay reporters with + tipper := s.newKeysWithTokens() reward := math.NewInt(100) - err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, accs[0], minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) + err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) s.NoError(err) - // report bypass commit/reveal - values := []string{"000001", "000002", "000003", "000004"} - // case 1: 1 reporter 1 report + + // testing for a query id and check if the reporter gets the reward, bypassing the commit/reveal process qId, err := utils.QueryIDFromDataString(ethQueryData) s.NoError(err) - reports := testutil.GenerateReports(accs, values, powers, hex.EncodeToString(qId)) - bal1 := s.bankKeeper.GetBalance(s.ctx, accs[0], s.denom) - s.oraclekeeper.WeightedMedian(s.ctx, reports[:1]) + value := []string{"000001"} + + reporterPower := int64(1) + addr, err := createReporter(s.ctx, 1, s.reporterkeeper) + s.NoError(err) + + reports := testutil.GenerateReports([]sdk.AccAddress{addr}, value, []int64{reporterPower}, hex.EncodeToString(qId)) + + bal1 := s.bankKeeper.GetBalance(s.ctx, addr, s.denom) + + _, err = s.oraclekeeper.WeightedMedian(s.ctx, reports[:1]) + s.NoError(err) res, err := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) s.NoError(err) - s.Equal(res.Report.AggregateReportIndex, int64(0)) - tbr, _ := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + s.Equal(res.Report.AggregateReportIndex, int64(0), "single report should be at index 0") + + tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) + s.NoError(err) + + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.distrKeeper.WithdrawDelegationRewards(s.ctx, accs[0], vals[0]) - bal2 := s.bankKeeper.GetBalance(s.ctx, accs[0], s.denom) - s.Equal(bal1.Amount.Add(reward), bal2.Amount) + amt, err := s.reporterkeeper.WithdrawDelegationRewards(s.ctx, addr.Bytes(), addr) + s.NoError(err) + s.True(amt.AmountOf(s.denom).GT(math.ZeroInt())) + + bal2 := s.bankKeeper.GetBalance(s.ctx, addr, s.denom) + s.Equal(bal1.Amount.Add(reward), bal2.Amount, "current balance should be equal to previous balance + reward") } func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { - powers := []int64{100, 200, 300, 400} - values := []string{"000001", "000002", "000003", "000004"} - accs, vals, _ := s.createValidatorAccs(powers) - reward := int64(100) - // transfer tokens to distribution module - s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, accs[0], minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, math.NewInt(reward)))) - // generate 4 reports for ethQueryData + // send timebasedrewards tokens to oracle module to pay reporters with + tipper := s.newKeysWithTokens() + reward := math.NewInt(100) + err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) + s.NoError(err) + qId, err := utils.QueryIDFromDataString(ethQueryData) s.NoError(err) - reports := testutil.GenerateReports(accs, values, powers, hex.EncodeToString(qId)) + value := []string{"000001", "000002"} + reporterPower1 := int64(1) + reporterPower2 := int64(2) + totalReporterPower := reporterPower1 + reporterPower2 + + reporterAddr, err := createReporter(s.ctx, 1, s.reporterkeeper) + s.NoError(err) + reporterAddr2, err := createReporter(s.ctx, 2, s.reporterkeeper) + s.NoError(err) + + // generate 2 reports for ethQueryData + reports := testutil.GenerateReports([]sdk.AccAddress{reporterAddr, reporterAddr2}, value, []int64{reporterPower1, reporterPower2}, hex.EncodeToString(qId)) + testCases := []struct { name string reporterIndex int beforeBalance sdk.Coin afterBalanceIncrease math.Int + delegator sdk.AccAddress }{ { - name: "reporter with 100 voting power", + name: "reporter with 1 voting power", reporterIndex: 0, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, accs[0], s.denom), - afterBalanceIncrease: keeper.CalculateRewardAmount(powers[0], 1, powers[0]+powers[1], math.NewInt(reward)), + beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr, s.denom), + afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower1, 1, totalReporterPower, reward), + delegator: reporterAddr, }, { - name: "reporter with 200 voting power", + name: "reporter with 2 voting power", reporterIndex: 1, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, accs[1], s.denom), - afterBalanceIncrease: keeper.CalculateRewardAmount(powers[1], 1, powers[0]+powers[1], math.NewInt(reward)), + beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr2, s.denom), + afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower2, 1, totalReporterPower, reward), + delegator: reporterAddr2, }, } - s.oraclekeeper.WeightedMedian(s.ctx, reports[:2]) + _, err = s.oraclekeeper.WeightedMedian(s.ctx, reports) + s.NoError(err) + + res, err := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) + s.NoError(err, "error getting aggregated report") + tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) + s.NoError(err, "error getting time based rewards") + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + s.NoError(err, "error allocating rewards") - res, _ := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) - tbr, _ := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - for _, tc := range testCases { s.T().Run(tc.name, func(t *testing.T) { - s.distrKeeper.WithdrawDelegationRewards(s.ctx, accs[tc.reporterIndex], vals[tc.reporterIndex]) - afterBalance := s.bankKeeper.GetBalance(s.ctx, accs[tc.reporterIndex], s.denom) + s.reporterkeeper.WithdrawDelegationRewards(s.ctx, tc.delegator.Bytes(), tc.delegator) + afterBalance := s.bankKeeper.GetBalance(s.ctx, tc.delegator, s.denom) s.Equal(tc.beforeBalance.Amount.Add(tc.afterBalanceIncrease), afterBalance.Amount) }) @@ -338,52 +390,72 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { } func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { - powers := []int64{100, 200, 300, 400} + + tipper := s.newKeysWithTokens() + reward := math.NewInt(100) + err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) + s.NoError(err) + values := []string{"000001", "000002", "000003", "000004"} - accs, vals, _ := s.createValidatorAccs(powers) - reward := int64(100) - // transfer tokens to distribution module - s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, accs[0], minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, math.NewInt(reward)))) + + reporterPower1 := int64(1) + reporterPower2 := int64(2) + reporterPower3 := int64(3) + totalPower := reporterPower1 + reporterPower2 + reporterPower3 + + reporterAddr, err := createReporter(s.ctx, 1, s.reporterkeeper) + s.NoError(err) + reporterAddr2, err := createReporter(s.ctx, 2, s.reporterkeeper) + s.NoError(err) + reporterAddr3, err := createReporter(s.ctx, 3, s.reporterkeeper) + s.NoError(err) + // generate 4 reports for ethQueryData qId, err := utils.QueryIDFromDataString(ethQueryData) s.NoError(err) - reports := testutil.GenerateReports(accs, values, powers, hex.EncodeToString(qId)) + reports := testutil.GenerateReports([]sdk.AccAddress{reporterAddr, reporterAddr2, reporterAddr3}, values, []int64{reporterPower1, reporterPower2, reporterPower3}, hex.EncodeToString(qId)) + testCases := []struct { name string reporterIndex int beforeBalance sdk.Coin afterBalanceIncrease math.Int + delegator sdk.AccAddress }{ { name: "reporter with 100 voting power", reporterIndex: 0, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, accs[0], s.denom), - afterBalanceIncrease: keeper.CalculateRewardAmount(powers[0], 1, powers[0]+powers[1]+powers[2], math.NewInt(reward)), + beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr, s.denom), + afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower1, 1, totalPower, reward), + delegator: reporterAddr, }, { name: "reporter with 200 voting power", reporterIndex: 1, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, accs[1], s.denom), - afterBalanceIncrease: keeper.CalculateRewardAmount(powers[1], 1, powers[0]+powers[1]+powers[2], math.NewInt(reward)), + beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr2, s.denom), + afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower2, 1, totalPower, reward), + delegator: reporterAddr2, }, { name: "reporter with 300 voting power", reporterIndex: 2, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, accs[2], s.denom), - afterBalanceIncrease: keeper.CalculateRewardAmount(powers[2], 1, powers[0]+powers[1]+powers[2], math.NewInt(reward)), + beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr3, s.denom), + afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower3, 1, totalPower, reward), + delegator: reporterAddr3, }, } s.oraclekeeper.WeightedMedian(s.ctx, reports[:3]) res, _ := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) tbr, _ := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) for _, tc := range testCases { s.T().Run(tc.name, func(t *testing.T) { - s.distrKeeper.WithdrawDelegationRewards(s.ctx, accs[tc.reporterIndex], vals[tc.reporterIndex]) - afterBalance := s.bankKeeper.GetBalance(s.ctx, accs[tc.reporterIndex], s.denom) + s.reporterkeeper.WithdrawDelegationRewards(s.ctx, tc.delegator.Bytes(), tc.delegator) + afterBalance := s.bankKeeper.GetBalance(s.ctx, tc.delegator, s.denom) expectedAfterBalance := tc.beforeBalance.Amount.Add(tc.afterBalanceIncrease) tolerance := expectedAfterBalance.SubRaw(1) //due to rounding int withinTolerance := expectedAfterBalance.Equal(afterBalance.Amount) || tolerance.Equal(afterBalance.Amount) @@ -394,18 +466,21 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { } func (s *IntegrationTestSuite) TestCommitQueryMixed() { - _, msgServer := s.oracleKeeper() - accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) - tip := sdk.NewCoin(s.denom, math.NewInt(1000)) - queryData1 := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + tipper := s.newKeysWithTokens() + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + // accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) + queryData1, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + s.Nil(err) queryData2 := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000056D6174696300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" queryData3 := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005737465746800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" msg := types.MsgTip{ - Tipper: accs[0].String(), + Tipper: tipper.String(), QueryData: queryData2, - Amount: tip, + Amount: sdk.NewCoin(s.denom, math.NewInt(1000)), } - _, err := msgServer.Tip(s.ctx, &msg) + _, err = msgServer.Tip(s.ctx, &msg) + s.Nil(err) + reporterAddr, err := createReporter(s.ctx, 1, s.reporterkeeper) s.Nil(err) value := "000000000000000000000000000000000000000000000058528649cf80ee0000" salt, err := oracleutils.Salt(32) @@ -413,15 +488,15 @@ func (s *IntegrationTestSuite) TestCommitQueryMixed() { hash := oracleutils.CalculateCommitment(value, salt) s.Nil(err) // commit report with query data in cycle list - commit, _ := report(accs[0].String(), value, salt, hash, queryData1) + commit, _ := report(reporterAddr.String(), value, salt, hash, queryData1) _, err = msgServer.CommitReport(s.ctx, &commit) s.Nil(err) // commit report with query data not in cycle list but has a tip - commit, _ = report(accs[0].String(), value, salt, hash, queryData2) + commit, _ = report(reporterAddr.String(), value, salt, hash, queryData2) _, err = msgServer.CommitReport(s.ctx, &commit) s.Nil(err) // commit report with query data not in cycle list and has no tip - commit, _ = report(accs[0].String(), value, salt, hash, queryData3) + commit, _ = report(reporterAddr.String(), value, salt, hash, queryData3) _, err = msgServer.CommitReport(s.ctx, &commit) - s.ErrorContains(err, "query data does not have tips/not in cycle") + s.ErrorContains(err, "query does not have tips and is not in cycle") } diff --git a/tests/integration/reporter_keeper_test.go b/tests/integration/reporter_keeper_test.go index 4cc1ab175..099f0a18c 100644 --- a/tests/integration/reporter_keeper_test.go +++ b/tests/integration/reporter_keeper_test.go @@ -4,17 +4,11 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/tellor-io/layer/testutil/sample" "github.com/tellor-io/layer/x/reporter/keeper" reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -/* -Need: -reporter Address: delegated stake with a validator 100*1e6 tokens -4-delegators staked with validator(100*1e6 tokens) that will delegate their tokens (25*1e6 tokens) tokens with the reporter -1-What happens when delegator removes delegation(10(shouldn't affect reporter), and 76(should affect reporter)) from validator? What to reporter, delegation? -2- -*/ const ( reporter = "reporter" delegatorI = "delegator1" @@ -53,7 +47,7 @@ func (s *IntegrationTestSuite) TestRegisteringReporterDelegators() map[string]De delegators = s.createdelegators(delegators) // register reporter in reporter module - commission := stakingtypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), + commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) source := reportertypes.TokenOrigin{ValidatorAddress: val.GetOperator(), Amount: math.NewIntFromUint64(100 * 1e6)} @@ -201,3 +195,35 @@ func (s *IntegrationTestSuite) TestDelegatorIundelegatesFromReporter() { s.NoError(err) s.Equal(oracleReporter.TotalTokens, math.NewInt(175*1e6)) } + +func callrewardHooks(ctx sdk.Context, k keeper.Keeper, delegator sdk.AccAddress, stake math.Int, reporterAddr sdk.AccAddress, reporter reportertypes.OracleReporter) error { + err := k.AfterReporterCreated(ctx, reporter) + if err != nil { + return err + } + err = k.BeforeDelegationCreated(ctx, reporter) + if err != nil { + return err + } + return k.AfterDelegationModified(ctx, delegator, reporterAddr.Bytes(), stake) +} + +func createReporter(ctx sdk.Context, power int64, k keeper.Keeper) (sdk.AccAddress, error) { + reporterAddr := sample.AccAddressBytes() + stake := sdk.DefaultPowerReduction.MulRaw(power) + reporter := reportertypes.NewOracleReporter(reporterAddr.String(), stake, &stakingtypes.Commission{}) + err := k.Reporters.Set(ctx, reporterAddr, reporter) + if err != nil { + return nil, err + } + delegator := reportertypes.NewDelegation(reporterAddr.String(), stake) + err = k.Delegators.Set(ctx, reporterAddr, delegator) + if err != nil { + return nil, err + } + err = callrewardHooks(ctx, k, reporterAddr, delegator.Amount, reporterAddr, reporter) + if err != nil { + return nil, err + } + return reporterAddr, nil +} diff --git a/tests/setup.go b/tests/setup.go index ff234618f..59fb7e4d8 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -37,6 +37,7 @@ func AuthModule() configurator.ModuleOption { {Account: "not_bonded_tokens_pool", Permissions: []string{"burner", "staking"}}, {Account: "gov", Permissions: []string{"burner"}}, {Account: "nft"}, + {Account: "reporter"}, }, }), } diff --git a/x/dispute/module.go b/x/dispute/module.go index 2069992e3..fcdf85f9e 100644 --- a/x/dispute/module.go +++ b/x/dispute/module.go @@ -163,7 +163,7 @@ func (am AppModule) BeginBlock(ctx context.Context) error { // App Wiring Setup // ---------------------------------------------------------------------------- -func AppWiringSetup() { +func init() { appmodule.Register(&disputemodulev1.Module{}, appmodule.Provide(ProvideModule)) diff --git a/x/oracle/module.go b/x/oracle/module.go index 7ce898867..b7aef1002 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -166,7 +166,7 @@ func (am AppModule) EndBlock(ctx context.Context) error { // App Wiring Setup // ---------------------------------------------------------------------------- -func AppWiringSetup() { +func init() { appmodule.Register(&oraclemodulev1.Module{}, appmodule.Provide(ProvideModule)) From a8d97b5080527eb8b591305e5a6af8cf8961eec2 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 27 Feb 2024 21:38:38 -0500 Subject: [PATCH 06/31] allocate reward as stake plus test --- tests/integration/keeper_test.go | 6 +- tests/integration/oracle_keeper_test.go | 120 +++++++++++++++++- tests/integration/reporter_keeper_test.go | 59 ++++++++- x/oracle/keeper/aggregate.go | 70 +++++----- x/oracle/keeper/cycle_list.go | 19 +++ .../keeper/query_get_aggregated_report.go | 8 +- x/oracle/keeper/time_based_rewards.go | 67 +++++++--- x/oracle/keeper/time_based_rewards_test.go | 14 +- x/oracle/keeper/weighted_median.go | 5 +- x/oracle/keeper/weighted_mode.go | 11 +- x/oracle/keeper/weighted_mode_test.go | 3 +- x/oracle/mocks/ReporterKeeper.go | 16 +++ x/oracle/types/errors.go | 2 + x/oracle/types/expected_keepers.go | 3 + x/reporter/keeper/distribution.go | 61 +++++++++ x/reporter/keeper/indexes.go | 29 +++++ x/reporter/keeper/indexes_test.go | 57 +++++++++ x/reporter/keeper/keeper.go | 4 +- x/reporter/mocks/StakingKeeper.go | 26 ++++ x/reporter/types/expected_keepers.go | 4 + x/reporter/types/keys.go | 1 + 21 files changed, 505 insertions(+), 80 deletions(-) create mode 100644 x/reporter/keeper/indexes.go create mode 100644 x/reporter/keeper/indexes_test.go diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index fe377d5a6..232e4604a 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -233,7 +233,7 @@ func (s *IntegrationTestSuite) createValidators(powers []int64) ([]sdk.AccAddres base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) amount := new(big.Int).Mul(big.NewInt(1000), base) testAddrs := simtestutil.CreateIncrementalAccounts(acctNum) - addrs := s.addTestAddrs(acctNum, math.NewIntFromBigInt(amount), testAddrs) + addrs := s.addTestAddrs(math.NewIntFromBigInt(amount), testAddrs) valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) pks := simtestutil.CreateTestPubKeys(acctNum) @@ -254,7 +254,7 @@ func (s *IntegrationTestSuite) createValidators(powers []int64) ([]sdk.AccAddres return addrs, valAddrs } -func (s *IntegrationTestSuite) addTestAddrs(accNum int, accAmt math.Int, testAddrs []sdk.AccAddress) []sdk.AccAddress { +func (s *IntegrationTestSuite) addTestAddrs(accAmt math.Int, testAddrs []sdk.AccAddress) []sdk.AccAddress { initCoins := sdk.NewCoin(s.denom, accAmt) for _, addr := range testAddrs { s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) @@ -300,7 +300,7 @@ func (s *IntegrationTestSuite) createValidatorAccs(powers []int64) ([]sdk.AccAdd amount := new(big.Int).Mul(big.NewInt(1000), base) privKeys := CreateRandomPrivateKeys(acctNum) testAddrs := s.convertToAccAddress(privKeys) - addrs := s.addTestAddrs(acctNum, math.NewIntFromBigInt(amount), testAddrs) + addrs := s.addTestAddrs(math.NewIntFromBigInt(amount), testAddrs) valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) for i, pk := range privKeys { diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index 77d05aadf..73165d700 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -23,6 +23,7 @@ import ( "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/types" oracleutils "github.com/tellor-io/layer/x/oracle/utils" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) func (s *IntegrationTestSuite) TestTipping() { @@ -311,7 +312,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err) - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateTBRRewards(s.ctx, res.Report.Reporters, tbr.Reward) s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) @@ -374,7 +375,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { s.NoError(err, "error getting aggregated report") tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err, "error getting time based rewards") - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateTBRRewards(s.ctx, res.Report.Reporters, tbr.Reward) s.NoError(err, "error allocating rewards") // advance height @@ -448,7 +449,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { res, _ := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) tbr, _ := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateTBRRewards(s.ctx, res.Report.Reporters, tbr.Reward) s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) @@ -500,3 +501,116 @@ func (s *IntegrationTestSuite) TestCommitQueryMixed() { _, err = msgServer.CommitReport(s.ctx, &commit) s.ErrorContains(err, "query does not have tips and is not in cycle") } + +// test tipping a query id not in cycle list and observe the reporters' delegators stake increase in staking module +func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + repAccs := s.CreateAccountsWithTokens(2, 100*1e6) + + stakeAmount := math.NewInt(100 * 1e6) + tipAmount := math.NewInt(1000) + + tipper := repAccs[0] + repAcc := repAccs[1] + valAddr := valAddrs[0] + delegators := repAccs[1:] + + queryData := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000366696C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + queryId, err := utils.QueryIDFromDataString(queryData) + s.Nil(err) + + // tip. Using msgServer.Tip to handle the transfers and burning of tokens + msg := types.MsgTip{ + Tipper: tipper.String(), + QueryData: queryData, + Amount: sdk.NewCoin(s.denom, tipAmount), + } + _, err = msgServer.Tip(s.ctx, &msg) + s.Nil(err) + + // create createReporterStakedWithValidator handles the delegation and staking plus the reporter creation + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + _, err = createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + s.Nil(err) + + // check delegation shares before reporting, should be equal to the stake amount + delBefore, err := s.stakingKeeper.Delegation(s.ctx, repAcc.Bytes(), valAddr) + s.Nil(err) + s.True(delBefore.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation shares should be equal to the stake amount") + + reporterPower := int64(1) + value := []string{"000001"} + reports := testutil.GenerateReports(repAccs[1:], value, []int64{reporterPower}, hex.EncodeToString(queryId)) + + err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), s.ctx.BlockHeight()), reports[0]) + s.Nil(err) + err = s.oraclekeeper.SetAggregatedReport(s.ctx) + s.Nil(err) + // delegation shares should increase after reporting + delAfter, err := s.stakingKeeper.Delegation(s.ctx, repAcc.Bytes(), valAddr) + s.Nil(err) + s.True(delAfter.GetShares().Equal(delBefore.GetShares().Add(math.LegacyNewDec(980))), "delegation shares should the tip added") // 1000 - 2% tip +} + +func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + accs := s.CreateAccountsWithTokens(3, 100*1e6) + + stakeAmount := math.NewInt(100 * 1e6) + tipAmount := math.NewInt(1000) + + tipper := accs[0] + repAcc := accs[1] + valAddr := valAddrs[0] + delegators := accs[1:] + delegator1 := accs[1] + delegator2 := accs[2] + + queryData := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000366696C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + queryId, err := utils.QueryIDFromDataString(queryData) + s.Nil(err) + + // tip. Using msgServer.Tip to handle the transfers and burning of tokens + msg := types.MsgTip{ + Tipper: tipper.String(), + QueryData: queryData, + Amount: sdk.NewCoin(s.denom, tipAmount), + } + _, err = msgServer.Tip(s.ctx, &msg) + s.Nil(err) + + // create createReporterStakedWithValidator handles the delegation and staking plus the reporter creation with 50 percent commission + commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), s.ctx.BlockTime()) + _, err = createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + s.Nil(err) + err = DelegateToReporterSingleValidator(s.ctx, s.reporterkeeper, repAcc, delegator2, valAddr, stakeAmount) + s.Nil(err) + + // check delegation shares before reporting, should be equal to the stake amount + del1Before, err := s.stakingKeeper.Delegation(s.ctx, delegator1.Bytes(), valAddr) + s.Nil(err) + s.True(del1Before.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation 1 shares should be equal to the stake amount") + + del2Before, err := s.stakingKeeper.Delegation(s.ctx, delegator2.Bytes(), valAddr) + s.Nil(err) + s.True(del2Before.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation 2 shares should be equal to the stake amount") + + reporterPower := int64(2) // normalize by sdk.DefaultPowerReduction + value := []string{"000001"} + reports := testutil.GenerateReports([]sdk.AccAddress{repAcc}, value, []int64{reporterPower}, hex.EncodeToString(queryId)) + + err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), s.ctx.BlockHeight()), reports[0]) + s.Nil(err) + err = s.oraclekeeper.SetAggregatedReport(s.ctx) + s.Nil(err) + // delegation shares should increase after reporting + del1After, err := s.stakingKeeper.Delegation(s.ctx, delegator1.Bytes(), valAddr) + s.Nil(err) + // 980 = 1000 - 2% tip, 980 / 2 = 490 for each delegator but with 50 percent commission for the reporter would be 490 + (490 / 2) = 735 + s.True(del1After.GetShares().Equal(del1Before.GetShares().Add(math.LegacyNewDec(735))), "delegation 1 (self delegation) shares should be half the tip plus 50 percent commission") + del2After, err := s.stakingKeeper.Delegation(s.ctx, delegator2.Bytes(), valAddr) + s.Nil(err) + s.True(del2After.GetShares().Equal(del2Before.GetShares().Add(math.LegacyNewDec(245))), "delegation 2 shares should be half the tip minus 50 percent reporter commission") +} diff --git a/tests/integration/reporter_keeper_test.go b/tests/integration/reporter_keeper_test.go index 099f0a18c..72a107f31 100644 --- a/tests/integration/reporter_keeper_test.go +++ b/tests/integration/reporter_keeper_test.go @@ -1,6 +1,8 @@ package integration_test import ( + "fmt" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -23,12 +25,14 @@ type Delegator struct { tokenAmount math.Int } -func (s *IntegrationTestSuite) createdelegators(delegators map[string]Delegator) map[string]Delegator { +func createdelegators(ctx sdk.Context, delegators map[string]Delegator, sk reportertypes.StakingKeeper) (map[string]Delegator, error) { for _, del := range delegators { - _, err := s.stakingKeeper.Delegate(s.ctx, del.delegatorAddress, del.tokenAmount, stakingtypes.Unbonded, del.validator, true) - s.NoError(err) + _, err := sk.Delegate(ctx, del.delegatorAddress, del.tokenAmount, stakingtypes.Unbonded, del.validator, true) + if err != nil { + return nil, err + } } - return delegators + return delegators, nil } func (s *IntegrationTestSuite) TestRegisteringReporterDelegators() map[string]Delegator { @@ -44,7 +48,8 @@ func (s *IntegrationTestSuite) TestRegisteringReporterDelegators() map[string]De delegatorIII: {delegatorAddress: delAcc[3], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, delegatorIV: {delegatorAddress: delAcc[4], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, } - delegators = s.createdelegators(delegators) + delegators, err = createdelegators(s.ctx, delegators, s.stakingKeeper) + s.NoError(err) // register reporter in reporter module commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), @@ -227,3 +232,47 @@ func createReporter(ctx sdk.Context, power int64, k keeper.Keeper) (sdk.AccAddre } return reporterAddr, nil } + +func createReporterStakedWithValidator(ctx sdk.Context, k keeper.Keeper, sk reportertypes.StakingKeeper, valAddr sdk.ValAddress, delAcc []sdk.AccAddress, commission stakingtypes.Commission, stake math.Int) (*reportertypes.MsgCreateReporter, error) { + val, err := sk.GetValidator(ctx, valAddr) + if err != nil { + return nil, err + } + // create delegator funded accounts + delegators := make(map[string]Delegator, len(delAcc)) + for i, addr := range delAcc { + key := fmt.Sprintf("delegator%d", i) + delegators[key] = Delegator{delegatorAddress: addr, validator: val, tokenAmount: stake} + + } + + delegators, err = createdelegators(ctx, delegators, sk) + if err != nil { + return nil, err + } + + source := reportertypes.TokenOrigin{ValidatorAddress: val.GetOperator(), Amount: stake} + createReporterMsg := reportertypes.NewMsgCreateReporter(delegators["delegator0"].delegatorAddress.String(), stake, []*reportertypes.TokenOrigin{&source}, &commission) + server := keeper.NewMsgServerImpl(k) + _, err = server.CreateReporter(ctx, createReporterMsg) + if err != nil { + return nil, err + } + return createReporterMsg, nil +} + +func DelegateToReporterSingleValidator(ctx sdk.Context, k keeper.Keeper, repAddr sdk.AccAddress, delAddr sdk.AccAddress, valAddr sdk.ValAddress, stake math.Int) error { + source := reportertypes.TokenOrigin{ValidatorAddress: valAddr.String(), Amount: stake} + delegation := reportertypes.NewMsgDelegateReporter( + delAddr.String(), + repAddr.String(), + stake, + []*reportertypes.TokenOrigin{&source}, + ) + server := keeper.NewMsgServerImpl(k) + _, err := server.DelegateReporter(ctx, delegation) + if err != nil { + return err + } + return err +} diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 1fb9dccdd..22c8bee64 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -4,7 +4,7 @@ import ( "context" "encoding/hex" "errors" - "fmt" + "strings" "time" "cosmossdk.io/collections" @@ -12,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" - regtypes "github.com/tellor-io/layer/x/registry/types" ) // SetAggregatedReport calculates and allocates rewards to reporters based on aggregated reports. @@ -50,55 +49,54 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { // Prepare a list to keep track of reporters who are eligible for tbr. reportersToPay := make([]*types.AggregateReporter, 0) - + cycleList, err := k.CycleListAsQueryIds(ctx) + if err != nil { + return err + } // Process each set of reports based on their aggregation method. for queryIdStr, reports := range revealedReportsByQueryID { // Handle weighted-median aggregation method. + var aggrFunc func(ctx sdk.Context, reports []types.MicroReport) (*types.Aggregate, error) if reports[0].AggregateMethod == "weighted-median" { // Calculate the aggregated report. - report, err := k.WeightedMedian(ctx, reports) + aggrFunc = k.WeightedMedian + } else { + // default to weighted-mode aggregation method. + // Calculate the aggregated report. + aggrFunc = k.WeightedMode + } + report, err := aggrFunc(ctx, reports) + if err != nil { + return err + } + + // Get the tip for this query. + queryIdBytes, err := hex.DecodeString(queryIdStr) + if err != nil { + return err + } + tip := k.GetQueryTip(ctx, queryIdBytes) + // Allocate rewards if there is a tip. + if !tip.Amount.IsZero() { + err = k.AllocateRewardsToStake(ctx, report.Reporters, tip) if err != nil { return err } - // Get the tip for this query. - tip := k.GetQueryTip(ctx, []byte(queryIdStr)) - // Allocate rewards if there is a tip. - if !tip.Amount.IsZero() { - err = k.AllocateRewards(ctx, report.Reporters, tip) - if err != nil { - return err - } - } - // Add reporters to the tbr payment list. - reportersToPay = append(reportersToPay, report.Reporters...) } - - // Handle weighted-mode aggregation method. - if reports[0].AggregateMethod == "weighted-mode" { - // Calculate the aggregated report. - report := k.WeightedMode(ctx, reports) - // Get the tip for this query. - tip := k.GetQueryTip(ctx, []byte(queryIdStr)) - // Allocate rewards if there is a tip. - if !tip.Amount.IsZero() { - err = k.AllocateRewards(ctx, report.Reporters, tip) - if err != nil { - return err - } - } - // Add reporters to the tbr payment list. + // Add reporters to the tbr payment list. + if cycleList[strings.ToLower(queryIdStr)] { reportersToPay = append(reportersToPay, report.Reporters...) } + } // Process time-based rewards for reporters. tbr := k.getTimeBasedRewards(ctx) // Allocate time-based rewards to all eligible reporters. - return k.AllocateRewards(ctx, reportersToPay, tbr) + return k.AllocateTBRRewards(ctx, reportersToPay, tbr) } func (k Keeper) SetAggregate(ctx sdk.Context, report *types.Aggregate) error { - report.QueryId = regtypes.Remove0xPrefix(report.QueryId) queryId, err := utils.QueryIDFromString(report.QueryId) if err != nil { return err @@ -139,13 +137,13 @@ func (k Keeper) getDataBefore(ctx sdk.Context, queryId []byte, timestamp time.Ti } if mostRecent == nil { - return nil, fmt.Errorf("no data before timestamp %v available for query id %s", timestamp, hex.EncodeToString(queryId)) + return nil, types.ErrNoAvailableReports.Wrapf("no data before timestamp %v available for query id %s", timestamp, hex.EncodeToString(queryId)) } return mostRecent, nil } -func (k Keeper) GetCurrentValueForQueryId(ctx context.Context, queryId []byte) *types.Aggregate { +func (k Keeper) GetCurrentValueForQueryId(ctx context.Context, queryId []byte) (*types.Aggregate, error) { rng := collections.NewPrefixedPairRange[[]byte, int64](queryId).Descending() var mostRecent *types.Aggregate // This should get us the most recent aggregate, as they are walked in descending order @@ -155,8 +153,8 @@ func (k Keeper) GetCurrentValueForQueryId(ctx context.Context, queryId []byte) * }) if err != nil { - panic(err) + return nil, err } - return mostRecent + return mostRecent, nil } diff --git a/x/oracle/keeper/cycle_list.go b/x/oracle/keeper/cycle_list.go index f1f10ed74..091205c0e 100644 --- a/x/oracle/keeper/cycle_list.go +++ b/x/oracle/keeper/cycle_list.go @@ -1,10 +1,13 @@ package keeper import ( + "encoding/hex" "errors" + "strings" "cosmossdk.io/collections" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tellor-io/layer/utils" ) // rotation what query is next @@ -46,3 +49,19 @@ func (k Keeper) GetCurrentQueryInCycleList(ctx sdk.Context) (string, error) { } return params.CycleList[currentIndex], nil } + +func (k Keeper) CycleListAsQueryIds(ctx sdk.Context) (map[string]bool, error) { + params, err := k.Params.Get(ctx) + if err != nil { + return nil, err + } + queryIds := make(map[string]bool, len(params.CycleList)) + for _, q := range params.CycleList { + queryId, err := utils.QueryIDFromDataString(q) + if err != nil { + return nil, err + } + queryIds[strings.ToLower(hex.EncodeToString(queryId))] = true + } + return queryIds, nil +} diff --git a/x/oracle/keeper/query_get_aggregated_report.go b/x/oracle/keeper/query_get_aggregated_report.go index d8bdb5d9f..be9525840 100644 --- a/x/oracle/keeper/query_get_aggregated_report.go +++ b/x/oracle/keeper/query_get_aggregated_report.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" @@ -20,9 +19,12 @@ func (k Keeper) GetAggregatedReport(goCtx context.Context, req *types.QueryGetCu panic(err) } - mostRecent := k.GetCurrentValueForQueryId(goCtx, queryId) + mostRecent, err := k.GetCurrentValueForQueryId(goCtx, queryId) + if err != nil { + return nil, err + } if mostRecent == nil { - return nil, fmt.Errorf("no available timestamps") + return nil, types.ErrNoAvailableReports.Wrapf("no reports available for query id %s", req.QueryId) } return &types.QueryGetAggregatedReportResponse{Report: mostRecent}, nil } diff --git a/x/oracle/keeper/time_based_rewards.go b/x/oracle/keeper/time_based_rewards.go index fe51bca50..e0c3ed5a7 100644 --- a/x/oracle/keeper/time_based_rewards.go +++ b/x/oracle/keeper/time_based_rewards.go @@ -3,13 +3,13 @@ package keeper import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" minttypes "github.com/tellor-io/layer/x/mint/types" "github.com/tellor-io/layer/x/oracle/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -type ValidatorReportCount struct { +type ReportersReportCount struct { Power int64 Reports int } @@ -17,11 +17,11 @@ type ValidatorReportCount struct { // AllocateRewards distributes rewards to reporters based on their power and number of reports. // It calculates the reward amount for each reporter and allocates the rewards to the corresponding validator. // Finally, it sends the allocated rewards to the distribution module. -func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) error { +func (k Keeper) AllocateTBRRewards(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) error { // Initialize totalPower to keep track of the total power of all reporters. totalPower := int64(0) // reportCounts maps reporter's address to their ValidatorReportCount. - reportCounts := make(map[string]ValidatorReportCount) + reportCounts := make(map[string]ReportersReportCount) // Loop through each reporter to calculate total power and individual report counts. for _, r := range reporters { @@ -31,7 +31,7 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep reporter.Reports++ } else { // If not found, add the reporter with their initial power and report count set to 1. - reporter = ValidatorReportCount{Power: r.Power, Reports: 1} + reporter = ReportersReportCount{Power: r.Power, Reports: 1} } reportCounts[r.Reporter] = reporter // Add the reporter's power to the total power. @@ -45,8 +45,7 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, tip.Amount) rewards[r] = sdk.NewDecCoins(sdk.NewDecCoin(tip.Denom, amount)) } - toDistr := sdk.NewCoins() - var err error + transferAmt := sdk.NewCoins() // Allocate calculated rewards to the corresponding reporters. for rep, reward := range rewards { repoterAddr, err := sdk.AccAddressFromBech32(rep) @@ -58,14 +57,16 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep return err } coin, _ := reward.TruncateDecimal() - toDistr = toDistr.Add(coin...) + transferAmt = transferAmt.Add(coin...) } - // If there are rewards to distribute, send them to the distribution module. - if !toDistr.IsZero() { - // Once rewards are allocated, send them to the distribution module. - err = k.bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.TimeBasedRewards, distrtypes.ModuleName, toDistr) + // If there are rewards to distribute, send them to the reporter module. + if !transferAmt.IsZero() { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.TimeBasedRewards, reportertypes.ModuleName, transferAmt) + if err != nil { + return err + } } - return err + return nil } func (k Keeper) getTimeBasedRewards(ctx sdk.Context) sdk.Coin { @@ -73,7 +74,7 @@ func (k Keeper) getTimeBasedRewards(ctx sdk.Context) sdk.Coin { return k.bankKeeper.GetBalance(ctx, tbrAccount.GetAddress(), types.DefaultBondDenom) } -func (k Keeper) getTimeBasedRewardsAccount(ctx sdk.Context) authtypes.ModuleAccountI { +func (k Keeper) getTimeBasedRewardsAccount(ctx sdk.Context) sdk.ModuleAccountI { return k.accountKeeper.GetModuleAccount(ctx, minttypes.TimeBasedRewards) } @@ -82,3 +83,39 @@ func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward amount := power.Quo(math.LegacyNewDec(totalPower)).MulTruncate(math.LegacyNewDecFromBigInt(reward.BigInt())) return amount.RoundInt() } + +func (k Keeper) AllocateRewardsToStake(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) error { + // Initialize totalPower to keep track of the total power of all reporters. + totalPower := int64(0) + // reportCounts maps reporter's address to their ValidatorReportCount. + reportCounts := make(map[string]ReportersReportCount) + + // Loop through each reporter to calculate total power and individual report counts. + for _, r := range reporters { + reporter, found := reportCounts[r.Reporter] + if found { + // If the reporter is already in the map, increment their report count. + reporter.Reports++ + } else { + // If not found, add the reporter with their initial power and report count set to 1. + reporter = ReportersReportCount{Power: r.Power, Reports: 1} + } + reportCounts[r.Reporter] = reporter + // Add the reporter's power to the total power. + totalPower += r.Power + } + // Calculate rewards for each reporter based on their power and report counts. + for r, c := range reportCounts { + amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, tip.Amount) + repAddr, err := sdk.AccAddressFromBech32(r) + if err != nil { + return err + } + err = k.reporterKeeper.AllocateRewardsToStake(ctx, repAddr, amount) + if err != nil { + return err + } + } + + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(tip)) +} diff --git a/x/oracle/keeper/time_based_rewards_test.go b/x/oracle/keeper/time_based_rewards_test.go index e07b3f68d..8398a34f9 100644 --- a/x/oracle/keeper/time_based_rewards_test.go +++ b/x/oracle/keeper/time_based_rewards_test.go @@ -14,7 +14,7 @@ var reward = math.NewInt(100) func TestCalculateRewardAmount(t *testing.T) { testCases := []struct { name string - reporter []keeper.ValidatorReportCount + reporter []keeper.ReportersReportCount reporterPowers []int64 totalPower int64 reportsCount int64 @@ -22,38 +22,38 @@ func TestCalculateRewardAmount(t *testing.T) { }{ { name: "Test all reporters report", - reporter: []keeper.ValidatorReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 1}, {Power: 30, Reports: 1}, {Power: 40, Reports: 1}}, + reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 1}, {Power: 30, Reports: 1}, {Power: 40, Reports: 1}}, expectedAmount: []math.Int{math.NewInt(10), math.NewInt(20), math.NewInt(30), math.NewInt(40)}, totalPower: 100, // 40 + 30 + 20 + 10 }, { name: "only 1 reports", - reporter: []keeper.ValidatorReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 0}, {Power: 30, Reports: 0}, {Power: 40, Reports: 0}}, + reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 0}, {Power: 30, Reports: 0}, {Power: 40, Reports: 0}}, expectedAmount: []math.Int{math.NewInt(100), math.NewInt(0), math.NewInt(0), math.NewInt(0)}, totalPower: 10, }, { name: "only 1 and 3 reports one report, a single queryId", - reporter: []keeper.ValidatorReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 0}, {Power: 30, Reports: 1}, {Power: 40, Reports: 0}}, + reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 1}, {Power: 20, Reports: 0}, {Power: 30, Reports: 1}, {Power: 40, Reports: 0}}, expectedAmount: []math.Int{math.NewInt(25), math.NewInt(0), math.NewInt(75), math.NewInt(0)}, totalPower: 40, // 30 + 10 }, { name: "all reporters report, a two queryIds", - reporter: []keeper.ValidatorReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 2}, {Power: 30, Reports: 2}, {Power: 40, Reports: 2}}, + reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 2}, {Power: 30, Reports: 2}, {Power: 40, Reports: 2}}, expectedAmount: []math.Int{math.NewInt(10), math.NewInt(20), math.NewInt(30), math.NewInt(40)}, totalPower: 200, }, { name: "all reporters report single, and 1 reports two queryIds", - reporter: []keeper.ValidatorReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 1}, {Power: 30, Reports: 1}, {Power: 40, Reports: 1}}, + reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 1}, {Power: 30, Reports: 1}, {Power: 40, Reports: 1}}, expectedAmount: []math.Int{math.NewInt(18), math.NewInt(18), math.NewInt(27), math.NewInt(36)}, totalPower: 110, // 40 + 30 + 20 + (10 * 2) }, { name: "all reporters report single, 1 and 3 report a second queryId", - reporter: []keeper.ValidatorReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 1}, {Power: 30, Reports: 2}, {Power: 40, Reports: 1}}, + reporter: []keeper.ReportersReportCount{{Power: 10, Reports: 2}, {Power: 20, Reports: 1}, {Power: 30, Reports: 2}, {Power: 40, Reports: 1}}, expectedAmount: []math.Int{math.NewInt(14), math.NewInt(14), math.NewInt(43), math.NewInt(29)}, totalPower: 140, // 40 + (30 * 2) + 20 + (10 * 2) }, diff --git a/x/oracle/keeper/weighted_median.go b/x/oracle/keeper/weighted_median.go index a4fa9749a..bbfe7dc9b 100644 --- a/x/oracle/keeper/weighted_median.go +++ b/x/oracle/keeper/weighted_median.go @@ -66,6 +66,9 @@ func (k Keeper) WeightedMedian(ctx sdk.Context, reports []types.MicroReport) (*t weightedStdDev := math.Sqrt(sumWeightedSquaredDiffs / float64(totalReporterPower.Int64())) medianReport.StandardDeviation = weightedStdDev - k.SetAggregate(ctx, &medianReport) + err := k.SetAggregate(ctx, &medianReport) + if err != nil { + return nil, err + } return &medianReport, nil } diff --git a/x/oracle/keeper/weighted_mode.go b/x/oracle/keeper/weighted_mode.go index b11f91b54..a6ef86cba 100644 --- a/x/oracle/keeper/weighted_mode.go +++ b/x/oracle/keeper/weighted_mode.go @@ -5,9 +5,9 @@ import ( "github.com/tellor-io/layer/x/oracle/types" ) -func (k Keeper) WeightedMode(ctx sdk.Context, reports []types.MicroReport) *types.Aggregate { +func (k Keeper) WeightedMode(ctx sdk.Context, reports []types.MicroReport) (*types.Aggregate, error) { if len(reports) == 0 { - return nil + return nil, types.ErrNoReportsToAggregate.Wrapf("can't aggregate empty reports") } var modeReport types.MicroReport @@ -56,6 +56,9 @@ func (k Keeper) WeightedMode(ctx sdk.Context, reports []types.MicroReport) *type AggregateReportIndex: modeReportIndex, } - k.SetAggregate(ctx, &aggregateReport) - return &aggregateReport + err := k.SetAggregate(ctx, &aggregateReport) + if err != nil { + return nil, err + } + return &aggregateReport, nil } diff --git a/x/oracle/keeper/weighted_mode_test.go b/x/oracle/keeper/weighted_mode_test.go index b12d61083..4c8844046 100644 --- a/x/oracle/keeper/weighted_mode_test.go +++ b/x/oracle/keeper/weighted_mode_test.go @@ -47,7 +47,8 @@ func (s *KeeperTestSuite) TestWeightedMode() { QueryId: qId, }, } - aggregates := s.oracleKeeper.WeightedMode(s.ctx, reports) + aggregates, err := s.oracleKeeper.WeightedMode(s.ctx, reports) + s.Nil(err) s.NotNil(aggregates) res, err := s.oracleKeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) s.Nil(err) diff --git a/x/oracle/mocks/ReporterKeeper.go b/x/oracle/mocks/ReporterKeeper.go index 3bca0223e..7b420d9f3 100644 --- a/x/oracle/mocks/ReporterKeeper.go +++ b/x/oracle/mocks/ReporterKeeper.go @@ -5,6 +5,8 @@ package mocks import ( context "context" + math "cosmossdk.io/math" + mock "github.com/stretchr/testify/mock" reportertypes "github.com/tellor-io/layer/x/reporter/types" @@ -17,6 +19,20 @@ type ReporterKeeper struct { mock.Mock } +// AllocateRewardsToStake provides a mock function with given fields: ctx, reporterAddr, reward +func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAddr types.AccAddress, reward math.Int) error { + ret := _m.Called(ctx, reporterAddr, reward) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { + r0 = rf(ctx, reporterAddr, reward) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // AllocateTokensToReporter provides a mock function with given fields: ctx, reporterAddr, tokens func (_m *ReporterKeeper) AllocateTokensToReporter(ctx context.Context, reporterAddr types.ValAddress, tokens types.DecCoins) error { ret := _m.Called(ctx, reporterAddr, tokens) diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index 96ce7aa68..53fcdad4d 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -16,4 +16,6 @@ var ( ErrNotEnoughStake = sdkerrors.Register(ModuleName, 1104, "not enough stake") ErrCommitRevealWindowEarly = sdkerrors.Register(ModuleName, 1105, "commit reveal window is too early") ErrReporterJailed = sdkerrors.Register(ModuleName, 1106, "reporter is jailed") + ErrNoAvailableReports = sdkerrors.Register(ModuleName, 1107, "no available reports") + ErrNoReportsToAggregate = sdkerrors.Register(ModuleName, 1108, "no reports to aggregate") ) diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index cd0da1ac1..daa3f8cc0 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -3,6 +3,8 @@ package types import ( context "context" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" rktypes "github.com/tellor-io/layer/x/registry/types" @@ -33,5 +35,6 @@ type RegistryKeeper interface { type ReporterKeeper interface { // Methods imported from reporter should be defined here AllocateTokensToReporter(ctx context.Context, reporterAddr sdk.ValAddress, tokens sdk.DecCoins) error + AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error Reporter(ctx context.Context, repAddress sdk.AccAddress) (*reportertypes.OracleReporter, error) } diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 07b57218e..1038a185a 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -10,6 +10,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tellor-io/layer/x/reporter/types" ) @@ -729,3 +730,63 @@ func (k Keeper) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddr func (k Keeper) BeforeReporterDisputed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error { return k.updateReporterDisputeFraction(ctx, valAddr, fraction) } + +func (k Keeper) AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error { + reporter, err := k.Reporters.Get(ctx, reporterAddr) + if err != nil { + return err + } + // Calculate commission + commission := math.LegacyNewDecFromInt(reward).Mul(reporter.Commission.Rate) + + // Calculate net reward + netReward := math.LegacyNewDecFromInt(reward).Sub(commission) + + // Calculate each delegator's share (including the reporter as a self-delegator) + repAddr, err := sdk.AccAddressFromBech32(reporter.Reporter) + if err != nil { + return err + } + delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + if err != nil { + return err + } + defer delAddrs.Close() + for ; delAddrs.Valid(); delAddrs.Next() { + key, err := delAddrs.PrimaryKey() + if err != nil { + return err + } + del, err := k.Delegators.Get(ctx, key) + if err != nil { + return err + } + delegatorShare := netReward.Mul(math.LegacyNewDecFromInt(del.Amount)).Quo(math.LegacyNewDecFromInt(reporter.TotalTokens)) + if key.Equals(repAddr) { + delegatorShare = delegatorShare.Add(commission) + } + rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](key) + iter, err := k.TokenOrigin.Iterate(ctx, rng) + if err != nil { + return err + } + delegatorSources, err := iter.KeyValues() + if err != nil { + return err + } + for _, source := range delegatorSources { + srcAmt := source.Value + _share := delegatorShare.Mul(math.LegacyNewDecFromInt(srcAmt)).Quo(math.LegacyNewDecFromInt(del.Amount)) + val, err := k.stakingKeeper.GetValidator(ctx, source.Key.K2()) + if err != nil { + return err + } + _, err = k.stakingKeeper.Delegate(ctx, key, _share.TruncateInt(), stakingtypes.Bonded, val, false) // ignore dust??? + if err != nil { + return err + } + } + } + + return nil +} diff --git a/x/reporter/keeper/indexes.go b/x/reporter/keeper/indexes.go new file mode 100644 index 000000000..a9f0fb732 --- /dev/null +++ b/x/reporter/keeper/indexes.go @@ -0,0 +1,29 @@ +package keeper + +import ( + "cosmossdk.io/collections" + "cosmossdk.io/collections/indexes" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tellor-io/layer/x/reporter/types" +) + +type ReporterDelegatorsIndex struct { + Reporter *indexes.Multi[sdk.AccAddress, sdk.AccAddress, types.Delegation] +} + +func (a ReporterDelegatorsIndex) IndexesList() []collections.Index[sdk.AccAddress, types.Delegation] { + return []collections.Index[sdk.AccAddress, types.Delegation]{a.Reporter} +} + +func NewDelegatorsIndex(sb *collections.SchemaBuilder) ReporterDelegatorsIndex { + return ReporterDelegatorsIndex{ + Reporter: indexes.NewMulti( + sb, types.ReporterDelegatorsIndexPrefix, "reporter_delegators_index", + sdk.AccAddressKey, sdk.AccAddressKey, + func(k sdk.AccAddress, del types.Delegation) (sdk.AccAddress, error) { + return sdk.AccAddressFromBech32(del.Reporter) + }, + ), + } +} diff --git a/x/reporter/keeper/indexes_test.go b/x/reporter/keeper/indexes_test.go new file mode 100644 index 000000000..71e0271d4 --- /dev/null +++ b/x/reporter/keeper/indexes_test.go @@ -0,0 +1,57 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + + keepertest "github.com/tellor-io/layer/testutil/keeper" + "github.com/tellor-io/layer/testutil/sample" + "github.com/tellor-io/layer/x/reporter/types" +) + +func TestReporterDelegatorIndex(t *testing.T) { + k, _, _, ctx := keepertest.ReporterKeeper(t) + + repAddr := sample.AccAddressBytes() + // set reporter + reporter := types.NewOracleReporter(repAddr.String(), math.NewInt(300), nil) + err := k.Reporters.Set(ctx, repAddr, reporter) + require.NoError(t, err) + + // set delegator 1 + delAddr1 := sample.AccAddressBytes() + del1 := types.NewDelegation(repAddr.String(), math.NewInt(100)) + err = k.Delegators.Set(ctx, delAddr1, del1) + require.NoError(t, err) + + // set delegator 2 + delAddr2 := sample.AccAddressBytes() + del2 := types.NewDelegation(repAddr.String(), math.NewInt(100)) + err = k.Delegators.Set(ctx, delAddr2, del2) + require.NoError(t, err) + + // set delegator 3 + delAddr3 := sample.AccAddressBytes() + del3 := types.NewDelegation(repAddr.String(), math.NewInt(100)) + err = k.Delegators.Set(ctx, delAddr3, del3) + require.NoError(t, err) + + // get delegators for a reporter + delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + require.NoError(t, err) + keys, err := delAddrs.PrimaryKeys() + require.NoError(t, err) + require.Len(t, keys, 3) + + defer delAddrs.Close() + for ; delAddrs.Valid(); delAddrs.Next() { + key, err := delAddrs.PrimaryKey() + require.NoError(t, err) + del, err := k.Delegators.Get(ctx, key) + require.NoError(t, err) + require.Equal(t, repAddr.String(), del.Reporter) + } + +} diff --git a/x/reporter/keeper/keeper.go b/x/reporter/keeper/keeper.go index 8c8264736..28f375449 100644 --- a/x/reporter/keeper/keeper.go +++ b/x/reporter/keeper/keeper.go @@ -19,7 +19,7 @@ type ( storeService store.KVStoreService Params collections.Item[types.Params] Reporters collections.Map[sdk.AccAddress, types.OracleReporter] - Delegators collections.Map[sdk.AccAddress, types.Delegation] + Delegators *collections.IndexedMap[sdk.AccAddress, types.Delegation, ReporterDelegatorsIndex] TokenOrigin collections.Map[collections.Pair[sdk.AccAddress, sdk.ValAddress], math.Int] ReportersAccumulatedCommission collections.Map[sdk.ValAddress, types.ReporterAccumulatedCommission] ReporterOutstandingRewards collections.Map[sdk.ValAddress, types.ReporterOutstandingRewards] @@ -59,7 +59,7 @@ func NewKeeper( Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), Reporters: collections.NewMap(sb, types.ReportersKey, "reporters_by_reporter", sdk.AccAddressKey, codec.CollValue[types.OracleReporter](cdc)), - Delegators: collections.NewMap(sb, types.DelegatorsKey, "delegation_by_delegator", sdk.AccAddressKey, codec.CollValue[types.Delegation](cdc)), + Delegators: collections.NewIndexedMap(sb, types.DelegatorsKey, "delegations_by_delegator", sdk.AccAddressKey, codec.CollValue[types.Delegation](cdc), NewDelegatorsIndex(sb)), TokenOrigin: collections.NewMap(sb, types.TokenOriginsKey, "token_origins_by_delegator_validator", collections.PairKeyCodec(sdk.AccAddressKey, sdk.ValAddressKey), sdk.IntValue), ReportersAccumulatedCommission: collections.NewMap(sb, types.ReporterAccumulatedCommissionPrefix, "reporters_accumulated_commission", sdk.ValAddressKey, codec.CollValue[types.ReporterAccumulatedCommission](cdc)), ReporterOutstandingRewards: collections.NewMap(sb, types.ReporterOutstandingRewardsPrefix, "reporter_outstanding_rewards", sdk.ValAddressKey, codec.CollValue[types.ReporterOutstandingRewards](cdc)), diff --git a/x/reporter/mocks/StakingKeeper.go b/x/reporter/mocks/StakingKeeper.go index d556f3768..68f8bdc86 100644 --- a/x/reporter/mocks/StakingKeeper.go +++ b/x/reporter/mocks/StakingKeeper.go @@ -9,6 +9,8 @@ import ( cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" + math "cosmossdk.io/math" + mock "github.com/stretchr/testify/mock" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -35,6 +37,30 @@ func (_m *StakingKeeper) ConsensusAddressCodec() address.Codec { return r0 } +// Delegate provides a mock function with given fields: ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount +func (_m *StakingKeeper) Delegate(ctx context.Context, delAddr cosmos_sdktypes.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool) (math.LegacyDec, error) { + ret := _m.Called(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) + + var r0 math.LegacyDec + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) (math.LegacyDec, error)); ok { + return rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) + } + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) math.LegacyDec); ok { + r0 = rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) + } else { + r0 = ret.Get(0).(math.LegacyDec) + } + + if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) error); ok { + r1 = rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // Delegation provides a mock function with given fields: _a0, _a1, _a2 func (_m *StakingKeeper) Delegation(_a0 context.Context, _a1 cosmos_sdktypes.AccAddress, _a2 cosmos_sdktypes.ValAddress) (stakingtypes.DelegationI, error) { ret := _m.Called(_a0, _a1, _a2) diff --git a/x/reporter/types/expected_keepers.go b/x/reporter/types/expected_keepers.go index ca3ca732b..50e492215 100644 --- a/x/reporter/types/expected_keepers.go +++ b/x/reporter/types/expected_keepers.go @@ -15,6 +15,10 @@ type StakingKeeper interface { ValidatorByConsAddr(context.Context, sdk.ConsAddress) (stakingtypes.ValidatorI, error) Delegation(context.Context, sdk.AccAddress, sdk.ValAddress) (stakingtypes.DelegationI, error) GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) + Delegate( + ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, + validator stakingtypes.Validator, subtractAccount bool, + ) (newShares math.LegacyDec, err error) // Methods imported from account should be defined here } diff --git a/x/reporter/types/keys.go b/x/reporter/types/keys.go index dc291597d..1b68e2fa0 100644 --- a/x/reporter/types/keys.go +++ b/x/reporter/types/keys.go @@ -26,6 +26,7 @@ var ( DelegatorStartingInfoPrefix = collections.NewPrefix(17) ReporterHistoricalRewardsPrefix = collections.NewPrefix(18) ReporterDisputeEventPrefix = collections.NewPrefix(19) + ReporterDelegatorsIndexPrefix = collections.NewPrefix(20) ) func KeyPrefix(p string) []byte { From de0f83901014fad7d0f343a23a0ff34ed38be741 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 27 Feb 2024 21:49:27 -0500 Subject: [PATCH 07/31] refactor code and rename file --- tests/integration/oracle_keeper_test.go | 6 +- x/oracle/keeper/aggregate.go | 10 +- x/oracle/keeper/rewards.go | 90 +++++++++++++ ..._based_rewards_test.go => rewards_test.go} | 0 x/oracle/keeper/time_based_rewards.go | 121 ------------------ 5 files changed, 96 insertions(+), 131 deletions(-) create mode 100644 x/oracle/keeper/rewards.go rename x/oracle/keeper/{time_based_rewards_test.go => rewards_test.go} (100%) delete mode 100644 x/oracle/keeper/time_based_rewards.go diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index 73165d700..84deeb5fe 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -312,7 +312,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err) - err = s.oraclekeeper.AllocateTBRRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward, false) s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) @@ -375,7 +375,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { s.NoError(err, "error getting aggregated report") tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err, "error getting time based rewards") - err = s.oraclekeeper.AllocateTBRRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward, false) s.NoError(err, "error allocating rewards") // advance height @@ -449,7 +449,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { res, _ := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) tbr, _ := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - err = s.oraclekeeper.AllocateTBRRewards(s.ctx, res.Report.Reporters, tbr.Reward) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward, false) s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 22c8bee64..8f59a4aa5 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -18,9 +18,7 @@ import ( // at a specific blockchain height (to be ran in begin-blocker) // It retrieves the revealed reports from the reports store, sorts them by query ID, and then // calculates the aggregate report for each query using either the weighted-median or weighted-mode method. -// TODO: Add support for other aggregation methods. -// Rewards are allocated to the reporters based on the query tip amount, and time-based rewards are also -// allocated to the reporters. +// Rewards based on the source are then allocated to the reporters. func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { // Get the current block height of the blockchain. currentHeight := ctx.BlockHeight() @@ -78,7 +76,7 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { tip := k.GetQueryTip(ctx, queryIdBytes) // Allocate rewards if there is a tip. if !tip.Amount.IsZero() { - err = k.AllocateRewardsToStake(ctx, report.Reporters, tip) + err = k.AllocateRewards(ctx, report.Reporters, tip, true) if err != nil { return err } @@ -87,13 +85,11 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { if cycleList[strings.ToLower(queryIdStr)] { reportersToPay = append(reportersToPay, report.Reporters...) } - } - // Process time-based rewards for reporters. tbr := k.getTimeBasedRewards(ctx) // Allocate time-based rewards to all eligible reporters. - return k.AllocateTBRRewards(ctx, reportersToPay, tbr) + return k.AllocateRewards(ctx, reportersToPay, tbr, false) } func (k Keeper) SetAggregate(ctx sdk.Context, report *types.Aggregate) error { diff --git a/x/oracle/keeper/rewards.go b/x/oracle/keeper/rewards.go new file mode 100644 index 000000000..983c40e3a --- /dev/null +++ b/x/oracle/keeper/rewards.go @@ -0,0 +1,90 @@ +package keeper + +import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + minttypes "github.com/tellor-io/layer/x/mint/types" + "github.com/tellor-io/layer/x/oracle/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" +) + +type ReportersReportCount struct { + Power int64 + Reports int +} + +// AllocateRewards distributes rewards to reporters based on their power and number of reports. +// It calculates the reward amount for each reporter and allocates the rewards. +// Finally, it sends the allocated rewards to the appropriate module based on the source of the reward. +func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, reward sdk.Coin, toStake bool) error { + // Initialize totalPower to keep track of the total power of all reporters. + totalPower := int64(0) + // reportCounts maps reporter's address to their ValidatorReportCount. + reportCounts := make(map[string]ReportersReportCount) + + // Loop through each reporter to calculate total power and individual report counts. + for _, r := range reporters { + reporter, found := reportCounts[r.Reporter] + if found { + // If the reporter is already in the map, increment their report count. + reporter.Reports++ + } else { + // If not found, add the reporter with their initial power and report count set to 1. + reporter = ReportersReportCount{Power: r.Power, Reports: 1} + } + reportCounts[r.Reporter] = reporter + // Add the reporter's power to the total power. + totalPower += r.Power + } + + var allocateReward func(ctx sdk.Context, addr []byte, amount math.Int) error + var from, to string + if toStake { + allocateReward = k.AllocateTip + from = types.ModuleName + to = stakingtypes.BondedPoolName + } else { + allocateReward = k.AllocateTBR + from = minttypes.TimeBasedRewards + to = reportertypes.ModuleName + + } + for r, c := range reportCounts { + amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, reward.Amount) + repoterAddr, err := sdk.AccAddressFromBech32(r) + if err != nil { + return err + } + err = allocateReward(ctx, repoterAddr.Bytes(), amount) + if err != nil { + return err + } + } + + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, from, to, sdk.NewCoins(reward)) +} + +func (k Keeper) getTimeBasedRewards(ctx sdk.Context) sdk.Coin { + tbrAccount := k.getTimeBasedRewardsAccount(ctx) + return k.bankKeeper.GetBalance(ctx, tbrAccount.GetAddress(), types.DefaultBondDenom) +} + +func (k Keeper) getTimeBasedRewardsAccount(ctx sdk.Context) sdk.ModuleAccountI { + return k.accountKeeper.GetModuleAccount(ctx, minttypes.TimeBasedRewards) +} + +func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward math.Int) math.Int { + power := math.LegacyNewDec(reporterPower * reportsCount) + amount := power.Quo(math.LegacyNewDec(totalPower)).MulTruncate(math.LegacyNewDecFromBigInt(reward.BigInt())) + return amount.RoundInt() +} + +func (k Keeper) AllocateTBR(ctx sdk.Context, addr []byte, amount math.Int) error { + reward := sdk.NewDecCoins(sdk.NewDecCoin(types.DefaultBondDenom, amount)) + return k.reporterKeeper.AllocateTokensToReporter(ctx, addr, reward) +} + +func (k Keeper) AllocateTip(ctx sdk.Context, addr []byte, amount math.Int) error { + return k.reporterKeeper.AllocateRewardsToStake(ctx, addr, amount) +} diff --git a/x/oracle/keeper/time_based_rewards_test.go b/x/oracle/keeper/rewards_test.go similarity index 100% rename from x/oracle/keeper/time_based_rewards_test.go rename to x/oracle/keeper/rewards_test.go diff --git a/x/oracle/keeper/time_based_rewards.go b/x/oracle/keeper/time_based_rewards.go deleted file mode 100644 index e0c3ed5a7..000000000 --- a/x/oracle/keeper/time_based_rewards.go +++ /dev/null @@ -1,121 +0,0 @@ -package keeper - -import ( - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - minttypes "github.com/tellor-io/layer/x/mint/types" - "github.com/tellor-io/layer/x/oracle/types" - reportertypes "github.com/tellor-io/layer/x/reporter/types" -) - -type ReportersReportCount struct { - Power int64 - Reports int -} - -// AllocateRewards distributes rewards to reporters based on their power and number of reports. -// It calculates the reward amount for each reporter and allocates the rewards to the corresponding validator. -// Finally, it sends the allocated rewards to the distribution module. -func (k Keeper) AllocateTBRRewards(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) error { - // Initialize totalPower to keep track of the total power of all reporters. - totalPower := int64(0) - // reportCounts maps reporter's address to their ValidatorReportCount. - reportCounts := make(map[string]ReportersReportCount) - - // Loop through each reporter to calculate total power and individual report counts. - for _, r := range reporters { - reporter, found := reportCounts[r.Reporter] - if found { - // If the reporter is already in the map, increment their report count. - reporter.Reports++ - } else { - // If not found, add the reporter with their initial power and report count set to 1. - reporter = ReportersReportCount{Power: r.Power, Reports: 1} - } - reportCounts[r.Reporter] = reporter - // Add the reporter's power to the total power. - totalPower += r.Power - } - - // Declare a map to hold the rewards for each reporter. - rewards := make(map[string]sdk.DecCoins) - // Calculate rewards for each reporter based on their power and report counts. - for r, c := range reportCounts { - amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, tip.Amount) - rewards[r] = sdk.NewDecCoins(sdk.NewDecCoin(tip.Denom, amount)) - } - transferAmt := sdk.NewCoins() - // Allocate calculated rewards to the corresponding reporters. - for rep, reward := range rewards { - repoterAddr, err := sdk.AccAddressFromBech32(rep) - if err != nil { - return err - } - err = k.reporterKeeper.AllocateTokensToReporter(ctx, repoterAddr.Bytes(), reward) - if err != nil { - return err - } - coin, _ := reward.TruncateDecimal() - transferAmt = transferAmt.Add(coin...) - } - // If there are rewards to distribute, send them to the reporter module. - if !transferAmt.IsZero() { - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.TimeBasedRewards, reportertypes.ModuleName, transferAmt) - if err != nil { - return err - } - } - return nil -} - -func (k Keeper) getTimeBasedRewards(ctx sdk.Context) sdk.Coin { - tbrAccount := k.getTimeBasedRewardsAccount(ctx) - return k.bankKeeper.GetBalance(ctx, tbrAccount.GetAddress(), types.DefaultBondDenom) -} - -func (k Keeper) getTimeBasedRewardsAccount(ctx sdk.Context) sdk.ModuleAccountI { - return k.accountKeeper.GetModuleAccount(ctx, minttypes.TimeBasedRewards) -} - -func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward math.Int) math.Int { - power := math.LegacyNewDec(reporterPower * reportsCount) - amount := power.Quo(math.LegacyNewDec(totalPower)).MulTruncate(math.LegacyNewDecFromBigInt(reward.BigInt())) - return amount.RoundInt() -} - -func (k Keeper) AllocateRewardsToStake(ctx sdk.Context, reporters []*types.AggregateReporter, tip sdk.Coin) error { - // Initialize totalPower to keep track of the total power of all reporters. - totalPower := int64(0) - // reportCounts maps reporter's address to their ValidatorReportCount. - reportCounts := make(map[string]ReportersReportCount) - - // Loop through each reporter to calculate total power and individual report counts. - for _, r := range reporters { - reporter, found := reportCounts[r.Reporter] - if found { - // If the reporter is already in the map, increment their report count. - reporter.Reports++ - } else { - // If not found, add the reporter with their initial power and report count set to 1. - reporter = ReportersReportCount{Power: r.Power, Reports: 1} - } - reportCounts[r.Reporter] = reporter - // Add the reporter's power to the total power. - totalPower += r.Power - } - // Calculate rewards for each reporter based on their power and report counts. - for r, c := range reportCounts { - amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, tip.Amount) - repAddr, err := sdk.AccAddressFromBech32(r) - if err != nil { - return err - } - err = k.reporterKeeper.AllocateRewardsToStake(ctx, repAddr, amount) - if err != nil { - return err - } - } - - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(tip)) -} From 46892a41d9a945ef9adb539349561c8bb30da1c7 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 5 Mar 2024 13:09:32 -0500 Subject: [PATCH 08/31] . --- .golangci.yml | 23 + README.md | 7 +- api/layer/oracle/tips.pulsar.go | 192 +-- app/app.go | 10 +- proto/layer/oracle/tips.proto | 14 +- proto/layer/oracle/user_tip.proto | 16 +- tests/integration/dispute_keeper_test.go | 1295 +++++++++-------- tests/integration/keeper_test.go | 64 +- tests/integration/oracle_keeper_test.go | 107 +- tests/integration/reporter_keeper_test.go | 13 +- testutil/keeper/dispute.go | 22 +- testutil/utils.go | 7 - types/global.go | 13 + x/dispute/genesis_test.go | 2 +- x/dispute/keeper/abci.go | 118 +- x/dispute/keeper/dispute.go | 201 ++- x/dispute/keeper/dispute_fee.go | 57 +- x/dispute/keeper/dispute_fee_test.go | 30 +- x/dispute/keeper/dispute_test.go | 6 +- x/dispute/keeper/execute.go | 14 +- x/dispute/keeper/jail.go | 45 - x/dispute/keeper/keeper.go | 9 +- x/dispute/keeper/keeper_test.go | 76 +- .../keeper/msg_server_add_fee_to_dispute.go | 25 +- .../keeper/msg_server_propose_dispute.go | 15 +- .../keeper/msg_server_propose_dispute_test.go | 74 +- x/dispute/keeper/msg_server_vote.go | 30 +- x/dispute/keeper/msg_server_vote_test.go | 49 +- x/dispute/keeper/params_test.go | 2 +- x/dispute/keeper/query_params_test.go | 6 +- x/dispute/keeper/slash.go | 99 -- x/dispute/keeper/tally.go | 204 ++- x/dispute/keeper/vote.go | 60 +- x/dispute/mocks/BankKeeper.go | 14 - x/dispute/mocks/DistrKeeper.go | 46 - x/dispute/mocks/Makefile | 9 + x/dispute/mocks/OracleKeeper.go | 41 +- x/dispute/mocks/ReporterKeeper.go | 142 ++ x/dispute/mocks/SlashingKeeper.go | 87 -- x/dispute/mocks/StakingKeeper.go | 371 ----- x/dispute/module.go | 21 +- x/dispute/types/errors.go | 1 + x/dispute/types/expected_keepers.go | 50 +- x/dispute/types/types.go | 3 +- x/mint/keeper/genesis.go | 5 +- x/oracle/keeper/aggregate.go | 12 +- x/oracle/keeper/keeper.go | 5 +- x/oracle/keeper/msg_server_commit_report.go | 7 +- x/oracle/keeper/msg_server_tip.go | 12 +- x/oracle/keeper/query_get_current_tip.go | 5 +- x/oracle/keeper/query_get_reports.go | 25 +- .../keeper/query_get_time_based_rewards.go | 3 +- x/oracle/keeper/query_get_user_tip_total.go | 10 +- x/oracle/keeper/rewards.go | 14 +- x/oracle/keeper/submit_value.go | 24 +- x/oracle/keeper/tip.go | 67 +- x/oracle/keeper/weighted_median_test.go | 4 +- x/oracle/keeper/weighted_mode_test.go | 5 +- x/oracle/types/keys.go | 1 + x/oracle/types/tips.pb.go | 87 +- x/oracle/types/user_tip.pb.go | 66 +- x/reporter/keeper/distribution.go | 77 +- x/reporter/keeper/jail.go | 9 +- .../keeper/msg_server_undelegate_reporter.go | 5 +- x/reporter/keeper/reporter.go | 33 +- x/reporter/keeper/reporter_test.go | 10 +- x/reporter/keeper/withdraw.go | 194 +++ x/reporter/mocks/BankKeeper.go | 14 + x/reporter/mocks/StakingKeeper.go | 113 ++ x/reporter/types/expected_keepers.go | 9 + 70 files changed, 2386 insertions(+), 2120 deletions(-) create mode 100644 .golangci.yml create mode 100644 types/global.go delete mode 100644 x/dispute/keeper/jail.go delete mode 100644 x/dispute/keeper/slash.go delete mode 100644 x/dispute/mocks/DistrKeeper.go create mode 100644 x/dispute/mocks/Makefile create mode 100644 x/dispute/mocks/ReporterKeeper.go delete mode 100644 x/dispute/mocks/SlashingKeeper.go delete mode 100644 x/dispute/mocks/StakingKeeper.go create mode 100644 x/reporter/keeper/withdraw.go diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..e579f2520 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,23 @@ +linters: + disable-all: true + enable: + - errcheck + - errorlint + - gofmt + - gosimple + - govet + - importas + - ineffassign + - lll + - misspell + - revive + - staticcheck + - typecheck + - unused + - whitespace +linters-settings: + revive: + rules: + - name: duplicated-imports + severity: warning + disabled: false \ No newline at end of file diff --git a/README.md b/README.md index 6f81b2627..cc652773e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ For more in-depth information about Layer, checkout the [TellorLayer - tech paper](https://github.com/tellor-io/layer/blob/main/TellorLayer%20-%20tech.pdf). ## Tests + To run all tests: `go test -v ./...` @@ -56,4 +57,8 @@ Check out our issues log here on Github or feel free to reach out anytime [info@ ## Copyright -Tellor Inc. 2022 \ No newline at end of file +Tellor Inc. 2022 + +### Tools + +1. Install [golangci-lint](https://golangci-lint.run/usage/install/) 1.55.2 diff --git a/api/layer/oracle/tips.pulsar.go b/api/layer/oracle/tips.pulsar.go index 7e5a0d9ba..b3984160b 100644 --- a/api/layer/oracle/tips.pulsar.go +++ b/api/layer/oracle/tips.pulsar.go @@ -2,8 +2,8 @@ package oracle import ( - 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" @@ -100,14 +100,14 @@ func (x *fastReflection_Tips) Range(f func(protoreflect.FieldDescriptor, protore return } } - if x.Amount != nil { - value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) if !f(fd_Tips_amount, value) { return } } - if x.TotalTips != nil { - value := protoreflect.ValueOfMessage(x.TotalTips.ProtoReflect()) + if x.TotalTips != "" { + value := protoreflect.ValueOfString(x.TotalTips) if !f(fd_Tips_total_tips, value) { return } @@ -130,9 +130,9 @@ func (x *fastReflection_Tips) Has(fd protoreflect.FieldDescriptor) bool { case "layer.oracle.Tips.query_data": return x.QueryData != "" case "layer.oracle.Tips.amount": - return x.Amount != nil + return x.Amount != "" case "layer.oracle.Tips.total_tips": - return x.TotalTips != nil + return x.TotalTips != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Tips")) @@ -152,9 +152,9 @@ func (x *fastReflection_Tips) Clear(fd protoreflect.FieldDescriptor) { case "layer.oracle.Tips.query_data": x.QueryData = "" case "layer.oracle.Tips.amount": - x.Amount = nil + x.Amount = "" case "layer.oracle.Tips.total_tips": - x.TotalTips = nil + x.TotalTips = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Tips")) @@ -176,10 +176,10 @@ func (x *fastReflection_Tips) Get(descriptor protoreflect.FieldDescriptor) proto return protoreflect.ValueOfString(value) case "layer.oracle.Tips.amount": value := x.Amount - return protoreflect.ValueOfMessage(value.ProtoReflect()) + return protoreflect.ValueOfString(value) case "layer.oracle.Tips.total_tips": value := x.TotalTips - return protoreflect.ValueOfMessage(value.ProtoReflect()) + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Tips")) @@ -203,9 +203,9 @@ func (x *fastReflection_Tips) Set(fd protoreflect.FieldDescriptor, value protore case "layer.oracle.Tips.query_data": x.QueryData = value.Interface().(string) case "layer.oracle.Tips.amount": - x.Amount = value.Message().Interface().(*v1beta1.Coin) + x.Amount = value.Interface().(string) case "layer.oracle.Tips.total_tips": - x.TotalTips = value.Message().Interface().(*v1beta1.Coin) + x.TotalTips = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Tips")) @@ -226,18 +226,12 @@ func (x *fastReflection_Tips) Set(fd protoreflect.FieldDescriptor, value protore // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Tips) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.oracle.Tips.amount": - if x.Amount == nil { - x.Amount = new(v1beta1.Coin) - } - return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) - case "layer.oracle.Tips.total_tips": - if x.TotalTips == nil { - x.TotalTips = new(v1beta1.Coin) - } - return protoreflect.ValueOfMessage(x.TotalTips.ProtoReflect()) case "layer.oracle.Tips.query_data": panic(fmt.Errorf("field query_data of message layer.oracle.Tips is not mutable")) + case "layer.oracle.Tips.amount": + panic(fmt.Errorf("field amount of message layer.oracle.Tips is not mutable")) + case "layer.oracle.Tips.total_tips": + panic(fmt.Errorf("field total_tips of message layer.oracle.Tips is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Tips")) @@ -254,11 +248,9 @@ func (x *fastReflection_Tips) NewField(fd protoreflect.FieldDescriptor) protoref case "layer.oracle.Tips.query_data": return protoreflect.ValueOfString("") case "layer.oracle.Tips.amount": - m := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + return protoreflect.ValueOfString("") case "layer.oracle.Tips.total_tips": - m := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Tips")) @@ -332,12 +324,12 @@ func (x *fastReflection_Tips) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Amount != nil { - l = options.Size(x.Amount) + l = len(x.Amount) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.TotalTips != nil { - l = options.Size(x.TotalTips) + l = len(x.TotalTips) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -369,31 +361,17 @@ func (x *fastReflection_Tips) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.TotalTips != nil { - encoded, err := options.Marshal(x.TotalTips) - 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))) + if len(x.TotalTips) > 0 { + i -= len(x.TotalTips) + copy(dAtA[i:], x.TotalTips) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalTips))) i-- dAtA[i] = 0x1a } - if x.Amount != nil { - encoded, err := options.Marshal(x.Amount) - 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))) + 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 } @@ -489,7 +467,7 @@ func (x *fastReflection_Tips) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -499,33 +477,29 @@ func (x *fastReflection_Tips) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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 } - if x.Amount == nil { - x.Amount = &v1beta1.Coin{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Amount = 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 TotalTips", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -535,27 +509,23 @@ func (x *fastReflection_Tips) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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 } - if x.TotalTips == nil { - x.TotalTips = &v1beta1.Coin{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TotalTips); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.TotalTips = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -614,9 +584,9 @@ type Tips struct { // queryData is the query data that was tipped QueryData string `protobuf:"bytes,1,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` // amount is the amount that was tipped - Amount *v1beta1.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` // totalTips is the total amount of tips for this query data so far - TotalTips *v1beta1.Coin `protobuf:"bytes,3,opt,name=total_tips,json=totalTips,proto3" json:"total_tips,omitempty"` + TotalTips string `protobuf:"bytes,3,opt,name=total_tips,json=totalTips,proto3" json:"total_tips,omitempty"` } func (x *Tips) Reset() { @@ -646,18 +616,18 @@ func (x *Tips) GetQueryData() string { return "" } -func (x *Tips) GetAmount() *v1beta1.Coin { +func (x *Tips) GetAmount() string { if x != nil { return x.Amount } - return nil + return "" } -func (x *Tips) GetTotalTips() *v1beta1.Coin { +func (x *Tips) GetTotalTips() string { if x != nil { return x.TotalTips } - return nil + return "" } var File_layer_oracle_tips_proto protoreflect.FileDescriptor @@ -665,30 +635,31 @@ var File_layer_oracle_tips_proto protoreflect.FileDescriptor var file_layer_oracle_tips_proto_rawDesc = []byte{ 0x0a, 0x17, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x74, 0x69, 0x70, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x01, - 0x0a, 0x04, 0x54, 0x69, 0x70, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x37, 0x0a, 0x06, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, - 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x70, 0x73, 0x18, 0x03, 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, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x54, 0x69, 0x70, 0x73, 0x42, 0x8d, - 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0x42, 0x09, 0x54, 0x69, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, - 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x22, 0xb6, 0x01, 0x0a, 0x04, 0x54, 0x69, 0x70, + 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, + 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x74, + 0x69, 0x70, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, + 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x54, 0x69, 0x70, + 0x73, 0x42, 0x8d, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x09, 0x54, 0x69, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -705,17 +676,14 @@ func file_layer_oracle_tips_proto_rawDescGZIP() []byte { var file_layer_oracle_tips_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_layer_oracle_tips_proto_goTypes = []interface{}{ - (*Tips)(nil), // 0: layer.oracle.Tips - (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin + (*Tips)(nil), // 0: layer.oracle.Tips } var file_layer_oracle_tips_proto_depIdxs = []int32{ - 1, // 0: layer.oracle.Tips.amount:type_name -> cosmos.base.v1beta1.Coin - 1, // 1: layer.oracle.Tips.total_tips:type_name -> cosmos.base.v1beta1.Coin - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] 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 + 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_layer_oracle_tips_proto_init() } diff --git a/app/app.go b/app/app.go index cfef967db..466fa316d 100644 --- a/app/app.go +++ b/app/app.go @@ -7,6 +7,7 @@ import ( "io" "os" "path/filepath" + "runtime/debug" "time" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" @@ -139,8 +140,6 @@ import ( daemonservertypes "github.com/tellor-io/layer/daemons/server/types" daemontypes "github.com/tellor-io/layer/daemons/types" - "runtime/debug" - pricefeedclient "github.com/tellor-io/layer/daemons/pricefeed/client" reporterclient "github.com/tellor-io/layer/daemons/reporter/client" medianserver "github.com/tellor-io/layer/daemons/server/median" @@ -570,8 +569,7 @@ func New( app.AccountKeeper, app.BankKeeper, app.OracleKeeper, - app.SlashingKeeper, - app.StakingKeeper, + app.ReporterKeeper, ) disputeModule := disputemodule.NewAppModule(appCodec, app.DisputeKeeper, app.AccountKeeper, app.BankKeeper) @@ -918,8 +916,8 @@ func (app *App) Name() string { return app.BaseApp.Name() } func (app *App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } // BeginBlocker application updates every begin block -func (a *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { - return a.mm.BeginBlock(ctx) +func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.mm.BeginBlock(ctx) } // EndBlocker application updates every end block diff --git a/proto/layer/oracle/tips.proto b/proto/layer/oracle/tips.proto index deca04f53..1dcde389f 100644 --- a/proto/layer/oracle/tips.proto +++ b/proto/layer/oracle/tips.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package layer.oracle; -import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; @@ -12,7 +12,15 @@ message Tips { // queryData is the query data that was tipped string query_data = 1; // amount is the amount that was tipped - cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; // totalTips is the total amount of tips for this query data so far - cosmos.base.v1beta1.Coin total_tips = 3 [(gogoproto.nullable) = false]; + string total_tips = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } diff --git a/proto/layer/oracle/user_tip.proto b/proto/layer/oracle/user_tip.proto index 7475478cc..2eb3c5b58 100644 --- a/proto/layer/oracle/user_tip.proto +++ b/proto/layer/oracle/user_tip.proto @@ -1,13 +1,17 @@ syntax = "proto3"; package layer.oracle; -option go_package = "github.com/tellor-io/layer/x/oracle/types"; -import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/tellor-io/layer/x/oracle/types"; message UserTipTotal { - - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin total = 2 [(gogoproto.nullable) = false]; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string total = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index ff4e71be5..699394d5c 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -1,170 +1,204 @@ package integration_test import ( - "cosmossdk.io/collections" "cosmossdk.io/math" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tellor-io/layer/x/dispute/keeper" "github.com/tellor-io/layer/x/dispute/types" + oracleKeeper "github.com/tellor-io/layer/x/oracle/keeper" + oracletypes "github.com/tellor-io/layer/x/oracle/types" + reporterKeeper "github.com/tellor-io/layer/x/reporter/keeper" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) func (s *IntegrationTestSuite) TestVotingOnDispute() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{1000, 20}) - val, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + repAccs := s.CreateAccountsWithTokens(2, 100*1e6) + stakeAmount := math.NewInt(100 * 1e6) + + repAcc := repAccs[0] + valAddr := valAddrs[0] + delegators := repAccs + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) + + // assemble report with reporter to dispute report := types.MicroReport{ - Reporter: addrs[0].String(), - Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + Reporter: repAcc.String(), + Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, } - Addr := s.newKeysWithTokens() - valAddr := valAddrs[0] + // disputer with tokens to pay fee + disputer := s.newKeysWithTokens() // Propose dispute pay half of the fee from account _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: addrs[1].String(), + Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, math.NewInt(5_000_000)), + Fee: sdk.NewCoin(s.denom, math.NewInt(500_000)), DisputeCategory: types.Warning, }) s.NoError(err) + + // 2 here because dispute count starts from 1 and dispute count gives the next dispute id s.Equal(uint64(2), s.disputekeeper.GetDisputeCount(s.ctx)) - s.Equal(1, len(s.disputekeeper.GetOpenDisputeIds(s.ctx).Ids)) + open, err := s.disputekeeper.GetOpenDisputeIds(s.ctx) + s.NoError(err) + s.Equal(1, len(open.Ids)) // check validator wasn't slashed/jailed - val, err = s.stakingKeeper.GetValidator(s.ctx, valAddr) - bondedTokensBefore := val.GetBondedTokens() + rep, err := s.reporterkeeper.Reporter(s.ctx, repAcc) s.NoError(err) - s.False(val.IsJailed()) - s.Equal(bondedTokensBefore, math.NewInt(1000_000_000)) + // reporter tokens should be the same as the stake amount since fee wasn't fully paid + s.Equal(rep.TotalTokens, stakeAmount) + s.False(rep.Jailed) // Add dispute fee to complete the fee and jail/slash validator _, err = msgServer.AddFeeToDispute(s.ctx, &types.MsgAddFeeToDispute{ - Creator: addrs[1].String(), + Creator: disputer.String(), DisputeId: 1, - Amount: sdk.NewCoin(s.denom, math.NewInt(5_000_000)), + Amount: sdk.NewCoin(s.denom, math.NewInt(500_000)), }) s.NoError(err) - // check validator was slashed/jailed - val, err = s.stakingKeeper.GetValidator(s.ctx, valAddr) + // check reporter was slashed/jailed after fee was added + rep, err = s.reporterkeeper.Reporter(s.ctx, repAcc) + s.NoError(err) + s.Equal(rep.TotalTokens, stakeAmount.Sub(math.NewInt(1_000_000))) + s.True(rep.Jailed) + + dispute, err := s.disputekeeper.GetDisputeById(s.ctx, 1) s.NoError(err) - s.True(val.IsJailed()) - // check validator was slashed 1% of tokens - s.Equal(val.GetBondedTokens(), bondedTokensBefore.Sub(bondedTokensBefore.Mul(math.NewInt(1)).Quo(math.NewInt(100)))) - dispute := s.disputekeeper.GetDisputeById(s.ctx, 1) s.Equal(types.Voting, dispute.DisputeStatus) // vote on dispute _, err = msgServer.Vote(s.ctx, &types.MsgVote{ - Voter: Addr.String(), + Voter: disputer.String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }) s.NoError(err) - voterV := s.disputekeeper.GetVoterVote(s.ctx, Addr.String(), 1) - s.Equal(types.VoteEnum_VOTE_SUPPORT, voterV.Vote) - v := s.disputekeeper.GetVote(s.ctx, 1) + vtr, err := s.disputekeeper.GetVoterVote(s.ctx, disputer.String(), 1) + s.NoError(err) + s.Equal(types.VoteEnum_VOTE_SUPPORT, vtr.Vote) + v, err := s.disputekeeper.GetVote(s.ctx, 1) + s.NoError(err) s.Equal(v.VoteResult, types.VoteResult_NO_TALLY) - s.Equal(v.Voters, []string{Addr.String()}) + s.Equal(v.Voters, []string{disputer.String()}) } func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - require := s.Require() - ctx := s.ctx - addrs, valAddrs := s.createValidators([]int64{100}) - val, err := s.stakingKeeper.Validator(ctx, valAddrs[0]) + + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + repAccs := s.CreateAccountsWithTokens(2, 100*1e6) + stakeAmount := math.NewInt(100 * 1e6) + + repAcc := repAccs[0] + valAddr := valAddrs[0] + delegators := repAccs + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) + report := types.MicroReport{ - Reporter: addrs[0].String(), - Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + Reporter: repAcc.String(), + Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, } - valAddr := valAddrs[0] - val, err = s.stakingKeeper.GetValidator(ctx, valAddr) - require.NoError(err) - - bondedTokensBefore := val.GetBondedTokens() - onePercent := bondedTokensBefore.Mul(math.NewInt(1)).Quo(math.NewInt(100)) - disputeFee := sdk.NewCoin(s.denom, onePercent) - slashAmount := disputeFee.Amount - _, err = msgServer.ProposeDispute(ctx, &types.MsgProposeDispute{ - Creator: sdk.AccAddress(valAddr).String(), + + _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ + Creator: repAcc.String(), Report: &report, DisputeCategory: types.Warning, - Fee: disputeFee, + Fee: sdk.NewCoin(s.denom, math.NewInt(1_000_000)), // one percent dispute fee PayFromBond: true, }) - require.NoError(err) - - val1, _ := s.stakingKeeper.GetValidator(ctx, valAddr) - require.Equal(val1.GetBondedTokens(), bondedTokensBefore.Sub(slashAmount).Sub(disputeFee.Amount)) - require.True(val1.IsJailed()) - // jail time for a warning is zero seconds so unjailing should be immediate - // TODO: have to unjail through the staking keeper, if no self delegation then validator can't unjail - s.mintTokens(sdk.AccAddress(valAddr), sdk.NewCoin(s.denom, math.NewInt(100))) - _, err = s.stakingKeeper.Delegate(ctx, sdk.AccAddress(valAddr), math.NewInt(10), stakingtypes.Unbonded, val1, true) - require.NoError(err) - err = s.slashingKeeper.Unjail(ctx, valAddr) - require.NoError(err) - val, _ = s.stakingKeeper.GetValidator(ctx, valAddr) - require.False(val.IsJailed()) + s.NoError(err) + + // check reporter was slashed/jailed after fee was added + rep, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + s.NoError(err) + s.Equal(rep.TotalTokens, stakeAmount.Sub(math.NewInt(2_000_000))) // two because fee was paid from bond (self dispute) and reporter was slashed + s.True(rep.Jailed) + + reporterServer := reporterKeeper.NewMsgServerImpl(s.reporterkeeper) + req := &reportertypes.MsgUnjailReporter{ + ReporterAddress: repAcc.String(), + } + _, err = reporterServer.UnjailReporter(s.ctx, req) + s.NoError(err) + rep, err = s.reporterkeeper.Reporter(s.ctx, repAcc) + s.NoError(err) + s.False(rep.Jailed) } func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{200, 300, 400, 500}) - reporterAddr := addrs[0].String() - disputerAcc := addrs[1] - disputerAddr := disputerAcc.String() - val, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + repAccs := s.CreateAccountsWithTokens(3, 100*1e6) + stakeAmount := math.NewInt(100 * 1e6) + disputer := s.newKeysWithTokens() + + repAcc := repAccs[0] + valAddr := valAddrs[0] + delegators := repAccs + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) + report := types.MicroReport{ - Reporter: reporterAddr, - Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + Reporter: repAcc.String(), + Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, reporterAddr, types.Warning) + disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) + s.NoError(err) burnAmount := disputeFee.MulRaw(1).QuoRaw(20) - disputerBalanceBefore := s.bankKeeper.GetBalance(s.ctx, disputerAcc, s.denom) + disputerBalanceBefore := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) // Propose dispute pay half of the fee from account _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: disputerAddr, + Creator: disputer.String(), Report: &report, Fee: sdk.NewCoin(s.denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) - s.True(s.bankKeeper.GetBalance(s.ctx, disputerAcc, s.denom).IsLT(disputerBalanceBefore)) + s.True(s.bankKeeper.GetBalance(s.ctx, disputer, s.denom).IsLT(disputerBalanceBefore)) // start vote - ids := s.disputekeeper.CheckPrevoteDisputesForExpiration(s.ctx) + ids, err := s.disputekeeper.CheckPrevoteDisputesForExpiration(s.ctx) + s.NoError(err) + votes := []types.MsgVote{ { - Voter: reporterAddr, + Voter: report.Reporter, Id: 1, Vote: types.VoteEnum_VOTE_INVALID, }, { - Voter: disputerAddr, + Voter: disputer.String(), Id: 1, Vote: types.VoteEnum_VOTE_INVALID, }, { - Voter: addrs[2].String(), + Voter: delegators[1].String(), Id: 1, Vote: types.VoteEnum_VOTE_INVALID, }, { - Voter: addrs[3].String(), + Voter: delegators[2].String(), Id: 1, Vote: types.VoteEnum_VOTE_INVALID, }, @@ -173,23 +207,29 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { _, err = msgServer.Vote(s.ctx, &votes[i]) s.NoError(err) } - // tally vote - s.disputekeeper.TallyVote(s.ctx, ids[0]) - reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + // only 25 percent of the total power voted so vote should not be tallied unless it's expired + s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + // // tally vote + err = s.disputekeeper.TallyVote(s.ctx, ids[0]) + s.NoError(err) + reporter, err := s.reporterkeeper.Reporter(s.ctx, repAcc) s.NoError(err) - valTknBeforeExecuteVote := reporter.GetBondedTokens() - disputerBalanceBeforeExecuteVote := s.bankKeeper.GetBalance(s.ctx, disputerAcc, s.denom) + + repTknBeforeExecuteVote := reporter.TotalTokens + disputerBalanceBeforeExecuteVote := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) // execute vote - s.disputekeeper.ExecuteVotes(s.ctx, ids) - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().GT(valTknBeforeExecuteVote)) - // dispute fee returned so balance should be the same as before paying fee - disputerBalanceAfterExecuteVote := s.bankKeeper.GetBalance(s.ctx, disputerAcc, s.denom) - voters := s.disputekeeper.GetVote(s.ctx, 1).Voters - rewards, _ := s.disputekeeper.CalculateVoterShare(s.ctx, voters, burnAmount.QuoRaw(2)) - voterReward := rewards[disputerAddr] - // add dispute fee returned minus burn amount plus the voter reward + err = s.disputekeeper.ExecuteVotes(s.ctx, ids) + s.NoError(err) + reporter, err = s.reporterkeeper.Reporter(s.ctx, repAcc) + s.NoError(err) + s.True(reporter.TotalTokens.GT(repTknBeforeExecuteVote)) + // // dispute fee returned so balance should be the same as before paying fee + disputerBalanceAfterExecuteVote := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) + v, err := s.disputekeeper.GetVote(s.ctx, 1) + s.NoError(err) + rewards, _ := s.disputekeeper.CalculateVoterShare(s.ctx, v.Voters, burnAmount.QuoRaw(2)) + voterReward := rewards[disputer.String()] + // // add dispute fee returned minus burn amount plus the voter reward disputerBalanceBeforeExecuteVote.Amount = disputerBalanceBeforeExecuteVote.Amount.Add(disputeFee.Sub(burnAmount)).Add(voterReward) s.Equal(disputerBalanceBeforeExecuteVote, disputerBalanceAfterExecuteVote) } @@ -197,23 +237,33 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) - reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + repAccs := s.CreateAccountsWithTokens(3, 100*1e6) + stakeAmount := math.NewInt(100 * 1e6) + disputer := s.newKeysWithTokens() + + repAcc := repAccs[0] + valAddr := valAddrs[0] + delegators := repAccs + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + reporter, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) report := types.MicroReport{ - Reporter: addrs[0].String(), - Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), + Reporter: repAcc.String(), + Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) + disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) + s.NoError(err) // Propose dispute pay half of the fee from account _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: addrs[1].String(), + Creator: disputer.String(), Report: &report, Fee: sdk.NewCoin(s.denom, disputeFee), DisputeCategory: types.Warning, @@ -222,7 +272,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { vote := []types.MsgVote{ { - Voter: addrs[0].String(), + Voter: repAcc.String(), Id: 1, Vote: types.VoteEnum_VOTE_INVALID, }, @@ -231,75 +281,99 @@ func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { _, err = msgServer.Vote(s.ctx, &vote[0]) s.NoError(err) - ctx := s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS + 1)) - s.disputekeeper.TallyVote(ctx, 1) + ctx := s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + err = s.disputekeeper.TallyVote(ctx, 1) + s.NoError(err) - reporter, err = s.stakingKeeper.Validator(ctx, valAddrs[0]) + bond := reporter.Amount + // // execute vote + err = s.disputekeeper.ExecuteVotes(ctx, []uint64{1}) s.NoError(err) - bond := reporter.GetBondedTokens() - // execute vote - s.disputekeeper.ExecuteVotes(ctx, []uint64{0}) - voteInfo := s.disputekeeper.GetVote(ctx, 1) + voteInfo, err := s.disputekeeper.GetVote(ctx, 1) + s.NoError(err) s.Equal(types.VoteResult_NO_QUORUM_MAJORITY_INVALID, voteInfo.VoteResult) - reporter, err = s.stakingKeeper.Validator(ctx, valAddrs[0]) + rep, err := s.reporterkeeper.Reporter(s.ctx, repAcc) s.NoError(err) - s.True(reporter.GetBondedTokens().Equal(bond)) + s.True(rep.TotalTokens.Equal(bond)) } func (s *IntegrationTestSuite) TestExecuteVoteSupport() { + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{200, 300, 400, 500}) - reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + repAccs := s.CreateAccountsWithTokens(3, 100*1e6) + stakeAmount := math.NewInt(100 * 1e6) + disputer := s.newKeysWithTokens() + + repAcc := repAccs[0] + valAddr := valAddrs[0] + delegators := repAccs + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + reporter, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) - disputerBefore, err := s.stakingKeeper.Validator(s.ctx, valAddrs[1]) + disputerBefore, err := s.stakingKeeper.GetAllDelegatorDelegations(s.ctx, disputer) s.NoError(err) - reporterAddr := sdk.AccAddress(valAddrs[0]).String() - disputerAddr := sdk.AccAddress(valAddrs[1]).String() + s.True(len(disputerBefore) == 0) + + // mint tokens to voters + s.mintTokens(disputer, sdk.NewCoin(s.denom, math.NewInt(100_000_000))) + oracleServer := oracleKeeper.NewMsgServerImpl(s.oraclekeeper) + msg := oracletypes.MsgTip{ + Tipper: disputer.String(), + QueryData: ethQueryData, + Amount: sdk.NewCoin(s.denom, math.NewInt(1_000_000)), + } + _, err = oracleServer.Tip(s.ctx, &msg) + s.Nil(err) report := types.MicroReport{ - Reporter: reporterAddr, - Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), + Reporter: repAcc.String(), + Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, reporterAddr, types.Warning) + disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) + s.NoError(err) fivePercentBurn := disputeFee.MulRaw(1).QuoRaw(20) twoPercentBurn := fivePercentBurn.QuoRaw(2) _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: disputerAddr, + Creator: disputer.String(), Report: &report, Fee: sdk.NewCoin(s.denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) // start vote - ids := s.disputekeeper.CheckPrevoteDisputesForExpiration(s.ctx) + ids, err := s.disputekeeper.CheckPrevoteDisputesForExpiration(s.ctx) + s.NoError(err) votersBalanceBefore := []sdk.Coin{ - s.bankKeeper.GetBalance(s.ctx, addrs[0], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[2], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[3], s.denom), + s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), + s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), } votes := []types.MsgVote{ { - Voter: addrs[0].String(), + Voter: repAcc.String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }, { - Voter: addrs[1].String(), + Voter: disputer.String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }, { - Voter: addrs[2].String(), + Voter: delegators[1].String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }, { - Voter: addrs[3].String(), + Voter: delegators[2].String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }, @@ -309,83 +383,113 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { s.NoError(err) } // tally vote - s.disputekeeper.Tally(s.ctx, ids) + err = s.disputekeeper.Tally(s.ctx, ids) + s.NoError(err) // execute vote - s.disputekeeper.ExecuteVotes(s.ctx, ids) - reporterAfter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + err = s.disputekeeper.ExecuteVotes(s.ctx, ids) + s.NoError(err) + reporterAfter, err := s.reporterkeeper.Reporter(s.ctx, repAcc) s.NoError(err) - s.True(reporterAfter.IsJailed()) - s.True(reporterAfter.GetBondedTokens().LT(reporter.GetBondedTokens())) + s.True(reporterAfter.Jailed) + s.True(reporterAfter.TotalTokens.LT(reporter.Amount)) votersBalanceAfter := []sdk.Coin{ - s.bankKeeper.GetBalance(s.ctx, addrs[0], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[2], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[3], s.denom), + s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), + s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), } - voters := s.disputekeeper.GetVote(s.ctx, 1).Voters - votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, voters, twoPercentBurn) + v, err := s.disputekeeper.GetVote(s.ctx, 1) + s.NoError(err) + + addrs := []sdk.AccAddress{repAcc, disputer, delegators[1], delegators[2]} + votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, v.Voters, twoPercentBurn) for i := range votersBalanceBefore { votersBalanceBefore[i].Amount = votersBalanceBefore[i].Amount.Add(votersReward[addrs[i].String()]) s.Equal(votersBalanceBefore[i], (votersBalanceAfter[i])) } - - val1, err := s.stakingKeeper.Validator(s.ctx, valAddrs[1]) + disputerDelgation, err := s.stakingKeeper.GetAllDelegatorDelegations(s.ctx, disputer) s.NoError(err) - s.True(disputerBefore.GetBondedTokens().Add(disputeFee).Equal(val1.GetBondedTokens())) + s.True(disputerDelgation[0].Shares.Equal(math.LegacyNewDecFromInt(math.NewInt(1_000_000)))) } func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { + msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{200, 300, 400, 500}) - reporterBefore, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + + _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + repAccs := s.CreateAccountsWithTokens(3, 100*1e6) + stakeAmount := math.NewInt(100 * 1e6) + disputer := s.newKeysWithTokens() + + repAcc := repAccs[0] + valAddr := valAddrs[0] + delegators := repAccs + commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) + reporterBefore, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) - reporterAddr := sdk.AccAddress(valAddrs[0]).String() - disputerAddr := sdk.AccAddress(valAddrs[1]).String() + + // tip to capture other group of voters 25% of the total power + s.mintTokens(disputer, sdk.NewCoin(s.denom, math.NewInt(100_000_000))) + oracleServer := oracleKeeper.NewMsgServerImpl(s.oraclekeeper) + msg := oracletypes.MsgTip{ + Tipper: disputer.String(), + QueryData: ethQueryData, + Amount: sdk.NewCoin(s.denom, math.NewInt(1_000_000)), + } + _, err = oracleServer.Tip(s.ctx, &msg) + s.Nil(err) + report := types.MicroReport{ - Reporter: reporterAddr, - Power: reporterBefore.GetConsensusPower(sdk.DefaultPowerReduction), + Reporter: repAcc.String(), + Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, reporterAddr, types.Warning) + disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) + s.NoError(err) + fivePercentBurn := disputeFee.MulRaw(1).QuoRaw(20) twoPercentBurn := fivePercentBurn.QuoRaw(2) disputeFeeMinusBurn := disputeFee.Sub(disputeFee.MulRaw(1).QuoRaw(20)) + // Propose dispute pay half of the fee from account _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: disputerAddr, + Creator: disputer.String(), Report: &report, Fee: sdk.NewCoin(s.denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) + addrs := []sdk.AccAddress{repAcc, disputer, delegators[1], delegators[2]} + votersBalanceBefore := []sdk.Coin{ - s.bankKeeper.GetBalance(s.ctx, addrs[0], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[2], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[3], s.denom), + s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), + s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), } votes := []types.MsgVote{ { - Voter: addrs[0].String(), + Voter: repAcc.String(), Id: 1, Vote: types.VoteEnum_VOTE_AGAINST, }, { - Voter: addrs[1].String(), + Voter: disputer.String(), Id: 1, Vote: types.VoteEnum_VOTE_AGAINST, }, { - Voter: addrs[2].String(), + Voter: delegators[1].String(), Id: 1, Vote: types.VoteEnum_VOTE_AGAINST, }, { - Voter: addrs[3].String(), + Voter: delegators[2].String(), Id: 1, Vote: types.VoteEnum_VOTE_AGAINST, }, @@ -395,450 +499,457 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { s.NoError(err) } // tally vote - s.disputekeeper.TallyVote(s.ctx, 1) + err = s.disputekeeper.TallyVote(s.ctx, 1) + s.NoError(err) // execute vote - s.disputekeeper.ExecuteVote(s.ctx, 1) - reporterAfterDispute, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) + err = s.disputekeeper.ExecuteVote(s.ctx, 1) + s.NoError(err) + reporterAfterDispute, err := s.reporterkeeper.Reporter(s.ctx, repAcc) s.NoError(err) - s.Equal(reporterBefore.GetBondedTokens().Add(disputeFeeMinusBurn), reporterAfterDispute.GetBondedTokens()) + + s.Equal(reporterBefore.Amount.Add(disputeFeeMinusBurn), reporterAfterDispute.TotalTokens) votersBalanceAfter := []sdk.Coin{ - s.bankKeeper.GetBalance(s.ctx, addrs[0], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[2], s.denom), - s.bankKeeper.GetBalance(s.ctx, addrs[3], s.denom), + s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), + s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), + s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), } - voters := s.disputekeeper.GetVote(s.ctx, 1).Voters - votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, voters, twoPercentBurn) + v, err := s.disputekeeper.GetVote(s.ctx, 1) + s.NoError(err) + votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, v.Voters, twoPercentBurn) for i := range votersBalanceBefore { votersBalanceBefore[i].Amount = votersBalanceBefore[i].Amount.Add(votersReward[addrs[i].String()]) s.Equal(votersBalanceBefore[i], (votersBalanceAfter[i])) } } -func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) - - bal0, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) - s.NoError(err) - s.Equal(bal0, math.NewInt(900_000_000)) - - bal1, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) - s.NoError(err) - s.Equal(bal1, math.NewInt(800_000_000)) - - bal2, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) - s.NoError(err) - s.Equal(bal2, math.NewInt(700_000_000)) - - balStaking, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) - s.NoError(err) - s.Equal(balStaking, math.NewInt(601_000_000)) - - reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - reporterStakeBefore := reporter.GetBondedTokens() - report := types.MicroReport{ - Reporter: addrs[0].String(), - Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), - QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", - Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, - } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) - burnAmount := disputeFee.MulRaw(1).QuoRaw(20) - dispute := types.MsgProposeDispute{ - Creator: addrs[1].String(), - Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), - DisputeCategory: types.Warning, - } - balanceBefore := s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - - bal0, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) - s.NoError(err) - s.Equal(bal0, math.NewInt(900_000_000)) - - bal1, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) - s.NoError(err) - s.Equal(bal1, math.NewInt(799_000_000)) - - bal2, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) - s.NoError(err) - s.Equal(bal2, math.NewInt(700_000_000)) - - balStaking, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) - s.NoError(err) - s.Equal(balStaking, math.NewInt(600_000_000)) - - moduleAccs := s.ModuleAccs() - balDispute, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(moduleAccs.dispute.GetAddress(), s.denom)) - s.NoError(err) - s.Equal(balDispute, disputeFee.MulRaw(2)) // disputeFee + slashAmount - - balanceAfter := s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.True(balanceBefore.Amount.Sub(disputeFee).Equal(balanceAfter.Amount)) - // check reporter stake - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) - // begin block - header := tmproto.Header{Height: s.app.LastBlockHeight() + 1, Time: s.ctx.BlockTime()} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - votes := []types.MsgVote{ - { - Voter: addrs[0].String(), - Id: 1, - Vote: types.VoteEnum_VOTE_INVALID, - }, - } - for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) - s.NoError(err) - } - - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime()} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.Equal(err.Error(), "can't start a new round for this dispute 1; dispute status DISPUTE_STATUS_VOTING") - // check reporter stake - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) - // forward time to after vote end - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(2))), balanceAfter) - - // check reporter stake - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) // TODO: this double-check seems unnecessary - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - // voting that doesn't reach quorum - votes = []types.MsgVote{ - { - Voter: addrs[0].String(), - Id: 2, - Vote: types.VoteEnum_VOTE_INVALID, - }, - } - for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) - s.NoError(err) - } - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.Equal(err.Error(), "can't start a new round for this dispute 2; dispute status DISPUTE_STATUS_VOTING") //fails since hasn't been tallied and executed - - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(4))), balanceAfter) - - // check reporter stake - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - // voting that doesn't reach quorum - votes = []types.MsgVote{ - { - Voter: addrs[0].String(), - Id: 3, - Vote: types.VoteEnum_VOTE_INVALID, - }, - } - for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) - s.NoError(err) - } - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.Error(err) //fails since hasn't been tallied and executed - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(8))), balanceAfter) - - // check reporter stake - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - // voting that doesn't reach quorum - votes = []types.MsgVote{ - { - Voter: addrs[0].String(), - Id: 4, - Vote: types.VoteEnum_VOTE_INVALID, - }, - } - for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) - s.NoError(err) - } - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.Equal(err.Error(), "can't start a new round for this dispute 4; dispute status DISPUTE_STATUS_VOTING") - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(16))), balanceAfter) - - // check reporter stake - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - // voting that doesn't reach quorum - votes = []types.MsgVote{ - { - Voter: addrs[0].String(), - Id: 5, - Vote: types.VoteEnum_VOTE_INVALID, - }, - } - for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) - s.NoError(err) - } - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.Equal(err.Error(), "can't start a new round for this dispute 5; dispute status DISPUTE_STATUS_VOTING") //fails since hasn't been tallied and executed - // forward time to end vote - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, disputeFee)), balanceAfter) - - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - - bal0, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) - s.NoError(err) - s.Equal(bal0, math.NewInt(900_000_000)) - - bal1, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) - s.NoError(err) - s.Equal(bal1, math.NewInt(795_500_000)) - - bal2, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) - s.NoError(err) - s.Equal(bal2, math.NewInt(700_000_000)) - - balStaking, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) - s.NoError(err) - s.Equal(balStaking, math.NewInt(600_000_000)) - - balDispute, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(moduleAccs.dispute.GetAddress(), s.denom)) - s.NoError(err) - s.Equal(balDispute, math.NewInt(5_500_000)) // disputeFee + slashAmount + round 1(100000) + round 2(200000) + round 3(400000) + round 4(800000) + round 5(1000000) + round 6(1000000) - - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, disputeFee)), balanceAfter) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - _, err = msgServer.ProposeDispute(s.ctx, &dispute) - s.NoError(err) - balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) - s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, disputeFee)), balanceAfter) - // forward time and end dispute - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - // check reporter stake, stake should be restored due to invalid vote final result - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.Equal(reporter.GetBondedTokens(), reporterStakeBefore) - - bal0, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) // voter reward half the total burn Amount(the 5%) - s.NoError(err) - s.Equal(bal0, math.NewInt(902_275_000)) - - bal1, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) - s.NoError(err) - s.Equal(bal1, math.NewInt(795_450_000)) - - bal2, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) - s.NoError(err) - s.Equal(bal2, math.NewInt(700_000_000)) - - balStaking, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) - s.NoError(err) - s.Equal(balStaking, math.NewInt(601_000_000)) - -} - -func (s *IntegrationTestSuite) TestNoQorumSingleRound() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) - reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - reporterStakeBefore := reporter.GetBondedTokens() - report := types.MicroReport{ - Reporter: addrs[0].String(), - Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), - QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", - Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, - } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) - // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: addrs[1].String(), - Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), - DisputeCategory: types.Warning, - }) - s.NoError(err) - header := tmproto.Header{Height: s.app.LastBlockHeight() + 1, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - votes := []types.MsgVote{ - { - Voter: addrs[0].String(), - Id: 1, - Vote: types.VoteEnum_VOTE_INVALID, - }, - { - Voter: addrs[1].String(), - Id: 1, - Vote: types.VoteEnum_VOTE_INVALID, - }, - } - - for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) - s.NoError(err) - } - // forward time to expire dispute - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(86400*3 + 1)) - header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - reporterStakeAfter := reporter.GetBondedTokens() - // reporter stake should be restored after dispute expires for invalid vote - s.Equal(reporterStakeBefore, reporterStakeAfter) -} - -func (s *IntegrationTestSuite) TestDisputeButNoVotes() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) - reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - reporterStakeBefore := reporter.GetBondedTokens() - report := types.MicroReport{ - Reporter: addrs[0].String(), - Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), - QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", - Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, - } - disputeFee := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) - // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: addrs[1].String(), - Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), - DisputeCategory: types.Warning, - }) - s.NoError(err) - - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.NotEqual(reporterStakeBefore, reporter.GetBondedTokens()) - // forward time to end dispute - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS)) - header := tmproto.Header{Height: s.app.LastBlockHeight() + 1, Time: s.ctx.BlockTime().Add(1)} - s.ctx = s.ctx.WithBlockHeader(header) - _, err = s.app.BeginBlocker(s.ctx) - s.NoError(err) - reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) - s.NoError(err) - s.Equal(reporterStakeBefore, reporter.GetBondedTokens()) -} +// func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { +// msgServer := keeper.NewMsgServerImpl(s.disputekeeper) +// addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) + +// bal0, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) +// s.NoError(err) +// s.Equal(bal0, math.NewInt(900_000_000)) + +// bal1, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) +// s.NoError(err) +// s.Equal(bal1, math.NewInt(800_000_000)) + +// bal2, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) +// s.NoError(err) +// s.Equal(bal2, math.NewInt(700_000_000)) + +// balStaking, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) +// s.NoError(err) +// s.Equal(balStaking, math.NewInt(601_000_000)) + +// reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// reporterStakeBefore := reporter.GetBondedTokens() +// report := types.MicroReport{ +// Reporter: addrs[0].String(), +// Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), +// QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", +// Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", +// Timestamp: 1696516597, +// } +// disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) +// s.NoError(err) +// burnAmount := disputeFee.MulRaw(1).QuoRaw(20) +// dispute := types.MsgProposeDispute{ +// Creator: addrs[1].String(), +// Report: &report, +// Fee: sdk.NewCoin(s.denom, disputeFee), +// DisputeCategory: types.Warning, +// } +// balanceBefore := s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// // Propose dispute pay half of the fee from account +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) + +// bal0, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) +// s.NoError(err) +// s.Equal(bal0, math.NewInt(900_000_000)) + +// bal1, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) +// s.NoError(err) +// s.Equal(bal1, math.NewInt(799_000_000)) + +// bal2, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) +// s.NoError(err) +// s.Equal(bal2, math.NewInt(700_000_000)) + +// balStaking, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) +// s.NoError(err) +// s.Equal(balStaking, math.NewInt(600_000_000)) + +// moduleAccs := s.ModuleAccs() +// balDispute, err := s.bankKeeper.Balances.Get(s.ctx, collections.Join(moduleAccs.dispute.GetAddress(), s.denom)) +// s.NoError(err) +// s.Equal(balDispute, disputeFee.MulRaw(2)) // disputeFee + slashAmount + +// balanceAfter := s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.True(balanceBefore.Amount.Sub(disputeFee).Equal(balanceAfter.Amount)) +// // check reporter stake +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) +// // begin block +// header := tmproto.Header{Height: s.app.LastBlockHeight() + 1, Time: s.ctx.BlockTime()} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// votes := []types.MsgVote{ +// { +// Voter: addrs[0].String(), +// Id: 1, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// } +// for i := range votes { +// _, err = msgServer.Vote(s.ctx, &votes[i]) +// s.NoError(err) +// } + +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime()} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.Equal(err.Error(), "can't start a new round for this dispute 1; dispute status DISPUTE_STATUS_VOTING") +// // check reporter stake +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) +// // forward time to after vote end +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(2))), balanceAfter) + +// // check reporter stake +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) // TODO: this double-check seems unnecessary +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// // voting that doesn't reach quorum +// votes = []types.MsgVote{ +// { +// Voter: addrs[0].String(), +// Id: 2, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// } +// for i := range votes { +// _, err = msgServer.Vote(s.ctx, &votes[i]) +// s.NoError(err) +// } +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) + +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(4))), balanceAfter) + +// // check reporter stake +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// // voting that doesn't reach quorum +// votes = []types.MsgVote{ +// { +// Voter: addrs[0].String(), +// Id: 3, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// } +// for i := range votes { +// _, err = msgServer.Vote(s.ctx, &votes[i]) +// s.NoError(err) +// } +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) + +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(8))), balanceAfter) + +// // check reporter stake +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// // voting that doesn't reach quorum +// votes = []types.MsgVote{ +// { +// Voter: addrs[0].String(), +// Id: 4, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// } +// for i := range votes { +// _, err = msgServer.Vote(s.ctx, &votes[i]) +// s.NoError(err) +// } +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.Equal(err.Error(), "can't start a new round for this dispute 4; dispute status DISPUTE_STATUS_VOTING") +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, burnAmount.MulRaw(16))), balanceAfter) + +// // check reporter stake +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.True(reporter.GetBondedTokens().LT(reporterStakeBefore)) +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore.Sub(disputeFee)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// // voting that doesn't reach quorum +// votes = []types.MsgVote{ +// { +// Voter: addrs[0].String(), +// Id: 5, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// } +// for i := range votes { +// _, err = msgServer.Vote(s.ctx, &votes[i]) +// s.NoError(err) +// } +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) + +// // forward time to end vote +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, disputeFee)), balanceAfter) + +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) + +// bal0, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) +// s.NoError(err) +// s.Equal(bal0, math.NewInt(900_000_000)) + +// bal1, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) +// s.NoError(err) +// s.Equal(bal1, math.NewInt(795_500_000)) + +// bal2, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) +// s.NoError(err) +// s.Equal(bal2, math.NewInt(700_000_000)) + +// balStaking, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) +// s.NoError(err) +// s.Equal(balStaking, math.NewInt(600_000_000)) + +// balDispute, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(moduleAccs.dispute.GetAddress(), s.denom)) +// s.NoError(err) +// s.Equal(balDispute, math.NewInt(5_500_000)) // disputeFee + slashAmount + round 1(100000) + round 2(200000) + round 3(400000) + round 4(800000) + round 5(1000000) + round 6(1000000) + +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, disputeFee)), balanceAfter) +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// balanceBefore = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// _, err = msgServer.ProposeDispute(s.ctx, &dispute) +// s.NoError(err) +// balanceAfter = s.bankKeeper.GetBalance(s.ctx, addrs[1], s.denom) +// s.Equal(balanceBefore.Sub(sdk.NewCoin(s.denom, disputeFee)), balanceAfter) +// // forward time and end dispute +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// // check reporter stake, stake should be restored due to invalid vote final result +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.Equal(reporter.GetBondedTokens(), reporterStakeBefore) + +// bal0, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[0], s.denom)) // voter reward half the total burn Amount(the 5%) +// s.NoError(err) +// s.Equal(bal0, math.NewInt(902_275_000)) + +// bal1, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[1], s.denom)) +// s.NoError(err) +// s.Equal(bal1, math.NewInt(795_450_000)) + +// bal2, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(addrs[2], s.denom)) +// s.NoError(err) +// s.Equal(bal2, math.NewInt(700_000_000)) + +// balStaking, err = s.bankKeeper.Balances.Get(s.ctx, collections.Join(s.stakingKeeper.GetBondedPool(s.ctx).GetAddress(), s.denom)) +// s.NoError(err) +// s.Equal(balStaking, math.NewInt(601_000_000)) +// } + +// func (s *IntegrationTestSuite) TestNoQorumSingleRound() { +// msgServer := keeper.NewMsgServerImpl(s.disputekeeper) +// addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) +// reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// reporterStakeBefore := reporter.GetBondedTokens() +// report := types.MicroReport{ +// Reporter: addrs[0].String(), +// Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), +// QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", +// Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", +// Timestamp: 1696516597, +// } +// disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) +// s.NoError(err) +// // Propose dispute pay half of the fee from account +// _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ +// Creator: addrs[1].String(), +// Report: &report, +// Fee: sdk.NewCoin(s.denom, disputeFee), +// DisputeCategory: types.Warning, +// }) +// s.NoError(err) +// header := tmproto.Header{Height: s.app.LastBlockHeight() + 1, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// votes := []types.MsgVote{ +// { +// Voter: addrs[0].String(), +// Id: 1, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// { +// Voter: addrs[1].String(), +// Id: 1, +// Vote: types.VoteEnum_VOTE_INVALID, +// }, +// } + +// for i := range votes { +// _, err = msgServer.Vote(s.ctx, &votes[i]) +// s.NoError(err) +// } +// // forward time to expire dispute +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(86400*3 + 1)) +// header = tmproto.Header{Height: s.app.LastBlockHeight() + 1, AppHash: s.app.LastCommitID().Hash, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) + +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// reporterStakeAfter := reporter.GetBondedTokens() +// // reporter stake should be restored after dispute expires for invalid vote +// s.Equal(reporterStakeBefore, reporterStakeAfter) +// } + +// func (s *IntegrationTestSuite) TestDisputeButNoVotes() { +// msgServer := keeper.NewMsgServerImpl(s.disputekeeper) +// addrs, valAddrs := s.createValidators([]int64{100, 200, 300}) +// reporter, err := s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// reporterStakeBefore := reporter.GetBondedTokens() +// report := types.MicroReport{ +// Reporter: addrs[0].String(), +// Power: reporter.GetConsensusPower(sdk.DefaultPowerReduction), +// QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", +// Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", +// Timestamp: 1696516597, +// } +// disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) +// s.NoError(err) +// // Propose dispute pay half of the fee from account +// _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ +// Creator: addrs[1].String(), +// Report: &report, +// Fee: sdk.NewCoin(s.denom, disputeFee), +// DisputeCategory: types.Warning, +// }) +// s.NoError(err) + +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.NotEqual(reporterStakeBefore, reporter.GetBondedTokens()) +// // forward time to end dispute +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS)) +// header := tmproto.Header{Height: s.app.LastBlockHeight() + 1, Time: s.ctx.BlockTime().Add(1)} +// s.ctx = s.ctx.WithBlockHeader(header) +// _, err = s.app.BeginBlocker(s.ctx) +// s.NoError(err) +// reporter, err = s.stakingKeeper.Validator(s.ctx, valAddrs[0]) +// s.NoError(err) +// s.Equal(reporterStakeBefore, reporter.GetBondedTokens()) +// } diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index 232e4604a..0b5df7fdb 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -5,6 +5,7 @@ import ( "fmt" "math/big" "strings" + "testing" "time" "cosmossdk.io/depinject" @@ -69,8 +70,6 @@ import ( registrytypes "github.com/tellor-io/layer/x/registry/types" reportertypes "github.com/tellor-io/layer/x/reporter/types" - "testing" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/ethereum/go-ethereum/accounts/abi" integration "github.com/tellor-io/layer/tests" @@ -174,7 +173,12 @@ func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[str ) suite.disputekeeper = disputekeeper.NewKeeper( - appCodec, suite.fetchStoreKey(disputetypes.StoreKey), suite.fetchStoreKey(disputetypes.StoreKey), paramtypes.Subspace{}, suite.accountKeeper, suite.bankKeeper, suite.oraclekeeper, suite.slashingKeeper, suite.stakingKeeper, + appCodec, suite.fetchStoreKey(disputetypes.StoreKey), suite.fetchStoreKey(disputetypes.StoreKey), paramtypes.Subspace{}, suite.accountKeeper, suite.bankKeeper, suite.oraclekeeper, suite.reporterkeeper, + ) + suite.stakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + suite.reporterkeeper.Hooks(), + ), ) } @@ -223,36 +227,36 @@ func (s *IntegrationTestSuite) mintTokens(addr sdk.AccAddress, amount sdk.Coin) func (s *IntegrationTestSuite) newKeysWithTokens() sdk.AccAddress { Addr := sample.AccAddressBytes() - s.mintTokens(Addr, sdk.NewCoin(s.denom, math.NewInt(1000000))) + s.mintTokens(Addr, sdk.NewCoin(s.denom, math.NewInt(1_000_000))) return Addr } -func (s *IntegrationTestSuite) createValidators(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { - ctx := s.ctx - acctNum := len(powers) - base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) - amount := new(big.Int).Mul(big.NewInt(1000), base) - testAddrs := simtestutil.CreateIncrementalAccounts(acctNum) - addrs := s.addTestAddrs(math.NewIntFromBigInt(amount), testAddrs) - valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) - pks := simtestutil.CreateTestPubKeys(acctNum) - - for i, pk := range pks { - s.accountKeeper.NewAccountWithAddress(ctx, testAddrs[i]) - - val, err := stakingtypes.NewValidator(valAddrs[i].String(), pk, stakingtypes.Description{}) - s.NoError(err) - s.stakingKeeper.SetValidator(ctx, val) - s.stakingKeeper.SetValidatorByConsAddr(ctx, val) - s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val) - s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) - } - - _, err := s.stakingKeeper.EndBlocker(ctx) - s.NoError(err) - - return addrs, valAddrs -} +// func (s *IntegrationTestSuite) createValidators(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { +// ctx := s.ctx +// acctNum := len(powers) +// base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) +// amount := new(big.Int).Mul(big.NewInt(1000), base) +// testAddrs := simtestutil.CreateIncrementalAccounts(acctNum) +// addrs := s.addTestAddrs(math.NewIntFromBigInt(amount), testAddrs) +// valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) +// pks := simtestutil.CreateTestPubKeys(acctNum) + +// for i, pk := range pks { +// s.accountKeeper.NewAccountWithAddress(ctx, testAddrs[i]) + +// val, err := stakingtypes.NewValidator(valAddrs[i].String(), pk, stakingtypes.Description{}) +// s.NoError(err) +// s.stakingKeeper.SetValidator(ctx, val) +// s.stakingKeeper.SetValidatorByConsAddr(ctx, val) +// s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val) +// s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) +// } + +// _, err := s.stakingKeeper.EndBlocker(ctx) +// s.NoError(err) + +// return addrs, valAddrs +// } func (s *IntegrationTestSuite) addTestAddrs(accAmt math.Int, testAddrs []sdk.AccAddress) []sdk.AccAddress { initCoins := sdk.NewCoin(s.denom, accAmt) diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index 84deeb5fe..fdc768cbb 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -2,9 +2,8 @@ package integration_test import ( "encoding/hex" - "time" - "testing" + "time" "cosmossdk.io/collections" "cosmossdk.io/math" @@ -27,7 +26,6 @@ import ( ) func (s *IntegrationTestSuite) TestTipping() { - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) addr := s.newKeysWithTokens() @@ -45,40 +43,44 @@ func (s *IntegrationTestSuite) TestTipping() { queryId, err := utils.QueryIDFromDataString(ethQueryData) s.NoError(err) - tips := s.oraclekeeper.GetQueryTip(s.ctx, queryId) - s.Equal(tip.Sub(twoPercent).Amount, tips.Amount) - s.Equal(tips.Amount, tips.Amount) + tips, err := s.oraclekeeper.GetQueryTip(s.ctx, queryId) + s.NoError(err) + s.Equal(tip.Sub(twoPercent).Amount, tips) - userTips := s.oraclekeeper.GetUserTips(s.ctx, addr) + userTips, err := s.oraclekeeper.GetUserTips(s.ctx, addr) + s.NoError(err) s.Equal(userTips.Address, addr.String()) - s.Equal(userTips.Total.Amount.Int64(), tips.Amount.Int64()) + s.Equal(userTips.Total.Int64(), tips.Int64()) // tip same query again _, err = msgServer.Tip(s.ctx, &msg) s.NoError(err) - tips = s.oraclekeeper.GetQueryTip(s.ctx, queryId) + tips, err = s.oraclekeeper.GetQueryTip(s.ctx, queryId) + s.NoError(err) // tips should be 2x - s.Equal(tip.Sub(twoPercent).Amount.Mul(math.NewInt(2)), tips.Amount) - s.Equal(tips.Amount, tips.Amount) + s.Equal(tip.Sub(twoPercent).Amount.Mul(math.NewInt(2)), tips) + // total tips overall - userTips = s.oraclekeeper.GetUserTips(s.ctx, addr) + userTips, err = s.oraclekeeper.GetUserTips(s.ctx, addr) + s.NoError(err) s.Equal(userTips.Address, addr.String()) - s.Equal(userTips.Total.Amount, tips.Amount) + s.Equal(userTips.Total, tips) // tip different query btcQueryId, err := utils.QueryIDFromDataString(btcQueryData) s.NoError(err) _, err = msgServer.Tip(s.ctx, &types.MsgTip{QueryData: btcQueryData, Tipper: addr.String(), Amount: tip}) s.NoError(err) - tips = s.oraclekeeper.GetQueryTip(s.ctx, btcQueryId) - s.Equal(tip.Sub(twoPercent).Amount, tips.Amount) - s.Equal(tips.Amount, tips.Amount) + tips, err = s.oraclekeeper.GetQueryTip(s.ctx, btcQueryId) + s.NoError(err) + s.Equal(tip.Sub(twoPercent).Amount, tips) userQueryTips, _ := s.oraclekeeper.Tips.Get(s.ctx, collections.Join(btcQueryId, addr.Bytes())) - s.Equal(userQueryTips, tips.Amount) - userTips = s.oraclekeeper.GetUserTips(s.ctx, addr) + s.Equal(userQueryTips, tips) + userTips, err = s.oraclekeeper.GetUserTips(s.ctx, addr) + s.NoError(err) s.Equal(userTips.Address, addr.String()) - s.Equal(userTips.Total.Amount, tips.Amount.Add(tips.Amount).Add(tips.Amount)) + s.Equal(userTips.Total, tips.Add(tips).Add(tips)) } func (s *IntegrationTestSuite) TestGetCurrentTip() { @@ -99,10 +101,11 @@ func (s *IntegrationTestSuite) TestGetCurrentTip() { // Get current tip resp, err := s.oraclekeeper.GetCurrentTip(s.ctx, &types.QueryGetCurrentTipRequest{QueryData: ethQueryData}) s.NoError(err) - s.Equal(resp.Tips, &types.Tips{QueryData: ethQueryData, Amount: tip.Sub(twoPercent)}) + s.Equal(resp.Tips, &types.Tips{QueryData: ethQueryData, Amount: tip.Amount.Sub(twoPercent.Amount)}) } -func (s *IntegrationTestSuite) TestGetUserTipTotal() { +// test tipping, reporting and allocation of rewards +func (s *IntegrationTestSuite) TestTippingReporting() { msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) addr := s.newKeysWithTokens() @@ -117,10 +120,58 @@ func (s *IntegrationTestSuite) TestGetUserTipTotal() { _, err := msgServer.Tip(s.ctx, &msg) s.NoError(err) + queryId, err := utils.QueryIDFromDataString(ethQueryData) + s.NoError(err) + + tips, err := s.oraclekeeper.GetQueryTip(s.ctx, queryId) + s.NoError(err) + s.Equal(tip.Sub(twoPercent).Amount, tips) + + newReporter, err := createReporter(s.ctx, int64(1), s.reporterkeeper) + s.Nil(err) + salt, err := oracleutils.Salt(32) + s.Nil(err) + value := encodeValue(29266) + hash := oracleutils.CalculateCommitment(value, salt) + commit, reveal := report(newReporter.String(), value, salt, hash, ethQueryData) + _, err = msgServer.CommitReport(s.ctx, &commit) + s.Nil(err) + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + _, err = msgServer.SubmitValue(s.ctx, &reveal) + s.Nil(err) + err = s.oraclekeeper.SetAggregatedReport(s.ctx) + s.Nil(err) + res, err := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(queryId)}) + s.Nil(err) + s.Equal(res.Report.AggregateReporter, newReporter.String()) + // tip should be 0 after aggregated report + tips, err = s.oraclekeeper.GetQueryTip(s.ctx, queryId) + s.Nil(err) + s.Equal(tips, math.ZeroInt()) + totalTips, err := s.oraclekeeper.GetTotalTips(s.ctx) + s.Nil(err) + s.Equal(totalTips, tip.Sub(twoPercent).Amount) // total tips should be equal to the tipped amount minus 2% burned +} + +func (s *IntegrationTestSuite) TestGetUserTipTotal() { + msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + + addr := s.newKeysWithTokens() + + tip := math.NewInt(1000) + twoPercent := tip.Mul(math.NewInt(2)).Quo(math.NewInt(100)) + msg := types.MsgTip{ + Tipper: addr.String(), + QueryData: ethQueryData, + Amount: sdk.NewCoin(s.denom, tip), + } + _, err := msgServer.Tip(s.ctx, &msg) + s.NoError(err) + // Get current tip resp, err := s.oraclekeeper.GetUserTipTotal(s.ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String(), QueryData: ethQueryData}) s.NoError(err) - s.Equal(resp.TotalTips.Total.Amount, tip.Sub(twoPercent).Amount) + s.Equal(resp.TotalTips.Total, tip.Sub(twoPercent)) // Check total tips without a given query data resp, err = s.oraclekeeper.GetUserTipTotal(s.ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) s.NoError(err) @@ -312,7 +363,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err) - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward, false) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward.Amount, false) s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) @@ -375,7 +426,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { s.NoError(err, "error getting aggregated report") tbr, err := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err, "error getting time based rewards") - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward, false) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward.Amount, false) s.NoError(err, "error allocating rewards") // advance height @@ -385,13 +436,11 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { s.reporterkeeper.WithdrawDelegationRewards(s.ctx, tc.delegator.Bytes(), tc.delegator) afterBalance := s.bankKeeper.GetBalance(s.ctx, tc.delegator, s.denom) s.Equal(tc.beforeBalance.Amount.Add(tc.afterBalanceIncrease), afterBalance.Amount) - }) } } func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { - tipper := s.newKeysWithTokens() reward := math.NewInt(100) err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) @@ -449,7 +498,7 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { res, _ := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) tbr, _ := s.oraclekeeper.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward, false) + err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward.Amount, false) s.NoError(err) // advance height s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) @@ -461,7 +510,6 @@ func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { tolerance := expectedAfterBalance.SubRaw(1) //due to rounding int withinTolerance := expectedAfterBalance.Equal(afterBalance.Amount) || tolerance.Equal(afterBalance.Amount) s.True(withinTolerance) - }) } } @@ -585,7 +633,8 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), s.ctx.BlockTime()) _, err = createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.Nil(err) - err = DelegateToReporterSingleValidator(s.ctx, s.reporterkeeper, repAcc, delegator2, valAddr, stakeAmount) + source := reportertypes.TokenOrigin{ValidatorAddress: valAddr.String(), Amount: stakeAmount} + err = DelegateToReporterSingleValidator(s.ctx, s.reporterkeeper, repAcc, delegator2, valAddr, []*reportertypes.TokenOrigin{&source}, stakeAmount) s.Nil(err) // check delegation shares before reporting, should be equal to the stake amount diff --git a/tests/integration/reporter_keeper_test.go b/tests/integration/reporter_keeper_test.go index 72a107f31..c03adb177 100644 --- a/tests/integration/reporter_keeper_test.go +++ b/tests/integration/reporter_keeper_test.go @@ -147,7 +147,6 @@ func (s *IntegrationTestSuite) TestDelegatorIundelegatesFromValidator() { s.NoError(err) s.Equal(amt, math.NewInt(10*1e6)) // call the staking hook - s.stakingKeeper.SetHooks(s.reporterkeeper.Hooks()) err = s.stakingKeeper.Hooks().AfterDelegationModified(s.ctx, delegators[delegatorI].delegatorAddress, valBz) s.NoError(err) oracleReporter, err := s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) @@ -261,13 +260,14 @@ func createReporterStakedWithValidator(ctx sdk.Context, k keeper.Keeper, sk repo return createReporterMsg, nil } -func DelegateToReporterSingleValidator(ctx sdk.Context, k keeper.Keeper, repAddr sdk.AccAddress, delAddr sdk.AccAddress, valAddr sdk.ValAddress, stake math.Int) error { - source := reportertypes.TokenOrigin{ValidatorAddress: valAddr.String(), Amount: stake} +func DelegateToReporterSingleValidator( + ctx sdk.Context, k keeper.Keeper, repAddr sdk.AccAddress, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sources []*reportertypes.TokenOrigin, stake math.Int, +) error { delegation := reportertypes.NewMsgDelegateReporter( delAddr.String(), repAddr.String(), stake, - []*reportertypes.TokenOrigin{&source}, + sources, ) server := keeper.NewMsgServerImpl(k) _, err := server.DelegateReporter(ctx, delegation) @@ -276,3 +276,8 @@ func DelegateToReporterSingleValidator(ctx sdk.Context, k keeper.Keeper, repAddr } return err } + +// create multiple validators +// stake 5 delegators with each validator +// create one reporter +// delegate 5 delegators to the reporter with token sources from each validator for each delegator diff --git a/testutil/keeper/dispute.go b/testutil/keeper/dispute.go index 068773535..03f1de881 100644 --- a/testutil/keeper/dispute.go +++ b/testutil/keeper/dispute.go @@ -15,10 +15,13 @@ import ( typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" "github.com/tellor-io/layer/x/dispute/keeper" + "github.com/tellor-io/layer/x/dispute/mocks" "github.com/tellor-io/layer/x/dispute/types" ) -func DisputeKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func DisputeKeeper(t testing.TB) ( + keeper.Keeper, *mocks.OracleKeeper, *mocks.ReporterKeeper, *mocks.AccountKeeper, *mocks.BankKeeper, sdk.Context, +) { storeKey := storetypes.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) @@ -37,16 +40,21 @@ func DisputeKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { memStoreKey, "DisputeParams", ) + + accountKeeper := new(mocks.AccountKeeper) + bankKeeper := new(mocks.BankKeeper) + oracleKeeper := new(mocks.OracleKeeper) + reporterKeeper := new(mocks.ReporterKeeper) + k := keeper.NewKeeper( cdc, storeKey, memStoreKey, paramsSubspace, - nil, - nil, - nil, - nil, - nil, + accountKeeper, + bankKeeper, + oracleKeeper, + reporterKeeper, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) @@ -54,5 +62,5 @@ func DisputeKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { // Initialize params k.SetParams(ctx, types.DefaultParams()) - return k, ctx + return k, oracleKeeper, reporterKeeper, accountKeeper, bankKeeper, ctx } diff --git a/testutil/utils.go b/testutil/utils.go index 85246bfb1..a46971376 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -1,7 +1,6 @@ package testutil import ( - "crypto/rand" "encoding/hex" "fmt" "math" @@ -11,12 +10,6 @@ import ( oracletypes "github.com/tellor-io/layer/x/oracle/types" ) -func GenerateRandomAddress() sdk.AccAddress { - randBytes := make([]byte, 20) - rand.Read(randBytes) - return sdk.AccAddress(randBytes) -} - func GenerateReports(reporters []sdk.AccAddress, values []string, powers []int64, qId string) []oracletypes.MicroReport { var reports []oracletypes.MicroReport queryId, err := utils.QueryIDFromString(qId) diff --git a/types/global.go b/types/global.go new file mode 100644 index 000000000..e9ee69115 --- /dev/null +++ b/types/global.go @@ -0,0 +1,13 @@ +package types + +import ( + "cosmossdk.io/math" +) + +var ( + BondDenom = "loya" + + OneTrb = math.NewInt(1_000_000) + // ten percent of 1TRB + TenPercent = math.NewInt(10_000) +) diff --git a/x/dispute/genesis_test.go b/x/dispute/genesis_test.go index c45ea4089..c659183cc 100644 --- a/x/dispute/genesis_test.go +++ b/x/dispute/genesis_test.go @@ -17,7 +17,7 @@ func TestGenesis(t *testing.T) { // this line is used by starport scaffolding # genesis/test/state } - k, ctx := keepertest.DisputeKeeper(t) + k, _, _, _, _, ctx := keepertest.DisputeKeeper(t) dispute.InitGenesis(ctx, k, genesisState) got := dispute.ExportGenesis(ctx, k) require.NotNil(t, got) diff --git a/x/dispute/keeper/abci.go b/x/dispute/keeper/abci.go index 1cbb70fe3..356f11fa0 100644 --- a/x/dispute/keeper/abci.go +++ b/x/dispute/keeper/abci.go @@ -3,29 +3,43 @@ package keeper import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" ) // tally votes -func (k Keeper) Tally(ctx sdk.Context, ids []uint64) { +func (k Keeper) Tally(ctx sdk.Context, ids []uint64) error { for _, id := range ids { - k.TallyVote(ctx, id) + err := k.TallyVote(ctx, id) + if err != nil { + return err + } } + return nil } // Execute the transfer of fee after the vote on a dispute is complete -func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) { - dispute := k.GetDisputeById(ctx, id) - if dispute == nil { - return +func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { + dispute, err := k.GetDisputeById(ctx, id) + if err != nil { + return err } var voters []string for _, id := range dispute.PrevDisputeIds { - voters = append(voters, k.GetVote(ctx, id).Voters...) + v, err := k.GetVote(ctx, id) + if err != nil { + return err + } + voters = append(voters, v.Voters...) + } + vote, err := k.GetVote(ctx, id) + if err != nil { + return err } - vote := k.GetVote(ctx, id) if vote.Executed || dispute.DisputeStatus != types.Resolved { - return + ctx.Logger().Info("can't execute vote, reason either vote has already executed: %v, or dispute status: %v", vote.Executed, dispute.DisputeStatus) + return nil } disputeFeeMinusBurn := dispute.SlashAmount.Sub(dispute.BurnAmount) // the burnAmount %5 of disputeFee, half of which is burned and the other half is distributed to the voters @@ -40,79 +54,97 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) { // divide the remaining burnAmount equally among the voters and transfer it to their accounts burnRemainder, err := k.RewardVoters(ctx, voters, voterReward) if err != nil { - panic(err) + return err } // burn half the burnAmount - if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { - panic(err) + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { + return err } // refund all fees to each dispute fee payer and restore validator bond/power // burn dispute fee then pay back the remaining dispute fee to the fee payers fromAcc, fromBond := k.SortPayerInfo(dispute.FeePayers) if err := k.RefundDisputeFeeToAccount(ctx, fromAcc); err != nil { - panic(err) + return err } if err := k.RefundDisputeFeeToBond(ctx, fromBond); err != nil { - panic(err) + return err } - if err := k.RefundToBond(ctx, dispute.ReportEvidence.Reporter, sdk.NewCoin(types.DefaultBondDenom, dispute.SlashAmount)); err != nil { - panic(err) + if err := k.RefundToBond(ctx, dispute.ReportEvidence.Reporter, sdk.NewCoin(layer.BondDenom, dispute.SlashAmount)); err != nil { + return err } vote.Executed = true - k.SetVote(ctx, id, vote) + if err := k.SetVote(ctx, id, vote); err != nil { + return err + } case types.VoteResult_SUPPORT, types.VoteResult_NO_QUORUM_MAJORITY_SUPPORT: burnRemainder, err := k.RewardVoters(ctx, voters, voterReward) if err != nil { - panic(err) + return err } // burn half the burnAmount - if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { - panic(err) + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { + return err } // divide the reporters bond equally amongst the dispute fee payers and add it to the bonded pool - reporterSlashAmount := dispute.SlashAmount.QuoRaw(int64(len(dispute.FeePayers))) - for _, disputer := range dispute.FeePayers { - if err := k.RefundToBond(ctx, disputer.PayerAddress, sdk.NewCoin(types.DefaultBondDenom, reporterSlashAmount)); err != nil { - panic(err) - } + if err := k.reporterKeeper.RewardReporterBondToFeePayers(ctx, dispute.FeePayers, dispute.SlashAmount); err != nil { + return err + } + // send coins to the staking module bonded pool + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, dispute.SlashAmount))); err != nil { + return err } vote.Executed = true - k.SetVote(ctx, id, vote) + if err := k.SetVote(ctx, id, vote); err != nil { + return err + } case types.VoteResult_AGAINST, types.VoteResult_NO_QUORUM_MAJORITY_AGAINST: burnRemainder, err := k.RewardVoters(ctx, voters, voterReward) if err != nil { - panic(err) + return err } // burn half the burnAmount - if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { - panic(err) + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { + return err } // refund the reporters bond to the reporter plus the remaining disputeFee; goes to bonded pool - if err := k.RefundToBond(ctx, dispute.ReportEvidence.Reporter, sdk.NewCoin(types.DefaultBondDenom, dispute.SlashAmount.Add(disputeFeeMinusBurn))); err != nil { - panic(err) + if err := k.RefundToBond(ctx, dispute.ReportEvidence.Reporter, sdk.NewCoin(layer.BondDenom, dispute.SlashAmount.Add(disputeFeeMinusBurn))); err != nil { + return err } vote.Executed = true - k.SetVote(ctx, id, vote) + if err := k.SetVote(ctx, id, vote); err != nil { + return err + } default: } + return nil } -func (k Keeper) ExecuteVotes(ctx sdk.Context, ids []uint64) { +func (k Keeper) ExecuteVotes(ctx sdk.Context, ids []uint64) error { for _, id := range ids { - k.ExecuteVote(ctx, id) + err := k.ExecuteVote(ctx, id) + if err != nil { + return err + } } + return nil } // set disputes to resolved if adding rounds has been exhausted // check if disputes can be removed due to expiration prior to commencing vote -func (k Keeper) CheckPrevoteDisputesForExpiration(ctx sdk.Context) []uint64 { - openDisputes := k.GetOpenDisputeIds(ctx) +func (k Keeper) CheckPrevoteDisputesForExpiration(ctx sdk.Context) ([]uint64, error) { + openDisputes, err := k.GetOpenDisputeIds(ctx) + if err != nil { + return nil, err + } var expiredDisputes []uint64 // disputes that failed to begin vote (ie fee unpaid in full) var activeDisputes []uint64 for _, disputeId := range openDisputes.Ids { // get dispute by id - dispute := k.GetDisputeById(ctx, disputeId) + dispute, err := k.GetDisputeById(ctx, disputeId) + if err != nil { + return nil, err + } if ctx.BlockTime().After(dispute.DisputeEndTime) && dispute.DisputeStatus == types.Prevote { // append to expired list @@ -124,11 +156,17 @@ func (k Keeper) CheckPrevoteDisputesForExpiration(ctx sdk.Context) []uint64 { } // update active disputes list openDisputes.Ids = activeDisputes - k.SetOpenDisputeIds(ctx, openDisputes) + err = k.SetOpenDisputeIds(ctx, openDisputes) + if err != nil { + return nil, err + } for _, disputeId := range expiredDisputes { // set dispute status to expired - k.SetDisputeStatus(ctx, disputeId, types.Failed) + err := k.SetDisputeStatus(ctx, disputeId, types.Failed) + if err != nil { + return nil, err + } } // return active list - return activeDisputes + return activeDisputes, nil } diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index 01ab1255b..cce826d92 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -3,6 +3,7 @@ package keeper import ( "crypto/sha256" "encoding/binary" + "errors" "fmt" "math/big" "time" @@ -14,15 +15,18 @@ import ( ) // Get dispute by dispute id -func (k Keeper) GetDisputeById(ctx sdk.Context, id uint64) *types.Dispute { +func (k Keeper) GetDisputeById(ctx sdk.Context, id uint64) (*types.Dispute, error) { store := k.disputeStore(ctx) bz := store.Get(types.DisputeIdBytes(id)) if bz == nil { - return nil + return nil, types.ErrDisputeDoesNotExist.Wrapf("no dispute found with id %d", id) } var dispute types.Dispute - k.cdc.MustUnmarshal(bz, &dispute) - return &dispute + err := k.cdc.Unmarshal(bz, &dispute) + if err != nil { + return nil, err + } + return &dispute, nil } // Get dispute by reporter key @@ -51,15 +55,18 @@ func (k Keeper) GetDisputeCount(ctx sdk.Context) uint64 { } // Get open dispute ids from the store -func (k Keeper) GetOpenDisputeIds(ctx sdk.Context) types.OpenDisputes { +func (k Keeper) GetOpenDisputeIds(ctx sdk.Context) (types.OpenDisputes, error) { store := k.disputeStore(ctx) bz := store.Get(types.OpenDisputeIdsKeyPrefix()) if bz == nil { - return types.OpenDisputes{} + return types.OpenDisputes{}, nil } var ids types.OpenDisputes - k.cdc.MustUnmarshal(bz, &ids) - return ids + err := k.cdc.Unmarshal(bz, &ids) + if err != nil { + return types.OpenDisputes{}, err + } + return ids, nil } // Generate hash id @@ -86,18 +93,26 @@ func (k Keeper) SetDisputeCount(ctx sdk.Context, count uint64) { } // Set dispute in the store by dispute id -func (k Keeper) SetDisputeById(ctx sdk.Context, id uint64, dispute types.Dispute) { +func (k Keeper) SetDisputeById(ctx sdk.Context, id uint64, dispute types.Dispute) error { store := k.disputeStore(ctx) - bz := k.cdc.MustMarshal(&dispute) + bz, err := k.cdc.Marshal(&dispute) + if err != nil { + return err + } store.Set(types.DisputeIdBytes(id), bz) + return nil } // Set dispute by reporter -func (k Keeper) SetDisputeByReporter(ctx sdk.Context, dispute types.Dispute) { +func (k Keeper) SetDisputeByReporter(ctx sdk.Context, dispute types.Dispute) error { store := k.disputeStore(ctx) - bz := k.cdc.MustMarshal(&dispute) + bz, err := k.cdc.Marshal(&dispute) + if err != nil { + return err + } key := []byte(k.ReporterKey(ctx, dispute.ReportEvidence, dispute.DisputeCategory)) store.Set(key, bz) + return nil } // Set new dispute @@ -105,9 +120,12 @@ func (k Keeper) SetNewDispute(ctx sdk.Context, msg types.MsgProposeDispute) erro disputeId := k.GetDisputeCount(ctx) hashId := k.HashId(ctx, *msg.Report, msg.DisputeCategory) // slash amount - disputeFee := k.GetDisputeFee(ctx, msg.Report.Reporter, msg.DisputeCategory) + disputeFee, err := k.GetDisputeFee(ctx, msg.Report.Reporter, msg.DisputeCategory) + if err != nil { + return err + } if disputeFee.IsZero() { - return fmt.Errorf("Error calculating dispute fee") + return errors.New("error calculating dispute fee") } feeList := make([]types.PayerInfo, 0) @@ -143,66 +161,86 @@ func (k Keeper) SetNewDispute(ctx sdk.Context, msg types.MsgProposeDispute) erro } // if the paid fee is equal to the slash amount, then slash validator and jail if dispute.FeeTotal.Equal(dispute.SlashAmount) { - k.SlashAndJailReporter(ctx, dispute.ReportEvidence, dispute.DisputeCategory) + if err := k.SlashAndJailReporter(ctx, dispute.ReportEvidence, dispute.DisputeCategory); err != nil { + return err + } // extend dispute end time by 3 days, 2 for voting and 1 to allow for more rounds dispute.DisputeEndTime = ctx.BlockTime().Add(THREE_DAYS) dispute.DisputeStatus = types.Voting - k.SetStartVote(ctx, dispute.DisputeId) // starting voting immediately + if err := k.SetStartVote(ctx, dispute.DisputeId); err != nil { // starting voting immediately + return err + } } - k.SetDispute(ctx, dispute) - return nil + return k.SetDispute(ctx, dispute) } // Slash and jail reporter -func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report types.MicroReport, category types.DisputeCategory) { - accAddress := sdk.MustAccAddressFromBech32(report.Reporter) +func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report types.MicroReport, category types.DisputeCategory) error { + reporterAddr := sdk.MustAccAddressFromBech32(report.Reporter) - k.Slash(ctx, sdk.ValAddress(accAddress), report.Power, k.GetSlashPercentage(category)) + // k.Slash(ctx, sdk.ValAddress(accAddress), report.Power, k.GetSlashPercentage(category)) + var jailDuration int64 switch category { case types.Warning: // jail for 0 seconds, forces validator to unjail manually - k.JailValidatorUntil(ctx, sdk.ValAddress(accAddress), 0) + jailDuration = 0 case types.Minor: // jail for 10 minutes - k.JailValidatorUntil(ctx, sdk.ValAddress(accAddress), 600) + jailDuration = 600 case types.Major: - // no need to jail since validator will be removed from bonded pool so do nothing + // TODO: jail duration should be until dispute ends default: - panic("invalid dispute category") + return types.ErrInvalidDisputeCategory.Wrapf("wrong category selected: %s", category) + } + + slashFactor, err := k.GetSlashPercentage(category) + if err != nil { + return err + } + amount := sdk.TokensFromConsensusPower(report.Power, sdk.DefaultPowerReduction) + slashAmount := math.LegacyNewDecFromInt(amount).Mul(slashFactor) + err = k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, slashAmount.TruncateInt()) + if err != nil { + return err } + return k.reporterKeeper.JailReporter(ctx, reporterAddr, jailDuration) } // Store open dispute ids in the store -func (k Keeper) SetOpenDisputeIds(ctx sdk.Context, ids types.OpenDisputes) { +func (k Keeper) SetOpenDisputeIds(ctx sdk.Context, ids types.OpenDisputes) error { store := k.disputeStore(ctx) - bz := k.cdc.MustMarshal(&ids) + bz, err := k.cdc.Marshal(&ids) + if err != nil { + return err + } store.Set(types.OpenDisputeIdsKeyPrefix(), bz) + return nil } // Get percentage of slash amount based on category -func (k Keeper) GetSlashPercentage(category types.DisputeCategory) math.LegacyDec { +func (k Keeper) GetSlashPercentage(category types.DisputeCategory) (math.LegacyDec, error) { switch category { case types.Warning: - return math.LegacyNewDecWithPrec(1, 2) // 1% + return math.LegacyNewDecWithPrec(1, 2), nil // 1% case types.Minor: - return math.LegacyNewDecWithPrec(5, 2) // 5% + return math.LegacyNewDecWithPrec(5, 2), nil // 5% case types.Major: - return math.LegacyNewDecWithPrec(1, 0) // 100% + return math.LegacyNewDecWithPrec(1, 0), nil // 100% default: - panic("invalid dispute category") + return math.LegacyDec{}, errors.New("invalid dispute category") } } // Get dispute fee -func (k Keeper) GetDisputeFee(ctx sdk.Context, reporter string, category types.DisputeCategory) math.Int { - reporterAddr := sdk.MustAccAddressFromBech32(reporter) - - validator, err := k.stakingKeeper.GetValidator(ctx, sdk.ValAddress(reporterAddr)) +func (k Keeper) GetDisputeFee(ctx sdk.Context, rep string, category types.DisputeCategory) (math.Int, error) { + reporterAddr := sdk.MustAccAddressFromBech32(rep) + reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) if err != nil { - panic(fmt.Errorf("validator %s not found", reporter)) + return math.Int{}, err } - stake := validator.GetBondedTokens() + + stake := reporter.TotalTokens fee := math.ZeroInt() switch category { case types.Warning: @@ -215,7 +253,7 @@ func (k Keeper) GetDisputeFee(ctx sdk.Context, reporter string, category types.D // calculate 100 percent of bond fee = stake } - return fee + return fee, nil } // Update existing dispute when conditions are met @@ -260,11 +298,20 @@ func (k Keeper) AddDisputeRound(ctx sdk.Context, dispute types.Dispute, msg type dispute.DisputeStartBlock = ctx.BlockHeight() dispute.DisputeRound++ // from previous dispute id from open disputes - k.removeId(ctx, dispute.PrevDisputeIds[len(dispute.PrevDisputeIds)-1]) + err := k.removeId(ctx, dispute.PrevDisputeIds[len(dispute.PrevDisputeIds)-1]) + if err != nil { + return err + } dispute.PrevDisputeIds = append(dispute.PrevDisputeIds, disputeId) - k.SetDispute(ctx, dispute) - k.SetStartVote(ctx, dispute.DisputeId) // starting voting immediately + err = k.SetDispute(ctx, dispute) + if err != nil { + return err + } + err = k.SetStartVote(ctx, dispute.DisputeId) // starting voting immediately + if err != nil { + return err + } // How does second round of dispute fee work? // If fee is not paid then doubling the burnAmount means reducing the fee total? // Reducing the fee total means that feeTotal - burnAmount could be zero and the fee payers don't get anything from the feePaid or who gets what is not clear @@ -272,52 +319,78 @@ func (k Keeper) AddDisputeRound(ctx sdk.Context, dispute types.Dispute, msg type } // remove dispute id from opendisputes after adding a new round -func (k Keeper) removeId(ctx sdk.Context, disputeId uint64) { - openDisputes := k.GetOpenDisputeIds(ctx) +func (k Keeper) removeId(ctx sdk.Context, disputeId uint64) error { + openDisputes, err := k.GetOpenDisputeIds(ctx) + if err != nil { + return err + } for i, id := range openDisputes.Ids { if id == disputeId { openDisputes.Ids[i] = openDisputes.Ids[len(openDisputes.Ids)-1] openDisputes.Ids = openDisputes.Ids[:len(openDisputes.Ids)-1] - k.SetOpenDisputeIds(ctx, openDisputes) + err = k.SetOpenDisputeIds(ctx, openDisputes) + if err != nil { + return err + } } } + return nil } // Add time to dispute end time func (k Keeper) AddTimeToDisputeEndTime(ctx sdk.Context, id uint64, timeToAdd time.Duration) error { - dispute := k.GetDisputeById(ctx, id) - if dispute == nil { - return types.ErrDisputeDoesNotExist + dispute, err := k.GetDisputeById(ctx, id) + if err != nil { + return err } dispute.DisputeEndTime = dispute.DisputeEndTime.Add(timeToAdd) - k.SetDisputeById(ctx, dispute.DisputeId, *dispute) - k.SetDisputeByReporter(ctx, *dispute) - return nil + err = k.SetDisputeById(ctx, dispute.DisputeId, *dispute) + if err != nil { + return err + } + return k.SetDisputeByReporter(ctx, *dispute) } // Append dispute id to open dispute ids -func (k Keeper) AppendDisputeIdToOpenDisputeIds(ctx sdk.Context, disputeId uint64) { - openDisputes := k.GetOpenDisputeIds(ctx) +func (k Keeper) AppendDisputeIdToOpenDisputeIds(ctx sdk.Context, disputeId uint64) error { + openDisputes, err := k.GetOpenDisputeIds(ctx) + if err != nil { + return err + } openDisputes.Ids = append(openDisputes.Ids, disputeId) - k.SetOpenDisputeIds(ctx, openDisputes) + err = k.SetOpenDisputeIds(ctx, openDisputes) + if err != nil { + return err + } + return nil } // Set DISPUTE -func (k Keeper) SetDispute(ctx sdk.Context, dispute types.Dispute) { - k.AppendDisputeIdToOpenDisputeIds(ctx, dispute.DisputeId) - k.SetDisputeByReporter(ctx, dispute) - k.SetDisputeById(ctx, dispute.DisputeId, dispute) +func (k Keeper) SetDispute(ctx sdk.Context, dispute types.Dispute) error { + if err := k.AppendDisputeIdToOpenDisputeIds(ctx, dispute.DisputeId); err != nil { + return err + } + if err := k.SetDisputeByReporter(ctx, dispute); err != nil { + return err + } + if err := k.SetDisputeById(ctx, dispute.DisputeId, dispute); err != nil { + return err + } k.SetDisputeCount(ctx, dispute.DisputeId+1) + return nil } // Set dispute status by dispute id func (k Keeper) SetDisputeStatus(ctx sdk.Context, id uint64, status types.DisputeStatus) error { - dispute := k.GetDisputeById(ctx, id) - if dispute == nil { - return types.ErrDisputeDoesNotExist + dispute, err := k.GetDisputeById(ctx, id) + if err != nil { + return err } dispute.DisputeStatus = status - k.SetDisputeById(ctx, id, *dispute) - k.SetDisputeByReporter(ctx, *dispute) - return nil + err = k.SetDisputeById(ctx, id, *dispute) + if err != nil { + return err + } + + return k.SetDisputeByReporter(ctx, *dispute) } diff --git a/x/dispute/keeper/dispute_fee.go b/x/dispute/keeper/dispute_fee.go index f91b87bed..ca6561940 100644 --- a/x/dispute/keeper/dispute_fee.go +++ b/x/dispute/keeper/dispute_fee.go @@ -20,65 +20,20 @@ func (k Keeper) PayFromAccount(ctx sdk.Context, addr sdk.AccAddress, fee sdk.Coi } // Pay fee from validator's bond can only be called by the validator itself -func (k Keeper) PayFromBond(ctx sdk.Context, delAddr sdk.AccAddress, fee sdk.Coin) error { - validator, err := k.stakingKeeper.GetValidator(ctx, sdk.ValAddress(delAddr)) - if err != nil { - return stakingtypes.ErrNoValidatorFound - } - - // Check if validator has tokens to pay the fee - if fee.Amount.GT(validator.GetBondedTokens()) { - return fmt.Errorf("not enough stake to pay the fee") - } - - // Deduct tokens from validator - validator, err = k.stakingKeeper.RemoveValidatorTokens(ctx, validator, fee.Amount) - if err != nil { - return err - } - - // Send fee to module account - var poolName string - switch validator.GetStatus() { - case stakingtypes.Bonded: - poolName = stakingtypes.BondedPoolName - case stakingtypes.Unbonded, stakingtypes.Unbonding: - poolName = stakingtypes.NotBondedPoolName - default: - panic("invalid validator status") - } - - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, poolName, types.ModuleName, sdk.NewCoins(fee)); err != nil { - return err - } - return nil +func (k Keeper) PayFromBond(ctx sdk.Context, reporterAddr sdk.AccAddress, fee sdk.Coin) error { + return k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, fee.Amount) } // Refund coins to bonded pool func (k Keeper) RefundToBond(ctx sdk.Context, refundTo string, fee sdk.Coin) error { - // TODO: loophole bypassing redelegation MaxEntries check - // k.GetLastRefundBlockTime(ctx, delAddr) - // k.SetLastRefundBlockTime(ctx, delAddr, currentBlock) - delAddr := sdk.MustAccAddressFromBech32(refundTo) - validator, err := k.stakingKeeper.GetValidator(ctx, sdk.ValAddress(delAddr)) - if err != nil { - return stakingtypes.ErrNoValidatorFound - } - validator, _, err = k.stakingKeeper.AddValidatorTokensAndShares(ctx, validator, fee.Amount) + reporterAddr, err := sdk.AccAddressFromBech32(refundTo) if err != nil { return err } - - if validator.IsBonded() { - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(fee)); err != nil { - return err - } - } else { - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.NotBondedPoolName, sdk.NewCoins(fee)); err != nil { - return err - } + if err := k.reporterKeeper.AllocateRewardsToStake(ctx, reporterAddr, fee.Amount); err != nil { + return err } - return nil + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(fee)) } // Pay dispute fee diff --git a/x/dispute/keeper/dispute_fee_test.go b/x/dispute/keeper/dispute_fee_test.go index 04113cc8d..dc88816a8 100644 --- a/x/dispute/keeper/dispute_fee_test.go +++ b/x/dispute/keeper/dispute_fee_test.go @@ -3,31 +3,25 @@ package keeper_test import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/mock" + "github.com/tellor-io/layer/testutil/sample" + layer "github.com/tellor-io/layer/types" ) func (s *KeeperTestSuite) TestPayFromAccount() { - require := s.Require() - s.bankKeeper.On("HasBalance", mock.Anything, mock.Anything, mock.Anything).Return(true) + addr := sample.AccAddressBytes() + + s.bankKeeper.On("HasBalance", s.ctx, addr, sdk.NewCoin(layer.BondDenom, math.NewInt(1))).Return(true) s.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - err := s.disputeKeeper.PayFromAccount(s.ctx, Addr, sdk.NewCoin("trb", math.NewInt(1))) - require.Nil(err) + + err := s.disputeKeeper.PayFromAccount(s.ctx, addr, sdk.NewCoin(layer.BondDenom, math.NewInt(1))) + s.Nil(err) } func (s *KeeperTestSuite) TestPayFromBond() { - require := s.Require() + addr := sample.AccAddressBytes() - val, _ := stakingtypes.NewValidator(Addr.String(), PubKey, stakingtypes.Description{Moniker: "test"}) - val.Jailed = false - val.Status = stakingtypes.Bonded - val.Tokens = math.NewInt(1) - s.stakingKeeper.On("GetValidator", mock.Anything, mock.Anything).Return(val, nil) - s.stakingKeeper.On("RemoveValidatorTokens", mock.Anything, mock.Anything, mock.Anything).Return(val, nil) - s.bankKeeper.On("SendCoinsFromModuleToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - err := s.disputeKeeper.PayFromBond(s.ctx, Addr, sdk.NewCoin("trb", math.NewInt(1))) - require.Nil(err) - // Should error since fee is more than bond - err = s.disputeKeeper.PayFromBond(s.ctx, Addr, sdk.NewCoin("trb", math.NewInt(10))) - require.NotNil(err) + s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, math.OneInt()).Return(nil) + err := s.disputeKeeper.PayFromBond(s.ctx, addr, sdk.NewCoin(layer.BondDenom, math.NewInt(1))) + s.Nil(err) } diff --git a/x/dispute/keeper/dispute_test.go b/x/dispute/keeper/dispute_test.go index aadcadf33..85f6b4e00 100644 --- a/x/dispute/keeper/dispute_test.go +++ b/x/dispute/keeper/dispute_test.go @@ -1,7 +1,7 @@ package keeper_test func (s *KeeperTestSuite) TestGetOpenDisputes() { - require := s.Require() - res := s.disputeKeeper.GetOpenDisputeIds(s.ctx) - require.Nil(res.Ids) + res, err := s.disputeKeeper.GetOpenDisputeIds(s.ctx) + s.Nil(err) + s.Nil(res.Ids) } diff --git a/x/dispute/keeper/execute.go b/x/dispute/keeper/execute.go index 169af1239..79645e7f6 100644 --- a/x/dispute/keeper/execute.go +++ b/x/dispute/keeper/execute.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" ) @@ -15,7 +16,7 @@ func (k Keeper) SortPayerInfo(feePayers []types.PayerInfo) (fromAcc, fromBond [] fromAcc = append(fromAcc, payer) } } - return + return fromAcc, fromBond } func (k Keeper) RefundDisputeFeeToAccount(ctx sdk.Context, fromAcc []types.PayerInfo) error { @@ -44,8 +45,10 @@ func (k Keeper) RefundDisputeFeeToBond(ctx sdk.Context, fromBond []types.PayerIn burn := recipient.Amount.Amount.MulRaw(1).QuoRaw(20) recipient.Amount.Amount = recipient.Amount.Amount.Sub(burn) if err := k.RefundToBond(ctx, recipient.PayerAddress, recipient.Amount); err != nil { - panic(err) + return err } + // TODO: add fallback to stake in random validator if for some reason the address is not found + // due to undelegating from being a reporter } return nil } @@ -58,10 +61,13 @@ func (k Keeper) RewardVoters(ctx sdk.Context, voters []string, totalAmount math. totalAmount = totalAmount.Sub(burnedRemainder) var outputs []banktypes.Output for voter, share := range tokenDistribution { - reward := sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, share)) + if share.IsZero() { + continue + } + reward := sdk.NewCoins(sdk.NewCoin(layer.BondDenom, share)) outputs = append(outputs, banktypes.NewOutput(sdk.MustAccAddressFromBech32(voter), reward)) } moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) - inputs := banktypes.NewInput(moduleAddress, sdk.NewCoins(sdk.NewCoin(types.DefaultBondDenom, totalAmount))) + inputs := banktypes.NewInput(moduleAddress, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, totalAmount))) return burnedRemainder, k.bankKeeper.InputOutputCoins(ctx, inputs, outputs) } diff --git a/x/dispute/keeper/jail.go b/x/dispute/keeper/jail.go deleted file mode 100644 index 81e8bb511..000000000 --- a/x/dispute/keeper/jail.go +++ /dev/null @@ -1,45 +0,0 @@ -package keeper - -import ( - "fmt" - "strconv" - "time" - - sdk "github.com/cosmos/cosmos-sdk/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" -) - -func (k Keeper) JailValidatorUntil(ctx sdk.Context, valAddr sdk.ValAddress, jailDuration int64) error { - val, err := k.stakingKeeper.GetValidator(ctx, valAddr) - if err != nil { - return fmt.Errorf("validator %s does not exist", valAddr) - } - consAddr, err := val.GetConsAddr() - if err != nil { - k.Logger(ctx).Error("error getting consensus address", "error", err) - // panic(err) - return err - } - - var signingInfo slashingtypes.ValidatorSigningInfo - signingInfo, err = k.slashingKeeper.GetValidatorSigningInfo(ctx, consAddr) - if err != nil { // TODO: check the error type here - signingInfo.Address, err = k.stakingKeeper.ConsensusAddressCodec().BytesToString(consAddr) - if err != nil { - return err - } - signingInfo.JailedUntil = ctx.BlockTime().Add(time.Second * time.Duration(jailDuration)) - } else { - signingInfo.JailedUntil = ctx.BlockTime().Add(time.Second * time.Duration(jailDuration)) - } - k.slashingKeeper.SetValidatorSigningInfo(ctx, consAddr, signingInfo) - k.stakingKeeper.Jail(ctx, consAddr) - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - "jailed_validator", - sdk.NewAttribute("validator", valAddr.String()), - sdk.NewAttribute("duration", strconv.FormatInt(jailDuration, 10)), - ), - }) - return nil -} diff --git a/x/dispute/keeper/keeper.go b/x/dispute/keeper/keeper.go index 0139535da..5022beef6 100644 --- a/x/dispute/keeper/keeper.go +++ b/x/dispute/keeper/keeper.go @@ -30,8 +30,7 @@ type ( accountKeeper types.AccountKeeper bankKeeper types.BankKeeper oracleKeeper types.OracleKeeper - slashingKeeper types.SlashingKeeper - stakingKeeper types.StakingKeeper + reporterKeeper types.ReporterKeeper } ) @@ -44,8 +43,7 @@ func NewKeeper( accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, oracleKeeper types.OracleKeeper, - slashingKeeper types.SlashingKeeper, - stakingKeeper types.StakingKeeper, + reporterKeeper types.ReporterKeeper, ) Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { @@ -61,8 +59,7 @@ func NewKeeper( accountKeeper: accountKeeper, bankKeeper: bankKeeper, oracleKeeper: oracleKeeper, - slashingKeeper: slashingKeeper, - stakingKeeper: stakingKeeper, + reporterKeeper: reporterKeeper, } } diff --git a/x/dispute/keeper/keeper_test.go b/x/dispute/keeper/keeper_test.go index 162496ad9..990fa8a7c 100644 --- a/x/dispute/keeper/keeper_test.go +++ b/x/dispute/keeper/keeper_test.go @@ -1,106 +1,44 @@ package keeper_test import ( - "context" "testing" - "time" - "cosmossdk.io/log" - "cosmossdk.io/store" - storemetrics "cosmossdk.io/store/metrics" - storetypes "cosmossdk.io/store/types" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmdb "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/codec" - 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" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/suite" "github.com/tellor-io/layer/app/config" + keepertest "github.com/tellor-io/layer/testutil/keeper" "github.com/tellor-io/layer/x/dispute/keeper" "github.com/tellor-io/layer/x/dispute/mocks" "github.com/tellor-io/layer/x/dispute/types" ) -var ( - PrivKey cryptotypes.PrivKey - PubKey cryptotypes.PubKey - Addr sdk.AccAddress -) - type KeeperTestSuite struct { suite.Suite ctx sdk.Context - goCtx context.Context disputeKeeper keeper.Keeper accountKeeper *mocks.AccountKeeper bankKeeper *mocks.BankKeeper oracleKeeper *mocks.OracleKeeper - slashingKeeper *mocks.SlashingKeeper - stakingKeeper *mocks.StakingKeeper + reporterKeeper *mocks.ReporterKeeper - queryClient types.QueryClient - msgServer types.MsgServer + msgServer types.MsgServer } func (s *KeeperTestSuite) SetupTest() { config.SetupConfig() - require := s.Require() - storeKey := storetypes.NewKVStoreKey(types.StoreKey) - memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) - - db := tmdb.NewMemDB() - stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), storemetrics.NewNoOpMetrics()) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - stateStore.MountStoreWithDB(memStoreKey, storetypes.StoreTypeMemory, nil) - require.NoError(stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "DisputeParams", - ) - s.accountKeeper = mocks.NewAccountKeeper(s.T()) - s.bankKeeper = mocks.NewBankKeeper(s.T()) - s.oracleKeeper = mocks.NewOracleKeeper(s.T()) - s.slashingKeeper = mocks.NewSlashingKeeper(s.T()) - s.stakingKeeper = mocks.NewStakingKeeper(s.T()) - s.disputeKeeper = keeper.NewKeeper( - cdc, - storeKey, - memStoreKey, - paramsSubspace, + s.disputeKeeper, + s.oracleKeeper, + s.reporterKeeper, s.accountKeeper, s.bankKeeper, - s.oracleKeeper, - s.slashingKeeper, - s.stakingKeeper, - ) - - s.ctx = sdk.NewContext(stateStore, tmproto.Header{Time: time.Now()}, false, log.NewNopLogger()) - s.goCtx = sdk.WrapSDKContext(s.ctx) - // Initialize params - s.disputeKeeper.SetParams(s.ctx, types.DefaultParams()) + s.ctx = keepertest.DisputeKeeper(s.T()) s.msgServer = keeper.NewMsgServerImpl(s.disputeKeeper) - KeyTestPubAddr() } func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } - -func KeyTestPubAddr() { - PrivKey = secp256k1.GenPrivKey() - PubKey = PrivKey.PubKey() - Addr = sdk.AccAddress(PubKey.Address()) -} diff --git a/x/dispute/keeper/msg_server_add_fee_to_dispute.go b/x/dispute/keeper/msg_server_add_fee_to_dispute.go index d51db3a63..fcf06b8b2 100644 --- a/x/dispute/keeper/msg_server_add_fee_to_dispute.go +++ b/x/dispute/keeper/msg_server_add_fee_to_dispute.go @@ -8,12 +8,13 @@ import ( ) func (k msgServer) AddFeeToDispute(goCtx context.Context, - msg *types.MsgAddFeeToDispute) (*types.MsgAddFeeToDisputeResponse, error) { + msg *types.MsgAddFeeToDispute, +) (*types.MsgAddFeeToDisputeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - dispute := k.GetDisputeById(ctx, msg.DisputeId) + dispute, err := k.GetDisputeById(ctx, msg.DisputeId) if dispute == nil { - return nil, types.ErrDisputeDoesNotExist + return nil, err } // check if time to add fee has expired if ctx.BlockTime().After(dispute.DisputeEndTime) { @@ -39,14 +40,24 @@ func (k msgServer) AddFeeToDispute(goCtx context.Context, }) dispute.FeeTotal = dispute.FeeTotal.Add(msg.Amount.Amount) if dispute.FeeTotal.Equal(dispute.SlashAmount) { - k.Keeper.SlashAndJailReporter(ctx, dispute.ReportEvidence, dispute.DisputeCategory) + err := k.Keeper.SlashAndJailReporter(ctx, dispute.ReportEvidence, dispute.DisputeCategory) + if err != nil { + return nil, err + } // begin voting immediately dispute.DisputeEndTime = ctx.BlockTime().Add(THREE_DAYS) dispute.DisputeStatus = types.Voting - k.Keeper.SetStartVote(ctx, dispute.DisputeId) + err = k.Keeper.SetStartVote(ctx, dispute.DisputeId) + if err != nil { + return nil, err + } + } + if err := k.Keeper.SetDisputeById(ctx, dispute.DisputeId, *dispute); err != nil { + return nil, err + } + if err := k.Keeper.SetDisputeByReporter(ctx, *dispute); err != nil { + return nil, err } - k.Keeper.SetDisputeById(ctx, dispute.DisputeId, *dispute) - k.Keeper.SetDisputeByReporter(ctx, *dispute) return &types.MsgAddFeeToDisputeResponse{}, nil } diff --git a/x/dispute/keeper/msg_server_propose_dispute.go b/x/dispute/keeper/msg_server_propose_dispute.go index b6ea905ab..6b9dc8fe8 100644 --- a/x/dispute/keeper/msg_server_propose_dispute.go +++ b/x/dispute/keeper/msg_server_propose_dispute.go @@ -3,21 +3,20 @@ package keeper import ( "context" - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" ) func (k msgServer) ProposeDispute(goCtx context.Context, msg *types.MsgProposeDispute) (*types.MsgProposeDisputeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // Exponent for the denomination (e.g., 6 for 1 trb = 1e6 loya) - oneTRB := math.NewInt(1_000_000) - if msg.Fee.IsLT(sdk.NewCoin(sdk.DefaultBondDenom, oneTRB)) { - return nil, types.ErrMinimumTRBrequired + + if msg.Fee.Denom != layer.BondDenom { + return nil, types.ErrInvalidFeeDenom.Wrapf("wrong fee denom: %s, expected: %s", msg.Fee.Denom, layer.BondDenom) } - if msg.Fee.Denom != sdk.DefaultBondDenom { - return nil, types.ErrInvalidFeeDenom + + if msg.Fee.Amount.LT(layer.TenPercent) { + return nil, types.ErrMinimumTRBrequired.Wrapf("fee %s dosen't meet minimum fee required", msg.Fee.Amount) } dispute := k.GetDisputeByReporter(ctx, *msg.Report, msg.DisputeCategory) diff --git a/x/dispute/keeper/msg_server_propose_dispute_test.go b/x/dispute/keeper/msg_server_propose_dispute_test.go index 12df94d20..88edc08d0 100644 --- a/x/dispute/keeper/msg_server_propose_dispute_test.go +++ b/x/dispute/keeper/msg_server_propose_dispute_test.go @@ -1,60 +1,64 @@ package keeper_test import ( + "time" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/mock" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/tellor-io/layer/testutil/sample" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() { - require := s.Require() +func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() sdk.AccAddress { + addr := sample.AccAddressBytes() + s.ctx = s.ctx.WithBlockTime(time.Now()) report := types.MicroReport{ - Reporter: "tellor1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34ds5rz", + Reporter: addr.String(), QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: 1696516597, + Power: 1, } - fee := sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(10000000000)) + fee := sdk.NewCoin(layer.BondDenom, math.NewInt(10000)) msg := types.MsgProposeDispute{ - Creator: Addr.String(), + Creator: addr.String(), Report: &report, DisputeCategory: types.Warning, Fee: fee, PayFromBond: false, } - // addy, _ := sdk.AccAddressFromBech32(Addr.String()) - //sdk.ValAddress(addy) - val, _ := stakingtypes.NewValidator(Addr.String(), PubKey, stakingtypes.Description{Moniker: "test"}) - val.Jailed = false - val.Status = stakingtypes.Bonded - val.Tokens = math.NewInt(1000000000) - + stakedReporter := reportertypes.NewOracleReporter( + addr.String(), + math.NewInt(1_000_000), + nil, + ) // mock dependency modules - s.bankKeeper.On("HasBalance", mock.Anything, mock.Anything, mock.Anything).Return(true) - s.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.bankKeeper.On("SendCoinsFromModuleToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.stakingKeeper.On("TokensFromConsensusPower", mock.Anything, mock.Anything).Return(math.NewInt(100)) - s.slashingKeeper.On("GetValidatorSigningInfo", mock.Anything, mock.Anything).Return(slashingtypes.ValidatorSigningInfo{}, nil) - s.slashingKeeper.On("SetValidatorSigningInfo", mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.stakingKeeper.On("Jail", mock.Anything, mock.Anything).Return(nil) - s.stakingKeeper.On("RemoveValidatorTokens", mock.Anything, mock.Anything, mock.Anything).Return(val, nil) - s.stakingKeeper.On("GetValidator", mock.Anything, mock.Anything).Return(val, nil) - msgRes, err := s.msgServer.ProposeDispute(s.goCtx, &msg) - require.NoError(err) - require.NotNil(msgRes) - openDisputesRes := s.disputeKeeper.GetOpenDisputeIds(s.ctx) - require.NotNil(openDisputesRes) - require.Len(openDisputesRes.Ids, 1) - require.Equal(openDisputesRes.Ids, []uint64{1}) - disputeRes := s.disputeKeeper.GetDisputeById(s.ctx, 1) - require.NotNil(disputeRes) - require.Equal(disputeRes.DisputeCategory, types.Warning) - require.Equal(disputeRes.ReportEvidence.Reporter, "tellor1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34ds5rz") - require.Equal(disputeRes.DisputeStatus, types.Voting) + s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, math.NewInt(10_000)).Return(nil) + s.reporterKeeper.On("JailReporter", s.ctx, addr, int64(0)).Return(nil) + + s.bankKeeper.On("HasBalance", s.ctx, addr, fee).Return(true) + s.bankKeeper.On("SendCoinsFromAccountToModule", s.ctx, addr, mock.Anything, sdk.NewCoins(fee)).Return(nil) + + msgRes, err := s.msgServer.ProposeDispute(s.ctx, &msg) + s.NoError(err) + s.NotNil(msgRes) + openDisputesRes, err := s.disputeKeeper.GetOpenDisputeIds(s.ctx) + s.NoError(err) + s.NotNil(openDisputesRes) + s.Len(openDisputesRes.Ids, 1) + s.Equal(openDisputesRes.Ids, []uint64{1}) + disputeRes, err := s.disputeKeeper.GetDisputeById(s.ctx, 1) + s.NoError(err) + s.NotNil(disputeRes) + s.Equal(disputeRes.DisputeCategory, types.Warning) + s.Equal(disputeRes.ReportEvidence.Reporter, addr.String()) + s.Equal(disputeRes.DisputeStatus, types.Voting) + return addr } diff --git a/x/dispute/keeper/msg_server_vote.go b/x/dispute/keeper/msg_server_vote.go index 0b24e746d..371a7c4dd 100644 --- a/x/dispute/keeper/msg_server_vote.go +++ b/x/dispute/keeper/msg_server_vote.go @@ -10,19 +10,28 @@ import ( func (k msgServer) Vote(goCtx context.Context, msg *types.MsgVote) (*types.MsgVoteResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - dispute := k.Keeper.GetDisputeById(ctx, msg.Id) + dispute, err := k.Keeper.GetDisputeById(ctx, msg.Id) + if err != nil { + return nil, err + } if dispute.DisputeStatus != types.Voting { return nil, types.ErrDisputeNotInVotingState } // Get vote by disputeId - vote := k.Keeper.GetVote(ctx, msg.Id) + vote, err := k.Keeper.GetVote(ctx, msg.Id) + if err != nil { + return nil, err + } if vote.VoteStart.IsZero() { return nil, types.ErrVoteDoesNotExist } // Check if voter has already voted - voter := k.Keeper.GetVoterVote(ctx, msg.Voter, msg.Id) + voter, err := k.Keeper.GetVoterVote(ctx, msg.Voter, msg.Id) + if err != nil { + return nil, err + } if voter.Voter != "" { return nil, types.ErrVoterHasAlreadyVoted } @@ -32,9 +41,18 @@ func (k msgServer) Vote(goCtx context.Context, msg *types.MsgVote) (*types.MsgVo return nil, types.ErrVotingPeriodEnded } - k.Keeper.SetTally(ctx, msg.Id, msg.Vote, msg.Voter) - k.Keeper.SetVoterVote(ctx, msg) - k.Keeper.AppendVoters(ctx, msg.Id, msg.Voter) + err = k.Keeper.SetTally(ctx, msg.Id, msg.Vote, msg.Voter) + if err != nil { + return nil, err + } + err = k.Keeper.SetVoterVote(ctx, msg) + if err != nil { + return nil, err + } + err = k.Keeper.AppendVoters(ctx, msg.Id, msg.Voter) + if err != nil { + return nil, err + } return &types.MsgVoteResponse{}, nil } diff --git a/x/dispute/keeper/msg_server_vote_test.go b/x/dispute/keeper/msg_server_vote_test.go index c4438a1d0..b29852c9e 100644 --- a/x/dispute/keeper/msg_server_vote_test.go +++ b/x/dispute/keeper/msg_server_vote_test.go @@ -3,41 +3,46 @@ package keeper_test import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/mock" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" oracletypes "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestVote() { - require := s.Require() // Add dispute - s.TestMsgProposeDisputeFromAccount() - s.bankKeeper.On("GetBalance", mock.Anything, mock.Anything, mock.Anything).Return(sdk.NewCoin("trb", math.NewInt(1)), nil) - s.oracleKeeper.On("GetUserTips", mock.Anything, mock.Anything).Return(oracletypes.UserTipTotal{Address: "", Total: sdk.NewCoin("trb", math.NewInt(1))}) - s.stakingKeeper.On("GetLastTotalPower", mock.Anything).Return(math.NewInt(1), nil) - s.bankKeeper.On("GetSupply", mock.Anything, mock.Anything).Return(sdk.NewCoin("trb", math.NewInt(1)), nil) - s.oracleKeeper.On("GetTotalTips", mock.Anything, mock.Anything).Return(sdk.NewCoin("trb", math.NewInt(1))) + addr := s.TestMsgProposeDisputeFromAccount() + + // mock dependency modules + s.bankKeeper.On("GetBalance", s.ctx, addr, layer.BondDenom).Return(sdk.NewCoin(layer.BondDenom, math.NewInt(1))) + s.oracleKeeper.On("GetUserTips", s.ctx, addr).Return(oracletypes.UserTipTotal{Address: addr.String(), Total: math.NewInt(1)}, nil) + s.bankKeeper.On("GetSupply", s.ctx, layer.BondDenom).Return(sdk.NewCoin(layer.BondDenom, math.NewInt(1))) + s.oracleKeeper.On("GetTotalTips", s.ctx).Return(math.NewInt(1), nil) + s.reporterKeeper.On("TotalReporterPower", s.ctx).Return(math.NewInt(1), nil) + voteMsg := types.MsgVote{ - Voter: Addr.String(), + Voter: addr.String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, } // vote should have started - _, err := s.msgServer.Vote(s.goCtx, &voteMsg) - require.NoError(err) + _, err := s.msgServer.Vote(s.ctx, &voteMsg) + s.NoError(err) + + _, err = s.msgServer.Vote(s.ctx, &voteMsg) + s.Error(err) - _, err = s.msgServer.Vote(s.goCtx, &voteMsg) - require.Error(err) + voterVote, err := s.disputeKeeper.GetVoterVote(s.ctx, addr.String(), 1) + s.NoError(err) - voterVote := s.disputeKeeper.GetVoterVote(s.ctx, Addr.String(), 1) - require.Equal(voterVote.Voter, Addr.String()) - require.Equal(voterVote.Id, uint64(1)) - require.Equal(voterVote.Vote, types.VoteEnum_VOTE_SUPPORT) + s.Equal(voterVote.Voter, addr.String()) + s.Equal(voterVote.Id, uint64(1)) + s.Equal(voterVote.Vote, types.VoteEnum_VOTE_SUPPORT) // start voting, this method is check on beginblock - vote := s.disputeKeeper.GetVote(s.ctx, 1) - require.NotNil(vote) - require.Equal(vote.Voters, []string{Addr.String()}) - require.Equal(vote.VoteResult, types.VoteResult_NO_TALLY) - require.Equal(vote.Id, uint64(1)) + vote, err := s.disputeKeeper.GetVote(s.ctx, 1) + s.NoError(err) + s.NotNil(vote) + s.Equal(vote.Voters, []string{addr.String()}) + s.Equal(vote.VoteResult, types.VoteResult_NO_TALLY) + s.Equal(vote.Id, uint64(1)) } diff --git a/x/dispute/keeper/params_test.go b/x/dispute/keeper/params_test.go index 5b28394e3..11ca419ed 100644 --- a/x/dispute/keeper/params_test.go +++ b/x/dispute/keeper/params_test.go @@ -9,7 +9,7 @@ import ( ) func TestGetParams(t *testing.T) { - k, ctx := testkeeper.DisputeKeeper(t) + k, _, _, _, _, ctx := testkeeper.DisputeKeeper(t) params := types.DefaultParams() k.SetParams(ctx, params) diff --git a/x/dispute/keeper/query_params_test.go b/x/dispute/keeper/query_params_test.go index 64f24f3e6..b7a00f6de 100644 --- a/x/dispute/keeper/query_params_test.go +++ b/x/dispute/keeper/query_params_test.go @@ -3,19 +3,17 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" testkeeper "github.com/tellor-io/layer/testutil/keeper" "github.com/tellor-io/layer/x/dispute/types" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.DisputeKeeper(t) - wctx := sdk.WrapSDKContext(ctx) + keeper, _, _, _, _, ctx := testkeeper.DisputeKeeper(t) params := types.DefaultParams() keeper.SetParams(ctx, params) - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.Equal(t, &types.QueryParamsResponse{Params: params}, response) } diff --git a/x/dispute/keeper/slash.go b/x/dispute/keeper/slash.go deleted file mode 100644 index 47e8f649e..000000000 --- a/x/dispute/keeper/slash.go +++ /dev/null @@ -1,99 +0,0 @@ -package keeper - -import ( - "fmt" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/tellor-io/layer/x/dispute/types" -) - -func (k Keeper) Slash(ctx sdk.Context, opAddr sdk.ValAddress, power int64, slashFactor math.LegacyDec) math.Int { - logger := k.Logger(ctx) - - if slashFactor.IsNegative() { - panic(fmt.Errorf("attempted to slash with a negative slash factor: %v", slashFactor)) - } - - // Amount of slashing = slash slashFactor * power at time of infraction - amount := k.stakingKeeper.TokensFromConsensusPower(ctx, power) - - slashAmountDec := math.LegacyNewDecFromInt(amount).Mul(slashFactor) - slashAmount := slashAmountDec.TruncateInt() - validator, error := k.stakingKeeper.GetValidator(ctx, opAddr) - // TODO: return error instead of panic - if error != nil { - // If not found, the validator must have been overslashed and removed - so we don't need to do anything - // NOTE: Correctness dependent on invariant that unbonding delegations / redelegations must also have been completely - // slashed in this case - which we don't explicitly check, but should be true. - // Log the slash attempt for future reference (maybe we should tag it too) - logger.Error( - "WARNING: ignored attempt to slash a nonexistent validator; we recommend you investigate immediately", - "validator", opAddr.String(), - ) - return math.ZeroInt() - } - - // should not be slashing an unbonded validator - if validator.IsUnbonded() { - panic(fmt.Sprintf("should not be slashing unbonded validator: %s", validator.GetOperator())) - } - - // cannot decrease balance below zero - tokensToBurn := math.MinInt(slashAmount, validator.Tokens) - tokensToBurn = math.MaxInt(tokensToBurn, math.ZeroInt()) // defensive. - - // Deduct from validator's bonded tokens and update the validator. - // Burn the slashed tokens from the pool account and decrease the total supply. - validator, err := k.stakingKeeper.RemoveValidatorTokens(ctx, validator, tokensToBurn) - if err != nil { - // TODO: return error instead of panic - panic(err) - } - - switch validator.GetStatus() { - case stakingtypes.Bonded: - if err := k.escrowBondedTokens(ctx, tokensToBurn); err != nil { - panic(err) - } - case stakingtypes.Unbonding, stakingtypes.Unbonded: - if err := k.escrowNotBondedTokens(ctx, tokensToBurn); err != nil { - panic(err) - } - default: - panic("invalid validator status") - } - - logger.Info( - "validator slashed by slash factor", - "validator", validator.GetOperator(), - "slash_factor", slashFactor.String(), - "burned", tokensToBurn, - ) - return tokensToBurn -} - -// burnBondedTokens removes coins from the bonded pool module account -func (k Keeper) escrowBondedTokens(ctx sdk.Context, amt math.Int) error { - if !amt.IsPositive() { - // skip as no coins need to be burned - return nil - } - - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amt)) - - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, stakingtypes.BondedPoolName, types.ModuleName, coins) -} - -// burnNotBondedTokens removes coins from the not bonded pool module account -func (k Keeper) escrowNotBondedTokens(ctx sdk.Context, amt math.Int) error { - if !amt.IsPositive() { - // skip as no coins need to be burned - return nil - } - - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, amt)) - - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, stakingtypes.NotBondedPoolName, types.ModuleName, coins) -} diff --git a/x/dispute/keeper/tally.go b/x/dispute/keeper/tally.go index 7fcf86e6b..80ffd8a19 100644 --- a/x/dispute/keeper/tally.go +++ b/x/dispute/keeper/tally.go @@ -1,27 +1,30 @@ package keeper import ( + "errors" "fmt" "math/big" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" + reptypes "github.com/tellor-io/layer/x/reporter/types" ) // Add invalid vote type and return all fees to the paying parties -func (k Keeper) TallyVote(ctx sdk.Context, id uint64) { - dispute := k.GetDisputeById(ctx, id) - if dispute == nil { - return +func (k Keeper) TallyVote(ctx sdk.Context, id uint64) error { + dispute, err := k.GetDisputeById(ctx, id) + if err != nil { + return err } - tally := k.GetTally(ctx, id) - if tally == nil { - return + tally, err := k.GetTally(ctx, id) + if err != nil { + return err } - vote := k.GetVote(ctx, id) - if vote == nil { - return + vote, err := k.GetVote(ctx, id) + if err != nil { + return err } tokenHolderVoteSum := tally.ForVotes.TokenHolders.Add(tally.AgainstVotes.TokenHolders).Add(tally.Invalid.TokenHolders) @@ -72,8 +75,13 @@ func (k Keeper) TallyVote(ctx sdk.Context, id uint64) { scaledInvalid := (invalidTokenHolders.Add(invalidValidators).Add(invalidUsers).Add(invalidTeam)).Quo(numGroups) tokenHolderRatio := ratio(k.GetTotalSupply(ctx), tokenHolderVoteSum) - validatorRatio := ratio(k.GetTotalValidatorPower(ctx), validatorVoteSum) - userRatio := ratio(k.GetTotalTips(ctx), userVoteSum) + totalPower, err := k.GetTotalReporterPower(ctx) + if err != nil { + return err + } + validatorRatio := ratio(totalPower, validatorVoteSum) + totalTips, _ := k.GetTotalTips(ctx) // TODO: handle err + userRatio := ratio(totalTips, userVoteSum) teamRatio := ratio(math.NewInt(1), teamVoteSum) totalRatio := tokenHolderRatio.Add(validatorRatio).Add(userRatio).Add(teamRatio) @@ -83,17 +91,29 @@ func (k Keeper) TallyVote(ctx sdk.Context, id uint64) { fmt.Println("quorum reached") switch { case scaledSupport.GT(scaledAgainst) && scaledSupport.GT(scaledInvalid): - k.SetDisputeStatus(ctx, id, types.Resolved) - k.SetVoteResult(ctx, id, types.VoteResult_SUPPORT) + if err := k.SetDisputeStatus(ctx, id, types.Resolved); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_SUPPORT); err != nil { + return err + } case scaledAgainst.GT(scaledSupport) && scaledAgainst.GT(scaledInvalid): - k.SetDisputeStatus(ctx, id, types.Resolved) - k.SetVoteResult(ctx, id, types.VoteResult_AGAINST) + if err := k.SetDisputeStatus(ctx, id, types.Resolved); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_AGAINST); err != nil { + return err + } case scaledInvalid.GT(scaledSupport) && scaledInvalid.GT(scaledAgainst): - k.SetDisputeStatus(ctx, id, types.Resolved) - k.SetVoteResult(ctx, id, types.VoteResult_INVALID) + if err := k.SetDisputeStatus(ctx, id, types.Resolved); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_INVALID); err != nil { + return err + } default: } - return + return nil } // quorum not reached case if vote.VoteEnd.Before(ctx.BlockTime()) { @@ -104,30 +124,48 @@ func (k Keeper) TallyVote(ctx sdk.Context, id uint64) { } switch { case scaledSupport.GT(scaledAgainst) && scaledSupport.GT(scaledInvalid): - k.SetDisputeStatus(ctx, id, disputeStatus) - k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_SUPPORT) + if err := k.SetDisputeStatus(ctx, id, disputeStatus); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_SUPPORT); err != nil { + return err + } case scaledAgainst.GT(scaledSupport) && scaledAgainst.GT(scaledInvalid): - k.SetDisputeStatus(ctx, id, disputeStatus) - k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_AGAINST) + if err := k.SetDisputeStatus(ctx, id, disputeStatus); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_AGAINST); err != nil { + return err + } case scaledInvalid.GT(scaledSupport) && scaledInvalid.GT(scaledAgainst): - k.SetDisputeStatus(ctx, id, disputeStatus) - k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_INVALID) + if err := k.SetDisputeStatus(ctx, id, disputeStatus); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_INVALID); err != nil { + return err + } case len(vote.Voters) == 0: - k.SetDisputeStatus(ctx, id, disputeStatus) - k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_INVALID) + if err := k.SetDisputeStatus(ctx, id, disputeStatus); err != nil { + return err + } + if err := k.SetVoteResult(ctx, id, types.VoteResult_NO_QUORUM_MAJORITY_INVALID); err != nil { + return err + } default: + return errors.New("no quorum majority") // TODO: log only? } - return + return nil } } + return nil } -func (k Keeper) GetTally(ctx sdk.Context, id uint64) *types.Tally { +func (k Keeper) GetTally(ctx sdk.Context, id uint64) (*types.Tally, error) { store := k.voteStore(ctx) tallyBytes := store.Get(types.TallyKeyPrefix(id)) var tallies types.Tally if err := k.cdc.Unmarshal(tallyBytes, &tallies); err != nil { - return nil + return nil, err } // for some reason the proto files don't initialize the tallies when nullable = false if tallies.ForVotes == nil { @@ -136,22 +174,43 @@ func (k Keeper) GetTally(ctx sdk.Context, id uint64) *types.Tally { tallies.Invalid = k.initVoterClasses() } - return &tallies + return &tallies, nil } // Set tally numbers func (k Keeper) SetTally(ctx sdk.Context, id uint64, voteFor types.VoteEnum, voter string) error { - var tallies *types.Tally - tallies = k.GetTally(ctx, id) - valP := k.GetValidatorPower(ctx, voter) - tkHol := k.GetAccountBalance(ctx, voter) - usrTps := k.GetUserTips(ctx, voter) + tallies, err := k.GetTally(ctx, id) + if err != nil { + return err + } + valP, err := k.GetReporterPower(ctx, voter) + if err != nil { + return err + } + tkHol, err := k.GetAccountBalance(ctx, voter) + if err != nil { + return err + } + usrTps, err := k.GetUserTips(ctx, voter) + if err != nil { + return err + } team := k.IsTeamAddress(ctx, voter) voterPower := math.ZeroInt() - voterPower = voterPower.Add(calculateVotingPower(valP, k.GetTotalValidatorPower(ctx))) + tp, err := k.GetTotalReporterPower(ctx) + + if err != nil { + return err + } + voterPower = voterPower.Add(calculateVotingPower(valP, tp)) voterPower = voterPower.Add(calculateVotingPower(tkHol, k.GetTotalSupply(ctx))) - voterPower = voterPower.Add(calculateVotingPower(usrTps, k.GetTotalTips(ctx))) + + totalTips, err := k.GetTotalTips(ctx) + if err != nil { + return err + } + voterPower = voterPower.Add(calculateVotingPower(usrTps, totalTips)) voterPower = voterPower.Add(calculateVotingPower(team, math.NewInt(1))) switch voteFor { @@ -171,7 +230,7 @@ func (k Keeper) SetTally(ctx sdk.Context, id uint64, voteFor types.VoteEnum, vot tallies.Invalid.Users = tallies.Invalid.Users.Add(usrTps) tallies.Invalid.Team = tallies.Invalid.Team.Add(team) default: - panic("invalid vote type") + return errors.New("invalid vote type") } k.SetVoterTally(ctx, id, tallies) @@ -179,27 +238,40 @@ func (k Keeper) SetTally(ctx sdk.Context, id uint64, voteFor types.VoteEnum, vot return nil } -func (k Keeper) GetValidatorPower(ctx sdk.Context, voter string) math.Int { - addr := sdk.MustAccAddressFromBech32(voter) - validator, err := k.stakingKeeper.GetValidator(ctx, sdk.ValAddress(addr)) - if err != nil { // TODO: return error instead of panic - return math.ZeroInt() +func (k Keeper) GetReporterPower(ctx sdk.Context, voter string) (math.Int, error) { + reporterAddr, err := sdk.AccAddressFromBech32(voter) + if err != nil { + return math.Int{}, err } - power := validator.GetConsensusPower(sdk.DefaultPowerReduction) - return math.NewInt(power) + reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) + if err != nil { + if errors.Is(err, reptypes.ErrReporterDoesNotExist) { + return math.ZeroInt(), nil + } + return math.Int{}, err + } + return reporter.TotalTokens.Quo(sdk.DefaultPowerReduction), nil } -func (k Keeper) GetAccountBalance(ctx sdk.Context, voter string) math.Int { +func (k Keeper) GetAccountBalance(ctx sdk.Context, voter string) (math.Int, error) { addr, err := sdk.AccAddressFromBech32(voter) if err != nil { - panic(err) + return math.Int{}, err } - return k.bankKeeper.GetBalance(ctx, addr, sdk.DefaultBondDenom).Amount + bal := k.bankKeeper.GetBalance(ctx, addr, layer.BondDenom) + return bal.Amount, nil } -func (k Keeper) GetUserTips(ctx sdk.Context, voter string) math.Int { - userTips := k.oracleKeeper.GetUserTips(ctx, sdk.MustAccAddressFromBech32(voter)) - return userTips.Total.Amount +func (k Keeper) GetUserTips(ctx sdk.Context, voter string) (math.Int, error) { + voterAddr, err := sdk.AccAddressFromBech32(voter) + if err != nil { + return math.Int{}, err + } + userTips, err := k.oracleKeeper.GetUserTips(ctx, voterAddr) + if err != nil { + return math.Int{}, err + } + return userTips.Total, nil } func (k Keeper) IsTeamAddress(ctx sdk.Context, voter string) math.Int { @@ -211,22 +283,21 @@ func (k Keeper) IsTeamAddress(ctx sdk.Context, voter string) math.Int { // Get total trb supply func (k Keeper) GetTotalSupply(ctx sdk.Context) math.Int { - return k.bankKeeper.GetSupply(ctx, sdk.DefaultBondDenom).Amount + return k.bankKeeper.GetSupply(ctx, layer.BondDenom).Amount } -// Get total validator power -// TODO: this changes with every block, so we need to store it somewhere? -func (k Keeper) GetTotalValidatorPower(ctx sdk.Context) math.Int { - p, err := k.stakingKeeper.GetLastTotalPower(ctx) +// Get total reporter power +func (k Keeper) GetTotalReporterPower(ctx sdk.Context) (math.Int, error) { + tp, err := k.reporterKeeper.TotalReporterPower(ctx) if err != nil { - panic(err) // TODO: return error instead of panic + return math.Int{}, err } - return p + return tp, nil } // Get total number of tips -func (k Keeper) GetTotalTips(ctx sdk.Context) math.Int { - return k.oracleKeeper.GetTotalTips(ctx).Amount +func (k Keeper) GetTotalTips(ctx sdk.Context) (math.Int, error) { + return k.oracleKeeper.GetTotalTips(ctx) } func (k Keeper) SetVoterTally(ctx sdk.Context, id uint64, tally *types.Tally) { @@ -258,12 +329,11 @@ func ratio(total, part math.Int) math.LegacyDec { } func calculateVotingPower(n, d math.Int) math.Int { - if d.IsZero() { + if n.IsZero() || d.IsZero() { return math.ZeroInt() } scalingFactor := math.NewInt(1_000_000) - // TODO: round? - return n.Mul(scalingFactor).Quo(d).MulRaw(25).Quo(scalingFactor) + return n.Mul(scalingFactor).Quo(d).MulRaw(25_000_000).Quo(scalingFactor) } func (k Keeper) CalculateVoterShare(ctx sdk.Context, voters []string, totalTokens math.Int) (map[string]math.Int, math.Int) { @@ -276,7 +346,7 @@ func (k Keeper) CalculateVoterShare(ctx sdk.Context, voters []string, totalToken uniqueVoters = append(uniqueVoters, voter) } } - var totalPower = math.ZeroInt() + totalPower := math.ZeroInt() powers := make(map[string]math.Int) for _, voter := range uniqueVoters { voterShare := k.GetVoterPower(ctx, sdk.MustAccAddressFromBech32(voter)) @@ -286,7 +356,7 @@ func (k Keeper) CalculateVoterShare(ctx sdk.Context, voters []string, totalToken // Calculate and allocate tokens based on each person's share of the total power tokenDistribution := make(map[string]math.Int) - scalingFactor := math.NewInt(1_000_000) + scalingFactor := math.NewInt(1_000_000) //TODO: use sdk.DefaultPowerReduction totalShare := math.ZeroInt() for voter, power := range powers { share := power.Mul(scalingFactor).Quo(totalPower) @@ -294,7 +364,7 @@ func (k Keeper) CalculateVoterShare(ctx sdk.Context, voters []string, totalToken tokenDistribution[voter] = tokens totalShare = totalShare.Add(tokens) } - var burnedRemainder = math.ZeroInt() + burnedRemainder := math.ZeroInt() if totalTokens.GT(totalShare) { burnedRemainder = totalTokens.Sub(totalShare) } diff --git a/x/dispute/keeper/vote.go b/x/dispute/keeper/vote.go index 024c9d895..36616f60d 100644 --- a/x/dispute/keeper/vote.go +++ b/x/dispute/keeper/vote.go @@ -7,40 +7,48 @@ import ( ) // Get vote by dispute id -func (k Keeper) GetVote(ctx sdk.Context, id uint64) *types.Vote { +func (k Keeper) GetVote(ctx sdk.Context, id uint64) (*types.Vote, error) { store := k.voteStore(ctx) voteBytes := store.Get(types.DisputeIdBytes(id)) var vote types.Vote if err := k.cdc.Unmarshal(voteBytes, &vote); err != nil { - return nil + return nil, err } - return &vote + return &vote, nil } // Get a voter's vote by voter & dispute id -func (k Keeper) GetVoterVote(ctx sdk.Context, voter string, id uint64) *types.MsgVote { +func (k Keeper) GetVoterVote(ctx sdk.Context, voter string, id uint64) (*types.MsgVote, error) { store := k.voteStore(ctx) voteBytes := store.Get(types.VoterKeyPrefix(voter, id)) var vote types.MsgVote if err := k.cdc.Unmarshal(voteBytes, &vote); err != nil { - return nil + return nil, err } - return &vote - + return &vote, nil } // Set vote by voter -func (k Keeper) SetVoterVote(ctx sdk.Context, msg *types.MsgVote) { +func (k Keeper) SetVoterVote(ctx sdk.Context, msg *types.MsgVote) error { store := k.voteStore(ctx) voterKey := types.VoterKeyPrefix(msg.Voter, msg.Id) - store.Set(voterKey, k.cdc.MustMarshal(msg)) + bz, err := k.cdc.Marshal(msg) + if err != nil { + return err + } + store.Set(voterKey, bz) + return nil } // Append voters to vote struct -func (k Keeper) AppendVoters(ctx sdk.Context, id uint64, voter string) { - vote := k.GetVote(ctx, id) +func (k Keeper) AppendVoters(ctx sdk.Context, id uint64, voter string) error { + vote, err := k.GetVote(ctx, id) + if err != nil { + return err + } vote.Voters = append(vote.Voters, voter) - k.SetVote(ctx, id, vote) + + return k.SetVote(ctx, id, vote) } func (k Keeper) initVoterClasses() *types.VoterClasses { @@ -52,26 +60,40 @@ func (k Keeper) initVoterClasses() *types.VoterClasses { } } -func (k Keeper) SetVote(ctx sdk.Context, id uint64, vote *types.Vote) { +func (k Keeper) SetVote(ctx sdk.Context, id uint64, vote *types.Vote) error { store := k.voteStore(ctx) - store.Set(types.DisputeIdBytes(id), k.cdc.MustMarshal(vote)) + bz, err := k.cdc.Marshal(vote) + if err != nil { + return err + } + store.Set(types.DisputeIdBytes(id), bz) + return nil } // Set vote results -func (k Keeper) SetVoteResult(ctx sdk.Context, id uint64, result types.VoteResult) { - vote := k.GetVote(ctx, id) +func (k Keeper) SetVoteResult(ctx sdk.Context, id uint64, result types.VoteResult) error { + vote, err := k.GetVote(ctx, id) + if err != nil { + return err + } vote.VoteResult = result vote.VoteEnd = ctx.BlockTime() - k.SetVote(ctx, id, vote) + + return k.SetVote(ctx, id, vote) } // Set vote start info for a dispute -func (k Keeper) SetStartVote(ctx sdk.Context, id uint64) { +func (k Keeper) SetStartVote(ctx sdk.Context, id uint64) error { store := k.voteStore(ctx) vote := types.Vote{ Id: id, VoteStart: ctx.BlockTime(), VoteEnd: ctx.BlockTime().Add(TWO_DAYS), } - store.Set(types.DisputeIdBytes(id), k.cdc.MustMarshal(&vote)) + bz, err := k.cdc.Marshal(&vote) + if err != nil { + return err + } + store.Set(types.DisputeIdBytes(id), bz) + return nil } diff --git a/x/dispute/mocks/BankKeeper.go b/x/dispute/mocks/BankKeeper.go index 47b91a237..795a910aa 100644 --- a/x/dispute/mocks/BankKeeper.go +++ b/x/dispute/mocks/BankKeeper.go @@ -101,20 +101,6 @@ func (_m *BankKeeper) SendCoinsFromAccountToModule(ctx context.Context, senderAd 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) - - 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 -} - // SendCoinsFromModuleToModule provides a mock function with given fields: ctx, senderModule, recipientModule, amt func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt types.Coins) error { ret := _m.Called(ctx, senderModule, recipientModule, amt) diff --git a/x/dispute/mocks/DistrKeeper.go b/x/dispute/mocks/DistrKeeper.go deleted file mode 100644 index 553a4c712..000000000 --- a/x/dispute/mocks/DistrKeeper.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" - mock "github.com/stretchr/testify/mock" - - types "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -// DistrKeeper is an autogenerated mock type for the DistrKeeper type -type DistrKeeper struct { - mock.Mock -} - -// AllocateTokensToValidator provides a mock function with given fields: ctx, val, tokens -func (_m *DistrKeeper) AllocateTokensToValidator(ctx context.Context, val types.ValidatorI, tokens cosmos_sdktypes.DecCoins) error { - ret := _m.Called(ctx, val, tokens) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ValidatorI, cosmos_sdktypes.DecCoins) error); ok { - r0 = rf(ctx, val, tokens) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -type mockConstructorTestingTNewDistrKeeper interface { - mock.TestingT - Cleanup(func()) -} - -// NewDistrKeeper creates a new instance of DistrKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDistrKeeper(t mockConstructorTestingTNewDistrKeeper) *DistrKeeper { - mock := &DistrKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/dispute/mocks/Makefile b/x/dispute/mocks/Makefile new file mode 100644 index 000000000..af85bbd7c --- /dev/null +++ b/x/dispute/mocks/Makefile @@ -0,0 +1,9 @@ +mock-clean: + @rm -f ./*.go + +mock-gen: + @go run github.com/vektra/mockery/v2 --name=AccountKeeper --dir=../types --recursive --output=. + @go run github.com/vektra/mockery/v2 --name=BankKeeper --dir=../types --recursive --output=. + @go run github.com/vektra/mockery/v2 --name=OracleKeeper --dir=../types --recursive --output=. + @go run github.com/vektra/mockery/v2 --name=ReporterKeeper --dir=../types --recursive --output=. + diff --git a/x/dispute/mocks/OracleKeeper.go b/x/dispute/mocks/OracleKeeper.go index b686546f4..77e9910fa 100644 --- a/x/dispute/mocks/OracleKeeper.go +++ b/x/dispute/mocks/OracleKeeper.go @@ -5,11 +5,12 @@ package mocks import ( context "context" + math "cosmossdk.io/math" + cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" + mock "github.com/stretchr/testify/mock" oracletypes "github.com/tellor-io/layer/x/oracle/types" - - types "github.com/cosmos/cosmos-sdk/types" ) // OracleKeeper is an autogenerated mock type for the OracleKeeper type @@ -18,31 +19,51 @@ type OracleKeeper struct { } // GetTotalTips provides a mock function with given fields: ctx -func (_m *OracleKeeper) GetTotalTips(ctx context.Context) types.Coin { +func (_m *OracleKeeper) GetTotalTips(ctx context.Context) (math.Int, error) { ret := _m.Called(ctx) - var r0 types.Coin - if rf, ok := ret.Get(0).(func(context.Context) types.Coin); ok { + var r0 math.Int + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (math.Int, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) math.Int); ok { r0 = rf(ctx) } else { - r0 = ret.Get(0).(types.Coin) + r0 = ret.Get(0).(math.Int) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) } - return r0 + return r0, r1 } // GetUserTips provides a mock function with given fields: ctx, tipper -func (_m *OracleKeeper) GetUserTips(ctx context.Context, tipper types.AccAddress) oracletypes.UserTipTotal { +func (_m *OracleKeeper) GetUserTips(ctx context.Context, tipper cosmos_sdktypes.AccAddress) (oracletypes.UserTipTotal, error) { ret := _m.Called(ctx, tipper) var r0 oracletypes.UserTipTotal - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) oracletypes.UserTipTotal); ok { + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress) (oracletypes.UserTipTotal, error)); ok { + return rf(ctx, tipper) + } + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress) oracletypes.UserTipTotal); ok { r0 = rf(ctx, tipper) } else { r0 = ret.Get(0).(oracletypes.UserTipTotal) } - return r0 + if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress) error); ok { + r1 = rf(ctx, tipper) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } type mockConstructorTestingTNewOracleKeeper interface { diff --git a/x/dispute/mocks/ReporterKeeper.go b/x/dispute/mocks/ReporterKeeper.go new file mode 100644 index 000000000..fe941eda7 --- /dev/null +++ b/x/dispute/mocks/ReporterKeeper.go @@ -0,0 +1,142 @@ +// Code generated by mockery v2.23.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + math "cosmossdk.io/math" + disputetypes "github.com/tellor-io/layer/x/dispute/types" + + mock "github.com/stretchr/testify/mock" + + reportertypes "github.com/tellor-io/layer/x/reporter/types" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// ReporterKeeper is an autogenerated mock type for the ReporterKeeper type +type ReporterKeeper struct { + mock.Mock +} + +// AllocateRewardsToStake provides a mock function with given fields: ctx, reporterAddr, reward +func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAddr types.AccAddress, reward math.Int) error { + ret := _m.Called(ctx, reporterAddr, reward) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { + r0 = rf(ctx, reporterAddr, reward) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// EscrowReporterStake provides a mock function with given fields: ctx, reporterAddr, amt +func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr types.AccAddress, amt math.Int) error { + ret := _m.Called(ctx, reporterAddr, amt) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { + r0 = rf(ctx, reporterAddr, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// JailReporter provides a mock function with given fields: ctx, reporterAddr, jailDuration +func (_m *ReporterKeeper) JailReporter(ctx context.Context, reporterAddr types.AccAddress, jailDuration int64) error { + ret := _m.Called(ctx, reporterAddr, jailDuration) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, int64) error); ok { + r0 = rf(ctx, reporterAddr, jailDuration) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Reporter provides a mock function with given fields: ctx, repAddr +func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddr types.AccAddress) (*reportertypes.OracleReporter, error) { + ret := _m.Called(ctx, repAddr) + + var r0 *reportertypes.OracleReporter + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) (*reportertypes.OracleReporter, error)); ok { + return rf(ctx, repAddr) + } + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) *reportertypes.OracleReporter); ok { + r0 = rf(ctx, repAddr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*reportertypes.OracleReporter) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress) error); ok { + r1 = rf(ctx, repAddr) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RewardReporterBondToFeePayers provides a mock function with given fields: ctx, recipients, reward +func (_m *ReporterKeeper) RewardReporterBondToFeePayers(ctx context.Context, recipients []disputetypes.PayerInfo, reward math.Int) error { + ret := _m.Called(ctx, recipients, reward) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, []disputetypes.PayerInfo, math.Int) error); ok { + r0 = rf(ctx, recipients, reward) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// TotalReporterPower provides a mock function with given fields: ctx +func (_m *ReporterKeeper) TotalReporterPower(ctx context.Context) (math.Int, error) { + ret := _m.Called(ctx) + + var r0 math.Int + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (math.Int, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) math.Int); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(math.Int) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewReporterKeeper interface { + mock.TestingT + Cleanup(func()) +} + +// NewReporterKeeper creates a new instance of ReporterKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewReporterKeeper(t mockConstructorTestingTNewReporterKeeper) *ReporterKeeper { + mock := &ReporterKeeper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/x/dispute/mocks/SlashingKeeper.go b/x/dispute/mocks/SlashingKeeper.go deleted file mode 100644 index bab87edc6..000000000 --- a/x/dispute/mocks/SlashingKeeper.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - - time "time" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// SlashingKeeper is an autogenerated mock type for the SlashingKeeper type -type SlashingKeeper struct { - mock.Mock -} - -// GetValidatorSigningInfo provides a mock function with given fields: ctx, address -func (_m *SlashingKeeper) GetValidatorSigningInfo(ctx context.Context, address types.ConsAddress) (slashingtypes.ValidatorSigningInfo, error) { - ret := _m.Called(ctx, address) - - var r0 slashingtypes.ValidatorSigningInfo - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress) (slashingtypes.ValidatorSigningInfo, error)); ok { - return rf(ctx, address) - } - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress) slashingtypes.ValidatorSigningInfo); ok { - r0 = rf(ctx, address) - } else { - r0 = ret.Get(0).(slashingtypes.ValidatorSigningInfo) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.ConsAddress) error); ok { - r1 = rf(ctx, address) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// JailUntil provides a mock function with given fields: ctx, consAddr, jailTime -func (_m *SlashingKeeper) JailUntil(ctx context.Context, consAddr types.ConsAddress, jailTime time.Time) error { - ret := _m.Called(ctx, consAddr, jailTime) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress, time.Time) error); ok { - r0 = rf(ctx, consAddr, jailTime) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetValidatorSigningInfo provides a mock function with given fields: ctx, address, info -func (_m *SlashingKeeper) SetValidatorSigningInfo(ctx context.Context, address types.ConsAddress, info slashingtypes.ValidatorSigningInfo) error { - ret := _m.Called(ctx, address, info) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ConsAddress, slashingtypes.ValidatorSigningInfo) error); ok { - r0 = rf(ctx, address, info) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -type mockConstructorTestingTNewSlashingKeeper interface { - mock.TestingT - Cleanup(func()) -} - -// 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. -func NewSlashingKeeper(t mockConstructorTestingTNewSlashingKeeper) *SlashingKeeper { - mock := &SlashingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/dispute/mocks/StakingKeeper.go b/x/dispute/mocks/StakingKeeper.go deleted file mode 100644 index aba2e8bb7..000000000 --- a/x/dispute/mocks/StakingKeeper.go +++ /dev/null @@ -1,371 +0,0 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - address "cosmossdk.io/core/address" - - cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" - - math "cosmossdk.io/math" - - 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 -} - -// AddValidatorTokensAndShares provides a mock function with given fields: ctx, validator, tokensToAdd -func (_m *StakingKeeper) AddValidatorTokensAndShares(ctx context.Context, validator types.Validator, tokensToAdd math.Int) (types.Validator, math.LegacyDec, error) { - ret := _m.Called(ctx, validator, tokensToAdd) - - var r0 types.Validator - var r1 math.LegacyDec - var r2 error - if rf, ok := ret.Get(0).(func(context.Context, types.Validator, math.Int) (types.Validator, math.LegacyDec, error)); ok { - return rf(ctx, validator, tokensToAdd) - } - if rf, ok := ret.Get(0).(func(context.Context, types.Validator, math.Int) types.Validator); ok { - r0 = rf(ctx, validator, tokensToAdd) - } else { - r0 = ret.Get(0).(types.Validator) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.Validator, math.Int) math.LegacyDec); ok { - r1 = rf(ctx, validator, tokensToAdd) - } else { - r1 = ret.Get(1).(math.LegacyDec) - } - - if rf, ok := ret.Get(2).(func(context.Context, types.Validator, math.Int) error); ok { - r2 = rf(ctx, validator, tokensToAdd) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ConsensusAddressCodec provides a mock function with given fields: -func (_m *StakingKeeper) ConsensusAddressCodec() address.Codec { - ret := _m.Called() - - var r0 address.Codec - if rf, ok := ret.Get(0).(func() address.Codec); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(address.Codec) - } - } - - return r0 -} - -// Delegate provides a mock function with given fields: ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount -func (_m *StakingKeeper) Delegate(ctx context.Context, delAddr cosmos_sdktypes.AccAddress, bondAmt math.Int, tokenSrc types.BondStatus, validator types.Validator, subtractAccount bool) (math.LegacyDec, error) { - ret := _m.Called(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) - - var r0 math.LegacyDec - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, types.BondStatus, types.Validator, bool) (math.LegacyDec, error)); ok { - return rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) - } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, types.BondStatus, types.Validator, bool) math.LegacyDec); ok { - r0 = rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) - } else { - r0 = ret.Get(0).(math.LegacyDec) - } - - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, types.BondStatus, types.Validator, bool) error); ok { - r1 = rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DeleteValidatorByPowerIndex provides a mock function with given fields: ctx, validator -func (_m *StakingKeeper) DeleteValidatorByPowerIndex(ctx context.Context, validator types.Validator) error { - ret := _m.Called(ctx, validator) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.Validator) error); ok { - r0 = rf(ctx, validator) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// GetDelegation provides a mock function with given fields: ctx, delAddr, valAddr -func (_m *StakingKeeper) GetDelegation(ctx context.Context, delAddr cosmos_sdktypes.AccAddress, valAddr cosmos_sdktypes.ValAddress) (types.Delegation, error) { - ret := _m.Called(ctx, delAddr, valAddr) - - var r0 types.Delegation - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, cosmos_sdktypes.ValAddress) (types.Delegation, error)); ok { - return rf(ctx, delAddr, valAddr) - } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, cosmos_sdktypes.ValAddress) types.Delegation); ok { - r0 = rf(ctx, delAddr, valAddr) - } else { - r0 = ret.Get(0).(types.Delegation) - } - - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress, cosmos_sdktypes.ValAddress) error); ok { - r1 = rf(ctx, delAddr, valAddr) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetLastTotalPower provides a mock function with given fields: ctx -func (_m *StakingKeeper) GetLastTotalPower(ctx context.Context) (math.Int, error) { - ret := _m.Called(ctx) - - var r0 math.Int - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (math.Int, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) math.Int); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(math.Int) - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetValidator provides a mock function with given fields: ctx, addr -func (_m *StakingKeeper) GetValidator(ctx context.Context, addr cosmos_sdktypes.ValAddress) (types.Validator, error) { - ret := _m.Called(ctx, addr) - - var r0 types.Validator - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ValAddress) (types.Validator, error)); ok { - return rf(ctx, addr) - } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ValAddress) types.Validator); ok { - r0 = rf(ctx, addr) - } else { - r0 = ret.Get(0).(types.Validator) - } - - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.ValAddress) error); ok { - r1 = rf(ctx, addr) - } 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) (types.Validator, error) { - ret := _m.Called(ctx, consAddr) - - var r0 types.Validator - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) (types.Validator, error)); ok { - return rf(ctx, consAddr) - } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) types.Validator); ok { - r0 = rf(ctx, consAddr) - } else { - r0 = ret.Get(0).(types.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 -} - -// IterateDelegatorDelegations provides a mock function with given fields: ctx, delegator, cb -func (_m *StakingKeeper) IterateDelegatorDelegations(ctx context.Context, delegator cosmos_sdktypes.AccAddress, cb func(types.Delegation) bool) error { - ret := _m.Called(ctx, delegator, cb) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, func(types.Delegation) bool) error); ok { - r0 = rf(ctx, delegator, cb) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Jail provides a mock function with given fields: ctx, consAddr -func (_m *StakingKeeper) Jail(ctx context.Context, consAddr cosmos_sdktypes.ConsAddress) error { - ret := _m.Called(ctx, consAddr) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) error); ok { - r0 = rf(ctx, consAddr) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// RemoveDelegation provides a mock function with given fields: ctx, delegation -func (_m *StakingKeeper) RemoveDelegation(ctx context.Context, delegation types.Delegation) error { - ret := _m.Called(ctx, delegation) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.Delegation) error); ok { - r0 = rf(ctx, delegation) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// RemoveValidatorTokens provides a mock function with given fields: ctx, validator, tokensToRemove -func (_m *StakingKeeper) RemoveValidatorTokens(ctx context.Context, validator types.Validator, tokensToRemove math.Int) (types.Validator, error) { - ret := _m.Called(ctx, validator, tokensToRemove) - - var r0 types.Validator - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.Validator, math.Int) (types.Validator, error)); ok { - return rf(ctx, validator, tokensToRemove) - } - if rf, ok := ret.Get(0).(func(context.Context, types.Validator, math.Int) types.Validator); ok { - r0 = rf(ctx, validator, tokensToRemove) - } else { - r0 = ret.Get(0).(types.Validator) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.Validator, math.Int) error); ok { - r1 = rf(ctx, validator, tokensToRemove) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveValidatorTokensAndShares provides a mock function with given fields: ctx, validator, sharesToRemove -func (_m *StakingKeeper) RemoveValidatorTokensAndShares(ctx context.Context, validator types.Validator, sharesToRemove math.LegacyDec) (types.Validator, math.Int, error) { - ret := _m.Called(ctx, validator, sharesToRemove) - - var r0 types.Validator - var r1 math.Int - var r2 error - if rf, ok := ret.Get(0).(func(context.Context, types.Validator, math.LegacyDec) (types.Validator, math.Int, error)); ok { - return rf(ctx, validator, sharesToRemove) - } - if rf, ok := ret.Get(0).(func(context.Context, types.Validator, math.LegacyDec) types.Validator); ok { - r0 = rf(ctx, validator, sharesToRemove) - } else { - r0 = ret.Get(0).(types.Validator) - } - - if rf, ok := ret.Get(1).(func(context.Context, types.Validator, math.LegacyDec) math.Int); ok { - r1 = rf(ctx, validator, sharesToRemove) - } else { - r1 = ret.Get(1).(math.Int) - } - - if rf, ok := ret.Get(2).(func(context.Context, types.Validator, math.LegacyDec) error); ok { - r2 = rf(ctx, validator, sharesToRemove) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// SetDelegation provides a mock function with given fields: ctx, delegation -func (_m *StakingKeeper) SetDelegation(ctx context.Context, delegation types.Delegation) error { - ret := _m.Called(ctx, delegation) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.Delegation) error); ok { - r0 = rf(ctx, delegation) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetValidator provides a mock function with given fields: ctx, validator -func (_m *StakingKeeper) SetValidator(ctx context.Context, validator types.Validator) error { - ret := _m.Called(ctx, validator) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.Validator) error); ok { - r0 = rf(ctx, validator) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetValidatorByPowerIndex provides a mock function with given fields: ctx, validator -func (_m *StakingKeeper) SetValidatorByPowerIndex(ctx context.Context, validator types.Validator) error { - ret := _m.Called(ctx, validator) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.Validator) error); ok { - r0 = rf(ctx, validator) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// TokensFromConsensusPower provides a mock function with given fields: ctx, power -func (_m *StakingKeeper) TokensFromConsensusPower(ctx context.Context, power int64) math.Int { - ret := _m.Called(ctx, power) - - var r0 math.Int - if rf, ok := ret.Get(0).(func(context.Context, int64) math.Int); ok { - r0 = rf(ctx, power) - } else { - r0 = ret.Get(0).(math.Int) - } - - return r0 -} - -type mockConstructorTestingTNewStakingKeeper interface { - mock.TestingT - Cleanup(func()) -} - -// 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. -func NewStakingKeeper(t mockConstructorTestingTNewStakingKeeper) *StakingKeeper { - mock := &StakingKeeper{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/x/dispute/module.go b/x/dispute/module.go index fcdf85f9e..50529e42f 100644 --- a/x/dispute/module.go +++ b/x/dispute/module.go @@ -153,10 +153,15 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(ctx context.Context) error { sdkCtx := sdk.UnwrapSDKContext(ctx) - ids := am.keeper.CheckPrevoteDisputesForExpiration(sdkCtx) - am.keeper.Tally(sdkCtx, ids) - am.keeper.ExecuteVotes(sdkCtx, ids) - return nil + ids, err := am.keeper.CheckPrevoteDisputesForExpiration(sdkCtx) + if err != nil { + return err + } + err = am.keeper.Tally(sdkCtx, ids) + if err != nil { + return err + } + return am.keeper.ExecuteVotes(sdkCtx, ids) } // ---------------------------------------------------------------------------- @@ -166,7 +171,6 @@ func (am AppModule) BeginBlock(ctx context.Context) error { func init() { appmodule.Register(&disputemodulev1.Module{}, appmodule.Provide(ProvideModule)) - } type DisputeInputs struct { @@ -180,8 +184,7 @@ type DisputeInputs struct { AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper OracleKeeper types.OracleKeeper - SlashingKeeper types.SlashingKeeper - StakingKeeper types.StakingKeeper + ReporterKeeper types.ReporterKeeper } type DisputeOutputs struct { @@ -192,7 +195,6 @@ type DisputeOutputs struct { } func ProvideModule(in DisputeInputs) DisputeOutputs { - k := keeper.NewKeeper( in.Cdc, in.KvStoreKey, @@ -201,8 +203,7 @@ func ProvideModule(in DisputeInputs) DisputeOutputs { in.AccountKeeper, in.BankKeeper, in.OracleKeeper, - in.SlashingKeeper, - in.StakingKeeper, + in.ReporterKeeper, ) m := NewAppModule( in.Cdc, diff --git a/x/dispute/types/errors.go b/x/dispute/types/errors.go index d971b3c56..7dd97b2b1 100644 --- a/x/dispute/types/errors.go +++ b/x/dispute/types/errors.go @@ -18,4 +18,5 @@ var ( ErrVotingPeriodEnded = sdkerrors.Register(ModuleName, 9, "voting period ended") ErrMinimumTRBrequired = sdkerrors.Register(ModuleName, 10, "Minimum fee amount is 1 TRB") ErrInvalidFeeDenom = sdkerrors.Register(ModuleName, 11, "invalid fee denom") + ErrInvalidDisputeCategory = sdkerrors.Register(ModuleName, 12, "invalid dispute category") ) diff --git a/x/dispute/types/expected_keepers.go b/x/dispute/types/expected_keepers.go index 511dd6075..1afc3cbce 100644 --- a/x/dispute/types/expected_keepers.go +++ b/x/dispute/types/expected_keepers.go @@ -2,47 +2,15 @@ package types import ( context "context" - "time" - "cosmossdk.io/core/address" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + oracletypes "github.com/tellor-io/layer/x/oracle/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -type SlashingKeeper interface { - JailUntil(ctx context.Context, consAddr sdk.ConsAddress, jailTime time.Time) error - GetValidatorSigningInfo(ctx context.Context, address sdk.ConsAddress) (slashingtypes.ValidatorSigningInfo, error) - SetValidatorSigningInfo(ctx context.Context, address sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) error -} - -type StakingKeeper interface { - ConsensusAddressCodec() address.Codec - // Methods imported from staking should be defined here - AddValidatorTokensAndShares(ctx context.Context, validator stakingtypes.Validator, - tokensToAdd math.Int, - ) (valOut stakingtypes.Validator, addedShares math.LegacyDec, err error) - Delegate(ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, - ) (newShares math.LegacyDec, err error) - DeleteValidatorByPowerIndex(ctx context.Context, validator stakingtypes.Validator) error - GetLastTotalPower(ctx context.Context) (math.Int, error) - GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (delegation stakingtypes.Delegation, err error) - GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) - GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, err error) - IterateDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) error - Jail(ctx context.Context, consAddr sdk.ConsAddress) error - RemoveDelegation(ctx context.Context, delegation stakingtypes.Delegation) error - RemoveValidatorTokens(ctx context.Context, validator stakingtypes.Validator, tokensToRemove math.Int) (stakingtypes.Validator, error) - RemoveValidatorTokensAndShares(ctx context.Context, validator stakingtypes.Validator, sharesToRemove math.LegacyDec) (valOut stakingtypes.Validator, removedTokens math.Int, err error) - SetDelegation(ctx context.Context, delegation stakingtypes.Delegation) error - SetValidator(ctx context.Context, validator stakingtypes.Validator) error - SetValidatorByPowerIndex(ctx context.Context, validator stakingtypes.Validator) error - TokensFromConsensusPower(ctx context.Context, power int64) math.Int -} - // AccountKeeper defines the expected account keeper used for simulations (noalias) type AccountKeeper interface { GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI @@ -58,13 +26,21 @@ type BankKeeper interface { HasBalance(ctx context.Context, addr sdk.AccAddress, amt sdk.Coin) bool InputOutputCoins(ctx context.Context, inputs banktypes.Input, outputs []banktypes.Output) error SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins // Methods imported from bank should be defined here } type OracleKeeper interface { - GetTotalTips(ctx context.Context) sdk.Coin - GetUserTips(ctx context.Context, tipper sdk.AccAddress) oracletypes.UserTipTotal + GetTotalTips(ctx context.Context) (math.Int, error) + GetUserTips(ctx context.Context, tipper sdk.AccAddress) (oracletypes.UserTipTotal, error) +} + +type ReporterKeeper interface { + AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error + EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error + Reporter(ctx context.Context, repAddr sdk.AccAddress) (*reportertypes.OracleReporter, error) + JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration int64) error + TotalReporterPower(ctx context.Context) (math.Int, error) + RewardReporterBondToFeePayers(ctx context.Context, recipients []PayerInfo, reward math.Int) error } diff --git a/x/dispute/types/types.go b/x/dispute/types/types.go index 504b3c95a..bcb2e8811 100644 --- a/x/dispute/types/types.go +++ b/x/dispute/types/types.go @@ -1,6 +1,5 @@ package types const ( - TeamAddress = "trbFakeAddress" - DefaultBondDenom = "loya" + TeamAddress = "trbFakeAddress" ) diff --git a/x/mint/keeper/genesis.go b/x/mint/keeper/genesis.go index c6812a137..db47dac12 100644 --- a/x/mint/keeper/genesis.go +++ b/x/mint/keeper/genesis.go @@ -22,7 +22,10 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { } func (k Keeper) InitialMint(ctx sdk.Context, gen *types.GenesisState) { - k.bankKeeper.MintCoins(ctx, types.ModuleName, gen.InitialMint) + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, gen.InitialMint); err != nil { + panic(err) + } + if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.MintToTeam, gen.InitialMint); err != nil { panic(err) } diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 8f59a4aa5..7a35e77d0 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -73,13 +73,21 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { if err != nil { return err } - tip := k.GetQueryTip(ctx, queryIdBytes) + tip, err := k.GetQueryTip(ctx, queryIdBytes) + if err != nil { + return err + } // Allocate rewards if there is a tip. - if !tip.Amount.IsZero() { + if !tip.IsZero() { err = k.AllocateRewards(ctx, report.Reporters, tip, true) if err != nil { return err } + // remove the tip from the store + err = k.CurrentTip.Remove(ctx, queryIdBytes) + if err != nil { + return err + } } // Add reporters to the tbr payment list. if cycleList[strings.ToLower(queryIdStr)] { diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 110bee7e1..3f673e45d 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -26,6 +26,7 @@ type ( // should be the x/gov module account. Schema collections.Schema Commits collections.Map[collections.Pair[[]byte, []byte], types.CommitReport] // key: reporter, queryid + CurrentTip collections.Map[[]byte, math.Int] // key: queryId Tips *collections.IndexedMap[collections.Pair[[]byte, []byte], math.Int, tipsIndex] // key: queryId, tipper TotalTips collections.Item[math.Int] // keep track of the total tips Aggregates collections.Map[collections.Pair[[]byte, int64], types.Aggregate] // key: queryId, timestamp @@ -64,7 +65,8 @@ func NewKeeper( authority: authority, - Commits: collections.NewMap(sb, types.CommitsPrefix, "commits", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), codec.CollValue[types.CommitReport](cdc)), + Commits: collections.NewMap(sb, types.CommitsPrefix, "commits", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), codec.CollValue[types.CommitReport](cdc)), + CurrentTip: collections.NewMap(sb, types.CurrentTipPrefix, "current_tip", collections.BytesKey, sdk.IntValue), Tips: collections.NewIndexedMap(sb, types.TipsPrefix, "tips", @@ -92,7 +94,6 @@ func NewKeeper( k.Schema = schema return k - } // GetAuthority returns the module's authority. diff --git a/x/oracle/keeper/msg_server_commit_report.go b/x/oracle/keeper/msg_server_commit_report.go index 7f98578e6..ff03f4b47 100644 --- a/x/oracle/keeper/msg_server_commit_report.go +++ b/x/oracle/keeper/msg_server_commit_report.go @@ -30,9 +30,12 @@ func (k msgServer) CommitReport(goCtx context.Context, msg *types.MsgCommitRepor if err != nil { return nil, err } - tip := k.GetQueryTip(ctx, queryId) + tip, err := k.GetQueryTip(ctx, queryId) + if err != nil { + return nil, err + } - if currentCycleQuery != msg.QueryData && tip.Amount.IsZero() { + if currentCycleQuery != msg.QueryData && tip.IsZero() { return nil, status.Error(codes.Unavailable, "query does not have tips and is not in cycle") } diff --git a/x/oracle/keeper/msg_server_tip.go b/x/oracle/keeper/msg_server_tip.go index dcaff5d6e..d99f6771c 100644 --- a/x/oracle/keeper/msg_server_tip.go +++ b/x/oracle/keeper/msg_server_tip.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/collections" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" ) @@ -15,7 +16,7 @@ import ( func (k msgServer) Tip(goCtx context.Context, msg *types.MsgTip) (*types.MsgTipResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if msg.Amount.Denom != types.DefaultBondDenom || msg.Amount.Amount.IsZero() || msg.Amount.Amount.IsNegative() { + if msg.Amount.Denom != layer.BondDenom || msg.Amount.Amount.IsZero() || msg.Amount.Amount.IsNegative() { return nil, sdkerrors.ErrInvalidRequest } tipper := sdk.MustAccAddressFromBech32(msg.Tipper) @@ -30,6 +31,15 @@ func (k msgServer) Tip(goCtx context.Context, msg *types.MsgTip) (*types.MsgTipR return nil, err } + err = k.Keeper.AddtoTotalTips(ctx, tip.Amount) + if err != nil { + return nil, err + } + + err = k.Keeper.SetQueryTip(ctx, queryId, tip.Amount) + if err != nil { + return nil, err + } prevTip, err := k.Keeper.Tips.Get(ctx, collections.Join(queryId, tipper.Bytes())) if err != nil && !errors.Is(err, collections.ErrNotFound) { return nil, fmt.Errorf("failed to get previous tip: %w", err) diff --git a/x/oracle/keeper/query_get_current_tip.go b/x/oracle/keeper/query_get_current_tip.go index 1084ebb6f..e990779b6 100644 --- a/x/oracle/keeper/query_get_current_tip.go +++ b/x/oracle/keeper/query_get_current_tip.go @@ -22,7 +22,10 @@ func (k Keeper) GetCurrentTip(goCtx context.Context, req *types.QueryGetCurrentT if err != nil { return nil, status.Error(codes.InvalidArgument, "invalid query data") } - tips := k.GetQueryTip(ctx, queryId) + tips, err := k.GetQueryTip(ctx, queryId) + if err != nil { + return nil, err + } return &types.QueryGetCurrentTipResponse{Tips: &types.Tips{ QueryData: req.QueryData, // TODO: avoid returning the same data as the request diff --git a/x/oracle/keeper/query_get_reports.go b/x/oracle/keeper/query_get_reports.go index f2467ba24..821dc1f78 100644 --- a/x/oracle/keeper/query_get_reports.go +++ b/x/oracle/keeper/query_get_reports.go @@ -17,20 +17,21 @@ func (k Querier) GetReportsbyQid(goCtx context.Context, req *types.QueryGetRepor if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) - - // TODO: add index and use that reports := types.Reports{ MicroReports: []*types.MicroReport{}, } - - k.Reports.Walk(ctx, nil, func(key collections.Triple[[]byte, []byte, int64], value types.MicroReport) (stop bool, err error) { - if value.QueryId == req.QueryId { - reports.MicroReports = append(reports.MicroReports, &value) - } + queryIdBytes, err := utils.QueryIDFromString(req.QueryId) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "failed to decode query ID") + } + rng := collections.NewPrefixedTripleRange[[]byte, []byte, int64](queryIdBytes) + err = k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, int64], value types.MicroReport) (stop bool, err error) { + reports.MicroReports = append(reports.MicroReports, &value) return false, nil }) - + if err != nil { + return nil, err + } return &types.QueryGetReportsbyQidResponse{Reports: reports}, nil } @@ -72,11 +73,13 @@ func (k Querier) GetReportsbyReporterQid(goCtx context.Context, req *types.Query microReports := []*types.MicroReport{} rng := collections.NewSuperPrefixedTripleRange[[]byte, []byte, int64](qId, reporterAdd.Bytes()) - k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, int64], value types.MicroReport) (stop bool, err error) { + err = k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, int64], value types.MicroReport) (stop bool, err error) { microReports = append(microReports, &value) return false, nil }) - + if err != nil { + return nil, err + } return &types.QueryGetReportsbyQidResponse{Reports: types.Reports{ MicroReports: microReports, }}, nil diff --git a/x/oracle/keeper/query_get_time_based_rewards.go b/x/oracle/keeper/query_get_time_based_rewards.go index bb5b10b4f..cfd1bc0ee 100644 --- a/x/oracle/keeper/query_get_time_based_rewards.go +++ b/x/oracle/keeper/query_get_time_based_rewards.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/oracle/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -18,5 +19,5 @@ func (k Keeper) GetTimeBasedRewards(goCtx context.Context, req *types.QueryGetTi rewards := k.getTimeBasedRewards(ctx) - return &types.QueryGetTimeBasedRewardsResponse{Reward: rewards}, nil + return &types.QueryGetTimeBasedRewardsResponse{Reward: sdk.NewCoin(layer.BondDenom, rewards)}, nil } diff --git a/x/oracle/keeper/query_get_user_tip_total.go b/x/oracle/keeper/query_get_user_tip_total.go index 8e05703b1..9573a42e2 100644 --- a/x/oracle/keeper/query_get_user_tip_total.go +++ b/x/oracle/keeper/query_get_user_tip_total.go @@ -23,10 +23,14 @@ func (k Keeper) GetUserTipTotal(goCtx context.Context, req *types.QueryGetUserTi var totalTips types.UserTipTotal if req.QueryData == "" { - totalTips = k.GetUserTips(ctx, tipper) + // if query data is not provide, return total tips for the tipper on all queries + totalTips, err := k.GetUserTips(ctx, tipper) + if err != nil { + return nil, err + } return &types.QueryGetUserTipTotalResponse{TotalTips: &totalTips}, nil } - + // if query data is provided, return total tips for the tipper on the specific query queryId, err := utils.QueryIDFromDataString(req.QueryData) if err != nil { return nil, err @@ -40,7 +44,7 @@ func (k Keeper) GetUserTipTotal(goCtx context.Context, req *types.QueryGetUserTi } return nil, err } - totalTips.Total = sdk.NewCoin(types.DefaultBondDenom, tip) + totalTips.Total = tip return &types.QueryGetUserTipTotalResponse{TotalTips: &totalTips}, nil } diff --git a/x/oracle/keeper/rewards.go b/x/oracle/keeper/rewards.go index 983c40e3a..3eae59038 100644 --- a/x/oracle/keeper/rewards.go +++ b/x/oracle/keeper/rewards.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + layer "github.com/tellor-io/layer/types" minttypes "github.com/tellor-io/layer/x/mint/types" "github.com/tellor-io/layer/x/oracle/types" reportertypes "github.com/tellor-io/layer/x/reporter/types" @@ -17,7 +18,7 @@ type ReportersReportCount struct { // AllocateRewards distributes rewards to reporters based on their power and number of reports. // It calculates the reward amount for each reporter and allocates the rewards. // Finally, it sends the allocated rewards to the appropriate module based on the source of the reward. -func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, reward sdk.Coin, toStake bool) error { +func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, reward math.Int, toStake bool) error { // Initialize totalPower to keep track of the total power of all reporters. totalPower := int64(0) // reportCounts maps reporter's address to their ValidatorReportCount. @@ -51,7 +52,7 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep } for r, c := range reportCounts { - amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, reward.Amount) + amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, reward) repoterAddr, err := sdk.AccAddressFromBech32(r) if err != nil { return err @@ -62,12 +63,13 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep } } - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, from, to, sdk.NewCoins(reward)) + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, from, to, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, reward))) } -func (k Keeper) getTimeBasedRewards(ctx sdk.Context) sdk.Coin { +func (k Keeper) getTimeBasedRewards(ctx sdk.Context) math.Int { tbrAccount := k.getTimeBasedRewardsAccount(ctx) - return k.bankKeeper.GetBalance(ctx, tbrAccount.GetAddress(), types.DefaultBondDenom) + balance := k.bankKeeper.GetBalance(ctx, tbrAccount.GetAddress(), layer.BondDenom) + return balance.Amount } func (k Keeper) getTimeBasedRewardsAccount(ctx sdk.Context) sdk.ModuleAccountI { @@ -81,7 +83,7 @@ func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward } func (k Keeper) AllocateTBR(ctx sdk.Context, addr []byte, amount math.Int) error { - reward := sdk.NewDecCoins(sdk.NewDecCoin(types.DefaultBondDenom, amount)) + reward := sdk.NewDecCoins(sdk.NewDecCoin(layer.BondDenom, amount)) return k.reporterKeeper.AllocateTokensToReporter(ctx, addr, reward) } diff --git a/x/oracle/keeper/submit_value.go b/x/oracle/keeper/submit_value.go index 3759db977..04b215ebc 100644 --- a/x/oracle/keeper/submit_value.go +++ b/x/oracle/keeper/submit_value.go @@ -10,14 +10,13 @@ import ( regTypes "github.com/tellor-io/layer/x/registry/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/accounts/abi" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) func (k Keeper) setValue(ctx sdk.Context, reporter sdk.AccAddress, val string, queryData []byte, power, block int64) error { // decode query data hex to get query type, returns interface array - queryType, err := decodeQueryType(queryData) + queryType, _, err := regTypes.DecodeQueryType(queryData) if err != nil { return status.Error(codes.InvalidArgument, fmt.Sprintf("failed to decode query type: %v", err)) } @@ -52,27 +51,6 @@ func (k Keeper) VerifyCommit(ctx sdk.Context, reporter string, value, salt, hash return calculatedCommit == hash } -func decodeQueryType(data []byte) (string, error) { - // Create an ABI arguments object based on the types - strArg, err := abi.NewType("string", "string", nil) - if err != nil { - return "", fmt.Errorf("failed to create new ABI type when decoding query type: %v", err) - } - bytesArg, err := abi.NewType("bytes", "bytes", nil) - if err != nil { - return "", fmt.Errorf("failed to create new ABI type when decoding query type: %v", err) - } - args := abi.Arguments{ - abi.Argument{Type: strArg}, - abi.Argument{Type: bytesArg}, - } - result, err := args.UnpackValues(data) - if err != nil { - return "", fmt.Errorf("failed to unpack query type: %v", err) - } - return result[0].(string), nil -} - func (k Keeper) GetDataSpec(ctx sdk.Context, queryType string) (regTypes.DataSpec, error) { // get data spec from registry by query type to validate value dataSpec, err := k.registryKeeper.GetSpec(ctx, queryType) diff --git a/x/oracle/keeper/tip.go b/x/oracle/keeper/tip.go index efe4297ee..a5e09c631 100644 --- a/x/oracle/keeper/tip.go +++ b/x/oracle/keeper/tip.go @@ -15,52 +15,79 @@ func (k Keeper) transfer(ctx sdk.Context, tipper sdk.AccAddress, tip sdk.Coin) ( twoPercent := tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100)) burnCoin := sdk.NewCoin(tip.Denom, twoPercent) if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, tipper, types.ModuleName, sdk.NewCoins(tip)); err != nil { - return sdk.NewCoin(tip.Denom, math.ZeroInt()), err + return sdk.Coin{}, err } // burn 2% of tip if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(burnCoin)); err != nil { - return sdk.NewCoin(tip.Denom, math.ZeroInt()), err + return sdk.Coin{}, err } return tip.Sub(burnCoin), nil } -func (k Keeper) GetQueryTip(ctx sdk.Context, queryId []byte) sdk.Coin { - tipsSum := sdk.NewCoin(types.DefaultBondDenom, math.ZeroInt()) - rng := collections.NewPrefixedPairRange[[]byte, []byte](queryId) // range all tips for this queryID - k.Tips.Walk(ctx, rng, func(key collections.Pair[[]byte, []byte], value math.Int) (stop bool, err error) { - tipsSum = tipsSum.AddAmount(value) - return false, nil - }) - return tipsSum +func (k Keeper) GetQueryTip(ctx sdk.Context, queryId []byte) (math.Int, error) { + tip, err := k.CurrentTip.Get(ctx, queryId) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return math.ZeroInt(), nil + } else { + return math.Int{}, err + } + } + return tip, nil } -func (k Keeper) GetUserTips(ctx context.Context, tipper sdk.AccAddress) types.UserTipTotal { +func (k Keeper) SetQueryTip(ctx sdk.Context, queryId []byte, tip math.Int) error { + existingTip, err := k.GetQueryTip(ctx, queryId) + if err != nil { + return err + } + return k.CurrentTip.Set(ctx, queryId, existingTip.Add(tip)) +} + +func (k Keeper) GetUserTips(ctx context.Context, tipper sdk.AccAddress) (types.UserTipTotal, error) { it, err := k.Tips.Indexes.Tipper.MatchExact(ctx, tipper.Bytes()) if err != nil { - panic(err) + return types.UserTipTotal{}, err } vals, err := indexes.CollectValues(ctx, k.Tips, it) if err != nil { - panic(err) + return types.UserTipTotal{}, err } - totalTips := sdk.NewCoin(types.DefaultBondDenom, math.ZeroInt()) + totalTips := math.ZeroInt() for _, tip := range vals { - totalTips = totalTips.AddAmount(tip) + totalTips = totalTips.Add(tip) } return types.UserTipTotal{ Address: tipper.String(), Total: totalTips, - } + }, nil } -func (k Keeper) GetTotalTips(ctx context.Context) sdk.Coin { +func (k Keeper) GetTotalTips(ctx context.Context) (math.Int, error) { totalTips, err := k.TotalTips.Get(ctx) - if errors.Is(err, collections.ErrNotFound) { - return sdk.NewCoin(types.DefaultBondDenom, math.ZeroInt()) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return math.ZeroInt(), nil + } + return math.Int{}, err } - return sdk.NewCoin(types.DefaultBondDenom, totalTips) + return totalTips, nil +} + +// Add to overall total tips, used for dispute voting calculation +func (k Keeper) AddtoTotalTips(ctx context.Context, tip math.Int) error { + totalTips, err := k.TotalTips.Get(ctx) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return k.TotalTips.Set(ctx, tip) + } + } else { + return err + } + totalTips = totalTips.Add(totalTips) + return k.TotalTips.Set(ctx, totalTips) } diff --git a/x/oracle/keeper/weighted_median_test.go b/x/oracle/keeper/weighted_median_test.go index 01bb9e4a0..bc46d3035 100644 --- a/x/oracle/keeper/weighted_median_test.go +++ b/x/oracle/keeper/weighted_median_test.go @@ -3,15 +3,15 @@ package keeper_test import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/testutil" + "github.com/tellor-io/layer/testutil/sample" "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestWeightedMedian() { - qId := "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992" reporters := make([]sdk.AccAddress, 18) for i := 0; i < 18; i++ { - reporters[i] = testutil.GenerateRandomAddress() + reporters[i] = sample.AccAddressBytes() } // normal scenario - 5 reporters various weights // list of addresses diff --git a/x/oracle/keeper/weighted_mode_test.go b/x/oracle/keeper/weighted_mode_test.go index 4c8844046..4eb2f4f57 100644 --- a/x/oracle/keeper/weighted_mode_test.go +++ b/x/oracle/keeper/weighted_mode_test.go @@ -2,14 +2,14 @@ package keeper_test import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tellor-io/layer/testutil" + "github.com/tellor-io/layer/testutil/sample" "github.com/tellor-io/layer/x/oracle/types" ) func (s *KeeperTestSuite) TestWeightedMode() { reporters := make([]sdk.AccAddress, 18) for i := 0; i < 10; i++ { - reporters[i] = testutil.GenerateRandomAddress() + reporters[i] = sample.AccAddressBytes() } qId := "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992" // normal scenario @@ -114,5 +114,4 @@ func (s *KeeperTestSuite) TestWeightedMode() { s.Equal(res.Report.Reporters[3].Reporter, reporters[8].String(), "reporter is not correct") s.Equal(res.Report.Reporters[4].Reporter, reporters[9].String(), "reporter is not correct") s.Equal(res.Report.AggregateReportIndex, int64(1), "report index is not correct") - } diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 12b9e7738..ed79f72cf 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -35,6 +35,7 @@ var ( TotalTipsPrefix = collections.NewPrefix(8) CycleIndexPrefix = collections.NewPrefix(9) + CurrentTipPrefix = collections.NewPrefix(10) ) func KeyPrefix(p string) []byte { diff --git a/x/oracle/types/tips.pb.go b/x/oracle/types/tips.pb.go index 0fc43fc57..26daa4530 100644 --- a/x/oracle/types/tips.pb.go +++ b/x/oracle/types/tips.pb.go @@ -4,8 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -29,9 +30,9 @@ type Tips struct { // queryData is the query data that was tipped QueryData string `protobuf:"bytes,1,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` // amount is the amount that was tipped - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` // totalTips is the total amount of tips for this query data so far - TotalTips types.Coin `protobuf:"bytes,3,opt,name=total_tips,json=totalTips,proto3" json:"total_tips"` + TotalTips cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=total_tips,json=totalTips,proto3,customtype=cosmossdk.io/math.Int" json:"total_tips"` } func (m *Tips) Reset() { *m = Tips{} } @@ -74,20 +75,6 @@ func (m *Tips) GetQueryData() string { return "" } -func (m *Tips) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -func (m *Tips) GetTotalTips() types.Coin { - if m != nil { - return m.TotalTips - } - return types.Coin{} -} - func init() { proto.RegisterType((*Tips)(nil), "layer.oracle.Tips") } @@ -95,24 +82,24 @@ func init() { func init() { proto.RegisterFile("layer/oracle/tips.proto", fileDescriptor_1dd649bc410cbcce) } var fileDescriptor_1dd649bc410cbcce = []byte{ - // 260 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x50, 0x3d, 0x4e, 0xc3, 0x30, - 0x14, 0x8e, 0xa1, 0xaa, 0x54, 0xc3, 0x14, 0x21, 0x11, 0x2a, 0x61, 0x2a, 0xa6, 0x32, 0x60, 0xab, - 0x30, 0xb0, 0x31, 0xb4, 0x9c, 0xa0, 0x62, 0x62, 0xa9, 0x5e, 0x82, 0x15, 0x2c, 0x25, 0x79, 0xc1, - 0x7e, 0x41, 0xe4, 0x16, 0x9c, 0x80, 0xf3, 0x74, 0xec, 0xc8, 0x84, 0x50, 0x72, 0x11, 0x14, 0xbb, - 0x62, 0x66, 0x7b, 0xfa, 0x7e, 0xf4, 0x7d, 0xef, 0xe3, 0xa7, 0x05, 0xb4, 0xda, 0x2a, 0xb4, 0x90, - 0x15, 0x5a, 0x91, 0xa9, 0x9d, 0xac, 0x2d, 0x12, 0xc6, 0xc7, 0x9e, 0x90, 0x81, 0x98, 0x8a, 0x0c, - 0x5d, 0x89, 0x4e, 0xa5, 0xe0, 0xb4, 0x7a, 0x5b, 0xa4, 0x9a, 0x60, 0xa1, 0x32, 0x34, 0x55, 0x50, - 0x4f, 0x4f, 0x72, 0xcc, 0xd1, 0x9f, 0x6a, 0xb8, 0x02, 0x7a, 0xf9, 0xc9, 0xf8, 0xe8, 0xd1, 0xd4, - 0x2e, 0x3e, 0xe7, 0xfc, 0xb5, 0xd1, 0xb6, 0xdd, 0x3c, 0x03, 0x41, 0xc2, 0x66, 0x6c, 0x3e, 0x59, - 0x4f, 0x3c, 0xf2, 0x00, 0x04, 0xf1, 0x1d, 0x1f, 0x43, 0x89, 0x4d, 0x45, 0xc9, 0xc1, 0x8c, 0xcd, - 0x8f, 0x6e, 0xce, 0x64, 0x88, 0x93, 0x43, 0x9c, 0xdc, 0xc7, 0xc9, 0x15, 0x9a, 0x6a, 0x39, 0xda, - 0x7e, 0x5f, 0x44, 0xeb, 0xbd, 0x3c, 0xbe, 0xe7, 0x9c, 0x90, 0xa0, 0xd8, 0x0c, 0xc5, 0x93, 0xc3, - 0xff, 0x99, 0x27, 0xde, 0x32, 0xf4, 0x5a, 0xae, 0xb6, 0x9d, 0x60, 0xbb, 0x4e, 0xb0, 0x9f, 0x4e, - 0xb0, 0x8f, 0x5e, 0x44, 0xbb, 0x5e, 0x44, 0x5f, 0xbd, 0x88, 0x9e, 0xae, 0x72, 0x43, 0x2f, 0x4d, - 0x2a, 0x33, 0x2c, 0x15, 0xe9, 0xa2, 0x40, 0x7b, 0x6d, 0x50, 0x85, 0xb1, 0xde, 0xff, 0xe6, 0x6a, - 0x6b, 0xed, 0xd2, 0xb1, 0x7f, 0xf6, 0xf6, 0x37, 0x00, 0x00, 0xff, 0xff, 0x13, 0x36, 0xc1, 0xaf, - 0x4b, 0x01, 0x00, 0x00, + // 261 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x49, 0xac, 0x4c, + 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0xc9, 0x2c, 0x28, 0xd6, 0x2b, 0x28, + 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x4b, 0xe8, 0x41, 0x24, 0xa4, 0x24, 0x93, 0xf3, 0x8b, 0x73, + 0xf3, 0x8b, 0xe3, 0xc1, 0x72, 0xfa, 0x10, 0x0e, 0x44, 0xa1, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, + 0x44, 0x1c, 0xc4, 0x82, 0x88, 0x2a, 0x6d, 0x63, 0xe4, 0x62, 0x09, 0xc9, 0x2c, 0x28, 0x16, 0x92, + 0xe5, 0xe2, 0x2a, 0x2c, 0x4d, 0x2d, 0xaa, 0x8c, 0x4f, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x54, 0x60, + 0xd4, 0xe0, 0x0c, 0xe2, 0x04, 0x8b, 0xb8, 0x24, 0x96, 0x24, 0x0a, 0x39, 0x73, 0xb1, 0x25, 0xe6, + 0xe6, 0x97, 0xe6, 0x95, 0x48, 0x30, 0x81, 0xa4, 0x9c, 0xb4, 0x4f, 0xdc, 0x93, 0x67, 0xb8, 0x75, + 0x4f, 0x5e, 0x14, 0x62, 0x47, 0x71, 0x4a, 0xb6, 0x5e, 0x66, 0xbe, 0x7e, 0x6e, 0x62, 0x49, 0x86, + 0x9e, 0x67, 0x5e, 0xc9, 0xa5, 0x2d, 0xba, 0x5c, 0x50, 0xcb, 0x3d, 0xf3, 0x4a, 0x82, 0xa0, 0x5a, + 0x85, 0xbc, 0xb8, 0xb8, 0x4a, 0xf2, 0x4b, 0x12, 0x73, 0xe2, 0x41, 0xee, 0x97, 0x60, 0x26, 0xdd, + 0x20, 0x4e, 0xb0, 0x76, 0x90, 0x7b, 0x9d, 0x9c, 0x4f, 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, 0x4a, 0x33, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xbf, 0x24, + 0x35, 0x27, 0x27, 0xbf, 0x48, 0x37, 0x33, 0x5f, 0x1f, 0x12, 0x7e, 0x15, 0xf0, 0x10, 0xac, 0x2c, + 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x07, 0x82, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x83, 0x75, 0x5f, + 0xc9, 0x5e, 0x01, 0x00, 0x00, } func (m *Tips) Marshal() (dAtA []byte, err error) { @@ -136,21 +123,21 @@ func (m *Tips) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.TotalTips.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.TotalTips.Size() + i -= size + if _, err := m.TotalTips.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintTips(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintTips(dAtA, i, uint64(size)) } i-- @@ -264,7 +251,7 @@ func (m *Tips) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTips @@ -274,15 +261,16 @@ func (m *Tips) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTips } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTips } @@ -297,7 +285,7 @@ func (m *Tips) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TotalTips", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTips @@ -307,15 +295,16 @@ func (m *Tips) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTips } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTips } diff --git a/x/oracle/types/user_tip.pb.go b/x/oracle/types/user_tip.pb.go index 8bb5d6496..d775c9d3e 100644 --- a/x/oracle/types/user_tip.pb.go +++ b/x/oracle/types/user_tip.pb.go @@ -4,9 +4,10 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -26,8 +27,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type UserTipTotal struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Total types.Coin `protobuf:"bytes,2,opt,name=total,proto3" json:"total"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Total cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total,proto3,customtype=cosmossdk.io/math.Int" json:"total"` } func (m *UserTipTotal) Reset() { *m = UserTipTotal{} } @@ -70,13 +71,6 @@ func (m *UserTipTotal) GetAddress() string { return "" } -func (m *UserTipTotal) GetTotal() types.Coin { - if m != nil { - return m.Total - } - return types.Coin{} -} - func init() { proto.RegisterType((*UserTipTotal)(nil), "layer.oracle.UserTipTotal") } @@ -84,24 +78,25 @@ func init() { func init() { proto.RegisterFile("layer/oracle/user_tip.proto", fileDescriptor_aa4312bb1dc0313d) } var fileDescriptor_aa4312bb1dc0313d = []byte{ - // 265 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x31, 0x4e, 0xf3, 0x30, - 0x18, 0x86, 0xe3, 0x5f, 0x3f, 0x20, 0x42, 0xa7, 0xa8, 0x43, 0x5a, 0x24, 0x53, 0x31, 0x95, 0xa1, - 0xb6, 0x5a, 0xc4, 0x01, 0x48, 0x6f, 0x50, 0xca, 0xc2, 0x52, 0x39, 0xa9, 0x15, 0x2c, 0xb9, 0xf9, - 0x22, 0xfb, 0x2b, 0x22, 0xb7, 0xe0, 0x30, 0x1c, 0xa2, 0x63, 0xc5, 0xc4, 0x84, 0x50, 0x72, 0x11, - 0x94, 0x7c, 0xe9, 0xe6, 0x57, 0xcf, 0x63, 0xbf, 0xf2, 0x1b, 0x5e, 0x5b, 0x55, 0x69, 0x27, 0xc1, - 0xa9, 0xcc, 0x6a, 0xb9, 0xf7, 0xda, 0x6d, 0xd0, 0x94, 0xa2, 0x74, 0x80, 0x10, 0x0d, 0x3a, 0x28, - 0x08, 0x8e, 0x87, 0x39, 0xe4, 0xd0, 0x01, 0xd9, 0x9e, 0xc8, 0x19, 0x8f, 0x32, 0xf0, 0x3b, 0xf0, - 0x1b, 0x02, 0x14, 0x7a, 0xc4, 0x29, 0xc9, 0x54, 0x79, 0x2d, 0xdf, 0xe6, 0xa9, 0x46, 0x35, 0x97, - 0x19, 0x98, 0x82, 0xf8, 0x6d, 0x15, 0x0e, 0x9e, 0xbd, 0x76, 0x6b, 0x53, 0xae, 0x01, 0x95, 0x8d, - 0x16, 0xe1, 0x85, 0xda, 0x6e, 0x9d, 0xf6, 0x3e, 0x66, 0x13, 0x36, 0xbd, 0x4c, 0xe2, 0xaf, 0xcf, - 0xd9, 0xb0, 0x7f, 0xf2, 0x91, 0xc8, 0x13, 0x3a, 0x53, 0xe4, 0xab, 0x93, 0x18, 0x3d, 0x84, 0x67, - 0xd8, 0x5e, 0x8e, 0xff, 0x4d, 0xd8, 0xf4, 0x6a, 0x31, 0x12, 0xbd, 0xde, 0x76, 0x8a, 0xbe, 0x53, - 0x2c, 0xc1, 0x14, 0xc9, 0xff, 0xc3, 0xcf, 0x4d, 0xb0, 0x22, 0x3b, 0x59, 0x1e, 0x6a, 0xce, 0x8e, - 0x35, 0x67, 0xbf, 0x35, 0x67, 0x1f, 0x0d, 0x0f, 0x8e, 0x0d, 0x0f, 0xbe, 0x1b, 0x1e, 0xbc, 0xdc, - 0xe5, 0x06, 0x5f, 0xf7, 0xa9, 0xc8, 0x60, 0x27, 0x51, 0x5b, 0x0b, 0x6e, 0x66, 0x40, 0xd2, 0x4a, - 0xef, 0xa7, 0x9d, 0xb0, 0x2a, 0xb5, 0x4f, 0xcf, 0xbb, 0x6f, 0xdc, 0xff, 0x05, 0x00, 0x00, 0xff, - 0xff, 0xb9, 0xd0, 0xe0, 0xa4, 0x44, 0x01, 0x00, 0x00, + // 276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0xc1, 0x4a, 0xc3, 0x40, + 0x10, 0x86, 0xb3, 0x82, 0x8a, 0xa1, 0xa7, 0x52, 0x21, 0x56, 0xd8, 0x8a, 0x27, 0x45, 0x92, 0xa5, + 0xfa, 0x04, 0xad, 0xa7, 0x5e, 0x6b, 0xbd, 0x78, 0x29, 0x9b, 0x64, 0x49, 0x17, 0x37, 0x99, 0xb0, + 0x3b, 0x15, 0xfb, 0x00, 0xde, 0x7d, 0x98, 0x3e, 0x44, 0x8f, 0xa5, 0x27, 0xf1, 0x50, 0x24, 0x79, + 0x11, 0x69, 0x26, 0xbd, 0xed, 0xcc, 0x37, 0xdf, 0x0f, 0xfb, 0xfb, 0xd7, 0x46, 0xae, 0x94, 0x15, + 0x60, 0x65, 0x62, 0x94, 0x58, 0x3a, 0x65, 0xe7, 0xa8, 0xcb, 0xa8, 0xb4, 0x80, 0xd0, 0xed, 0x34, + 0x30, 0x22, 0xd8, 0xe7, 0x09, 0xb8, 0x1c, 0x9c, 0x88, 0xa5, 0x53, 0xe2, 0x63, 0x18, 0x2b, 0x94, + 0x43, 0x91, 0x80, 0x2e, 0xe8, 0xba, 0x7f, 0x45, 0x7c, 0xde, 0x4c, 0x82, 0x86, 0x16, 0xf5, 0x32, + 0xc8, 0x80, 0xf6, 0x87, 0x17, 0x6d, 0x6f, 0xbf, 0x98, 0xdf, 0x79, 0x75, 0xca, 0xce, 0x74, 0x39, + 0x03, 0x94, 0xa6, 0xfb, 0xe8, 0x9f, 0xcb, 0x34, 0xb5, 0xca, 0xb9, 0x80, 0xdd, 0xb0, 0xbb, 0x8b, + 0x71, 0xb0, 0x5b, 0x87, 0xbd, 0x36, 0x69, 0x44, 0xe4, 0x05, 0xad, 0x2e, 0xb2, 0xe9, 0xf1, 0xb0, + 0x3b, 0xf2, 0x4f, 0xf1, 0x20, 0x07, 0x27, 0x8d, 0xf1, 0xb0, 0xd9, 0x0f, 0xbc, 0xdf, 0xfd, 0xe0, + 0x92, 0x2c, 0x97, 0xbe, 0x47, 0x1a, 0x44, 0x2e, 0x71, 0x11, 0x4d, 0x0a, 0xdc, 0xad, 0x43, 0xbf, + 0x8d, 0x9b, 0x14, 0x38, 0x25, 0x73, 0xfc, 0xbc, 0xa9, 0x38, 0xdb, 0x56, 0x9c, 0xfd, 0x55, 0x9c, + 0x7d, 0xd7, 0xdc, 0xdb, 0xd6, 0xdc, 0xfb, 0xa9, 0xb9, 0xf7, 0x76, 0x9f, 0x69, 0x5c, 0x2c, 0xe3, + 0x28, 0x81, 0x5c, 0xa0, 0x32, 0x06, 0x6c, 0xa8, 0x41, 0x50, 0x65, 0x9f, 0xc7, 0xd2, 0x70, 0x55, + 0x2a, 0x17, 0x9f, 0x35, 0x7f, 0x7a, 0xfa, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xac, 0xd3, 0x66, 0xc9, + 0x51, 0x01, 0x00, 0x00, } func (m *UserTipTotal) Marshal() (dAtA []byte, err error) { @@ -125,11 +120,11 @@ func (m *UserTipTotal) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l { - size, err := m.Total.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintUserTip(dAtA, i, uint64(size)) } i-- @@ -241,7 +236,7 @@ func (m *UserTipTotal) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUserTip @@ -251,15 +246,16 @@ func (m *UserTipTotal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthUserTip } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthUserTip } diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 1038a185a..b53df3c20 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -11,6 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + disputetypes "github.com/tellor-io/layer/x/dispute/types" "github.com/tellor-io/layer/x/reporter/types" ) @@ -774,6 +775,7 @@ func (k Keeper) AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.Acc if err != nil { return err } + bondedShares := math.ZeroInt() for _, source := range delegatorSources { srcAmt := source.Value _share := delegatorShare.Mul(math.LegacyNewDecFromInt(srcAmt)).Quo(math.LegacyNewDecFromInt(del.Amount)) @@ -781,12 +783,85 @@ func (k Keeper) AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.Acc if err != nil { return err } - _, err = k.stakingKeeper.Delegate(ctx, key, _share.TruncateInt(), stakingtypes.Bonded, val, false) // ignore dust??? + newShares, err := k.stakingKeeper.Delegate(ctx, key, _share.TruncateInt(), stakingtypes.Bonded, val, false) // ignore dust??? if err != nil { return err } + source.Value = source.Value.Sub(newShares.TruncateInt()) + if err := k.TokenOrigin.Set(ctx, collections.Join(source.Key.K1(), source.Key.K2()), source.Value); err != nil { + return err + } + bondedShares = bondedShares.Add(newShares.TruncateInt()) + } + if bondedShares.IsPositive() { + del.Amount = del.Amount.Add(bondedShares) + if err := k.Delegators.Set(ctx, key, del); err != nil { + return err + } } + + } + reporter.TotalTokens = reporter.TotalTokens.Add(reward) + if err := k.Reporters.Set(ctx, reporterAddr, reporter); err != nil { + return err + } + + return nil +} + +// allocate reward as stake to an address that isn't a reporter, that stakes with a validator +// get all the validators and delegate to them as much as possible +// is there a limit to how much you can delegate to a validator? +func (k Keeper) allocateRewardsToStake(ctx context.Context, val stakingtypes.Validator, addr sdk.AccAddress, reward math.Int) (math.LegacyDec, error) { + newShares, err := k.stakingKeeper.Delegate(ctx, addr, reward, stakingtypes.Bonded, val, false) + if err != nil { + return math.LegacyDec{}, err } + return newShares, nil +} +func (k Keeper) RewardReporterBondToFeePayers(ctx context.Context, recipients []disputetypes.PayerInfo, reward math.Int) error { + totalAmt := math.ZeroInt() + for _, recipient := range recipients { + totalAmt = totalAmt.Add(recipient.Amount.Amount) + } + unbondedAddrs := make([]disputetypes.PayerInfo, 0) + for _, recipient := range recipients { + amt := recipient.Amount.Amount.Quo(totalAmt).Mul(reward) + addr, err := sdk.AccAddressFromBech32(recipient.PayerAddress) + if err != nil { + return err + } + err = k.AllocateRewardsToStake(ctx, addr, amt) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + unbondedAddrs = append(unbondedAddrs, recipient) + } else { + return err + } + } + } + if len(unbondedAddrs) == 0 { + return nil + } + // allocate to unbonded addresses + // get list of validators + validators, err := k.stakingKeeper.GetValidators(ctx, uint32(len(unbondedAddrs))) + if err != nil { + return err + } + // for each validator, delegate as much as possible + for i, val := range validators { + payer := unbondedAddrs[i] + amt := payer.Amount.Amount.Quo(totalAmt).Mul(reward) + addr, err := sdk.AccAddressFromBech32(payer.PayerAddress) + if err != nil { + return err + } + _, err = k.allocateRewardsToStake(ctx, val, addr, amt) + if err != nil { + return err + } + } return nil } diff --git a/x/reporter/keeper/jail.go b/x/reporter/keeper/jail.go index 260ab20fd..846d2c73f 100644 --- a/x/reporter/keeper/jail.go +++ b/x/reporter/keeper/jail.go @@ -10,15 +10,18 @@ import ( ) // send a reporter to jail -func (k Keeper) JailReporter(ctx context.Context, reporter types.OracleReporter, jailDuration int64) error { +func (k Keeper) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration int64) error { + reporter, err := k.Reporters.Get(ctx, reporterAddr) + if err != nil { + return err + } if reporter.Jailed { return types.ErrReporterJailed.Wrapf("cannot jail already jailed reporter, %v", reporter) } sdkctx := sdk.UnwrapSDKContext(ctx) reporter.JailedUntil = sdkctx.BlockTime().Add(time.Second * time.Duration(jailDuration)) reporter.Jailed = true - reporterAddr := sdk.MustAccAddressFromBech32(reporter.GetReporter()) - err := k.Reporters.Set(ctx, reporterAddr, reporter) + err = k.Reporters.Set(ctx, reporterAddr, reporter) if err != nil { return err } diff --git a/x/reporter/keeper/msg_server_undelegate_reporter.go b/x/reporter/keeper/msg_server_undelegate_reporter.go index 4366a7d2f..fb293cf2b 100644 --- a/x/reporter/keeper/msg_server_undelegate_reporter.go +++ b/x/reporter/keeper/msg_server_undelegate_reporter.go @@ -30,11 +30,12 @@ func (k msgServer) UndelegateReporter(goCtx context.Context, msg *types.MsgUndel if err != nil { return nil, err } - _source, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr, valAddr)) + currentSourceAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr, valAddr)) if err != nil { return nil, err } - if err := k.UpdateOrRemoveSource(ctx, collections.Join(delAddr, valAddr), _source, source.Amount); err != nil { + err = k.UndelegateSource(ctx, collections.Join(delAddr, valAddr), currentSourceAmt, source.Amount) + if err != nil { return nil, err } reducedbyAmount = reducedbyAmount.Add(source.Amount) diff --git a/x/reporter/keeper/reporter.go b/x/reporter/keeper/reporter.go index 9f304f173..81c44a7f5 100644 --- a/x/reporter/keeper/reporter.go +++ b/x/reporter/keeper/reporter.go @@ -13,7 +13,7 @@ import ( ) func (k Keeper) ValidateAndSetAmount(ctx context.Context, delegator sdk.AccAddress, originAmounts []*types.TokenOrigin, amount math.Int) error { - var _amt = math.ZeroInt() + _amt := math.ZeroInt() for _, origin := range originAmounts { _amt = _amt.Add(origin.Amount) } @@ -87,11 +87,19 @@ func (k Keeper) UpdateOrRemoveReporter(ctx context.Context, key sdk.AccAddress, } func (k Keeper) UpdateOrRemoveSource(ctx context.Context, key collections.Pair[sdk.AccAddress, sdk.ValAddress], srcAmount math.Int, amt math.Int) (err error) { - if srcAmount.LTE(amt) { + // amount is the current staked amount in staking mod + // so if current amount is zero remove the source + if amt.IsZero() { return k.TokenOrigin.Remove(ctx, key) } - srcAmount = srcAmount.Sub(amt) - return k.TokenOrigin.Set(ctx, key, srcAmount) + return k.TokenOrigin.Set(ctx, key, amt) +} + +func (k Keeper) UndelegateSource(ctx context.Context, key collections.Pair[sdk.AccAddress, sdk.ValAddress], currentAmount math.Int, newAmount math.Int) error { + if newAmount.GTE(currentAmount) { + return k.TokenOrigin.Remove(ctx, key) + } + return k.TokenOrigin.Set(ctx, key, currentAmount.Sub(newAmount)) } func (k Keeper) Reporter(ctx context.Context, repAddr sdk.AccAddress) (*types.OracleReporter, error) { @@ -104,3 +112,20 @@ func (k Keeper) Reporter(ctx context.Context, repAddr sdk.AccAddress) (*types.Or } return &reporter, nil } + +func (k Keeper) TotalReporterPower(ctx context.Context) (math.Int, error) { + totalPower := math.ZeroInt() + iter, err := k.Reporters.Iterate(ctx, nil) + if err != nil { + return math.Int{}, err + } + defer iter.Close() + for ; iter.Valid(); iter.Next() { + reporter, err := iter.Value() + if err != nil { + return math.Int{}, err + } + totalPower = totalPower.Add(reporter.TotalTokens) + } + return totalPower, nil +} diff --git a/x/reporter/keeper/reporter_test.go b/x/reporter/keeper/reporter_test.go index 20359e989..20b36d940 100644 --- a/x/reporter/keeper/reporter_test.go +++ b/x/reporter/keeper/reporter_test.go @@ -13,7 +13,7 @@ import ( "github.com/tellor-io/layer/x/reporter/types" ) -func TestUpdateOrRemoveSource(t *testing.T) { +func TestUndelegateSource(t *testing.T) { k, _, _, ctx := setupKeeper(t) // Create a test key @@ -25,8 +25,8 @@ func TestUpdateOrRemoveSource(t *testing.T) { err := k.TokenOrigin.Set(ctx, key, math.NewInt(100)) require.NoError(t, err) - // Call the updateOrRemoveSource function with a reduction amount of 50 - err = k.UpdateOrRemoveSource(ctx, key, math.NewInt(100), math.NewInt(50)) + // Call the updateOrRemoveSource function with a reduced amount of 50 + err = k.UndelegateSource(ctx, key, math.NewInt(100), math.NewInt(50)) require.NoError(t, err) // Check if the token origin was updated correctly @@ -34,8 +34,8 @@ func TestUpdateOrRemoveSource(t *testing.T) { require.NoError(t, err) require.Equal(t, math.NewInt(50), updatedTokenOrigin) - // Call the updateOrRemoveSource function with a reduction amount of 60 - err = k.UpdateOrRemoveSource(ctx, key, updatedTokenOrigin, math.NewInt(60)) + // Call the updateOrRemoveSource function with a reduced amount of 60 + err = k.UndelegateSource(ctx, key, updatedTokenOrigin, math.NewInt(60)) require.NoError(t, err) // Check if the token origin was removed diff --git a/x/reporter/keeper/withdraw.go b/x/reporter/keeper/withdraw.go new file mode 100644 index 000000000..edc43a449 --- /dev/null +++ b/x/reporter/keeper/withdraw.go @@ -0,0 +1,194 @@ +package keeper + +import ( + "bytes" + "context" + "fmt" + + "cosmossdk.io/collections" + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + layer "github.com/tellor-io/layer/types" + disputetypes "github.com/tellor-io/layer/x/dispute/types" +) + +func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error { + reporter, err := k.Reporters.Get(ctx, reporterAddr) + if err != nil { + return err + } + + // Calculate each delegator's share (including the reporter as a self-delegator) + repAddr, err := sdk.AccAddressFromBech32(reporter.Reporter) + if err != nil { + return err + } + delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + if err != nil { + return err + } + totaltokens := reporter.TotalTokens + defer delAddrs.Close() + for ; delAddrs.Valid(); delAddrs.Next() { + key, err := delAddrs.PrimaryKey() + if err != nil { + return err + } + del, err := k.Delegators.Get(ctx, key) + if err != nil { + return err + } + // total amount to remove from the delegator + delegatorShare := del.Amount.Quo(totaltokens).Mul(amt) + + rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](key) + iter, err := k.TokenOrigin.Iterate(ctx, rng) + if err != nil { + return err + } + delegatorSources, err := iter.KeyValues() + if err != nil { + return err + } + for _, source := range delegatorSources { + srcAmt := source.Value + _share := srcAmt.Quo(del.Amount).Mul(delegatorShare) + _, err = k.Undelegate(ctx, source.Key.K1(), source.Key.K2(), math.LegacyNewDecFromInt(_share)) + if err != nil { + return err + } + } + } + return nil +} + +func (k Keeper) Undelegate( + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount math.LegacyDec, +) (math.Int, error) { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return math.Int{}, err + } + + returnAmount, err := k.Unbond(ctx, delAddr, valAddr, sharesAmount) + if err != nil { + return math.Int{}, err + } + + // transfer the validator tokens to the not bonded pool + if validator.IsBonded() { + err = k.bondedTokensToDispute(ctx, returnAmount) + if err != nil { + return math.Int{}, err + } + } + + return returnAmount, nil +} + +func (k Keeper) bondedTokensToDispute(ctx context.Context, amount math.Int) error { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, stakingtypes.BondedPoolName, disputetypes.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, amount))) +} + +func (k Keeper) Unbond( + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec, +) (amount math.Int, err error) { + del, err := k.stakingKeeper.Delegation(ctx, delAddr, valAddr) + if err != nil { + return amount, err + } + delegation := stakingtypes.Delegation{ + DelegatorAddress: del.GetDelegatorAddr(), + ValidatorAddress: del.GetValidatorAddr(), + Shares: del.GetShares(), + } + // call the before-delegation-modified hook + if err := k.Hooks().BeforeDelegationSharesModified(ctx, delAddr, valAddr); err != nil { + return amount, err + } + + // ensure that we have enough shares to remove + if delegation.Shares.LT(shares) { + return amount, errorsmod.Wrap(stakingtypes.ErrNotEnoughDelegationShares, delegation.Shares.String()) + } + + // get validator + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return amount, err + } + + // subtract shares from delegation + delegation.Shares = delegation.Shares.Sub(shares) + + delegatorAddress, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + return amount, err + } + + valbz, err := sdk.ValAddressFromBech32(validator.GetOperator()) + if err != nil { + return amount, err + } + + isValidatorOperator := bytes.Equal(delegatorAddress, valbz) + + // If the delegation is the operator of the validator and undelegating will decrease the validator's + // self-delegation below their minimum, we jail the validator. + if isValidatorOperator && !validator.Jailed && + validator.TokensFromShares(delegation.Shares).TruncateInt().LT(validator.MinSelfDelegation) { + consAddr, err := validator.GetConsAddr() + if err != nil { + return amount, err + } + err = k.stakingKeeper.Jail(ctx, consAddr) + if err != nil { + return amount, fmt.Errorf("failed to jail validator: %v", err) + } + validator, err = k.stakingKeeper.GetValidator(ctx, valbz) + if err != nil { + return amount, fmt.Errorf("validator record not found for address: %X", valbz) + } + } + + if delegation.Shares.IsZero() { + err = k.stakingKeeper.RemoveDelegation(ctx, delegation) + } else { + if err = k.stakingKeeper.SetDelegation(ctx, delegation); err != nil { + return amount, err + } + + valAddr, err = sdk.ValAddressFromBech32(delegation.GetValidatorAddr()) + if err != nil { + return amount, err + } + + // call the after delegation modification hook + err = k.Hooks().AfterDelegationModified(ctx, delegatorAddress, valAddr) + if err != nil { + return amount, err + } + } + + if err != nil { + return amount, err + } + + // remove the shares and coins from the validator + // NOTE that the amount is later (in keeper.Delegation) moved between staking module pools + validator, amount, err = k.stakingKeeper.RemoveValidatorTokensAndShares(ctx, validator, shares) + if err != nil { + return amount, err + } + + if validator.DelegatorShares.IsZero() && validator.IsUnbonded() { + // if not unbonded, we must instead remove validator in EndBlocker once it finishes its unbonding period + if err = k.stakingKeeper.RemoveValidator(ctx, valbz); err != nil { + return amount, err + } + } + + return amount, nil +} diff --git a/x/reporter/mocks/BankKeeper.go b/x/reporter/mocks/BankKeeper.go index a2518b927..8bfd19f07 100644 --- a/x/reporter/mocks/BankKeeper.go +++ b/x/reporter/mocks/BankKeeper.go @@ -29,6 +29,20 @@ func (_m *BankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderMo return r0 } +// SendCoinsFromModuleToModule provides a mock function with given fields: ctx, senderModule, recipientModule, amt +func (_m *BankKeeper) SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt types.Coins) error { + ret := _m.Called(ctx, senderModule, recipientModule, amt) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, types.Coins) error); ok { + r0 = rf(ctx, senderModule, recipientModule, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // SpendableCoins provides a mock function with given fields: _a0, _a1 func (_m *BankKeeper) SpendableCoins(_a0 context.Context, _a1 types.AccAddress) types.Coins { ret := _m.Called(_a0, _a1) diff --git a/x/reporter/mocks/StakingKeeper.go b/x/reporter/mocks/StakingKeeper.go index 68f8bdc86..d1b7b7f82 100644 --- a/x/reporter/mocks/StakingKeeper.go +++ b/x/reporter/mocks/StakingKeeper.go @@ -111,6 +111,119 @@ func (_m *StakingKeeper) GetValidator(ctx context.Context, addr cosmos_sdktypes. return r0, r1 } +// GetValidators provides a mock function with given fields: ctx, maxRetrieve +func (_m *StakingKeeper) GetValidators(ctx context.Context, maxRetrieve uint32) ([]stakingtypes.Validator, error) { + ret := _m.Called(ctx, maxRetrieve) + + var r0 []stakingtypes.Validator + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint32) ([]stakingtypes.Validator, error)); ok { + return rf(ctx, maxRetrieve) + } + if rf, ok := ret.Get(0).(func(context.Context, uint32) []stakingtypes.Validator); ok { + r0 = rf(ctx, maxRetrieve) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]stakingtypes.Validator) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok { + r1 = rf(ctx, maxRetrieve) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Jail provides a mock function with given fields: ctx, consAddr +func (_m *StakingKeeper) Jail(ctx context.Context, consAddr cosmos_sdktypes.ConsAddress) error { + ret := _m.Called(ctx, consAddr) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) error); ok { + r0 = rf(ctx, consAddr) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// RemoveDelegation provides a mock function with given fields: ctx, delegation +func (_m *StakingKeeper) RemoveDelegation(ctx context.Context, delegation stakingtypes.Delegation) error { + ret := _m.Called(ctx, delegation) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Delegation) error); ok { + r0 = rf(ctx, delegation) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// RemoveValidator provides a mock function with given fields: ctx, _a1 +func (_m *StakingKeeper) RemoveValidator(ctx context.Context, _a1 cosmos_sdktypes.ValAddress) error { + ret := _m.Called(ctx, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ValAddress) error); ok { + r0 = rf(ctx, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// RemoveValidatorTokensAndShares provides a mock function with given fields: ctx, validator, sharesToRemove +func (_m *StakingKeeper) RemoveValidatorTokensAndShares(ctx context.Context, validator stakingtypes.Validator, sharesToRemove math.LegacyDec) (stakingtypes.Validator, math.Int, error) { + ret := _m.Called(ctx, validator, sharesToRemove) + + var r0 stakingtypes.Validator + var r1 math.Int + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Validator, math.LegacyDec) (stakingtypes.Validator, math.Int, error)); ok { + return rf(ctx, validator, sharesToRemove) + } + if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Validator, math.LegacyDec) stakingtypes.Validator); ok { + r0 = rf(ctx, validator, sharesToRemove) + } else { + r0 = ret.Get(0).(stakingtypes.Validator) + } + + if rf, ok := ret.Get(1).(func(context.Context, stakingtypes.Validator, math.LegacyDec) math.Int); ok { + r1 = rf(ctx, validator, sharesToRemove) + } else { + r1 = ret.Get(1).(math.Int) + } + + if rf, ok := ret.Get(2).(func(context.Context, stakingtypes.Validator, math.LegacyDec) error); ok { + r2 = rf(ctx, validator, sharesToRemove) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// SetDelegation provides a mock function with given fields: ctx, delegation +func (_m *StakingKeeper) SetDelegation(ctx context.Context, delegation stakingtypes.Delegation) error { + ret := _m.Called(ctx, delegation) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Delegation) error); ok { + r0 = rf(ctx, delegation) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // ValidatorByConsAddr provides a mock function with given fields: _a0, _a1 func (_m *StakingKeeper) ValidatorByConsAddr(_a0 context.Context, _a1 cosmos_sdktypes.ConsAddress) (stakingtypes.ValidatorI, error) { ret := _m.Called(_a0, _a1) diff --git a/x/reporter/types/expected_keepers.go b/x/reporter/types/expected_keepers.go index 50e492215..a49932551 100644 --- a/x/reporter/types/expected_keepers.go +++ b/x/reporter/types/expected_keepers.go @@ -19,6 +19,14 @@ type StakingKeeper interface { ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, ) (newShares math.LegacyDec, err error) + RemoveDelegation(ctx context.Context, delegation stakingtypes.Delegation) error + RemoveValidatorTokensAndShares(ctx context.Context, validator stakingtypes.Validator, + sharesToRemove math.LegacyDec, + ) (valOut stakingtypes.Validator, removedTokens math.Int, err error) + SetDelegation(ctx context.Context, delegation stakingtypes.Delegation) error + RemoveValidator(ctx context.Context, address sdk.ValAddress) error + Jail(ctx context.Context, consAddr sdk.ConsAddress) error + GetValidators(ctx context.Context, maxRetrieve uint32) (validators []stakingtypes.Validator, err error) // Methods imported from account should be defined here } @@ -32,6 +40,7 @@ type AccountKeeper interface { type BankKeeper interface { SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error // Methods imported from bank should be defined here } From 5242752201a26ee7685b528f7f9ff03227b32767 Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 7 Mar 2024 09:55:18 -0500 Subject: [PATCH 09/31] add sources snapshot pre un-bonding msg --- proto/layer/dispute/dispute.proto | 68 +++++++++++-------- proto/layer/reporter/token_origin.proto | 16 +++++ tests/integration/dispute_keeper_test.go | 14 ++-- x/dispute/keeper/dispute.go | 2 +- x/dispute/keeper/dispute_fee.go | 2 +- x/dispute/keeper/dispute_fee_test.go | 2 +- .../keeper/msg_server_propose_dispute_test.go | 5 +- x/dispute/mocks/ReporterKeeper.go | 18 ++++- x/dispute/types/expected_keepers.go | 3 +- x/reporter/keeper/hooks.go | 62 +++++++++++++++-- x/reporter/keeper/keeper.go | 2 + x/reporter/keeper/withdraw.go | 21 +++++- x/reporter/types/keys.go | 1 + 13 files changed, 166 insertions(+), 50 deletions(-) diff --git a/proto/layer/dispute/dispute.proto b/proto/layer/dispute/dispute.proto index 9a03dd330..4559e2fb0 100644 --- a/proto/layer/dispute/dispute.proto +++ b/proto/layer/dispute/dispute.proto @@ -1,54 +1,66 @@ syntax = "proto3"; package layer.dispute; -import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/tellor-io/layer/x/dispute/types"; message Dispute { - - bytes hashId = 1; - uint64 disputeId = 2; - DisputeCategory disputeCategory = 3; + bytes hashId = 1; + uint64 disputeId = 2; + DisputeCategory disputeCategory = 3; string disputeFee = 4 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; - DisputeStatus disputeStatus = 5; - google.protobuf.Timestamp disputeStartTime = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - google.protobuf.Timestamp disputeEndTime = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - int64 disputeStartBlock = 8; - uint64 disputeRound = 9; + (gogoproto.nullable) = false + ]; + DisputeStatus disputeStatus = 5; + google.protobuf.Timestamp disputeStartTime = 6 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + google.protobuf.Timestamp disputeEndTime = 7 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + int64 disputeStartBlock = 8; + uint64 disputeRound = 9; string slashAmount = 10 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; string burnAmount = 11 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; + (gogoproto.nullable) = false + ]; MicroReport reportEvidence = 12 [(gogoproto.nullable) = false]; - repeated PayerInfo feePayers = 13 [(gogoproto.nullable) = false]; + repeated PayerInfo feePayers = 13 [(gogoproto.nullable) = false]; string feeTotal = 14 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; - repeated uint64 prevDisputeIds = 15; + (gogoproto.nullable) = false + ]; + repeated uint64 prevDisputeIds = 15; } +// TODO: remove this duplicate message MicroReport { string reporter = 1; int64 power = 2; - string queryId = 3; - string value = 4; - int64 timestamp = 5; + string query_type = 3; + string query_id = 4; + string aggregate_method = 5; + string value = 6; + int64 block_number = 7; + google.protobuf.Timestamp timestamp = 8 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; } enum DisputeCategory { @@ -83,4 +95,4 @@ message PayerInfo { string payerAddress = 1; cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; bool fromBond = 3; -} \ No newline at end of file +} diff --git a/proto/layer/reporter/token_origin.proto b/proto/layer/reporter/token_origin.proto index 2be932fd5..9e881b30a 100644 --- a/proto/layer/reporter/token_origin.proto +++ b/proto/layer/reporter/token_origin.proto @@ -18,3 +18,19 @@ message TokenOrigin { (gogoproto.nullable) = false ]; } + +message TokenOriginInfo { + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; + string amount = 3 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +// reporter's snapshot of delegators' sources pre unbonding +message DelegationsPreUpdate { + // token_origin is the origin of the tokens that are about to be updated + repeated TokenOriginInfo token_origins = 1; +} diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index 699394d5c..bae41702e 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -1,6 +1,8 @@ package integration_test import ( + "time" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/x/dispute/keeper" @@ -32,7 +34,7 @@ func (s *IntegrationTestSuite) TestVotingOnDispute() { Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), } // disputer with tokens to pay fee disputer := s.newKeysWithTokens() @@ -110,7 +112,7 @@ func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), } _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ @@ -161,7 +163,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), } disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) s.NoError(err) @@ -255,7 +257,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), } disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) @@ -333,7 +335,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), } disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) s.NoError(err) @@ -446,7 +448,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), } disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) s.NoError(err) diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index cce826d92..c3c7bdf2c 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -200,7 +200,7 @@ func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report types.MicroReport, } amount := sdk.TokensFromConsensusPower(report.Power, sdk.DefaultPowerReduction) slashAmount := math.LegacyNewDecFromInt(amount).Mul(slashFactor) - err = k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, slashAmount.TruncateInt()) + err = k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, report.BlockNumber, slashAmount.TruncateInt()) if err != nil { return err } diff --git a/x/dispute/keeper/dispute_fee.go b/x/dispute/keeper/dispute_fee.go index ca6561940..79c281188 100644 --- a/x/dispute/keeper/dispute_fee.go +++ b/x/dispute/keeper/dispute_fee.go @@ -21,7 +21,7 @@ func (k Keeper) PayFromAccount(ctx sdk.Context, addr sdk.AccAddress, fee sdk.Coi // Pay fee from validator's bond can only be called by the validator itself func (k Keeper) PayFromBond(ctx sdk.Context, reporterAddr sdk.AccAddress, fee sdk.Coin) error { - return k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, fee.Amount) + return k.reporterKeeper.FeefromReporterStake(ctx, reporterAddr, fee.Amount) } // Refund coins to bonded pool diff --git a/x/dispute/keeper/dispute_fee_test.go b/x/dispute/keeper/dispute_fee_test.go index dc88816a8..4b0bf8178 100644 --- a/x/dispute/keeper/dispute_fee_test.go +++ b/x/dispute/keeper/dispute_fee_test.go @@ -21,7 +21,7 @@ func (s *KeeperTestSuite) TestPayFromAccount() { func (s *KeeperTestSuite) TestPayFromBond() { addr := sample.AccAddressBytes() - s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, math.OneInt()).Return(nil) + s.reporterKeeper.On("FeefromReporterStake", s.ctx, addr, math.OneInt()).Return(nil) err := s.disputeKeeper.PayFromBond(s.ctx, addr, sdk.NewCoin(layer.BondDenom, math.NewInt(1))) s.Nil(err) } diff --git a/x/dispute/keeper/msg_server_propose_dispute_test.go b/x/dispute/keeper/msg_server_propose_dispute_test.go index 88edc08d0..80787b0af 100644 --- a/x/dispute/keeper/msg_server_propose_dispute_test.go +++ b/x/dispute/keeper/msg_server_propose_dispute_test.go @@ -20,7 +20,7 @@ func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() sdk.AccAddress { Reporter: addr.String(), QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: 1696516597, + Timestamp: time.Unix(1696516597, 0), Power: 1, } @@ -40,7 +40,8 @@ func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() sdk.AccAddress { ) // mock dependency modules s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) - s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, math.NewInt(10_000)).Return(nil) + s.reporterKeeper.On("FeefromReporterStake", s.ctx, addr, math.NewInt(10_000)).Return(nil) + s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, int64(0), math.NewInt(10_000)).Return(nil) s.reporterKeeper.On("JailReporter", s.ctx, addr, int64(0)).Return(nil) s.bankKeeper.On("HasBalance", s.ctx, addr, fee).Return(true) diff --git a/x/dispute/mocks/ReporterKeeper.go b/x/dispute/mocks/ReporterKeeper.go index fe941eda7..1e4d76450 100644 --- a/x/dispute/mocks/ReporterKeeper.go +++ b/x/dispute/mocks/ReporterKeeper.go @@ -34,8 +34,22 @@ func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAd return r0 } -// EscrowReporterStake provides a mock function with given fields: ctx, reporterAddr, amt -func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr types.AccAddress, amt math.Int) error { +// EscrowReporterStake provides a mock function with given fields: ctx, reporterAddr, height, amt +func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr types.AccAddress, height int64, amt math.Int) error { + ret := _m.Called(ctx, reporterAddr, height, amt) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, int64, math.Int) error); ok { + r0 = rf(ctx, reporterAddr, height, amt) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// FeefromReporterStake provides a mock function with given fields: ctx, reporterAddr, amt +func (_m *ReporterKeeper) FeefromReporterStake(ctx context.Context, reporterAddr types.AccAddress, amt math.Int) error { ret := _m.Called(ctx, reporterAddr, amt) var r0 error diff --git a/x/dispute/types/expected_keepers.go b/x/dispute/types/expected_keepers.go index 1afc3cbce..e57fe889e 100644 --- a/x/dispute/types/expected_keepers.go +++ b/x/dispute/types/expected_keepers.go @@ -38,9 +38,10 @@ type OracleKeeper interface { type ReporterKeeper interface { AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error - EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error + EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, height int64, amt math.Int) error Reporter(ctx context.Context, repAddr sdk.AccAddress) (*reportertypes.OracleReporter, error) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration int64) error TotalReporterPower(ctx context.Context) (math.Int, error) RewardReporterBondToFeePayers(ctx context.Context, recipients []PayerInfo, reward math.Int) error + FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error } diff --git a/x/reporter/keeper/hooks.go b/x/reporter/keeper/hooks.go index 797b6d7b9..ec45ba82d 100644 --- a/x/reporter/keeper/hooks.go +++ b/x/reporter/keeper/hooks.go @@ -86,18 +86,36 @@ func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddre } // update token origin if the staked amount becomes less than what is written in the token origin struct if tokenAmount.LT(sourced) { - // get the difference in the token change to reduce delegation and reporter tokens by. - diff := sourced.Sub(tokenAmount) - if err := h.k.UpdateOrRemoveSource(ctx, collections.Join(delAddr, valAddr), sourced, tokenAmount); err != nil { + delegator, err := h.k.Delegators.Get(ctx, delAddr) + if err != nil { return err } + repAddr := sdk.MustAccAddressFromBech32(delegator.Reporter) - // update delegator - delegator, err := h.k.Delegators.Get(ctx, delAddr) + sdkCtx := sdk.UnwrapSDKContext(ctx) + snapshotKey := collections.Join(repAddr, sdkCtx.BlockHeight()) + snapshotExists, err := h.k.TokenOriginSnapshot.Has(ctx, snapshotKey) if err != nil { return err } - repAddr := sdk.MustAccAddressFromBech32(delegator.Reporter) + if !snapshotExists { + // get all the token origins for the reporter + tokenSources, err := h.k.GetTokenSourcesForReporter(ctx, repAddr) + if err != nil { + return err + } + err = h.k.TokenOriginSnapshot.Set(ctx, snapshotKey, tokenSources) + if err != nil { + return err + } + } + + // get the difference in the token change to reduce delegation and reporter tokens by. + diff := sourced.Sub(tokenAmount) + if err := h.k.UpdateOrRemoveSource(ctx, collections.Join(delAddr, valAddr), sourced, tokenAmount); err != nil { + return err + } + // update reporter reporter, err := h.k.Reporters.Get(ctx, repAddr) if err != nil { @@ -124,6 +142,36 @@ func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error { } // AfterConsensusPubKeyUpdate triggers the functions to rotate the signing-infos also sets address pubkey relation. -func (h Hooks) AfterConsensusPubKeyUpdate(_ context.Context, oldPubKey, newPubKey cryptotypes.PubKey, _ sdk.Coin) error { +func (h Hooks) AfterConsensusPubKeyUpdate(_ context.Context, _, _ cryptotypes.PubKey, _ sdk.Coin) error { return nil } + +func (k Keeper) GetTokenSourcesForReporter(ctx context.Context, repAddr sdk.AccAddress) (types.DelegationsPreUpdate, error) { + delegators, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + if err != nil { + return types.DelegationsPreUpdate{}, err + } + + var tokenSources []*types.TokenOriginInfo + for ; delegators.Valid(); delegators.Next() { + key, err := delegators.PrimaryKey() + if err != nil { + return types.DelegationsPreUpdate{}, err + } + rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](key) + err = k.TokenOrigin.Walk(ctx, rng, func(key collections.Pair[sdk.AccAddress, sdk.ValAddress], value sdkmath.Int) (bool, error) { + tokenSources = append(tokenSources, &types.TokenOriginInfo{ + DelegatorAddress: key.K1().String(), + ValidatorAddress: key.K2().String(), + Amount: value, + }) + return false, nil + }) + if err != nil { + return types.DelegationsPreUpdate{}, err + } + } + return types.DelegationsPreUpdate{ + TokenOrigins: tokenSources, + }, nil +} diff --git a/x/reporter/keeper/keeper.go b/x/reporter/keeper/keeper.go index 28f375449..f841b474e 100644 --- a/x/reporter/keeper/keeper.go +++ b/x/reporter/keeper/keeper.go @@ -27,6 +27,7 @@ type ( DelegatorStartingInfo collections.Map[collections.Pair[sdk.ValAddress, sdk.AccAddress], types.DelegatorStartingInfo] ReporterHistoricalRewards collections.Map[collections.Pair[sdk.ValAddress, uint64], types.ReporterHistoricalRewards] ReporterDisputeEvents collections.Map[collections.Triple[sdk.ValAddress, uint64, uint64], types.ReporterDisputeEvent] + TokenOriginSnapshot collections.Map[collections.Pair[sdk.AccAddress, int64], types.DelegationsPreUpdate] Schema collections.Schema logger log.Logger @@ -67,6 +68,7 @@ func NewKeeper( DelegatorStartingInfo: collections.NewMap(sb, types.DelegatorStartingInfoPrefix, "delegators_starting_info", collections.PairKeyCodec(sdk.ValAddressKey, sdk.AccAddressKey), codec.CollValue[types.DelegatorStartingInfo](cdc)), ReporterHistoricalRewards: collections.NewMap(sb, types.ReporterHistoricalRewardsPrefix, "reporter_historical_rewards", collections.PairKeyCodec(sdk.ValAddressKey, collections.Uint64Key), codec.CollValue[types.ReporterHistoricalRewards](cdc)), ReporterDisputeEvents: collections.NewMap(sb, types.ReporterDisputeEventPrefix, "reporter_dispute_events", collections.TripleKeyCodec(sdk.ValAddressKey, collections.Uint64Key, collections.Uint64Key), codec.CollValue[types.ReporterDisputeEvent](cdc)), + TokenOriginSnapshot: collections.NewMap(sb, types.TokenOriginSnapshotPrefix, "token_origin_snapshot", collections.PairKeyCodec(sdk.AccAddressKey, collections.Int64Key), codec.CollValue[types.DelegationsPreUpdate](cdc)), authority: authority, logger: logger, stakingKeeper: stakingKeeper, diff --git a/x/reporter/keeper/withdraw.go b/x/reporter/keeper/withdraw.go index edc43a449..70b9c23d0 100644 --- a/x/reporter/keeper/withdraw.go +++ b/x/reporter/keeper/withdraw.go @@ -12,9 +12,28 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" layer "github.com/tellor-io/layer/types" disputetypes "github.com/tellor-io/layer/x/dispute/types" + "github.com/tellor-io/layer/x/reporter/types" ) -func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error { +func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, height int64, amt math.Int) error { + // get origins at height + rng := collections.NewPrefixedPairRange[sdk.AccAddress, int64](reporterAddr).StartExclusive(height) + var firstValue *types.DelegationsPreUpdate + err := k.TokenOriginSnapshot.Walk(ctx, rng, func(key collections.Pair[sdk.AccAddress, int64], value types.DelegationsPreUpdate) (stop bool, err error) { + firstValue = &value + return true, nil + }) + if firstValue == nil { + return k.FeefromReporterStake(ctx, reporterAddr, amt) + } + if err != nil { + return err + } + // TODO: + + return nil +} +func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error { reporter, err := k.Reporters.Get(ctx, reporterAddr) if err != nil { return err diff --git a/x/reporter/types/keys.go b/x/reporter/types/keys.go index 1b68e2fa0..e19912a1b 100644 --- a/x/reporter/types/keys.go +++ b/x/reporter/types/keys.go @@ -27,6 +27,7 @@ var ( ReporterHistoricalRewardsPrefix = collections.NewPrefix(18) ReporterDisputeEventPrefix = collections.NewPrefix(19) ReporterDelegatorsIndexPrefix = collections.NewPrefix(20) + TokenOriginSnapshotPrefix = collections.NewPrefix(21) ) func KeyPrefix(p string) []byte { From 4c710a912419107dd3a3bf7beb7d0d6dde11168e Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 11 Mar 2024 11:23:26 -0400 Subject: [PATCH 10/31] add methods for deducting from unbonding --- tests/integration/dispute_keeper_test.go | 17 +- x/dispute/keeper/dispute.go | 2 +- .../keeper/msg_server_propose_dispute_test.go | 2 +- x/dispute/mocks/ReporterKeeper.go | 10 +- x/dispute/types/expected_keepers.go | 2 +- x/reporter/keeper/distribution.go | 17 ++ x/reporter/keeper/hooks.go | 19 -- x/reporter/keeper/withdraw.go | 251 ++++++++++-------- x/reporter/mocks/StakingKeeper.go | 221 ++++++++------- x/reporter/types/errors.go | 29 +- x/reporter/types/expected_keepers.go | 18 +- 11 files changed, 304 insertions(+), 284 deletions(-) diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index bae41702e..886263679 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -108,13 +108,14 @@ func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { s.NoError(err) report := types.MicroReport{ - Reporter: repAcc.String(), - Power: 100, - QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", - Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", - Timestamp: time.Unix(1696516597, 0), + Reporter: repAcc.String(), + Power: 100, + QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", + Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", + Timestamp: time.Unix(1696516597, 0), + BlockNumber: s.ctx.BlockHeight(), } - + s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ Creator: repAcc.String(), Report: &report, @@ -410,9 +411,9 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { votersBalanceBefore[i].Amount = votersBalanceBefore[i].Amount.Add(votersReward[addrs[i].String()]) s.Equal(votersBalanceBefore[i], (votersBalanceAfter[i])) } - disputerDelgation, err := s.stakingKeeper.GetAllDelegatorDelegations(s.ctx, disputer) + disputerDelgation, err := s.stakingKeeper.GetDelegatorBonded(s.ctx, disputer) s.NoError(err) - s.True(disputerDelgation[0].Shares.Equal(math.LegacyNewDecFromInt(math.NewInt(1_000_000)))) + s.True(disputerDelgation.Equal(math.NewInt(1_000_000))) } func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index c3c7bdf2c..07ccd842c 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -200,7 +200,7 @@ func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report types.MicroReport, } amount := sdk.TokensFromConsensusPower(report.Power, sdk.DefaultPowerReduction) slashAmount := math.LegacyNewDecFromInt(amount).Mul(slashFactor) - err = k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, report.BlockNumber, slashAmount.TruncateInt()) + err = k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, report.Power, report.BlockNumber, slashAmount.TruncateInt()) if err != nil { return err } diff --git a/x/dispute/keeper/msg_server_propose_dispute_test.go b/x/dispute/keeper/msg_server_propose_dispute_test.go index 80787b0af..b5a200846 100644 --- a/x/dispute/keeper/msg_server_propose_dispute_test.go +++ b/x/dispute/keeper/msg_server_propose_dispute_test.go @@ -41,7 +41,7 @@ func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() sdk.AccAddress { // mock dependency modules s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) s.reporterKeeper.On("FeefromReporterStake", s.ctx, addr, math.NewInt(10_000)).Return(nil) - s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, int64(0), math.NewInt(10_000)).Return(nil) + s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, int64(1), int64(0), math.NewInt(10_000)).Return(nil) s.reporterKeeper.On("JailReporter", s.ctx, addr, int64(0)).Return(nil) s.bankKeeper.On("HasBalance", s.ctx, addr, fee).Return(true) diff --git a/x/dispute/mocks/ReporterKeeper.go b/x/dispute/mocks/ReporterKeeper.go index 1e4d76450..644a46eae 100644 --- a/x/dispute/mocks/ReporterKeeper.go +++ b/x/dispute/mocks/ReporterKeeper.go @@ -34,13 +34,13 @@ func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAd return r0 } -// EscrowReporterStake provides a mock function with given fields: ctx, reporterAddr, height, amt -func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr types.AccAddress, height int64, amt math.Int) error { - ret := _m.Called(ctx, reporterAddr, height, amt) +// EscrowReporterStake provides a mock function with given fields: ctx, reporterAddr, power, height, amt +func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr types.AccAddress, power int64, height int64, amt math.Int) error { + ret := _m.Called(ctx, reporterAddr, power, height, amt) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, int64, math.Int) error); ok { - r0 = rf(ctx, reporterAddr, height, amt) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, int64, int64, math.Int) error); ok { + r0 = rf(ctx, reporterAddr, power, height, amt) } else { r0 = ret.Error(0) } diff --git a/x/dispute/types/expected_keepers.go b/x/dispute/types/expected_keepers.go index e57fe889e..2e423ede2 100644 --- a/x/dispute/types/expected_keepers.go +++ b/x/dispute/types/expected_keepers.go @@ -38,7 +38,7 @@ type OracleKeeper interface { type ReporterKeeper interface { AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error - EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, height int64, amt math.Int) error + EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, power, height int64, amt math.Int) error Reporter(ctx context.Context, repAddr sdk.AccAddress) (*reportertypes.OracleReporter, error) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration int64) error TotalReporterPower(ctx context.Context) (math.Int, error) diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index b53df3c20..513fae43b 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -724,6 +724,23 @@ func (k Keeper) BeforeDelegationModified(ctx context.Context, delAddr sdk.AccAdd // create new delegation period record func (k Keeper) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, reporterVal sdk.ValAddress, stake math.Int) error { + delegator, err := k.Delegators.Get(ctx, delAddr) + if err != nil { + return err + } + repAddr := sdk.MustAccAddressFromBech32(delegator.Reporter) + + sdkCtx := sdk.UnwrapSDKContext(ctx) + snapshotKey := collections.Join(repAddr, sdkCtx.BlockHeight()) + // get all the token origins for the reporter + tokenSources, err := k.GetTokenSourcesForReporter(ctx, repAddr) + if err != nil { + return err + } + err = k.TokenOriginSnapshot.Set(ctx, snapshotKey, tokenSources) + if err != nil { + return err + } return k.initializeDelegation(ctx, reporterVal, delAddr, stake) } diff --git a/x/reporter/keeper/hooks.go b/x/reporter/keeper/hooks.go index ec45ba82d..d50e93f70 100644 --- a/x/reporter/keeper/hooks.go +++ b/x/reporter/keeper/hooks.go @@ -59,7 +59,6 @@ func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sd } func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { - // TODO: check context to see how this is called in sdk!!! // reflect changes only when token/power decreases // update the reporter tokens and the delegator's tokens to reflect the new power numbers // also need to update the token origins to reflect the new changes when the delegator's tokens are updated @@ -92,24 +91,6 @@ func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddre } repAddr := sdk.MustAccAddressFromBech32(delegator.Reporter) - sdkCtx := sdk.UnwrapSDKContext(ctx) - snapshotKey := collections.Join(repAddr, sdkCtx.BlockHeight()) - snapshotExists, err := h.k.TokenOriginSnapshot.Has(ctx, snapshotKey) - if err != nil { - return err - } - if !snapshotExists { - // get all the token origins for the reporter - tokenSources, err := h.k.GetTokenSourcesForReporter(ctx, repAddr) - if err != nil { - return err - } - err = h.k.TokenOriginSnapshot.Set(ctx, snapshotKey, tokenSources) - if err != nil { - return err - } - } - // get the difference in the token change to reduce delegation and reporter tokens by. diff := sourced.Sub(tokenAmount) if err := h.k.UpdateOrRemoveSource(ctx, collections.Join(delAddr, valAddr), sourced, tokenAmount); err != nil { diff --git a/x/reporter/keeper/withdraw.go b/x/reporter/keeper/withdraw.go index 70b9c23d0..d2abac76c 100644 --- a/x/reporter/keeper/withdraw.go +++ b/x/reporter/keeper/withdraw.go @@ -1,12 +1,11 @@ package keeper import ( - "bytes" "context" + "errors" "fmt" "cosmossdk.io/collections" - errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -15,24 +14,7 @@ import ( "github.com/tellor-io/layer/x/reporter/types" ) -func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, height int64, amt math.Int) error { - // get origins at height - rng := collections.NewPrefixedPairRange[sdk.AccAddress, int64](reporterAddr).StartExclusive(height) - var firstValue *types.DelegationsPreUpdate - err := k.TokenOriginSnapshot.Walk(ctx, rng, func(key collections.Pair[sdk.AccAddress, int64], value types.DelegationsPreUpdate) (stop bool, err error) { - firstValue = &value - return true, nil - }) - if firstValue == nil { - return k.FeefromReporterStake(ctx, reporterAddr, amt) - } - if err != nil { - return err - } - // TODO: - - return nil -} +// FeefromReporterStake deducts the fee from the reporter's stake used mainly for paying dispute from bond func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error { reporter, err := k.Reporters.Get(ctx, reporterAddr) if err != nil { @@ -48,19 +30,13 @@ func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAd if err != nil { return err } - totaltokens := reporter.TotalTokens + totaltokens := math.LegacyNewDecFromInt(reporter.TotalTokens) defer delAddrs.Close() for ; delAddrs.Valid(); delAddrs.Next() { key, err := delAddrs.PrimaryKey() if err != nil { return err } - del, err := k.Delegators.Get(ctx, key) - if err != nil { - return err - } - // total amount to remove from the delegator - delegatorShare := del.Amount.Quo(totaltokens).Mul(amt) rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](key) iter, err := k.TokenOrigin.Iterate(ctx, rng) @@ -72,9 +48,9 @@ func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAd return err } for _, source := range delegatorSources { - srcAmt := source.Value - _share := srcAmt.Quo(del.Amount).Mul(delegatorShare) - _, err = k.Undelegate(ctx, source.Key.K1(), source.Key.K2(), math.LegacyNewDecFromInt(_share)) + srcAmt := math.LegacyNewDecFromInt(source.Value) + share := srcAmt.Quo(totaltokens).Mul(math.LegacyNewDecFromInt(amt)) + _, err = k.feeFromStake(ctx, source.Key.K1(), source.Key.K2(), share) if err != nil { return err } @@ -83,131 +59,182 @@ func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAd return nil } -func (k Keeper) Undelegate( +func (k Keeper) feeFromStake( ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount math.LegacyDec, ) (math.Int, error) { - validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) - if err != nil { - return math.Int{}, err - } - returnAmount, err := k.Unbond(ctx, delAddr, valAddr, sharesAmount) + returnAmount, err := k.stakingKeeper.Unbond(ctx, delAddr, valAddr, sharesAmount) if err != nil { return math.Int{}, err } - - // transfer the validator tokens to the not bonded pool - if validator.IsBonded() { - err = k.bondedTokensToDispute(ctx, returnAmount) - if err != nil { - return math.Int{}, err - } + if err := k.moveTokensFromValidator(ctx, valAddr, returnAmount); err != nil { + return math.Int{}, err } return returnAmount, nil } -func (k Keeper) bondedTokensToDispute(ctx context.Context, amount math.Int) error { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, stakingtypes.BondedPoolName, disputetypes.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, amount))) +// get dst validator for a redelegated delegator +func (k Keeper) getDstValidator(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.ValAddress, error) { + reds, err := k.stakingKeeper.GetRedelegationsFromSrcValidator(ctx, valAddr) + if err != nil { + return nil, err + } + for _, red := range reds { + if red.DelegatorAddress == delAddr.String() { + valAddr, err := sdk.ValAddressFromBech32(red.ValidatorDstAddress) + if err != nil { + return nil, err + } + return valAddr, nil + } + } + return nil, errors.New("redelegation to destination validator not found") } -func (k Keeper) Unbond( - ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec, -) (amount math.Int, err error) { - del, err := k.stakingKeeper.Delegation(ctx, delAddr, valAddr) +func (k Keeper) deductUnbondingDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.Int) (math.Int, error) { + ubd, err := k.stakingKeeper.GetUnbondingDelegation(ctx, delAddr, valAddr) if err != nil { - return amount, err - } - delegation := stakingtypes.Delegation{ - DelegatorAddress: del.GetDelegatorAddr(), - ValidatorAddress: del.GetValidatorAddr(), - Shares: del.GetShares(), + return math.Int{}, err } - // call the before-delegation-modified hook - if err := k.Hooks().BeforeDelegationSharesModified(ctx, delAddr, valAddr); err != nil { - return amount, err + if len(ubd.Entries) == 0 { + return math.Int{}, types.ErrNoUnbondingDelegationEntries + } + for i, u := range ubd.Entries { + if u.Balance.LT(shares) { + shares = shares.Sub(u.Balance) + ubd.RemoveEntry(int64(i)) + } else { + u.Balance = u.Balance.Sub(shares) + u.InitialBalance = u.InitialBalance.Sub(shares) + ubd.Entries[i] = u + shares = math.ZeroInt() + break + } } - // ensure that we have enough shares to remove - if delegation.Shares.LT(shares) { - return amount, errorsmod.Wrap(stakingtypes.ErrNotEnoughDelegationShares, delegation.Shares.String()) + if len(ubd.Entries) == 0 { + err = k.stakingKeeper.RemoveUnbondingDelegation(ctx, ubd) + } else { + err = k.stakingKeeper.SetUnbondingDelegation(ctx, ubd) } - - // get validator - validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) if err != nil { - return amount, err + return math.Int{}, err } + return shares, nil - // subtract shares from delegation - delegation.Shares = delegation.Shares.Sub(shares) - - delegatorAddress, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) - if err != nil { - return amount, err - } +} - valbz, err := sdk.ValAddressFromBech32(validator.GetOperator()) +func (k Keeper) deductFromdelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec) (math.LegacyDec, error) { + // get delegation + del, err := k.stakingKeeper.GetDelegation(ctx, delAddr, valAddr) if err != nil { - return amount, err + return shares, err } - - isValidatorOperator := bytes.Equal(delegatorAddress, valbz) - - // If the delegation is the operator of the validator and undelegating will decrease the validator's - // self-delegation below their minimum, we jail the validator. - if isValidatorOperator && !validator.Jailed && - validator.TokensFromShares(delegation.Shares).TruncateInt().LT(validator.MinSelfDelegation) { - consAddr, err := validator.GetConsAddr() + if del.Shares.GTE(shares) { + _, err := k.stakingKeeper.Unbond(ctx, delAddr, valAddr, shares) if err != nil { - return amount, err + return shares, err } - err = k.stakingKeeper.Jail(ctx, consAddr) - if err != nil { - return amount, fmt.Errorf("failed to jail validator: %v", err) - } - validator, err = k.stakingKeeper.GetValidator(ctx, valbz) + return math.LegacyZeroDec(), nil + } else { + shares = shares.Sub(del.Shares) + _, err := k.stakingKeeper.Unbond(ctx, delAddr, valAddr, del.Shares) if err != nil { - return amount, fmt.Errorf("validator record not found for address: %X", valbz) + return shares, err } + return shares, nil } - if delegation.Shares.IsZero() { - err = k.stakingKeeper.RemoveDelegation(ctx, delegation) - } else { - if err = k.stakingKeeper.SetDelegation(ctx, delegation); err != nil { - return amount, err +} + +func (k Keeper) moveTokensFromValidator(ctx context.Context, valAddr sdk.ValAddress, amount math.Int) error { + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return err + } + var fromPool string + switch { + case validator.IsBonded(): + fromPool = stakingtypes.BondedPoolName + case validator.IsUnbonding(): + fromPool = stakingtypes.NotBondedPoolName + default: + return fmt.Errorf("unknown validator status: %s", validator.GetStatus()) + } + return k.tokensToDispute(ctx, fromPool, amount) +} +func (k Keeper) undelegate(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec) (math.Int, error) { + remainingFromdel, err := k.deductFromdelegation(ctx, delAddr, valAddr, shares) + if err != nil { + if !errors.Is(err, stakingtypes.ErrNoDelegation) { + return math.Int{}, err } + } - valAddr, err = sdk.ValAddressFromBech32(delegation.GetValidatorAddr()) - if err != nil { - return amount, err + if remainingFromdel.IsZero() { + if err := k.moveTokensFromValidator(ctx, valAddr, shares.TruncateInt()); err != nil { + return math.Int{}, err } + return remainingFromdel.TruncateInt(), nil - // call the after delegation modification hook - err = k.Hooks().AfterDelegationModified(ctx, delegatorAddress, valAddr) + } else { + remainingUnbonding, err := k.deductUnbondingDelegation(ctx, delAddr, valAddr, remainingFromdel.TruncateInt()) if err != nil { - return amount, err + return math.Int{}, err + } + if remainingUnbonding.IsZero() { + if err := k.tokensToDispute(ctx, stakingtypes.NotBondedPoolName, remainingFromdel.TruncateInt()); err != nil { + return math.Int{}, err + } } + return remainingUnbonding, nil } - if err != nil { - return amount, err - } +} + +func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, power, height int64, amt math.Int) error { + // get origins at height + rng := collections.NewPrefixedPairRange[sdk.AccAddress, int64](reporterAddr).StartInclusive(height) + var firstValue *types.DelegationsPreUpdate - // remove the shares and coins from the validator - // NOTE that the amount is later (in keeper.Delegation) moved between staking module pools - validator, amount, err = k.stakingKeeper.RemoveValidatorTokensAndShares(ctx, validator, shares) + err := k.TokenOriginSnapshot.Walk(ctx, rng, func(key collections.Pair[sdk.AccAddress, int64], value types.DelegationsPreUpdate) (stop bool, err error) { + firstValue = &value + return true, nil + }) if err != nil { - return amount, err + return err } - if validator.DelegatorShares.IsZero() && validator.IsUnbonded() { - // if not unbonded, we must instead remove validator in EndBlocker once it finishes its unbonding period - if err = k.stakingKeeper.RemoveValidator(ctx, valbz); err != nil { - return amount, err + totalTokens := sdk.DefaultPowerReduction.MulRaw(power) + for _, del := range firstValue.TokenOrigins { + delegatorShare := math.LegacyNewDecFromInt(del.Amount).Quo(math.LegacyNewDecFromInt(totalTokens)).Mul(math.LegacyNewDecFromInt(amt)) + delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) + if err != nil { + return err + } + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + if err != nil { + return err + } + remaining, err := k.undelegate(ctx, delAddr, valAddr, delegatorShare) + if err != nil { + return err + } + if !remaining.IsZero() { + dstVAl, err := k.getDstValidator(ctx, delAddr, valAddr) + if err != nil { + return err + } + _, err = k.undelegate(ctx, delAddr, dstVAl, math.LegacyNewDecFromInt(remaining)) + if err != nil { + return err + } } } + return nil +} - return amount, nil +func (k Keeper) tokensToDispute(ctx context.Context, fromPool string, amount math.Int) error { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, fromPool, disputetypes.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, amount))) } diff --git a/x/reporter/mocks/StakingKeeper.go b/x/reporter/mocks/StakingKeeper.go index d1b7b7f82..a314f0e9c 100644 --- a/x/reporter/mocks/StakingKeeper.go +++ b/x/reporter/mocks/StakingKeeper.go @@ -5,15 +5,13 @@ package mocks import ( context "context" - address "cosmossdk.io/core/address" - - cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" - math "cosmossdk.io/math" mock "github.com/stretchr/testify/mock" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + types "github.com/cosmos/cosmos-sdk/types" ) // StakingKeeper is an autogenerated mock type for the StakingKeeper type @@ -21,38 +19,22 @@ type StakingKeeper struct { mock.Mock } -// ConsensusAddressCodec provides a mock function with given fields: -func (_m *StakingKeeper) ConsensusAddressCodec() address.Codec { - ret := _m.Called() - - var r0 address.Codec - if rf, ok := ret.Get(0).(func() address.Codec); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(address.Codec) - } - } - - return r0 -} - // Delegate provides a mock function with given fields: ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount -func (_m *StakingKeeper) Delegate(ctx context.Context, delAddr cosmos_sdktypes.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool) (math.LegacyDec, error) { +func (_m *StakingKeeper) Delegate(ctx context.Context, delAddr types.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool) (math.LegacyDec, error) { ret := _m.Called(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) var r0 math.LegacyDec var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) (math.LegacyDec, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) (math.LegacyDec, error)); ok { return rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) math.LegacyDec); ok { + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) math.LegacyDec); ok { r0 = rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) } else { r0 = ret.Get(0).(math.LegacyDec) } - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, math.Int, stakingtypes.BondStatus, stakingtypes.Validator, bool) error); ok { r1 = rf(ctx, delAddr, bondAmt, tokenSrc, validator, subtractAccount) } else { r1 = ret.Error(1) @@ -62,15 +44,15 @@ func (_m *StakingKeeper) Delegate(ctx context.Context, delAddr cosmos_sdktypes.A } // Delegation provides a mock function with given fields: _a0, _a1, _a2 -func (_m *StakingKeeper) Delegation(_a0 context.Context, _a1 cosmos_sdktypes.AccAddress, _a2 cosmos_sdktypes.ValAddress) (stakingtypes.DelegationI, error) { +func (_m *StakingKeeper) Delegation(_a0 context.Context, _a1 types.AccAddress, _a2 types.ValAddress) (stakingtypes.DelegationI, error) { ret := _m.Called(_a0, _a1, _a2) var r0 stakingtypes.DelegationI var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, cosmos_sdktypes.ValAddress) (stakingtypes.DelegationI, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) (stakingtypes.DelegationI, error)); ok { return rf(_a0, _a1, _a2) } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, cosmos_sdktypes.ValAddress) stakingtypes.DelegationI); ok { + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) stakingtypes.DelegationI); ok { r0 = rf(_a0, _a1, _a2) } else { if ret.Get(0) != nil { @@ -78,7 +60,7 @@ func (_m *StakingKeeper) Delegation(_a0 context.Context, _a1 cosmos_sdktypes.Acc } } - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress, cosmos_sdktypes.ValAddress) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, types.ValAddress) error); ok { r1 = rf(_a0, _a1, _a2) } else { r1 = ret.Error(1) @@ -87,23 +69,23 @@ func (_m *StakingKeeper) Delegation(_a0 context.Context, _a1 cosmos_sdktypes.Acc return r0, r1 } -// GetValidator provides a mock function with given fields: ctx, addr -func (_m *StakingKeeper) GetValidator(ctx context.Context, addr cosmos_sdktypes.ValAddress) (stakingtypes.Validator, error) { - ret := _m.Called(ctx, addr) +// GetDelegation provides a mock function with given fields: ctx, delAddr, valAddr +func (_m *StakingKeeper) GetDelegation(ctx context.Context, delAddr types.AccAddress, valAddr types.ValAddress) (stakingtypes.Delegation, error) { + ret := _m.Called(ctx, delAddr, valAddr) - var r0 stakingtypes.Validator + var r0 stakingtypes.Delegation var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ValAddress) (stakingtypes.Validator, error)); ok { - return rf(ctx, addr) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) (stakingtypes.Delegation, error)); ok { + return rf(ctx, delAddr, valAddr) } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ValAddress) stakingtypes.Validator); ok { - r0 = rf(ctx, addr) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) stakingtypes.Delegation); ok { + r0 = rf(ctx, delAddr, valAddr) } else { - r0 = ret.Get(0).(stakingtypes.Validator) + r0 = ret.Get(0).(stakingtypes.Delegation) } - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.ValAddress) error); ok { - r1 = rf(ctx, addr) + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, types.ValAddress) error); ok { + r1 = rf(ctx, delAddr, valAddr) } else { r1 = ret.Error(1) } @@ -111,25 +93,25 @@ func (_m *StakingKeeper) GetValidator(ctx context.Context, addr cosmos_sdktypes. return r0, r1 } -// GetValidators provides a mock function with given fields: ctx, maxRetrieve -func (_m *StakingKeeper) GetValidators(ctx context.Context, maxRetrieve uint32) ([]stakingtypes.Validator, error) { - ret := _m.Called(ctx, maxRetrieve) +// GetRedelegationsFromSrcValidator provides a mock function with given fields: ctx, valAddr +func (_m *StakingKeeper) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr types.ValAddress) ([]stakingtypes.Redelegation, error) { + ret := _m.Called(ctx, valAddr) - var r0 []stakingtypes.Validator + var r0 []stakingtypes.Redelegation var r1 error - if rf, ok := ret.Get(0).(func(context.Context, uint32) ([]stakingtypes.Validator, error)); ok { - return rf(ctx, maxRetrieve) + if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) ([]stakingtypes.Redelegation, error)); ok { + return rf(ctx, valAddr) } - if rf, ok := ret.Get(0).(func(context.Context, uint32) []stakingtypes.Validator); ok { - r0 = rf(ctx, maxRetrieve) + if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) []stakingtypes.Redelegation); ok { + r0 = rf(ctx, valAddr) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]stakingtypes.Validator) + r0 = ret.Get(0).([]stakingtypes.Redelegation) } } - if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok { - r1 = rf(ctx, maxRetrieve) + if rf, ok := ret.Get(1).(func(context.Context, types.ValAddress) error); ok { + r1 = rf(ctx, valAddr) } else { r1 = ret.Error(1) } @@ -137,86 +119,101 @@ func (_m *StakingKeeper) GetValidators(ctx context.Context, maxRetrieve uint32) return r0, r1 } -// Jail provides a mock function with given fields: ctx, consAddr -func (_m *StakingKeeper) Jail(ctx context.Context, consAddr cosmos_sdktypes.ConsAddress) error { - ret := _m.Called(ctx, consAddr) +// GetUnbondingDelegation provides a mock function with given fields: ctx, delAddr, valAddr +func (_m *StakingKeeper) GetUnbondingDelegation(ctx context.Context, delAddr types.AccAddress, valAddr types.ValAddress) (stakingtypes.UnbondingDelegation, error) { + ret := _m.Called(ctx, delAddr, valAddr) - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) error); ok { - r0 = rf(ctx, consAddr) + var r0 stakingtypes.UnbondingDelegation + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) (stakingtypes.UnbondingDelegation, error)); ok { + return rf(ctx, delAddr, valAddr) + } + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) stakingtypes.UnbondingDelegation); ok { + r0 = rf(ctx, delAddr, valAddr) } else { - r0 = ret.Error(0) + r0 = ret.Get(0).(stakingtypes.UnbondingDelegation) } - return r0 -} - -// RemoveDelegation provides a mock function with given fields: ctx, delegation -func (_m *StakingKeeper) RemoveDelegation(ctx context.Context, delegation stakingtypes.Delegation) error { - ret := _m.Called(ctx, delegation) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Delegation) error); ok { - r0 = rf(ctx, delegation) + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, types.ValAddress) error); ok { + r1 = rf(ctx, delAddr, valAddr) } else { - r0 = ret.Error(0) + r1 = ret.Error(1) } - return r0 + return r0, r1 } -// RemoveValidator provides a mock function with given fields: ctx, _a1 -func (_m *StakingKeeper) RemoveValidator(ctx context.Context, _a1 cosmos_sdktypes.ValAddress) error { - ret := _m.Called(ctx, _a1) +// GetValidator provides a mock function with given fields: ctx, addr +func (_m *StakingKeeper) GetValidator(ctx context.Context, addr types.ValAddress) (stakingtypes.Validator, error) { + ret := _m.Called(ctx, addr) - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ValAddress) error); ok { - r0 = rf(ctx, _a1) + var r0 stakingtypes.Validator + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) (stakingtypes.Validator, error)); ok { + return rf(ctx, addr) + } + if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress) stakingtypes.Validator); ok { + r0 = rf(ctx, addr) } else { - r0 = ret.Error(0) + r0 = ret.Get(0).(stakingtypes.Validator) } - return r0 + if rf, ok := ret.Get(1).(func(context.Context, types.ValAddress) error); ok { + r1 = rf(ctx, addr) + } else { + r1 = ret.Error(1) + } + + return r0, r1 } -// RemoveValidatorTokensAndShares provides a mock function with given fields: ctx, validator, sharesToRemove -func (_m *StakingKeeper) RemoveValidatorTokensAndShares(ctx context.Context, validator stakingtypes.Validator, sharesToRemove math.LegacyDec) (stakingtypes.Validator, math.Int, error) { - ret := _m.Called(ctx, validator, sharesToRemove) +// GetValidators provides a mock function with given fields: ctx, maxRetrieve +func (_m *StakingKeeper) GetValidators(ctx context.Context, maxRetrieve uint32) ([]stakingtypes.Validator, error) { + ret := _m.Called(ctx, maxRetrieve) - var r0 stakingtypes.Validator - var r1 math.Int - var r2 error - if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Validator, math.LegacyDec) (stakingtypes.Validator, math.Int, error)); ok { - return rf(ctx, validator, sharesToRemove) + var r0 []stakingtypes.Validator + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint32) ([]stakingtypes.Validator, error)); ok { + return rf(ctx, maxRetrieve) } - if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Validator, math.LegacyDec) stakingtypes.Validator); ok { - r0 = rf(ctx, validator, sharesToRemove) + if rf, ok := ret.Get(0).(func(context.Context, uint32) []stakingtypes.Validator); ok { + r0 = rf(ctx, maxRetrieve) } else { - r0 = ret.Get(0).(stakingtypes.Validator) + if ret.Get(0) != nil { + r0 = ret.Get(0).([]stakingtypes.Validator) + } } - if rf, ok := ret.Get(1).(func(context.Context, stakingtypes.Validator, math.LegacyDec) math.Int); ok { - r1 = rf(ctx, validator, sharesToRemove) + if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok { + r1 = rf(ctx, maxRetrieve) } else { - r1 = ret.Get(1).(math.Int) + r1 = ret.Error(1) } - if rf, ok := ret.Get(2).(func(context.Context, stakingtypes.Validator, math.LegacyDec) error); ok { - r2 = rf(ctx, validator, sharesToRemove) + return r0, r1 +} + +// RemoveUnbondingDelegation provides a mock function with given fields: ctx, ubd +func (_m *StakingKeeper) RemoveUnbondingDelegation(ctx context.Context, ubd stakingtypes.UnbondingDelegation) error { + ret := _m.Called(ctx, ubd) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.UnbondingDelegation) error); ok { + r0 = rf(ctx, ubd) } else { - r2 = ret.Error(2) + r0 = ret.Error(0) } - return r0, r1, r2 + return r0 } -// SetDelegation provides a mock function with given fields: ctx, delegation -func (_m *StakingKeeper) SetDelegation(ctx context.Context, delegation stakingtypes.Delegation) error { - ret := _m.Called(ctx, delegation) +// SetUnbondingDelegation provides a mock function with given fields: ctx, ubd +func (_m *StakingKeeper) SetUnbondingDelegation(ctx context.Context, ubd stakingtypes.UnbondingDelegation) error { + ret := _m.Called(ctx, ubd) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.Delegation) error); ok { - r0 = rf(ctx, delegation) + if rf, ok := ret.Get(0).(func(context.Context, stakingtypes.UnbondingDelegation) error); ok { + r0 = rf(ctx, ubd) } else { r0 = ret.Error(0) } @@ -224,25 +221,23 @@ func (_m *StakingKeeper) SetDelegation(ctx context.Context, delegation stakingty return r0 } -// ValidatorByConsAddr provides a mock function with given fields: _a0, _a1 -func (_m *StakingKeeper) ValidatorByConsAddr(_a0 context.Context, _a1 cosmos_sdktypes.ConsAddress) (stakingtypes.ValidatorI, error) { - ret := _m.Called(_a0, _a1) +// Unbond provides a mock function with given fields: ctx, delAddr, valAddr, shares +func (_m *StakingKeeper) Unbond(ctx context.Context, delAddr types.AccAddress, valAddr types.ValAddress, shares math.LegacyDec) (math.Int, error) { + ret := _m.Called(ctx, delAddr, valAddr, shares) - var r0 stakingtypes.ValidatorI + var r0 math.Int var r1 error - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) (stakingtypes.ValidatorI, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress, math.LegacyDec) (math.Int, error)); ok { + return rf(ctx, delAddr, valAddr, shares) } - if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.ConsAddress) stakingtypes.ValidatorI); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress, math.LegacyDec) math.Int); ok { + r0 = rf(ctx, delAddr, valAddr, shares) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(stakingtypes.ValidatorI) - } + r0 = ret.Get(0).(math.Int) } - if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.ConsAddress) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, types.ValAddress, math.LegacyDec) error); ok { + r1 = rf(ctx, delAddr, valAddr, shares) } else { r1 = ret.Error(1) } diff --git a/x/reporter/types/errors.go b/x/reporter/types/errors.go index 4de66c741..06ee5decc 100644 --- a/x/reporter/types/errors.go +++ b/x/reporter/types/errors.go @@ -8,18 +8,19 @@ import ( // x/reporter module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrReporterExists = sdkerrors.Register(ModuleName, 1102, "reporter already registered!") - ErrAddressDelegated = sdkerrors.Register(ModuleName, 1103, "address currently delegated to a reporter") - ErrCommissionLTMinRate = sdkerrors.Register(ModuleName, 1104, "commission cannot be less than min rate") - ErrInvalidReporter = sdkerrors.Register(ModuleName, 1105, "invalid reporter") - ErrInsufficientTokens = sdkerrors.Register(ModuleName, 1106, "insufficient tokens") - ErrTokenAmountMismatch = sdkerrors.Register(ModuleName, 1107, "token amount mismatch") - ErrReporterMismatch = sdkerrors.Register(ModuleName, 1108, "reporter mismatch") - ErrEmptyDelegationDistInfo = sdkerrors.Register(ModuleName, 1109, "no delegation distribution info") - ErrNoReporterCommission = sdkerrors.Register(ModuleName, 1110, "no reporter commission to withdraw") - ErrReporterDoesNotExist = sdkerrors.Register(ModuleName, 1111, "reporter does not exist") - ErrReporterJailed = sdkerrors.Register(ModuleName, 1112, "reporter jailed") - ErrReporterNotJailed = sdkerrors.Register(ModuleName, 1113, "reporter not jailed") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrReporterExists = sdkerrors.Register(ModuleName, 1102, "reporter already registered!") + ErrAddressDelegated = sdkerrors.Register(ModuleName, 1103, "address currently delegated to a reporter") + ErrCommissionLTMinRate = sdkerrors.Register(ModuleName, 1104, "commission cannot be less than min rate") + ErrInvalidReporter = sdkerrors.Register(ModuleName, 1105, "invalid reporter") + ErrInsufficientTokens = sdkerrors.Register(ModuleName, 1106, "insufficient tokens") + ErrTokenAmountMismatch = sdkerrors.Register(ModuleName, 1107, "token amount mismatch") + ErrReporterMismatch = sdkerrors.Register(ModuleName, 1108, "reporter mismatch") + ErrEmptyDelegationDistInfo = sdkerrors.Register(ModuleName, 1109, "no delegation distribution info") + ErrNoReporterCommission = sdkerrors.Register(ModuleName, 1110, "no reporter commission to withdraw") + ErrReporterDoesNotExist = sdkerrors.Register(ModuleName, 1111, "reporter does not exist") + ErrReporterJailed = sdkerrors.Register(ModuleName, 1112, "reporter jailed") + ErrReporterNotJailed = sdkerrors.Register(ModuleName, 1113, "reporter not jailed") + ErrNoUnbondingDelegationEntries = sdkerrors.Register(ModuleName, 1114, "no unbonding delegation entries") ) diff --git a/x/reporter/types/expected_keepers.go b/x/reporter/types/expected_keepers.go index a49932551..b9901aa6c 100644 --- a/x/reporter/types/expected_keepers.go +++ b/x/reporter/types/expected_keepers.go @@ -3,7 +3,6 @@ package types import ( "context" - "cosmossdk.io/core/address" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -11,22 +10,21 @@ import ( // StakingKeeper defines the expected interface for the Staking module. type StakingKeeper interface { - ConsensusAddressCodec() address.Codec - ValidatorByConsAddr(context.Context, sdk.ConsAddress) (stakingtypes.ValidatorI, error) Delegation(context.Context, sdk.AccAddress, sdk.ValAddress) (stakingtypes.DelegationI, error) GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) Delegate( ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, ) (newShares math.LegacyDec, err error) - RemoveDelegation(ctx context.Context, delegation stakingtypes.Delegation) error - RemoveValidatorTokensAndShares(ctx context.Context, validator stakingtypes.Validator, - sharesToRemove math.LegacyDec, - ) (valOut stakingtypes.Validator, removedTokens math.Int, err error) - SetDelegation(ctx context.Context, delegation stakingtypes.Delegation) error - RemoveValidator(ctx context.Context, address sdk.ValAddress) error - Jail(ctx context.Context, consAddr sdk.ConsAddress) error GetValidators(ctx context.Context, maxRetrieve uint32) (validators []stakingtypes.Validator, err error) + GetUnbondingDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd stakingtypes.UnbondingDelegation, err error) + GetRedelegationsFromSrcValidator(ctx context.Context, valAddr sdk.ValAddress) (reds []stakingtypes.Redelegation, err error) + RemoveUnbondingDelegation(ctx context.Context, ubd stakingtypes.UnbondingDelegation) error + SetUnbondingDelegation(ctx context.Context, ubd stakingtypes.UnbondingDelegation) error + GetDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (stakingtypes.Delegation, error) + Unbond( + ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec, + ) (amount math.Int, err error) // Methods imported from account should be defined here } From 12a20dea120d4cd247e6d48512e87a5a84a7d631 Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 11 Mar 2024 11:24:50 -0400 Subject: [PATCH 11/31] scripts for generating proto files --- proto/buf.gen.pulsar.yaml | 4 +-- scripts/protocgen-pulsar.sh | 20 ++++++++++++++ scripts/protocgen.sh | 52 +++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100755 scripts/protocgen-pulsar.sh create mode 100755 scripts/protocgen.sh diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml index e8fffdb28..d71f00468 100644 --- a/proto/buf.gen.pulsar.yaml +++ b/proto/buf.gen.pulsar.yaml @@ -15,8 +15,8 @@ managed: override: plugins: - name: go-pulsar - out: ./api + out: ../api opt: paths=source_relative - name: go-grpc - out: ./api + out: ../api opt: paths=source_relative diff --git a/scripts/protocgen-pulsar.sh b/scripts/protocgen-pulsar.sh new file mode 100755 index 000000000..c29613dac --- /dev/null +++ b/scripts/protocgen-pulsar.sh @@ -0,0 +1,20 @@ +!/usr/bin/env bash + +Directory containing proto files relative to the script's location +PROTO_DIR="./proto" +OUTPUT_DIR="." +# Path to the buf template, assuming it's in the proto directory +TEMPLATE_PATH="${PROTO_DIR}/buf.gen.pulsar.yaml" + +# Find and process all proto files +find "${PROTO_DIR}" -name '*.proto' -print0 | while IFS= read -r -d '' proto_file; do + echo "Current working directory: $(pwd)" + buf generate --template "${TEMPLATE_PATH}" --output "${OUTPUT_DIR}" --error-format=json --log-format=json "${proto_file}" + if [ $? -ne 0 ]; then + echo "Failed to process ${proto_file}" + exit 1 + fi +done + +cp -r layer/* ../api +rm -rf layer diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh new file mode 100755 index 000000000..cc448c97c --- /dev/null +++ b/scripts/protocgen.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +set -e + +GOSUMDB=off GOTOOLCHAIN=local+path go mod tidy + +# Function to check if a command exists and install it if it does not +ensure_command() { + local cmd=$1 + local package=$2 + + if ! command -v "$cmd" &> /dev/null; then + echo "$cmd could not be found, installing..." + go install "$package" + fi +} + +# Ensure buf and other required tools are installed +ensure_command buf github.com/bufbuild/buf/cmd/buf@latest +ensure_command protoc-gen-gocosmos github.com/cosmos/gogoproto/protoc-gen-gocosmos@latest +ensure_command protoc-gen-go-grpc google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +ensure_command protoc-gen-go google.golang.org/protobuf/cmd/protoc-gen-go@latest +ensure_command protoc-gen-go-pulsar github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest +ensure_command protoc-gen-grpc-gateway github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest +ensure_command protoc-gen-openapiv2 github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest +ensure_command goimports golang.org/x/tools/cmd/goimports@latest + +# Directory containing proto files relative to the script's location +PROTO_DIR="./proto" +# Path to the buf template, assuming it's in the proto directory +TEMPLATE_PATH="${PROTO_DIR}/buf.gen.gogo.yaml" +# Create a temporary directory for the output +OUTPUT_DIR="." + +# Find and process all proto files +find "${PROTO_DIR}" -name '*.proto' -print0 | while IFS= read -r -d '' proto_file; do + buf generate --template "${TEMPLATE_PATH}" --output "${OUTPUT_DIR}" --error-format=json --log-format=json "${proto_file}" + if [ $? -ne 0 ]; then + echo "Failed to process ${proto_file}" + exit 1 + fi +done + +# move proto files to the right places +cp -r github.com/tellor-io/layer/* ./ +rm -rf github.com + +./scripts/protocgen-pulsar.sh + +go mod tidy + +echo "Proto file generation completed successfully." From 8523861575a7aa93eecbcafe0e6610526a6373ca Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 11 Mar 2024 11:27:22 -0400 Subject: [PATCH 12/31] proto stuff --- api/layer/dispute/dispute.pulsar.go | 454 ++++-- api/layer/oracle/params.pulsar.go | 42 +- api/layer/oracle/user_tip.pulsar.go | 127 +- api/layer/registry/data_spec.pulsar.go | 137 +- api/layer/reporter/token_origin.pulsar.go | 1218 ++++++++++++++++- proto/layer/oracle/params.proto | 2 +- proto/layer/registry/data_spec.proto | 2 +- tests/integration/keeper_test.go | 9 +- x/dispute/types/dispute.pb.go | 312 +++-- x/oracle/types/params.pb.go | 30 +- .../keeper/query_decode_querydata_test.go | 2 +- x/registry/keeper/query_decode_value_test.go | 2 +- .../keeper/query_generate_querydata_test.go | 2 +- x/registry/types/data_spec.pb.go | 82 +- x/registry/types/dataspec.go | 10 +- x/registry/types/dataspec_test.go | 66 +- x/registry/types/decoding.go | 2 +- x/reporter/types/token_origin.pb.go | 494 ++++++- 18 files changed, 2507 insertions(+), 486 deletions(-) diff --git a/api/layer/dispute/dispute.pulsar.go b/api/layer/dispute/dispute.pulsar.go index 48f02f128..14287ccb3 100644 --- a/api/layer/dispute/dispute.pulsar.go +++ b/api/layer/dispute/dispute.pulsar.go @@ -1490,12 +1490,15 @@ func (x *fastReflection_Dispute) ProtoMethods() *protoiface.Methods { } var ( - md_MicroReport protoreflect.MessageDescriptor - fd_MicroReport_reporter protoreflect.FieldDescriptor - fd_MicroReport_power protoreflect.FieldDescriptor - fd_MicroReport_queryId protoreflect.FieldDescriptor - fd_MicroReport_value protoreflect.FieldDescriptor - fd_MicroReport_timestamp protoreflect.FieldDescriptor + md_MicroReport protoreflect.MessageDescriptor + fd_MicroReport_reporter protoreflect.FieldDescriptor + fd_MicroReport_power protoreflect.FieldDescriptor + fd_MicroReport_query_type protoreflect.FieldDescriptor + fd_MicroReport_query_id protoreflect.FieldDescriptor + fd_MicroReport_aggregate_method protoreflect.FieldDescriptor + fd_MicroReport_value protoreflect.FieldDescriptor + fd_MicroReport_block_number protoreflect.FieldDescriptor + fd_MicroReport_timestamp protoreflect.FieldDescriptor ) func init() { @@ -1503,8 +1506,11 @@ func init() { md_MicroReport = File_layer_dispute_dispute_proto.Messages().ByName("MicroReport") fd_MicroReport_reporter = md_MicroReport.Fields().ByName("reporter") fd_MicroReport_power = md_MicroReport.Fields().ByName("power") - fd_MicroReport_queryId = md_MicroReport.Fields().ByName("queryId") + fd_MicroReport_query_type = md_MicroReport.Fields().ByName("query_type") + fd_MicroReport_query_id = md_MicroReport.Fields().ByName("query_id") + fd_MicroReport_aggregate_method = md_MicroReport.Fields().ByName("aggregate_method") fd_MicroReport_value = md_MicroReport.Fields().ByName("value") + fd_MicroReport_block_number = md_MicroReport.Fields().ByName("block_number") fd_MicroReport_timestamp = md_MicroReport.Fields().ByName("timestamp") } @@ -1585,9 +1591,21 @@ func (x *fastReflection_MicroReport) Range(f func(protoreflect.FieldDescriptor, return } } + if x.QueryType != "" { + value := protoreflect.ValueOfString(x.QueryType) + if !f(fd_MicroReport_query_type, value) { + return + } + } if x.QueryId != "" { value := protoreflect.ValueOfString(x.QueryId) - if !f(fd_MicroReport_queryId, value) { + if !f(fd_MicroReport_query_id, value) { + return + } + } + if x.AggregateMethod != "" { + value := protoreflect.ValueOfString(x.AggregateMethod) + if !f(fd_MicroReport_aggregate_method, value) { return } } @@ -1597,8 +1615,14 @@ func (x *fastReflection_MicroReport) Range(f func(protoreflect.FieldDescriptor, return } } - if x.Timestamp != int64(0) { - value := protoreflect.ValueOfInt64(x.Timestamp) + if x.BlockNumber != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockNumber) + if !f(fd_MicroReport_block_number, value) { + return + } + } + if x.Timestamp != nil { + value := protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) if !f(fd_MicroReport_timestamp, value) { return } @@ -1622,12 +1646,18 @@ func (x *fastReflection_MicroReport) Has(fd protoreflect.FieldDescriptor) bool { return x.Reporter != "" case "layer.dispute.MicroReport.power": return x.Power != int64(0) - case "layer.dispute.MicroReport.queryId": + case "layer.dispute.MicroReport.query_type": + return x.QueryType != "" + case "layer.dispute.MicroReport.query_id": return x.QueryId != "" + case "layer.dispute.MicroReport.aggregate_method": + return x.AggregateMethod != "" case "layer.dispute.MicroReport.value": return x.Value != "" + case "layer.dispute.MicroReport.block_number": + return x.BlockNumber != int64(0) case "layer.dispute.MicroReport.timestamp": - return x.Timestamp != int64(0) + return x.Timestamp != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) @@ -1648,12 +1678,18 @@ func (x *fastReflection_MicroReport) Clear(fd protoreflect.FieldDescriptor) { x.Reporter = "" case "layer.dispute.MicroReport.power": x.Power = int64(0) - case "layer.dispute.MicroReport.queryId": + case "layer.dispute.MicroReport.query_type": + x.QueryType = "" + case "layer.dispute.MicroReport.query_id": x.QueryId = "" + case "layer.dispute.MicroReport.aggregate_method": + x.AggregateMethod = "" case "layer.dispute.MicroReport.value": x.Value = "" + case "layer.dispute.MicroReport.block_number": + x.BlockNumber = int64(0) case "layer.dispute.MicroReport.timestamp": - x.Timestamp = int64(0) + x.Timestamp = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) @@ -1676,15 +1712,24 @@ func (x *fastReflection_MicroReport) Get(descriptor protoreflect.FieldDescriptor case "layer.dispute.MicroReport.power": value := x.Power return protoreflect.ValueOfInt64(value) - case "layer.dispute.MicroReport.queryId": + case "layer.dispute.MicroReport.query_type": + value := x.QueryType + return protoreflect.ValueOfString(value) + case "layer.dispute.MicroReport.query_id": value := x.QueryId return protoreflect.ValueOfString(value) + case "layer.dispute.MicroReport.aggregate_method": + value := x.AggregateMethod + return protoreflect.ValueOfString(value) case "layer.dispute.MicroReport.value": value := x.Value return protoreflect.ValueOfString(value) + case "layer.dispute.MicroReport.block_number": + value := x.BlockNumber + return protoreflect.ValueOfInt64(value) case "layer.dispute.MicroReport.timestamp": value := x.Timestamp - return protoreflect.ValueOfInt64(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) @@ -1709,12 +1754,18 @@ func (x *fastReflection_MicroReport) Set(fd protoreflect.FieldDescriptor, value x.Reporter = value.Interface().(string) case "layer.dispute.MicroReport.power": x.Power = value.Int() - case "layer.dispute.MicroReport.queryId": + case "layer.dispute.MicroReport.query_type": + x.QueryType = value.Interface().(string) + case "layer.dispute.MicroReport.query_id": x.QueryId = value.Interface().(string) + case "layer.dispute.MicroReport.aggregate_method": + x.AggregateMethod = value.Interface().(string) case "layer.dispute.MicroReport.value": x.Value = value.Interface().(string) + case "layer.dispute.MicroReport.block_number": + x.BlockNumber = value.Int() case "layer.dispute.MicroReport.timestamp": - x.Timestamp = value.Int() + x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) @@ -1735,16 +1786,25 @@ func (x *fastReflection_MicroReport) Set(fd protoreflect.FieldDescriptor, value // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MicroReport) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "layer.dispute.MicroReport.timestamp": + if x.Timestamp == nil { + x.Timestamp = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) case "layer.dispute.MicroReport.reporter": panic(fmt.Errorf("field reporter of message layer.dispute.MicroReport is not mutable")) case "layer.dispute.MicroReport.power": panic(fmt.Errorf("field power of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.queryId": - panic(fmt.Errorf("field queryId of message layer.dispute.MicroReport is not mutable")) + case "layer.dispute.MicroReport.query_type": + panic(fmt.Errorf("field query_type of message layer.dispute.MicroReport is not mutable")) + case "layer.dispute.MicroReport.query_id": + panic(fmt.Errorf("field query_id of message layer.dispute.MicroReport is not mutable")) + case "layer.dispute.MicroReport.aggregate_method": + panic(fmt.Errorf("field aggregate_method of message layer.dispute.MicroReport is not mutable")) case "layer.dispute.MicroReport.value": panic(fmt.Errorf("field value of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.timestamp": - panic(fmt.Errorf("field timestamp of message layer.dispute.MicroReport is not mutable")) + case "layer.dispute.MicroReport.block_number": + panic(fmt.Errorf("field block_number of message layer.dispute.MicroReport is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) @@ -1762,12 +1822,19 @@ func (x *fastReflection_MicroReport) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfString("") case "layer.dispute.MicroReport.power": return protoreflect.ValueOfInt64(int64(0)) - case "layer.dispute.MicroReport.queryId": + case "layer.dispute.MicroReport.query_type": + return protoreflect.ValueOfString("") + case "layer.dispute.MicroReport.query_id": + return protoreflect.ValueOfString("") + case "layer.dispute.MicroReport.aggregate_method": return protoreflect.ValueOfString("") case "layer.dispute.MicroReport.value": return protoreflect.ValueOfString("") - case "layer.dispute.MicroReport.timestamp": + case "layer.dispute.MicroReport.block_number": return protoreflect.ValueOfInt64(int64(0)) + case "layer.dispute.MicroReport.timestamp": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) @@ -1844,16 +1911,28 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { if x.Power != 0 { n += 1 + runtime.Sov(uint64(x.Power)) } + l = len(x.QueryType) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } l = len(x.QueryId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.AggregateMethod) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } l = len(x.Value) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Timestamp != 0 { - n += 1 + runtime.Sov(uint64(x.Timestamp)) + if x.BlockNumber != 0 { + n += 1 + runtime.Sov(uint64(x.BlockNumber)) + } + if x.Timestamp != nil { + l = options.Size(x.Timestamp) + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1884,23 +1963,51 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Timestamp != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Timestamp)) + if x.Timestamp != nil { + encoded, err := options.Marshal(x.Timestamp) + 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] = 0x28 + dAtA[i] = 0x42 + } + if x.BlockNumber != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockNumber)) + i-- + dAtA[i] = 0x38 } if len(x.Value) > 0 { i -= len(x.Value) copy(dAtA[i:], x.Value) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Value))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x32 + } + if len(x.AggregateMethod) > 0 { + i -= len(x.AggregateMethod) + copy(dAtA[i:], x.AggregateMethod) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AggregateMethod))) + i-- + dAtA[i] = 0x2a } if len(x.QueryId) > 0 { i -= len(x.QueryId) copy(dAtA[i:], x.QueryId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryId))) i-- + dAtA[i] = 0x22 + } + if len(x.QueryType) > 0 { + i -= len(x.QueryType) + copy(dAtA[i:], x.QueryType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryType))) + i-- dAtA[i] = 0x1a } if x.Power != 0 { @@ -2016,6 +2123,38 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { } } case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryType", 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.QueryType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryId", wireType) } @@ -2047,7 +2186,39 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { } x.QueryId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AggregateMethod", 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.AggregateMethod = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } @@ -2079,11 +2250,30 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { } x.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 7: if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + x.BlockNumber = 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.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } - x.Timestamp = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2093,11 +2283,28 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.Timestamp |= int64(b&0x7F) << shift + 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.Timestamp == nil { + x.Timestamp = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Timestamp); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2962,16 +3169,20 @@ func (x *Dispute) GetPrevDisputeIds() []uint64 { return nil } +// TODO: remove this duplicate type MicroReport struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - QueryId string `protobuf:"bytes,3,opt,name=queryId,proto3" json:"queryId,omitempty"` - Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + QueryType string `protobuf:"bytes,3,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + QueryId string `protobuf:"bytes,4,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + AggregateMethod string `protobuf:"bytes,5,opt,name=aggregate_method,json=aggregateMethod,proto3" json:"aggregate_method,omitempty"` + Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` + BlockNumber int64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (x *MicroReport) Reset() { @@ -3008,6 +3219,13 @@ func (x *MicroReport) GetPower() int64 { return 0 } +func (x *MicroReport) GetQueryType() string { + if x != nil { + return x.QueryType + } + return "" +} + func (x *MicroReport) GetQueryId() string { if x != nil { return x.QueryId @@ -3015,6 +3233,13 @@ func (x *MicroReport) GetQueryId() string { return "" } +func (x *MicroReport) GetAggregateMethod() string { + if x != nil { + return x.AggregateMethod + } + return "" +} + func (x *MicroReport) GetValue() string { if x != nil { return x.Value @@ -3022,13 +3247,20 @@ func (x *MicroReport) GetValue() string { return "" } -func (x *MicroReport) GetTimestamp() int64 { +func (x *MicroReport) GetBlockNumber() int64 { if x != nil { - return x.Timestamp + return x.BlockNumber } return 0 } +func (x *MicroReport) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + type PayerInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3085,14 +3317,14 @@ var File_layer_dispute_dispute_proto protoreflect.FileDescriptor var file_layer_dispute_dispute_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 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, 0x1f, 0x67, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 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, 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, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x22, 0xa1, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa1, 0x07, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x73, 0x68, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, 0x18, @@ -3151,61 +3383,70 @@ var file_layer_dispute_dispute_proto_rawDesc = []byte{ 0x52, 0x08, 0x66, 0x65, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, - 0x64, 0x73, 0x22, 0x8d, 0x01, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, + 0x64, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, - 0x6f, 0x77, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x37, 0x0a, 0x06, 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, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x2a, 0xc3, 0x01, 0x0a, 0x0f, 0x44, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x31, 0x0a, - 0x1c, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, - 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x1a, - 0x0f, 0x8a, 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x12, 0x29, 0x0a, 0x18, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, - 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0b, - 0x8a, 0x9d, 0x20, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x0a, 0x16, 0x44, - 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, - 0x4d, 0x49, 0x4e, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x09, 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x69, 0x6e, - 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, - 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x10, 0x03, 0x1a, 0x09, - 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x61, 0x6a, 0x6f, 0x72, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x2a, - 0xe6, 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x27, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, - 0x54, 0x55, 0x53, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x4f, 0x54, 0x45, 0x10, 0x00, 0x1a, 0x0b, 0x8a, - 0x9d, 0x20, 0x07, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, - 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x4f, 0x54, - 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x56, 0x6f, 0x74, 0x69, 0x6e, - 0x67, 0x12, 0x29, 0x0a, 0x17, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, - 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x02, 0x1a, 0x0c, - 0x8a, 0x9d, 0x20, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x19, - 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, - 0x4e, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x03, 0x1a, 0x0e, 0x8a, 0x9d, 0x20, - 0x0a, 0x55, 0x6e, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x15, 0x44, - 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, - 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x46, 0x61, 0x69, 0x6c, - 0x65, 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0x96, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0c, - 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, - 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x29, + 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x79, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x65, + 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x37, 0x0a, 0x06, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x2a, 0xc3, 0x01, + 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, + 0x79, 0x12, 0x31, 0x0a, 0x1c, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, + 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x1a, 0x0f, 0x8a, 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x18, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, + 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, + 0x10, 0x01, 0x1a, 0x0b, 0x8a, 0x9d, 0x20, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x12, + 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, + 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x49, 0x4e, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x09, 0x8a, 0x9d, 0x20, + 0x05, 0x4d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, + 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, + 0x10, 0x03, 0x1a, 0x09, 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x61, 0x6a, 0x6f, 0x72, 0x1a, 0x04, 0x88, + 0xa3, 0x1e, 0x00, 0x2a, 0xe6, 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x27, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x4f, 0x54, 0x45, 0x10, + 0x00, 0x1a, 0x0b, 0x8a, 0x9d, 0x20, 0x07, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x25, + 0x0a, 0x15, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, + 0x5f, 0x56, 0x4f, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x56, + 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x17, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, + 0x10, 0x02, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, + 0x12, 0x2d, 0x0a, 0x19, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x03, 0x1a, + 0x0e, 0x8a, 0x9d, 0x20, 0x0a, 0x55, 0x6e, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, + 0x25, 0x0a, 0x15, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, + 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0x96, 0x01, 0x0a, + 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, + 0x74, 0x65, 0x42, 0x0c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, + 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3238,12 +3479,13 @@ var file_layer_dispute_dispute_proto_depIdxs = []int32{ 5, // 3: layer.dispute.Dispute.disputeEndTime:type_name -> google.protobuf.Timestamp 3, // 4: layer.dispute.Dispute.reportEvidence:type_name -> layer.dispute.MicroReport 4, // 5: layer.dispute.Dispute.feePayers:type_name -> layer.dispute.PayerInfo - 6, // 6: layer.dispute.PayerInfo.amount:type_name -> cosmos.base.v1beta1.Coin - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 5, // 6: layer.dispute.MicroReport.timestamp:type_name -> google.protobuf.Timestamp + 6, // 7: layer.dispute.PayerInfo.amount:type_name -> cosmos.base.v1beta1.Coin + 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_layer_dispute_dispute_proto_init() } diff --git a/api/layer/oracle/params.pulsar.go b/api/layer/oracle/params.pulsar.go index ab081996a..95441bd65 100644 --- a/api/layer/oracle/params.pulsar.go +++ b/api/layer/oracle/params.pulsar.go @@ -623,27 +623,27 @@ var file_layer_oracle_params_proto_rawDesc = []byte{ 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x5f, 0x6c, - 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6e, 0x0a, 0x0e, 0x6d, 0x69, - 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, - 0x74, 0xf2, 0xde, 0x1f, 0x17, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x73, - 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd2, 0xb4, 0x2d, 0x0a, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x53, - 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, - 0x42, 0x8f, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x01, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x5f, 0x6c, + 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6e, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x46, 0xc8, 0xde, + 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, + 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xf2, 0xde, 0x1f, 0x17, 0x79, + 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0x8f, 0x01, 0x0a, 0x10, 0x63, + 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, + 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, + 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/user_tip.pulsar.go b/api/layer/oracle/user_tip.pulsar.go index 1587803f5..33e767837 100644 --- a/api/layer/oracle/user_tip.pulsar.go +++ b/api/layer/oracle/user_tip.pulsar.go @@ -2,7 +2,7 @@ package oracle import ( - v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" @@ -99,8 +99,8 @@ func (x *fastReflection_UserTipTotal) Range(f func(protoreflect.FieldDescriptor, return } } - if x.Total != nil { - value := protoreflect.ValueOfMessage(x.Total.ProtoReflect()) + if x.Total != "" { + value := protoreflect.ValueOfString(x.Total) if !f(fd_UserTipTotal_total, value) { return } @@ -123,7 +123,7 @@ func (x *fastReflection_UserTipTotal) Has(fd protoreflect.FieldDescriptor) bool case "layer.oracle.UserTipTotal.address": return x.Address != "" case "layer.oracle.UserTipTotal.total": - return x.Total != nil + return x.Total != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.UserTipTotal")) @@ -143,7 +143,7 @@ func (x *fastReflection_UserTipTotal) Clear(fd protoreflect.FieldDescriptor) { case "layer.oracle.UserTipTotal.address": x.Address = "" case "layer.oracle.UserTipTotal.total": - x.Total = nil + x.Total = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.UserTipTotal")) @@ -165,7 +165,7 @@ func (x *fastReflection_UserTipTotal) Get(descriptor protoreflect.FieldDescripto return protoreflect.ValueOfString(value) case "layer.oracle.UserTipTotal.total": value := x.Total - return protoreflect.ValueOfMessage(value.ProtoReflect()) + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.UserTipTotal")) @@ -189,7 +189,7 @@ func (x *fastReflection_UserTipTotal) Set(fd protoreflect.FieldDescriptor, value case "layer.oracle.UserTipTotal.address": x.Address = value.Interface().(string) case "layer.oracle.UserTipTotal.total": - x.Total = value.Message().Interface().(*v1beta1.Coin) + x.Total = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.UserTipTotal")) @@ -210,13 +210,10 @@ func (x *fastReflection_UserTipTotal) Set(fd protoreflect.FieldDescriptor, value // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_UserTipTotal) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.oracle.UserTipTotal.total": - if x.Total == nil { - x.Total = new(v1beta1.Coin) - } - return protoreflect.ValueOfMessage(x.Total.ProtoReflect()) case "layer.oracle.UserTipTotal.address": panic(fmt.Errorf("field address of message layer.oracle.UserTipTotal is not mutable")) + case "layer.oracle.UserTipTotal.total": + panic(fmt.Errorf("field total of message layer.oracle.UserTipTotal is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.UserTipTotal")) @@ -233,8 +230,7 @@ func (x *fastReflection_UserTipTotal) NewField(fd protoreflect.FieldDescriptor) case "layer.oracle.UserTipTotal.address": return protoreflect.ValueOfString("") case "layer.oracle.UserTipTotal.total": - m := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.UserTipTotal")) @@ -308,8 +304,8 @@ func (x *fastReflection_UserTipTotal) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Total != nil { - l = options.Size(x.Total) + l = len(x.Total) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -341,17 +337,10 @@ func (x *fastReflection_UserTipTotal) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Total != nil { - encoded, err := options.Marshal(x.Total) - 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))) + if len(x.Total) > 0 { + i -= len(x.Total) + copy(dAtA[i:], x.Total) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Total))) i-- dAtA[i] = 0x12 } @@ -447,7 +436,7 @@ func (x *fastReflection_UserTipTotal) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -457,27 +446,23 @@ func (x *fastReflection_UserTipTotal) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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 } - if x.Total == nil { - x.Total = &v1beta1.Coin{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Total); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Total = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -532,8 +517,8 @@ type UserTipTotal struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Total *v1beta1.Coin `protobuf:"bytes,2,opt,name=total,proto3" json:"total,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Total string `protobuf:"bytes,2,opt,name=total,proto3" json:"total,omitempty"` } func (x *UserTipTotal) Reset() { @@ -563,11 +548,11 @@ func (x *UserTipTotal) GetAddress() string { return "" } -func (x *UserTipTotal) GetTotal() *v1beta1.Coin { +func (x *UserTipTotal) GetTotal() string { if x != nil { return x.Total } - return nil + return "" } var File_layer_oracle_user_tip_proto protoreflect.FileDescriptor @@ -575,30 +560,30 @@ var File_layer_oracle_user_tip_proto protoreflect.FileDescriptor var file_layer_oracle_user_tip_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x74, 0x69, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 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, 0x22, 0x79, 0x0a, 0x0c, - 0x55, 0x73, 0x65, 0x72, 0x54, 0x69, 0x70, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x32, 0x0a, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x12, 0x35, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x55, 0x73, - 0x65, 0x72, 0x54, 0x69, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, - 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, - 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 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, 0x22, 0x85, 0x01, 0x0a, + 0x0c, 0x55, 0x73, 0x65, 0x72, 0x54, 0x69, 0x70, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x32, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x41, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x54, + 0x69, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, + 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, + 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -616,15 +601,13 @@ func file_layer_oracle_user_tip_proto_rawDescGZIP() []byte { var file_layer_oracle_user_tip_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_layer_oracle_user_tip_proto_goTypes = []interface{}{ (*UserTipTotal)(nil), // 0: layer.oracle.UserTipTotal - (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_layer_oracle_user_tip_proto_depIdxs = []int32{ - 1, // 0: layer.oracle.UserTipTotal.total:type_name -> cosmos.base.v1beta1.Coin - 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 + 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_layer_oracle_user_tip_proto_init() } diff --git a/api/layer/registry/data_spec.pulsar.go b/api/layer/registry/data_spec.pulsar.go index b8c4ec423..61671c58f 100644 --- a/api/layer/registry/data_spec.pulsar.go +++ b/api/layer/registry/data_spec.pulsar.go @@ -70,7 +70,7 @@ func (x *_ABIComponent_3_list) IsValid() bool { var ( md_ABIComponent protoreflect.MessageDescriptor fd_ABIComponent_name protoreflect.FieldDescriptor - fd_ABIComponent_type protoreflect.FieldDescriptor + fd_ABIComponent_field_type protoreflect.FieldDescriptor fd_ABIComponent_nested_component protoreflect.FieldDescriptor ) @@ -78,7 +78,7 @@ func init() { file_layer_registry_data_spec_proto_init() md_ABIComponent = File_layer_registry_data_spec_proto.Messages().ByName("ABIComponent") fd_ABIComponent_name = md_ABIComponent.Fields().ByName("name") - fd_ABIComponent_type = md_ABIComponent.Fields().ByName("type") + fd_ABIComponent_field_type = md_ABIComponent.Fields().ByName("field_type") fd_ABIComponent_nested_component = md_ABIComponent.Fields().ByName("nested_component") } @@ -153,9 +153,9 @@ func (x *fastReflection_ABIComponent) Range(f func(protoreflect.FieldDescriptor, return } } - if x.Type_ != "" { - value := protoreflect.ValueOfString(x.Type_) - if !f(fd_ABIComponent_type, value) { + if x.FieldType != "" { + value := protoreflect.ValueOfString(x.FieldType) + if !f(fd_ABIComponent_field_type, value) { return } } @@ -182,8 +182,8 @@ func (x *fastReflection_ABIComponent) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "layer.registry.ABIComponent.name": return x.Name != "" - case "layer.registry.ABIComponent.type": - return x.Type_ != "" + case "layer.registry.ABIComponent.field_type": + return x.FieldType != "" case "layer.registry.ABIComponent.nested_component": return len(x.NestedComponent) != 0 default: @@ -204,8 +204,8 @@ func (x *fastReflection_ABIComponent) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "layer.registry.ABIComponent.name": x.Name = "" - case "layer.registry.ABIComponent.type": - x.Type_ = "" + case "layer.registry.ABIComponent.field_type": + x.FieldType = "" case "layer.registry.ABIComponent.nested_component": x.NestedComponent = nil default: @@ -227,8 +227,8 @@ func (x *fastReflection_ABIComponent) Get(descriptor protoreflect.FieldDescripto case "layer.registry.ABIComponent.name": value := x.Name return protoreflect.ValueOfString(value) - case "layer.registry.ABIComponent.type": - value := x.Type_ + case "layer.registry.ABIComponent.field_type": + value := x.FieldType return protoreflect.ValueOfString(value) case "layer.registry.ABIComponent.nested_component": if len(x.NestedComponent) == 0 { @@ -258,8 +258,8 @@ func (x *fastReflection_ABIComponent) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "layer.registry.ABIComponent.name": x.Name = value.Interface().(string) - case "layer.registry.ABIComponent.type": - x.Type_ = value.Interface().(string) + case "layer.registry.ABIComponent.field_type": + x.FieldType = value.Interface().(string) case "layer.registry.ABIComponent.nested_component": lv := value.List() clv := lv.(*_ABIComponent_3_list) @@ -292,8 +292,8 @@ func (x *fastReflection_ABIComponent) Mutable(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfList(value) case "layer.registry.ABIComponent.name": panic(fmt.Errorf("field name of message layer.registry.ABIComponent is not mutable")) - case "layer.registry.ABIComponent.type": - panic(fmt.Errorf("field type of message layer.registry.ABIComponent is not mutable")) + case "layer.registry.ABIComponent.field_type": + panic(fmt.Errorf("field field_type of message layer.registry.ABIComponent is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.registry.ABIComponent")) @@ -309,7 +309,7 @@ func (x *fastReflection_ABIComponent) NewField(fd protoreflect.FieldDescriptor) switch fd.FullName() { case "layer.registry.ABIComponent.name": return protoreflect.ValueOfString("") - case "layer.registry.ABIComponent.type": + case "layer.registry.ABIComponent.field_type": return protoreflect.ValueOfString("") case "layer.registry.ABIComponent.nested_component": list := []*ABIComponent{} @@ -387,7 +387,7 @@ func (x *fastReflection_ABIComponent) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Type_) + l = len(x.FieldType) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -442,10 +442,10 @@ func (x *fastReflection_ABIComponent) ProtoMethods() *protoiface.Methods { dAtA[i] = 0x1a } } - if len(x.Type_) > 0 { - i -= len(x.Type_) - copy(dAtA[i:], x.Type_) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Type_))) + if len(x.FieldType) > 0 { + i -= len(x.FieldType) + copy(dAtA[i:], x.FieldType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FieldType))) i-- dAtA[i] = 0x12 } @@ -539,7 +539,7 @@ func (x *fastReflection_ABIComponent) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Type_", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FieldType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -567,7 +567,7 @@ func (x *fastReflection_ABIComponent) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Type_ = string(dAtA[iNdEx:postIndex]) + x.FieldType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -1489,7 +1489,7 @@ type ABIComponent struct { // name Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // type - Type_ string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + FieldType string `protobuf:"bytes,2,opt,name=field_type,json=fieldType,proto3" json:"field_type,omitempty"` // consider taking this recursion out and make it once only NestedComponent []*ABIComponent `protobuf:"bytes,3,rep,name=nested_component,json=nestedComponent,proto3" json:"nested_component,omitempty"` } @@ -1521,9 +1521,9 @@ func (x *ABIComponent) GetName() string { return "" } -func (x *ABIComponent) GetType_() string { +func (x *ABIComponent) GetFieldType() string { if x != nil { - return x.Type_ + return x.FieldType } return "" } @@ -1634,48 +1634,49 @@ var file_layer_registry_data_spec_proto_rawDesc = []byte{ 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7f, 0x0a, 0x0c, 0x41, 0x42, 0x49, 0x43, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x10, - 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x41, 0x42, 0x49, 0x43, 0x6f, 0x6d, 0x70, 0x6f, - 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, - 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, 0xe7, 0x02, 0x0a, 0x08, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, - 0x65, 0x63, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x61, 0x62, 0x69, 0x5f, 0x63, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x2e, 0x41, 0x42, 0x49, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, - 0x62, 0x69, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x12, - 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x72, 0x18, 0x05, 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, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x61, 0x72, 0x12, 0x5a, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x62, 0x75, - 0x66, 0x66, 0x65, 0x72, 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, - 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x42, - 0x9d, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x0d, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, - 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, - 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8a, 0x01, 0x0a, 0x0c, 0x41, 0x42, 0x49, 0x43, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x10, 0x6e, 0x65, 0x73, 0x74, + 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x2e, 0x41, 0x42, 0x49, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x52, 0x0f, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x22, 0xe7, 0x02, 0x0a, 0x08, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, 0x12, 0x23, + 0x0a, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x11, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x61, 0x62, 0x69, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x41, 0x42, 0x49, + 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x0d, 0x61, 0x62, 0x69, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x67, 0x67, 0x72, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x61, 0x72, 0x18, 0x05, 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, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x72, 0x12, + 0x5a, 0x0a, 0x14, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, + 0x5f, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, + 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x42, + 0x75, 0x66, 0x66, 0x65, 0x72, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x42, 0x9d, 0x01, 0x0a, 0x12, + 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x42, 0x0d, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/token_origin.pulsar.go b/api/layer/reporter/token_origin.pulsar.go index ff31faeee..20ce924d5 100644 --- a/api/layer/reporter/token_origin.pulsar.go +++ b/api/layer/reporter/token_origin.pulsar.go @@ -499,6 +499,1048 @@ func (x *fastReflection_TokenOrigin) ProtoMethods() *protoiface.Methods { } } +var ( + md_TokenOriginInfo protoreflect.MessageDescriptor + fd_TokenOriginInfo_delegator_address protoreflect.FieldDescriptor + fd_TokenOriginInfo_validator_address protoreflect.FieldDescriptor + fd_TokenOriginInfo_amount protoreflect.FieldDescriptor +) + +func init() { + file_layer_reporter_token_origin_proto_init() + md_TokenOriginInfo = File_layer_reporter_token_origin_proto.Messages().ByName("TokenOriginInfo") + fd_TokenOriginInfo_delegator_address = md_TokenOriginInfo.Fields().ByName("delegator_address") + fd_TokenOriginInfo_validator_address = md_TokenOriginInfo.Fields().ByName("validator_address") + fd_TokenOriginInfo_amount = md_TokenOriginInfo.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_TokenOriginInfo)(nil) + +type fastReflection_TokenOriginInfo TokenOriginInfo + +func (x *TokenOriginInfo) ProtoReflect() protoreflect.Message { + return (*fastReflection_TokenOriginInfo)(x) +} + +func (x *TokenOriginInfo) slowProtoReflect() protoreflect.Message { + mi := &file_layer_reporter_token_origin_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_TokenOriginInfo_messageType fastReflection_TokenOriginInfo_messageType +var _ protoreflect.MessageType = fastReflection_TokenOriginInfo_messageType{} + +type fastReflection_TokenOriginInfo_messageType struct{} + +func (x fastReflection_TokenOriginInfo_messageType) Zero() protoreflect.Message { + return (*fastReflection_TokenOriginInfo)(nil) +} +func (x fastReflection_TokenOriginInfo_messageType) New() protoreflect.Message { + return new(fastReflection_TokenOriginInfo) +} +func (x fastReflection_TokenOriginInfo_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_TokenOriginInfo +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_TokenOriginInfo) Descriptor() protoreflect.MessageDescriptor { + return md_TokenOriginInfo +} + +// 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_TokenOriginInfo) Type() protoreflect.MessageType { + return _fastReflection_TokenOriginInfo_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_TokenOriginInfo) New() protoreflect.Message { + return new(fastReflection_TokenOriginInfo) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_TokenOriginInfo) Interface() protoreflect.ProtoMessage { + return (*TokenOriginInfo)(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_TokenOriginInfo) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_TokenOriginInfo_delegator_address, value) { + return + } + } + if x.ValidatorAddress != "" { + value := protoreflect.ValueOfString(x.ValidatorAddress) + if !f(fd_TokenOriginInfo_validator_address, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_TokenOriginInfo_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_TokenOriginInfo) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "layer.reporter.TokenOriginInfo.delegator_address": + return x.DelegatorAddress != "" + case "layer.reporter.TokenOriginInfo.validator_address": + return x.ValidatorAddress != "" + case "layer.reporter.TokenOriginInfo.amount": + return x.Amount != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOriginInfo")) + } + panic(fmt.Errorf("message layer.reporter.TokenOriginInfo 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_TokenOriginInfo) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "layer.reporter.TokenOriginInfo.delegator_address": + x.DelegatorAddress = "" + case "layer.reporter.TokenOriginInfo.validator_address": + x.ValidatorAddress = "" + case "layer.reporter.TokenOriginInfo.amount": + x.Amount = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOriginInfo")) + } + panic(fmt.Errorf("message layer.reporter.TokenOriginInfo 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_TokenOriginInfo) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "layer.reporter.TokenOriginInfo.delegator_address": + value := x.DelegatorAddress + return protoreflect.ValueOfString(value) + case "layer.reporter.TokenOriginInfo.validator_address": + value := x.ValidatorAddress + return protoreflect.ValueOfString(value) + case "layer.reporter.TokenOriginInfo.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOriginInfo")) + } + panic(fmt.Errorf("message layer.reporter.TokenOriginInfo 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_TokenOriginInfo) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "layer.reporter.TokenOriginInfo.delegator_address": + x.DelegatorAddress = value.Interface().(string) + case "layer.reporter.TokenOriginInfo.validator_address": + x.ValidatorAddress = value.Interface().(string) + case "layer.reporter.TokenOriginInfo.amount": + x.Amount = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOriginInfo")) + } + panic(fmt.Errorf("message layer.reporter.TokenOriginInfo 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_TokenOriginInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.reporter.TokenOriginInfo.delegator_address": + panic(fmt.Errorf("field delegator_address of message layer.reporter.TokenOriginInfo is not mutable")) + case "layer.reporter.TokenOriginInfo.validator_address": + panic(fmt.Errorf("field validator_address of message layer.reporter.TokenOriginInfo is not mutable")) + case "layer.reporter.TokenOriginInfo.amount": + panic(fmt.Errorf("field amount of message layer.reporter.TokenOriginInfo is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOriginInfo")) + } + panic(fmt.Errorf("message layer.reporter.TokenOriginInfo 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_TokenOriginInfo) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.reporter.TokenOriginInfo.delegator_address": + return protoreflect.ValueOfString("") + case "layer.reporter.TokenOriginInfo.validator_address": + return protoreflect.ValueOfString("") + case "layer.reporter.TokenOriginInfo.amount": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOriginInfo")) + } + panic(fmt.Errorf("message layer.reporter.TokenOriginInfo 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_TokenOriginInfo) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.TokenOriginInfo", 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_TokenOriginInfo) 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_TokenOriginInfo) 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_TokenOriginInfo) 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_TokenOriginInfo) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*TokenOriginInfo) + 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.DelegatorAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ValidatorAddress) + 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().(*TokenOriginInfo) + 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] = 0x1a + } + if len(x.ValidatorAddress) > 0 { + i -= len(x.ValidatorAddress) + copy(dAtA[i:], x.ValidatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) + 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().(*TokenOriginInfo) + 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: TokenOriginInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TokenOriginInfo: 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 DelegatorAddress", 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.DelegatorAddress = 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 ValidatorAddress", 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.ValidatorAddress = 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 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, + } +} + +var _ protoreflect.List = (*_DelegationsPreUpdate_1_list)(nil) + +type _DelegationsPreUpdate_1_list struct { + list *[]*TokenOriginInfo +} + +func (x *_DelegationsPreUpdate_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_DelegationsPreUpdate_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_DelegationsPreUpdate_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*TokenOriginInfo) + (*x.list)[i] = concreteValue +} + +func (x *_DelegationsPreUpdate_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*TokenOriginInfo) + *x.list = append(*x.list, concreteValue) +} + +func (x *_DelegationsPreUpdate_1_list) AppendMutable() protoreflect.Value { + v := new(TokenOriginInfo) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_DelegationsPreUpdate_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_DelegationsPreUpdate_1_list) NewElement() protoreflect.Value { + v := new(TokenOriginInfo) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_DelegationsPreUpdate_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_DelegationsPreUpdate protoreflect.MessageDescriptor + fd_DelegationsPreUpdate_token_origins protoreflect.FieldDescriptor +) + +func init() { + file_layer_reporter_token_origin_proto_init() + md_DelegationsPreUpdate = File_layer_reporter_token_origin_proto.Messages().ByName("DelegationsPreUpdate") + fd_DelegationsPreUpdate_token_origins = md_DelegationsPreUpdate.Fields().ByName("token_origins") +} + +var _ protoreflect.Message = (*fastReflection_DelegationsPreUpdate)(nil) + +type fastReflection_DelegationsPreUpdate DelegationsPreUpdate + +func (x *DelegationsPreUpdate) ProtoReflect() protoreflect.Message { + return (*fastReflection_DelegationsPreUpdate)(x) +} + +func (x *DelegationsPreUpdate) slowProtoReflect() protoreflect.Message { + mi := &file_layer_reporter_token_origin_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_DelegationsPreUpdate_messageType fastReflection_DelegationsPreUpdate_messageType +var _ protoreflect.MessageType = fastReflection_DelegationsPreUpdate_messageType{} + +type fastReflection_DelegationsPreUpdate_messageType struct{} + +func (x fastReflection_DelegationsPreUpdate_messageType) Zero() protoreflect.Message { + return (*fastReflection_DelegationsPreUpdate)(nil) +} +func (x fastReflection_DelegationsPreUpdate_messageType) New() protoreflect.Message { + return new(fastReflection_DelegationsPreUpdate) +} +func (x fastReflection_DelegationsPreUpdate_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_DelegationsPreUpdate +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_DelegationsPreUpdate) Descriptor() protoreflect.MessageDescriptor { + return md_DelegationsPreUpdate +} + +// 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_DelegationsPreUpdate) Type() protoreflect.MessageType { + return _fastReflection_DelegationsPreUpdate_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_DelegationsPreUpdate) New() protoreflect.Message { + return new(fastReflection_DelegationsPreUpdate) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_DelegationsPreUpdate) Interface() protoreflect.ProtoMessage { + return (*DelegationsPreUpdate)(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_DelegationsPreUpdate) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.TokenOrigins) != 0 { + value := protoreflect.ValueOfList(&_DelegationsPreUpdate_1_list{list: &x.TokenOrigins}) + if !f(fd_DelegationsPreUpdate_token_origins, 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_DelegationsPreUpdate) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "layer.reporter.DelegationsPreUpdate.token_origins": + return len(x.TokenOrigins) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + } + panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate 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_DelegationsPreUpdate) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "layer.reporter.DelegationsPreUpdate.token_origins": + x.TokenOrigins = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + } + panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate 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_DelegationsPreUpdate) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "layer.reporter.DelegationsPreUpdate.token_origins": + if len(x.TokenOrigins) == 0 { + return protoreflect.ValueOfList(&_DelegationsPreUpdate_1_list{}) + } + listValue := &_DelegationsPreUpdate_1_list{list: &x.TokenOrigins} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + } + panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate 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_DelegationsPreUpdate) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "layer.reporter.DelegationsPreUpdate.token_origins": + lv := value.List() + clv := lv.(*_DelegationsPreUpdate_1_list) + x.TokenOrigins = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + } + panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate 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_DelegationsPreUpdate) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.reporter.DelegationsPreUpdate.token_origins": + if x.TokenOrigins == nil { + x.TokenOrigins = []*TokenOriginInfo{} + } + value := &_DelegationsPreUpdate_1_list{list: &x.TokenOrigins} + return protoreflect.ValueOfList(value) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + } + panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate 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_DelegationsPreUpdate) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.reporter.DelegationsPreUpdate.token_origins": + list := []*TokenOriginInfo{} + return protoreflect.ValueOfList(&_DelegationsPreUpdate_1_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + } + panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate 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_DelegationsPreUpdate) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.DelegationsPreUpdate", 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_DelegationsPreUpdate) 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_DelegationsPreUpdate) 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_DelegationsPreUpdate) 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_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*DelegationsPreUpdate) + 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.TokenOrigins) > 0 { + for _, e := range x.TokenOrigins { + 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().(*DelegationsPreUpdate) + 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.TokenOrigins) > 0 { + for iNdEx := len(x.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.TokenOrigins[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().(*DelegationsPreUpdate) + 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: DelegationsPreUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DelegationsPreUpdate: 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 TokenOrigins", 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.TokenOrigins = append(x.TokenOrigins, &TokenOriginInfo{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TokenOrigins[len(x.TokenOrigins)-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 @@ -558,6 +1600,94 @@ func (x *TokenOrigin) GetAmount() string { return "" } +type TokenOriginInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *TokenOriginInfo) Reset() { + *x = TokenOriginInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_reporter_token_origin_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TokenOriginInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TokenOriginInfo) ProtoMessage() {} + +// Deprecated: Use TokenOriginInfo.ProtoReflect.Descriptor instead. +func (*TokenOriginInfo) Descriptor() ([]byte, []int) { + return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{1} +} + +func (x *TokenOriginInfo) GetDelegatorAddress() string { + if x != nil { + return x.DelegatorAddress + } + return "" +} + +func (x *TokenOriginInfo) GetValidatorAddress() string { + if x != nil { + return x.ValidatorAddress + } + return "" +} + +func (x *TokenOriginInfo) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +// reporter's snapshot of delegators' sources pre unbonding +type DelegationsPreUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // token_origin is the origin of the tokens that are about to be updated + TokenOrigins []*TokenOriginInfo `protobuf:"bytes,1,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` +} + +func (x *DelegationsPreUpdate) Reset() { + *x = DelegationsPreUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_reporter_token_origin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DelegationsPreUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DelegationsPreUpdate) ProtoMessage() {} + +// Deprecated: Use DelegationsPreUpdate.ProtoReflect.Descriptor instead. +func (*DelegationsPreUpdate) Descriptor() ([]byte, []int) { + return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{2} +} + +func (x *DelegationsPreUpdate) GetTokenOrigins() []*TokenOriginInfo { + if x != nil { + return x.TokenOrigins + } + return nil +} + var File_layer_reporter_token_origin_proto protoreflect.FileDescriptor var file_layer_reporter_token_origin_proto_rawDesc = []byte{ @@ -576,18 +1706,39 @@ var file_layer_reporter_token_origin_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, - 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xa0, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, - 0x10, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xed, 0x01, 0x0a, 0x0f, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x45, 0x0a, 0x11, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 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, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, + 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, + 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, + 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5c, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x12, 0x44, 0x0a, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x42, 0xa0, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x10, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, + 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -602,16 +1753,19 @@ func file_layer_reporter_token_origin_proto_rawDescGZIP() []byte { return file_layer_reporter_token_origin_proto_rawDescData } -var file_layer_reporter_token_origin_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_layer_reporter_token_origin_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_layer_reporter_token_origin_proto_goTypes = []interface{}{ - (*TokenOrigin)(nil), // 0: layer.reporter.TokenOrigin + (*TokenOrigin)(nil), // 0: layer.reporter.TokenOrigin + (*TokenOriginInfo)(nil), // 1: layer.reporter.TokenOriginInfo + (*DelegationsPreUpdate)(nil), // 2: layer.reporter.DelegationsPreUpdate } var file_layer_reporter_token_origin_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 + 1, // 0: layer.reporter.DelegationsPreUpdate.token_origins:type_name -> layer.reporter.TokenOriginInfo + 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_layer_reporter_token_origin_proto_init() } @@ -632,6 +1786,30 @@ func file_layer_reporter_token_origin_proto_init() { return nil } } + file_layer_reporter_token_origin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TokenOriginInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_layer_reporter_token_origin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DelegationsPreUpdate); 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{ @@ -639,7 +1817,7 @@ func file_layer_reporter_token_origin_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_reporter_token_origin_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/layer/oracle/params.proto b/proto/layer/oracle/params.proto index e25f3447a..e0b669be3 100644 --- a/proto/layer/oracle/params.proto +++ b/proto/layer/oracle/params.proto @@ -9,7 +9,7 @@ option go_package = "github.com/tellor-io/layer/x/oracle/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - repeated string cycle_list = 1 [(gogoproto.nullable) = false]; + repeated string cycle_list = 1; string minStakeAmount = 2 [ (gogoproto.moretags) = "yaml:\"min_stake_amount\"", diff --git a/proto/layer/registry/data_spec.proto b/proto/layer/registry/data_spec.proto index 2fec5761e..907c258b9 100644 --- a/proto/layer/registry/data_spec.proto +++ b/proto/layer/registry/data_spec.proto @@ -13,7 +13,7 @@ message ABIComponent { // name string name = 1; // type - string type = 2; + string field_type = 2; // consider taking this recursion out and make it once only repeated ABIComponent nested_component = 3; } diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index 0b5df7fdb..967bbb97a 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -316,10 +316,11 @@ func (s *IntegrationTestSuite) createValidatorAccs(powers []int64) ([]sdk.AccAdd s.accountKeeper.SetAccount(s.ctx, &account) val, err := stakingtypes.NewValidator(valAddrs[i].String(), pk.PubKey(), stakingtypes.Description{}) s.NoError(err) - s.stakingKeeper.SetValidator(ctx, val) - s.stakingKeeper.SetValidatorByConsAddr(ctx, val) - s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val) - s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) + s.NoError(s.stakingKeeper.SetValidator(ctx, val)) + s.NoError(s.stakingKeeper.SetValidatorByConsAddr(ctx, val)) + s.NoError(s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val)) + _, err = s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) + s.NoError(err) // call hooks for distribution init valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) if err != nil { diff --git a/x/dispute/types/dispute.pb.go b/x/dispute/types/dispute.pb.go index e1cdfb4ea..3a557ddd6 100644 --- a/x/dispute/types/dispute.pb.go +++ b/x/dispute/types/dispute.pb.go @@ -232,12 +232,16 @@ func (m *Dispute) GetPrevDisputeIds() []uint64 { return nil } +// TODO: remove this duplicate type MicroReport struct { - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - QueryId string `protobuf:"bytes,3,opt,name=queryId,proto3" json:"queryId,omitempty"` - Value string `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + QueryType string `protobuf:"bytes,3,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + QueryId string `protobuf:"bytes,4,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + AggregateMethod string `protobuf:"bytes,5,opt,name=aggregate_method,json=aggregateMethod,proto3" json:"aggregate_method,omitempty"` + Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` + BlockNumber int64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + Timestamp time.Time `protobuf:"bytes,8,opt,name=timestamp,proto3,stdtime" json:"timestamp"` } func (m *MicroReport) Reset() { *m = MicroReport{} } @@ -287,6 +291,13 @@ func (m *MicroReport) GetPower() int64 { return 0 } +func (m *MicroReport) GetQueryType() string { + if m != nil { + return m.QueryType + } + return "" +} + func (m *MicroReport) GetQueryId() string { if m != nil { return m.QueryId @@ -294,6 +305,13 @@ func (m *MicroReport) GetQueryId() string { return "" } +func (m *MicroReport) GetAggregateMethod() string { + if m != nil { + return m.AggregateMethod + } + return "" +} + func (m *MicroReport) GetValue() string { if m != nil { return m.Value @@ -301,13 +319,20 @@ func (m *MicroReport) GetValue() string { return "" } -func (m *MicroReport) GetTimestamp() int64 { +func (m *MicroReport) GetBlockNumber() int64 { if m != nil { - return m.Timestamp + return m.BlockNumber } return 0 } +func (m *MicroReport) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + type PayerInfo struct { PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` @@ -379,66 +404,70 @@ func init() { func init() { proto.RegisterFile("layer/dispute/dispute.proto", fileDescriptor_2a5d4b70d69c78b5) } var fileDescriptor_2a5d4b70d69c78b5 = []byte{ - // 931 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x6f, 0xe2, 0x46, - 0x14, 0xc7, 0x81, 0xf0, 0x67, 0x48, 0x08, 0x1d, 0xed, 0x6e, 0x1d, 0x37, 0x22, 0x56, 0xa4, 0x6d, - 0xd9, 0xb4, 0xb1, 0x95, 0xf4, 0xd0, 0x4b, 0x2f, 0x10, 0x9c, 0xac, 0xdb, 0x04, 0xd0, 0x00, 0x59, - 0xb5, 0x97, 0xc8, 0xe0, 0x01, 0xdc, 0x35, 0x1e, 0x3a, 0x1e, 0xd3, 0xe6, 0xde, 0x43, 0x85, 0x54, - 0x69, 0xbf, 0x00, 0x87, 0xaa, 0x5f, 0xa1, 0xdf, 0xa0, 0x97, 0x3d, 0xae, 0x7a, 0xaa, 0x7a, 0xd8, - 0x56, 0x89, 0xd4, 0xcf, 0x51, 0xd9, 0x33, 0x40, 0x30, 0x7b, 0xc9, 0x9e, 0xe0, 0xf7, 0xde, 0xef, - 0x37, 0xfe, 0xbd, 0x37, 0x7e, 0xcf, 0xe0, 0x23, 0xd7, 0xba, 0xc1, 0x54, 0xb7, 0x1d, 0x7f, 0x1c, - 0x30, 0x3c, 0xff, 0xd5, 0xc6, 0x94, 0x30, 0x02, 0xb7, 0xa3, 0xa4, 0x26, 0x82, 0xca, 0xa3, 0x01, - 0x19, 0x90, 0x28, 0xa3, 0x87, 0xff, 0x38, 0x49, 0xd9, 0xed, 0x11, 0x7f, 0x44, 0xfc, 0x6b, 0x9e, - 0xe0, 0x40, 0xa4, 0xf6, 0x07, 0x84, 0x0c, 0x5c, 0xac, 0x47, 0xa8, 0x1b, 0xf4, 0x75, 0xe6, 0x8c, - 0xb0, 0xcf, 0xac, 0xd1, 0x58, 0x10, 0x4a, 0x9c, 0xae, 0x77, 0x2d, 0x1f, 0xeb, 0x93, 0xe3, 0x2e, - 0x66, 0xd6, 0xb1, 0xde, 0x23, 0x8e, 0xc7, 0xf3, 0x07, 0xbf, 0x66, 0x40, 0xa6, 0xc6, 0x9f, 0x0e, - 0x9f, 0x80, 0xf4, 0xd0, 0xf2, 0x87, 0xa6, 0x2d, 0x4b, 0xaa, 0x54, 0xde, 0x42, 0x02, 0xc1, 0x3d, - 0x90, 0x13, 0x06, 0x4d, 0x5b, 0xde, 0x50, 0xa5, 0x72, 0x0a, 0x2d, 0x03, 0xf0, 0x39, 0xd8, 0x11, - 0xe0, 0xd4, 0x62, 0x78, 0x40, 0xe8, 0x8d, 0x9c, 0x54, 0xa5, 0x72, 0xe1, 0xa4, 0xa4, 0xad, 0x14, - 0xa7, 0xd5, 0x56, 0x59, 0x28, 0x2e, 0x83, 0x5f, 0x03, 0x20, 0x42, 0x67, 0x18, 0xcb, 0x29, 0x55, - 0x2a, 0xe7, 0xaa, 0x9f, 0xbe, 0x7e, 0xbb, 0x9f, 0xf8, 0xfb, 0xed, 0xfe, 0x63, 0x5e, 0x87, 0x6f, - 0xbf, 0xd4, 0x1c, 0xa2, 0x8f, 0x2c, 0x36, 0xd4, 0x4c, 0x8f, 0xfd, 0xf9, 0xfb, 0x11, 0x10, 0xfd, - 0x30, 0x3d, 0x86, 0xee, 0xc9, 0x61, 0x15, 0x6c, 0x0b, 0xd4, 0x62, 0x16, 0x0b, 0x7c, 0x79, 0x33, - 0x32, 0xb5, 0xf7, 0x6e, 0x53, 0x9c, 0x83, 0x56, 0x25, 0xb0, 0x09, 0x8a, 0xcb, 0x00, 0x65, 0x6d, - 0x67, 0x84, 0xe5, 0xb4, 0x2a, 0x95, 0xf3, 0x27, 0x8a, 0xc6, 0x1b, 0xaf, 0xcd, 0x1b, 0xaf, 0xb5, - 0xe7, 0x8d, 0xaf, 0x66, 0x43, 0xcb, 0xaf, 0xfe, 0xd9, 0x97, 0xd0, 0x9a, 0x1a, 0x5e, 0x80, 0x82, - 0x88, 0x19, 0x9e, 0x1d, 0x9d, 0x97, 0x79, 0xc0, 0x79, 0x31, 0x2d, 0xfc, 0x0c, 0x7c, 0x70, 0xff, - 0x09, 0x55, 0x97, 0xf4, 0x5e, 0xca, 0x59, 0x55, 0x2a, 0x27, 0xd1, 0x7a, 0x02, 0x1e, 0x80, 0x2d, - 0x11, 0x44, 0x24, 0xf0, 0x6c, 0x39, 0x17, 0xdd, 0xe4, 0x4a, 0x0c, 0x5e, 0x82, 0xbc, 0xef, 0x5a, - 0xfe, 0xb0, 0x32, 0x22, 0x81, 0xc7, 0x64, 0xf0, 0xf0, 0x3b, 0xb8, 0xaf, 0x0f, 0x6f, 0xb4, 0x1b, - 0x50, 0x4f, 0x9c, 0x96, 0x7f, 0x8f, 0x1b, 0x5d, 0xca, 0xe1, 0x73, 0x50, 0xa0, 0x78, 0x4c, 0x28, - 0x33, 0x26, 0x8e, 0x8d, 0xbd, 0x1e, 0x96, 0xb7, 0x44, 0xef, 0x56, 0xaf, 0xf4, 0xd2, 0xe9, 0x51, - 0x82, 0x22, 0x66, 0x35, 0x15, 0x3e, 0x0c, 0xc5, 0x74, 0xf0, 0x4b, 0x90, 0xeb, 0x63, 0xdc, 0x0c, - 0x55, 0xbe, 0xbc, 0xad, 0x26, 0xcb, 0xf9, 0x13, 0x39, 0x76, 0x48, 0x94, 0x34, 0xbd, 0x3e, 0x11, - 0x47, 0x2c, 0x05, 0xf0, 0x1c, 0x64, 0xfb, 0x18, 0xb7, 0x09, 0xb3, 0x5c, 0xb9, 0xf0, 0xf0, 0x92, - 0x16, 0x62, 0xf8, 0x31, 0x28, 0x8c, 0x29, 0x9e, 0xd4, 0xe6, 0xa3, 0xe4, 0xcb, 0x3b, 0x6a, 0xb2, - 0x9c, 0x42, 0xb1, 0xe8, 0xc1, 0x2f, 0x12, 0xc8, 0xdf, 0x2b, 0x0a, 0x2a, 0x20, 0xcb, 0x0b, 0xc2, - 0x34, 0x9a, 0xd4, 0x1c, 0x5a, 0x60, 0xf8, 0x08, 0x6c, 0x8e, 0xc9, 0x0f, 0x98, 0x46, 0x73, 0x9a, - 0x44, 0x1c, 0x40, 0x19, 0x64, 0xbe, 0x0f, 0x30, 0xbd, 0x31, 0xed, 0x68, 0x36, 0x73, 0x68, 0x0e, - 0x43, 0xfe, 0xc4, 0x72, 0x03, 0x31, 0x6e, 0x88, 0x83, 0x70, 0xe2, 0x17, 0x8b, 0x24, 0x1a, 0x9c, - 0x24, 0x5a, 0x06, 0x0e, 0x7e, 0x92, 0x40, 0x6e, 0xd1, 0x9f, 0xf0, 0xb5, 0x1a, 0x87, 0xa0, 0x62, - 0xdb, 0x14, 0xfb, 0xbe, 0x70, 0xb4, 0x12, 0x83, 0x5f, 0x80, 0xb4, 0xc5, 0xdf, 0x81, 0x8d, 0xe8, - 0xca, 0x76, 0x35, 0xd1, 0x90, 0x70, 0x2d, 0x69, 0x62, 0x2d, 0x69, 0xa7, 0xc4, 0xf1, 0x44, 0xbb, - 0x05, 0x3d, 0x2c, 0xb5, 0x4f, 0xc9, 0xa8, 0x4a, 0x3c, 0xee, 0x3c, 0x8b, 0x16, 0xf8, 0xf0, 0x0f, - 0x09, 0xec, 0xc4, 0x76, 0x0a, 0x3c, 0x06, 0x7b, 0x35, 0xb3, 0xd5, 0xec, 0xb4, 0x8d, 0xeb, 0xd3, - 0x4a, 0xdb, 0x38, 0x6f, 0xa0, 0x6f, 0xae, 0x3b, 0xf5, 0x56, 0xd3, 0x38, 0x35, 0xcf, 0x4c, 0xa3, - 0x56, 0x4c, 0x28, 0x3b, 0xd3, 0x99, 0x9a, 0xef, 0x78, 0xfe, 0x18, 0xf7, 0x9c, 0xbe, 0x83, 0x6d, - 0xf8, 0x0c, 0xc8, 0x6b, 0x92, 0x17, 0x15, 0x54, 0x37, 0xeb, 0xe7, 0x45, 0x49, 0xc9, 0x4f, 0x67, - 0x6a, 0xe6, 0x85, 0x45, 0x3d, 0xc7, 0x1b, 0xc0, 0xa7, 0xe0, 0xc9, 0x1a, 0xf5, 0xd2, 0xac, 0x37, - 0x50, 0x71, 0x43, 0xc9, 0x4d, 0x67, 0xea, 0xe6, 0xa5, 0xe3, 0x11, 0xfa, 0x6e, 0x5a, 0xe5, 0xab, - 0x06, 0x2a, 0x26, 0x05, 0xcd, 0xfa, 0x8e, 0x50, 0x25, 0xf5, 0xf3, 0x6f, 0xa5, 0xc4, 0xe1, 0x7f, - 0x12, 0xd8, 0x5e, 0x59, 0x42, 0xf0, 0x93, 0xa5, 0xbc, 0xd5, 0xae, 0xb4, 0x3b, 0xad, 0xeb, 0x26, - 0x32, 0xae, 0x1a, 0x6d, 0xa3, 0x98, 0xe0, 0x76, 0x9a, 0x14, 0x4f, 0x08, 0xc3, 0xf0, 0x29, 0x78, - 0x1c, 0x23, 0x5e, 0x35, 0xda, 0xdc, 0x36, 0x98, 0xce, 0xd4, 0xf4, 0x15, 0x61, 0xa1, 0xeb, 0x67, - 0xe0, 0xc3, 0x18, 0x0d, 0x19, 0xad, 0xc6, 0xc5, 0x95, 0x51, 0x2b, 0x6e, 0x28, 0x5b, 0xd3, 0x99, - 0x9a, 0x45, 0xd8, 0x27, 0xee, 0x04, 0xdb, 0xf0, 0x08, 0xec, 0xc6, 0xa8, 0x9d, 0xfa, 0x82, 0x9c, - 0x54, 0x0a, 0xd3, 0x99, 0x0a, 0x3a, 0x1e, 0x9d, 0xd3, 0xd7, 0x0d, 0x9c, 0x55, 0xcc, 0x0b, 0xa3, - 0x56, 0x4c, 0x71, 0x03, 0x67, 0x96, 0xe3, 0x62, 0x9b, 0x17, 0x5a, 0xad, 0xbd, 0xbe, 0x2d, 0x49, - 0x6f, 0x6e, 0x4b, 0xd2, 0xbf, 0xb7, 0x25, 0xe9, 0xd5, 0x5d, 0x29, 0xf1, 0xe6, 0xae, 0x94, 0xf8, - 0xeb, 0xae, 0x94, 0xf8, 0xf6, 0x70, 0xe0, 0xb0, 0x61, 0xd0, 0xd5, 0x7a, 0x64, 0xa4, 0x33, 0xec, - 0xba, 0x84, 0x1e, 0x39, 0x44, 0xe7, 0x9f, 0xcd, 0x1f, 0x17, 0x1f, 0x4e, 0x76, 0x33, 0xc6, 0x7e, - 0x37, 0x1d, 0x2d, 0xc8, 0xcf, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc6, 0xa0, 0x11, 0xd2, 0x56, - 0x07, 0x00, 0x00, + // 996 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x72, 0x22, 0x45, + 0x1c, 0x66, 0x02, 0x9b, 0x30, 0x4d, 0x42, 0xb0, 0x6b, 0x77, 0x9d, 0x60, 0x24, 0x63, 0xaa, 0x56, + 0xd9, 0x68, 0x86, 0x4a, 0x3c, 0x78, 0xf1, 0x02, 0x61, 0x92, 0x1d, 0x4d, 0x80, 0x6a, 0x20, 0x5b, + 0x7a, 0xa1, 0x06, 0xa6, 0x81, 0x71, 0x99, 0xe9, 0xb1, 0xa7, 0x07, 0xcd, 0xdd, 0x83, 0xc5, 0x69, + 0x5f, 0x80, 0xc3, 0x96, 0xaf, 0xe0, 0x1b, 0x78, 0xd9, 0xe3, 0x96, 0x27, 0xcb, 0xc3, 0x6a, 0x25, + 0x55, 0x3e, 0x87, 0x35, 0xdd, 0x1d, 0x08, 0xb0, 0x07, 0xe3, 0x09, 0xbe, 0xaf, 0xbf, 0xaf, 0xfb, + 0xd7, 0xbf, 0x3f, 0x3d, 0xe0, 0x83, 0x91, 0x7d, 0x85, 0x69, 0xc9, 0x71, 0xc3, 0x20, 0x62, 0xf8, + 0xf6, 0xd7, 0x08, 0x28, 0x61, 0x04, 0x6e, 0xf1, 0x45, 0x43, 0x92, 0xf9, 0x42, 0x8f, 0x84, 0x1e, + 0x09, 0x4b, 0x5d, 0x3b, 0xc4, 0xa5, 0xf1, 0x51, 0x17, 0x33, 0xfb, 0xa8, 0xd4, 0x23, 0xae, 0x2f, + 0xe4, 0xf9, 0x1d, 0xb1, 0xde, 0xe1, 0xa8, 0x24, 0x80, 0x5c, 0x7a, 0x38, 0x20, 0x03, 0x22, 0xf8, + 0xf8, 0x9f, 0x64, 0xf7, 0x06, 0x84, 0x0c, 0x46, 0xb8, 0xc4, 0x51, 0x37, 0xea, 0x97, 0x98, 0xeb, + 0xe1, 0x90, 0xd9, 0x5e, 0x20, 0x04, 0xfb, 0xaf, 0x36, 0xc0, 0x46, 0x55, 0x9c, 0x0e, 0x1f, 0x83, + 0xf5, 0xa1, 0x1d, 0x0e, 0x2d, 0x47, 0x53, 0x74, 0xa5, 0xb8, 0x89, 0x24, 0x82, 0xbb, 0x40, 0x95, + 0x01, 0x5a, 0x8e, 0xb6, 0xa6, 0x2b, 0xc5, 0x14, 0x9a, 0x13, 0xf0, 0x19, 0xd8, 0x96, 0xe0, 0xc4, + 0x66, 0x78, 0x40, 0xe8, 0x95, 0x96, 0xd4, 0x95, 0x62, 0xf6, 0xb8, 0x60, 0x2c, 0x5c, 0xce, 0xa8, + 0x2e, 0xaa, 0xd0, 0xb2, 0x0d, 0x7e, 0x0d, 0x80, 0xa4, 0x4e, 0x31, 0xd6, 0x52, 0xba, 0x52, 0x54, + 0x2b, 0x9f, 0xbe, 0x7e, 0xbb, 0x97, 0xf8, 0xf3, 0xed, 0xde, 0x23, 0x71, 0xd9, 0xd0, 0x79, 0x61, + 0xb8, 0xa4, 0xe4, 0xd9, 0x6c, 0x68, 0x58, 0x3e, 0xfb, 0xfd, 0xd7, 0x43, 0x20, 0xb3, 0x60, 0xf9, + 0x0c, 0xdd, 0xb1, 0xc3, 0x0a, 0xd8, 0x92, 0xa8, 0xc9, 0x6c, 0x16, 0x85, 0xda, 0x03, 0x1e, 0xd4, + 0xee, 0xbb, 0x83, 0x12, 0x1a, 0xb4, 0x68, 0x81, 0x0d, 0x90, 0x9b, 0x13, 0x94, 0xb5, 0x5c, 0x0f, + 0x6b, 0xeb, 0xba, 0x52, 0xcc, 0x1c, 0xe7, 0x0d, 0x91, 0x58, 0xe3, 0x36, 0xb1, 0x46, 0xeb, 0x36, + 0xb1, 0x95, 0x74, 0x1c, 0xf2, 0xcb, 0xbf, 0xf6, 0x14, 0xb4, 0xe2, 0x86, 0xe7, 0x20, 0x2b, 0x39, + 0xd3, 0x77, 0xf8, 0x7e, 0x1b, 0xf7, 0xd8, 0x6f, 0xc9, 0x0b, 0x3f, 0x03, 0xef, 0xdd, 0x3d, 0xa1, + 0x32, 0x22, 0xbd, 0x17, 0x5a, 0x5a, 0x57, 0x8a, 0x49, 0xb4, 0xba, 0x00, 0xf7, 0xc1, 0xa6, 0x24, + 0x11, 0x89, 0x7c, 0x47, 0x53, 0x79, 0x25, 0x17, 0x38, 0x78, 0x01, 0x32, 0xe1, 0xc8, 0x0e, 0x87, + 0x65, 0x8f, 0x44, 0x3e, 0xd3, 0xc0, 0xfd, 0x6b, 0x70, 0xd7, 0x1f, 0x57, 0xb4, 0x1b, 0x51, 0x5f, + 0xee, 0x96, 0xf9, 0x1f, 0x15, 0x9d, 0xdb, 0xe1, 0x33, 0x90, 0xa5, 0x38, 0x20, 0x94, 0x99, 0x63, + 0xd7, 0xc1, 0x7e, 0x0f, 0x6b, 0x9b, 0x32, 0x77, 0x8b, 0x25, 0xbd, 0x70, 0x7b, 0x94, 0x20, 0xae, + 0xac, 0xa4, 0xe2, 0xc3, 0xd0, 0x92, 0x0f, 0x7e, 0x09, 0xd4, 0x3e, 0xc6, 0x8d, 0xd8, 0x15, 0x6a, + 0x5b, 0x7a, 0xb2, 0x98, 0x39, 0xd6, 0x96, 0x36, 0xe1, 0x8b, 0x96, 0xdf, 0x27, 0x72, 0x8b, 0xb9, + 0x01, 0x9e, 0x81, 0x74, 0x1f, 0xe3, 0x16, 0x61, 0xf6, 0x48, 0xcb, 0xde, 0xff, 0x4a, 0x33, 0x33, + 0xfc, 0x18, 0x64, 0x03, 0x8a, 0xc7, 0xd5, 0xdb, 0x51, 0x0a, 0xb5, 0x6d, 0x3d, 0x59, 0x4c, 0xa1, + 0x25, 0x76, 0xff, 0xd5, 0x1a, 0xc8, 0xdc, 0xb9, 0x14, 0xcc, 0x83, 0xb4, 0xb8, 0x10, 0xa6, 0x7c, + 0x52, 0x55, 0x34, 0xc3, 0xf0, 0x21, 0x78, 0x10, 0x90, 0x1f, 0x30, 0xe5, 0x73, 0x9a, 0x44, 0x02, + 0xc0, 0x0f, 0x01, 0xf8, 0x3e, 0xc2, 0xf4, 0xaa, 0xc3, 0xae, 0x02, 0xcc, 0xc7, 0x53, 0x45, 0x2a, + 0x67, 0x5a, 0x57, 0x01, 0x86, 0x3b, 0x20, 0x2d, 0x96, 0x5d, 0x47, 0x8c, 0x1d, 0xda, 0xe0, 0xd8, + 0x72, 0xe0, 0x53, 0x90, 0xb3, 0x07, 0x03, 0x8a, 0x07, 0x36, 0xc3, 0x1d, 0x0f, 0xb3, 0x21, 0x71, + 0xf8, 0x24, 0xa9, 0x68, 0x7b, 0xc6, 0x5f, 0x70, 0x3a, 0x3e, 0x7a, 0x6c, 0x8f, 0x22, 0x31, 0x22, + 0x2a, 0x12, 0x00, 0x7e, 0x04, 0x36, 0xbb, 0x71, 0xfb, 0x75, 0xfc, 0xc8, 0xeb, 0x62, 0xca, 0xfb, + 0x3d, 0x89, 0x32, 0x9c, 0xab, 0x71, 0x0a, 0x56, 0x80, 0x3a, 0x7b, 0x96, 0x78, 0xfb, 0xfe, 0xd7, + 0x79, 0x98, 0xdb, 0xf6, 0x7f, 0x52, 0x80, 0x3a, 0xab, 0x59, 0xdc, 0xea, 0x41, 0x0c, 0xca, 0x8e, + 0x43, 0x71, 0x18, 0xca, 0x2c, 0x2d, 0x70, 0xf0, 0x0b, 0xb0, 0x6e, 0x8b, 0xbe, 0x5c, 0xe3, 0x47, + 0xee, 0x18, 0xb2, 0x48, 0xf1, 0xe3, 0x6b, 0xc8, 0xc7, 0xd7, 0x38, 0x21, 0xae, 0x2f, 0x5b, 0x40, + 0xca, 0xe3, 0xf4, 0xf7, 0x29, 0xf1, 0x2a, 0xc4, 0x77, 0x78, 0x2a, 0xd3, 0x68, 0x86, 0x0f, 0x7e, + 0x53, 0xc0, 0xf6, 0xd2, 0x3b, 0x07, 0x8f, 0xc0, 0x6e, 0xd5, 0x6a, 0x36, 0xda, 0x2d, 0xb3, 0x73, + 0x52, 0x6e, 0x99, 0x67, 0x75, 0xf4, 0x4d, 0xa7, 0x5d, 0x6b, 0x36, 0xcc, 0x13, 0xeb, 0xd4, 0x32, + 0xab, 0xb9, 0x44, 0x7e, 0x7b, 0x32, 0xd5, 0x33, 0x6d, 0x3f, 0x0c, 0x70, 0xcf, 0xed, 0xbb, 0x38, + 0xce, 0xba, 0xb6, 0x62, 0x79, 0x5e, 0x46, 0x35, 0xab, 0x76, 0x96, 0x53, 0xf2, 0x99, 0xc9, 0x54, + 0xdf, 0x78, 0x6e, 0x53, 0xdf, 0xf5, 0x07, 0xf0, 0x09, 0x78, 0xbc, 0x22, 0xbd, 0xb0, 0x6a, 0x75, + 0x94, 0x5b, 0xcb, 0xab, 0x93, 0xa9, 0xfe, 0xe0, 0xc2, 0xf5, 0x09, 0x7d, 0xb7, 0xac, 0xfc, 0x55, + 0x1d, 0xe5, 0x92, 0x52, 0x66, 0x7f, 0x47, 0x68, 0x3e, 0xf5, 0xf3, 0x2f, 0x85, 0xc4, 0xc1, 0x3f, + 0x0a, 0xd8, 0x5a, 0x78, 0x18, 0xe1, 0x27, 0x73, 0x7b, 0xb3, 0x55, 0x6e, 0xb5, 0x9b, 0x9d, 0x06, + 0x32, 0x2f, 0xeb, 0x2d, 0x33, 0x97, 0x10, 0xe1, 0x34, 0x28, 0x1e, 0x13, 0x86, 0xe1, 0x13, 0xf0, + 0x68, 0x49, 0x78, 0x59, 0x6f, 0x89, 0xb0, 0xc1, 0x64, 0xaa, 0xaf, 0x5f, 0x12, 0x16, 0x47, 0xfd, + 0x14, 0xbc, 0xbf, 0x24, 0x43, 0x66, 0xb3, 0x7e, 0x7e, 0x69, 0x56, 0x73, 0x6b, 0xf9, 0xcd, 0xc9, + 0x54, 0x4f, 0x23, 0x1c, 0x92, 0xd1, 0x18, 0x3b, 0xf0, 0x10, 0xec, 0x2c, 0x49, 0xdb, 0xb5, 0x99, + 0x38, 0x99, 0xcf, 0x4e, 0xa6, 0x3a, 0x68, 0xfb, 0xf4, 0x56, 0xbe, 0x1a, 0xc0, 0x69, 0xd9, 0x3a, + 0x37, 0xab, 0xb9, 0x94, 0x08, 0xe0, 0xd4, 0x76, 0x47, 0xd8, 0x11, 0x17, 0xad, 0x54, 0x5f, 0x5f, + 0x17, 0x94, 0x37, 0xd7, 0x05, 0xe5, 0xef, 0xeb, 0x82, 0xf2, 0xf2, 0xa6, 0x90, 0x78, 0x73, 0x53, + 0x48, 0xfc, 0x71, 0x53, 0x48, 0x7c, 0x7b, 0x30, 0x70, 0xd9, 0x30, 0xea, 0x1a, 0x3d, 0xe2, 0x95, + 0x18, 0x1e, 0x8d, 0x08, 0x3d, 0x74, 0x49, 0x49, 0x7c, 0xca, 0x7f, 0x9c, 0x7d, 0xcc, 0xe3, 0x71, + 0x0a, 0xbb, 0xeb, 0xbc, 0x49, 0x3f, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x32, 0x1e, 0xd7, 0x49, + 0xea, 0x07, 0x00, 0x00, } func (m *Dispute) Marshal() (dAtA []byte, err error) { @@ -614,23 +643,45 @@ func (m *MicroReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Timestamp != 0 { - i = encodeVarintDispute(dAtA, i, uint64(m.Timestamp)) + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintDispute(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x42 + if m.BlockNumber != 0 { + i = encodeVarintDispute(dAtA, i, uint64(m.BlockNumber)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x38 } if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) i = encodeVarintDispute(dAtA, i, uint64(len(m.Value))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x32 + } + if len(m.AggregateMethod) > 0 { + i -= len(m.AggregateMethod) + copy(dAtA[i:], m.AggregateMethod) + i = encodeVarintDispute(dAtA, i, uint64(len(m.AggregateMethod))) + i-- + dAtA[i] = 0x2a } if len(m.QueryId) > 0 { i -= len(m.QueryId) copy(dAtA[i:], m.QueryId) i = encodeVarintDispute(dAtA, i, uint64(len(m.QueryId))) i-- + dAtA[i] = 0x22 + } + if len(m.QueryType) > 0 { + i -= len(m.QueryType) + copy(dAtA[i:], m.QueryType) + i = encodeVarintDispute(dAtA, i, uint64(len(m.QueryType))) + i-- dAtA[i] = 0x1a } if m.Power != 0 { @@ -777,17 +828,27 @@ func (m *MicroReport) Size() (n int) { if m.Power != 0 { n += 1 + sovDispute(uint64(m.Power)) } + l = len(m.QueryType) + if l > 0 { + n += 1 + l + sovDispute(uint64(l)) + } l = len(m.QueryId) if l > 0 { n += 1 + l + sovDispute(uint64(l)) } + l = len(m.AggregateMethod) + if l > 0 { + n += 1 + l + sovDispute(uint64(l)) + } l = len(m.Value) if l > 0 { n += 1 + l + sovDispute(uint64(l)) } - if m.Timestamp != 0 { - n += 1 + sovDispute(uint64(m.Timestamp)) + if m.BlockNumber != 0 { + n += 1 + sovDispute(uint64(m.BlockNumber)) } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovDispute(uint64(l)) return n } @@ -1420,6 +1481,38 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { } } case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDispute + } + 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 ErrInvalidLengthDispute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDispute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QueryType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field QueryId", wireType) } @@ -1451,7 +1544,39 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { } m.QueryId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregateMethod", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDispute + } + 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 ErrInvalidLengthDispute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDispute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AggregateMethod = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } @@ -1483,11 +1608,30 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { } m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 7: if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDispute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } - m.Timestamp = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDispute @@ -1497,11 +1641,25 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Timestamp |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthDispute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDispute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipDispute(dAtA[iNdEx:]) diff --git a/x/oracle/types/params.pb.go b/x/oracle/types/params.pb.go index 4070c1d04..fdfc301d8 100644 --- a/x/oracle/types/params.pb.go +++ b/x/oracle/types/params.pb.go @@ -77,25 +77,25 @@ func init() { func init() { proto.RegisterFile("layer/oracle/params.proto", fileDescriptor_ac0e3bcb871977fd) } var fileDescriptor_ac0e3bcb871977fd = []byte{ - // 284 bytes of a gzipped FileDescriptorProto + // 280 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x4b, 0xe9, 0x41, 0xa4, 0xa4, 0x24, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0x72, 0xfa, 0x10, 0x0e, 0x44, 0xa1, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x44, 0x1c, 0xc4, 0x82, 0x88, 0x2a, 0x2d, 0x66, 0xe4, 0x62, 0x0b, 0x00, 0x9b, 0x27, - 0xa4, 0xcc, 0xc5, 0x95, 0x5c, 0x99, 0x9c, 0x93, 0x1a, 0x9f, 0x93, 0x59, 0x5c, 0x22, 0xc1, 0xa8, - 0xc0, 0xac, 0xc1, 0xe9, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x27, 0x58, 0xdc, 0x27, 0xb3, - 0xb8, 0x44, 0x28, 0x8f, 0x8b, 0x2f, 0x37, 0x33, 0x2f, 0xb8, 0x24, 0x31, 0x3b, 0xd5, 0x31, 0x37, - 0xbf, 0x34, 0xaf, 0x44, 0x82, 0x49, 0x81, 0x51, 0x83, 0xd3, 0xc9, 0x0d, 0xa4, 0xf0, 0xd6, 0x3d, - 0x79, 0x51, 0x88, 0x9d, 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, - 0x9e, 0x79, 0x25, 0x9f, 0xee, 0xc9, 0x8b, 0x57, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xe5, 0x66, 0xe6, - 0xc5, 0x17, 0x83, 0x74, 0xc7, 0x27, 0x82, 0xb5, 0x2b, 0x5d, 0xda, 0xa2, 0xcb, 0x05, 0x75, 0xa7, - 0x67, 0x5e, 0x49, 0x10, 0x9a, 0xe9, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x39, 0x9f, 0x78, - 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, - 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x66, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, - 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x49, 0x6a, 0x4e, 0x4e, 0x7e, 0x91, 0x6e, 0x66, 0xbe, 0x3e, 0x24, - 0xb8, 0x2a, 0x60, 0x01, 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xb1, 0x31, 0x20, - 0x00, 0x00, 0xff, 0xff, 0x7e, 0x9e, 0xb5, 0xf2, 0x4d, 0x01, 0x00, 0x00, + 0x7a, 0x3e, 0x44, 0x1c, 0xc4, 0x82, 0x88, 0x2a, 0xcd, 0x65, 0xe4, 0x62, 0x0b, 0x00, 0x9b, 0x27, + 0x24, 0xcb, 0xc5, 0x95, 0x5c, 0x99, 0x9c, 0x93, 0x1a, 0x9f, 0x93, 0x59, 0x5c, 0x22, 0xc1, 0xa8, + 0xc0, 0xac, 0xc1, 0x19, 0xc4, 0x09, 0x16, 0xf1, 0xc9, 0x2c, 0x2e, 0x11, 0xca, 0xe3, 0xe2, 0xcb, + 0xcd, 0xcc, 0x0b, 0x2e, 0x49, 0xcc, 0x4e, 0x75, 0xcc, 0xcd, 0x2f, 0xcd, 0x2b, 0x91, 0x60, 0x52, + 0x60, 0xd4, 0xe0, 0x74, 0x72, 0x3b, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x51, 0x88, 0x6d, + 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, 0x9e, 0x79, 0x25, 0x9f, + 0xee, 0xc9, 0x8b, 0x57, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xe5, 0x66, 0xe6, 0xc5, 0x17, 0x83, 0x74, + 0xc7, 0x27, 0x82, 0xb5, 0x2b, 0x5d, 0xda, 0xa2, 0xcb, 0x05, 0x75, 0xa1, 0x67, 0x5e, 0x49, 0x10, + 0x9a, 0xe9, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x39, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, + 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, + 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x66, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, + 0x7e, 0x49, 0x6a, 0x4e, 0x4e, 0x7e, 0x91, 0x6e, 0x66, 0xbe, 0x3e, 0x24, 0xa0, 0x2a, 0x60, 0x41, + 0x55, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, + 0x3e, 0x62, 0xeb, 0xb4, 0x47, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/registry/keeper/query_decode_querydata_test.go b/x/registry/keeper/query_decode_querydata_test.go index 4c726b100..1278f96a7 100644 --- a/x/registry/keeper/query_decode_querydata_test.go +++ b/x/registry/keeper/query_decode_querydata_test.go @@ -19,7 +19,7 @@ func TestDecodeQuerydata(t *testing.T) { AggregationMethod: "weighted-median", ResponseValueType: "uint256", AbiComponents: []*types.ABIComponent{ - {Name: "test", Type: "string"}, + {Name: "test", FieldType: "string"}, }, }, }) diff --git a/x/registry/keeper/query_decode_value_test.go b/x/registry/keeper/query_decode_value_test.go index e5fe04421..c3549214f 100644 --- a/x/registry/keeper/query_decode_value_test.go +++ b/x/registry/keeper/query_decode_value_test.go @@ -19,7 +19,7 @@ func TestDecodeValueQuery(t *testing.T) { AggregationMethod: "weighted-median", ResponseValueType: "uint256", AbiComponents: []*types.ABIComponent{ - {Name: "test", Type: "string"}, + {Name: "test", FieldType: "string"}, }, }, }) diff --git a/x/registry/keeper/query_generate_querydata_test.go b/x/registry/keeper/query_generate_querydata_test.go index 9aa077c87..668bed73a 100644 --- a/x/registry/keeper/query_generate_querydata_test.go +++ b/x/registry/keeper/query_generate_querydata_test.go @@ -18,7 +18,7 @@ func TestGenerateQueryData(t *testing.T) { Spec: types.DataSpec{ ResponseValueType: "uint256", AbiComponents: []*types.ABIComponent{ - {Name: "test", Type: "string"}, + {Name: "test", FieldType: "string"}, }, AggregationMethod: "weighted-median", }, diff --git a/x/registry/types/data_spec.pb.go b/x/registry/types/data_spec.pb.go index 260f4bfaf..8a98df3cb 100644 --- a/x/registry/types/data_spec.pb.go +++ b/x/registry/types/data_spec.pb.go @@ -34,7 +34,7 @@ type ABIComponent struct { // name Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // type - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + FieldType string `protobuf:"bytes,2,opt,name=field_type,json=fieldType,proto3" json:"field_type,omitempty"` // consider taking this recursion out and make it once only NestedComponent []*ABIComponent `protobuf:"bytes,3,rep,name=nested_component,json=nestedComponent,proto3" json:"nested_component,omitempty"` } @@ -79,9 +79,9 @@ func (m *ABIComponent) GetName() string { return "" } -func (m *ABIComponent) GetType() string { +func (m *ABIComponent) GetFieldType() string { if m != nil { - return m.Type + return m.FieldType } return "" } @@ -197,37 +197,37 @@ func init() { func init() { proto.RegisterFile("layer/registry/data_spec.proto", fileDescriptor_8c1d9edbb99f1378) } var fileDescriptor_8c1d9edbb99f1378 = []byte{ - // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xb1, 0x6e, 0xd4, 0x40, - 0x10, 0x3d, 0x27, 0x21, 0x22, 0x9b, 0x5c, 0x20, 0xcb, 0x15, 0x4e, 0x84, 0x9c, 0x53, 0x68, 0x4e, - 0xa0, 0xb3, 0xa5, 0x20, 0xd1, 0xc7, 0x09, 0x02, 0x0a, 0x9a, 0x0b, 0x02, 0x29, 0x8d, 0xb5, 0xb6, - 0xe7, 0xd6, 0x96, 0xec, 0x1d, 0x6b, 0x77, 0x4d, 0xb8, 0x8a, 0x5f, 0xa0, 0xe4, 0x13, 0x28, 0x29, - 0xf8, 0x88, 0x94, 0x11, 0x15, 0x15, 0xa0, 0xbb, 0x22, 0xbf, 0x81, 0xbc, 0x6b, 0xe7, 0x8e, 0x2e, - 0x8d, 0x35, 0xf3, 0xde, 0xec, 0xdb, 0xe7, 0x7d, 0x43, 0xbc, 0x82, 0xcd, 0x40, 0x06, 0x12, 0x78, - 0xae, 0xb4, 0x9c, 0x05, 0x29, 0xd3, 0x2c, 0x52, 0x15, 0x24, 0x7e, 0x25, 0x51, 0x23, 0xdd, 0x35, - 0xbc, 0xdf, 0xf1, 0x07, 0x7b, 0xac, 0xcc, 0x05, 0x06, 0xe6, 0x6b, 0x47, 0x0e, 0xf6, 0x13, 0x54, - 0x25, 0xaa, 0xc8, 0x74, 0x81, 0x6d, 0x5a, 0x6a, 0xc0, 0x91, 0xa3, 0xc5, 0x9b, 0xaa, 0x45, 0x3d, - 0x8e, 0xc8, 0x0b, 0x08, 0x4c, 0x17, 0xd7, 0xd3, 0x20, 0xad, 0x25, 0xd3, 0x39, 0x0a, 0xcb, 0x1f, - 0x7d, 0x26, 0x3b, 0x27, 0xe1, 0x9b, 0x53, 0x2c, 0x2b, 0x14, 0x20, 0x34, 0xa5, 0x64, 0x43, 0xb0, - 0x12, 0x5c, 0x67, 0xe8, 0x8c, 0xb6, 0x26, 0xa6, 0x6e, 0x30, 0x3d, 0xab, 0xc0, 0x5d, 0xb3, 0x58, - 0x53, 0xd3, 0x57, 0xe4, 0xa1, 0x00, 0xa5, 0x21, 0x8d, 0x92, 0xee, 0xac, 0xbb, 0x3e, 0x5c, 0x1f, - 0x6d, 0x1f, 0x3f, 0xf6, 0xff, 0xff, 0x0d, 0x7f, 0x55, 0x7f, 0xf2, 0xc0, 0x9e, 0xba, 0x05, 0x8e, - 0x6e, 0xd6, 0xc8, 0xfd, 0x33, 0xa6, 0xd9, 0x79, 0x05, 0x09, 0x7d, 0x42, 0xfa, 0x29, 0x26, 0x75, - 0x09, 0x42, 0x47, 0x19, 0x53, 0x59, 0x6b, 0x63, 0xa7, 0x03, 0x5f, 0x33, 0x95, 0x51, 0x9f, 0x3c, - 0x92, 0xa0, 0x2a, 0x14, 0x0a, 0xa2, 0x8f, 0xac, 0xa8, 0x21, 0x5a, 0x71, 0xb7, 0xd7, 0x51, 0xef, - 0x1b, 0xe6, 0x5d, 0x63, 0xf5, 0x94, 0xec, 0xb2, 0x38, 0x5f, 0xfa, 0x54, 0x77, 0x32, 0xda, 0x67, - 0x71, 0x7e, 0xdb, 0x29, 0x3a, 0x26, 0x94, 0x71, 0x2e, 0x81, 0x9b, 0xc7, 0x8b, 0x4a, 0xd0, 0x19, - 0xa6, 0xee, 0x86, 0xbd, 0x73, 0x85, 0x79, 0x6b, 0x08, 0xfa, 0x82, 0x6c, 0xb5, 0xb2, 0x4c, 0xba, - 0xf7, 0x9a, 0xa9, 0xd0, 0xfd, 0xf9, 0x63, 0x3c, 0x68, 0x13, 0x3b, 0x49, 0x53, 0x09, 0x4a, 0x9d, - 0x6b, 0x99, 0x0b, 0x3e, 0x59, 0x8e, 0xd2, 0x0b, 0x32, 0x90, 0x50, 0xa1, 0xd4, 0x51, 0x5c, 0x4f, - 0xa7, 0x20, 0xa3, 0xcb, 0x5c, 0xa4, 0x78, 0xe9, 0x6e, 0x0e, 0x9d, 0xd1, 0xf6, 0xf1, 0xbe, 0x6f, - 0xd3, 0xf4, 0xbb, 0x34, 0xfd, 0xb3, 0x36, 0xcd, 0xb0, 0x7f, 0xf5, 0xfb, 0xb0, 0xf7, 0xf5, 0xcf, - 0xa1, 0xf3, 0xed, 0xe6, 0xfb, 0x53, 0x67, 0x42, 0xad, 0x4a, 0x68, 0x44, 0x3e, 0x18, 0x8d, 0xf0, - 0xe5, 0xd5, 0xdc, 0x73, 0xae, 0xe7, 0x9e, 0xf3, 0x77, 0xee, 0x39, 0x5f, 0x16, 0x5e, 0xef, 0x7a, - 0xe1, 0xf5, 0x7e, 0x2d, 0xbc, 0xde, 0xc5, 0x33, 0x9e, 0xeb, 0xac, 0x8e, 0xfd, 0x04, 0xcb, 0x40, - 0x43, 0x51, 0xa0, 0x1c, 0xe7, 0x18, 0xd8, 0x6d, 0xfd, 0xb4, 0xdc, 0xd7, 0xe6, 0x99, 0x55, 0xbc, - 0x69, 0x2e, 0x7f, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x73, 0xf3, 0x1f, 0x76, 0xce, 0x02, 0x00, - 0x00, + // 475 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0xb6, 0x54, 0xe4, 0xda, 0x14, 0x7a, 0x64, 0x70, 0x2b, 0x70, 0xa3, 0xb2, 0x44, + 0xa0, 0xd8, 0x52, 0x91, 0xd8, 0xeb, 0x16, 0x01, 0x03, 0x4b, 0x8a, 0x40, 0xea, 0x62, 0x9d, 0xed, + 0x97, 0xf3, 0x49, 0xf6, 0x3d, 0xeb, 0xee, 0x4c, 0xc9, 0x57, 0x60, 0x62, 0xe4, 0x23, 0x30, 0x32, + 0xf0, 0x21, 0x3a, 0x56, 0x4c, 0x4c, 0x80, 0x92, 0xa1, 0x5f, 0x03, 0xe5, 0x6c, 0x27, 0x61, 0x63, + 0x89, 0xee, 0xfd, 0x7f, 0x2f, 0xff, 0xf7, 0xf7, 0xbd, 0x23, 0x5e, 0xce, 0xa6, 0xa0, 0x02, 0x05, + 0x5c, 0x68, 0xa3, 0xa6, 0x41, 0xca, 0x0c, 0x8b, 0x74, 0x09, 0x89, 0x5f, 0x2a, 0x34, 0x48, 0xf7, + 0x2c, 0xf7, 0x5b, 0x7e, 0xb8, 0xcf, 0x0a, 0x21, 0x31, 0xb0, 0xbf, 0x75, 0xcb, 0xe1, 0x41, 0x82, + 0xba, 0x40, 0x1d, 0xd9, 0x2a, 0xa8, 0x8b, 0x06, 0xf5, 0x39, 0x72, 0xac, 0xf5, 0xc5, 0xa9, 0x51, + 0x3d, 0x8e, 0xc8, 0x73, 0x08, 0x6c, 0x15, 0x57, 0x93, 0x20, 0xad, 0x14, 0x33, 0x02, 0x65, 0xcd, + 0x8f, 0x3f, 0x39, 0x64, 0xf7, 0x34, 0x7c, 0x7d, 0x86, 0x45, 0x89, 0x12, 0xa4, 0xa1, 0x94, 0x6c, + 0x49, 0x56, 0x80, 0xeb, 0x0c, 0x9c, 0x61, 0x77, 0x6c, 0xcf, 0xf4, 0x11, 0x21, 0x13, 0x01, 0x79, + 0x1a, 0x99, 0x69, 0x09, 0xee, 0x86, 0x25, 0x5d, 0xab, 0xbc, 0x9d, 0x96, 0x40, 0x5f, 0x92, 0xfb, + 0x12, 0xb4, 0x81, 0x34, 0x4a, 0x5a, 0x1b, 0x77, 0x73, 0xb0, 0x39, 0xdc, 0x39, 0x79, 0xe8, 0xff, + 0xfb, 0x49, 0xfe, 0xfa, 0xa8, 0xf1, 0xbd, 0xfa, 0x5f, 0x4b, 0xe1, 0xf8, 0x76, 0x83, 0xdc, 0x3d, + 0x67, 0x86, 0x5d, 0x94, 0x90, 0xd0, 0xc7, 0xa4, 0x97, 0x62, 0x52, 0x15, 0x20, 0x4d, 0x94, 0x31, + 0x9d, 0x35, 0x89, 0x76, 0x5b, 0xf1, 0x15, 0xd3, 0x19, 0xf5, 0xc9, 0x03, 0x05, 0xba, 0x44, 0xa9, + 0x21, 0xfa, 0xc0, 0xf2, 0x0a, 0xd6, 0x23, 0xee, 0xb7, 0xe8, 0xdd, 0x82, 0xd8, 0xa8, 0x67, 0x64, + 0x8f, 0xc5, 0x62, 0x95, 0x53, 0xff, 0x57, 0xd0, 0x1e, 0x8b, 0xc5, 0xb2, 0xd2, 0x74, 0x44, 0x28, + 0xe3, 0x5c, 0x01, 0xb7, 0x17, 0x19, 0x15, 0x60, 0x32, 0x4c, 0xdd, 0xad, 0x7a, 0xe6, 0x1a, 0x79, + 0x63, 0x01, 0x7d, 0x4e, 0xba, 0x8d, 0x2d, 0x53, 0xee, 0x9d, 0x45, 0x57, 0xe8, 0xfe, 0xf8, 0x3e, + 0xea, 0x37, 0xdb, 0x3b, 0x4d, 0x53, 0x05, 0x5a, 0x5f, 0x18, 0x25, 0x24, 0x1f, 0xaf, 0x5a, 0xe9, + 0x25, 0xe9, 0x2b, 0x28, 0x51, 0x99, 0x28, 0xae, 0x26, 0x13, 0x50, 0xd1, 0x95, 0x90, 0x29, 0x5e, + 0xb9, 0xdb, 0x03, 0x67, 0xb8, 0x73, 0x72, 0xe0, 0xd7, 0x9b, 0xf5, 0xdb, 0xcd, 0xfa, 0xe7, 0xcd, + 0x66, 0xc3, 0xde, 0xf5, 0xaf, 0xa3, 0xce, 0x97, 0xdf, 0x47, 0xce, 0xd7, 0xdb, 0x6f, 0x4f, 0x9c, + 0x31, 0xad, 0x5d, 0x42, 0x6b, 0xf2, 0xde, 0x7a, 0x84, 0x2f, 0xae, 0x67, 0x9e, 0x73, 0x33, 0xf3, + 0x9c, 0x3f, 0x33, 0xcf, 0xf9, 0x3c, 0xf7, 0x3a, 0x37, 0x73, 0xaf, 0xf3, 0x73, 0xee, 0x75, 0x2e, + 0x9f, 0x72, 0x61, 0xb2, 0x2a, 0xf6, 0x13, 0x2c, 0x02, 0x03, 0x79, 0x8e, 0x6a, 0x24, 0x30, 0xa8, + 0x5f, 0xee, 0xc7, 0xd5, 0xdb, 0x5d, 0x5c, 0xb3, 0x8e, 0xb7, 0xed, 0xf0, 0x67, 0x7f, 0x03, 0x00, + 0x00, 0xff, 0xff, 0x44, 0x86, 0x5c, 0xb7, 0xda, 0x02, 0x00, 0x00, } func (m *ABIComponent) Marshal() (dAtA []byte, err error) { @@ -264,10 +264,10 @@ func (m *ABIComponent) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintDataSpec(dAtA, i, uint64(len(m.Type))) + if len(m.FieldType) > 0 { + i -= len(m.FieldType) + copy(dAtA[i:], m.FieldType) + i = encodeVarintDataSpec(dAtA, i, uint64(len(m.FieldType))) i-- dAtA[i] = 0x12 } @@ -375,7 +375,7 @@ func (m *ABIComponent) Size() (n int) { if l > 0 { n += 1 + l + sovDataSpec(uint64(l)) } - l = len(m.Type) + l = len(m.FieldType) if l > 0 { n += 1 + l + sovDataSpec(uint64(l)) } @@ -490,7 +490,7 @@ func (m *ABIComponent) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FieldType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -518,7 +518,7 @@ func (m *ABIComponent) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = string(dAtA[iNdEx:postIndex]) + m.FieldType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { diff --git a/x/registry/types/dataspec.go b/x/registry/types/dataspec.go index 6d6601bab..547a74c25 100644 --- a/x/registry/types/dataspec.go +++ b/x/registry/types/dataspec.go @@ -16,8 +16,8 @@ func GenesisDataSpec() DataSpec { DocumentHash: "", ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "asset", Type: "string"}, - {Name: "currency", Type: "string"}, + {Name: "asset", FieldType: "string"}, + {Name: "currency", FieldType: "string"}, }, AggregationMethod: "weighted-median", Registrar: "genesis", @@ -62,13 +62,13 @@ func (d DataSpec) MakeArgMarshaller() []abi.ArgumentMarshaling { for _, cmp := range d.AbiComponents { _argMrsh := abi.ArgumentMarshaling{ Name: cmp.Name, - Type: cmp.Type, + Type: cmp.FieldType, } - if cmp.Type == "tuple" || cmp.Type == "tuple[]" { + if cmp.FieldType == "tuple" || cmp.FieldType == "tuple[]" { for _, cmp2 := range cmp.NestedComponent { _argMrsh_ := abi.ArgumentMarshaling{ Name: cmp2.Name, - Type: cmp2.Type, + Type: cmp2.FieldType, } _argMrsh.Components = append(_argMrsh.Components, _argMrsh_) } diff --git a/x/registry/types/dataspec_test.go b/x/registry/types/dataspec_test.go index 3b08c33b2..e6f8ab01e 100644 --- a/x/registry/types/dataspec_test.go +++ b/x/registry/types/dataspec_test.go @@ -13,19 +13,19 @@ func TestTupleListEncoding(t *testing.T) { DocumentHash: "", ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "metric", Type: "string"}, - {Name: "currency", Type: "string"}, - {Name: "collection", Type: "tuple[]", + {Name: "metric", FieldType: "string"}, + {Name: "currency", FieldType: "string"}, + {Name: "collection", FieldType: "tuple[]", NestedComponent: []*ABIComponent{ - {Name: "chainName", Type: "string"}, - {Name: "collectionAddress", Type: "address"}, + {Name: "chainName", FieldType: "string"}, + {Name: "collectionAddress", FieldType: "address"}, }, }, - {Name: "tokens", Type: "tuple[]", + {Name: "tokens", FieldType: "tuple[]", NestedComponent: []*ABIComponent{ - {Name: "chainName", Type: "string"}, - {Name: "tokenName", Type: "string"}, - {Name: "tokenAddress", Type: "address"}, + {Name: "chainName", FieldType: "string"}, + {Name: "tokenName", FieldType: "string"}, + {Name: "tokenAddress", FieldType: "address"}, }, }, }, @@ -65,11 +65,11 @@ func TestTupleDataSpecEncoding(t *testing.T) { DocumentHash: "", ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "tupletest", Type: "tuple", + {Name: "tupletest", FieldType: "tuple", NestedComponent: []*ABIComponent{ - {Name: "num1", Type: "uint256"}, - {Name: "num2", Type: "uint256"}, - {Name: "text", Type: "string"}, + {Name: "num1", FieldType: "uint256"}, + {Name: "num2", FieldType: "uint256"}, + {Name: "text", FieldType: "string"}, }, }, }, @@ -104,8 +104,8 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "asset", Type: "string"}, - {Name: "currency", Type: "string"}, + {Name: "asset", FieldType: "string"}, + {Name: "currency", FieldType: "string"}, }, AggregationMethod: "weighted-median", }, @@ -119,8 +119,8 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "asset", Type: "string"}, - {Name: "currency", Type: "string"}, + {Name: "asset", FieldType: "string"}, + {Name: "currency", FieldType: "string"}, }, AggregationMethod: "weighted-median", }, @@ -134,8 +134,8 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "asset", Type: "string"}, - {Name: "currency", Type: "string"}, + {Name: "asset", FieldType: "string"}, + {Name: "currency", FieldType: "string"}, }, AggregationMethod: "weighted-median", }, @@ -149,8 +149,8 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "address", Type: "string"}, - {Name: "timestamp", Type: "uint256"}, + {Name: "address", FieldType: "string"}, + {Name: "timestamp", FieldType: "uint256"}, }, AggregationMethod: "weighted-mode", }, @@ -164,9 +164,9 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "chainId", Type: "uint256"}, - {Name: "contractAddress", Type: "address"}, - {Name: "timestamp", Type: "uint256"}, + {Name: "chainId", FieldType: "uint256"}, + {Name: "contractAddress", FieldType: "address"}, + {Name: "timestamp", FieldType: "uint256"}, }, AggregationMethod: "weighted-mode", }, @@ -180,7 +180,7 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "uint256", AbiComponents: []*ABIComponent{ - {Name: "phantom", Type: "bytes"}, + {Name: "phantom", FieldType: "bytes"}, }, AggregationMethod: "weighted-median", }, @@ -194,7 +194,7 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "string", AbiComponents: []*ABIComponent{ - {Name: "", Type: "bytes"}, + {Name: "", FieldType: "bytes"}, }, AggregationMethod: "weighted-mode", }, @@ -208,8 +208,8 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "string", AbiComponents: []*ABIComponent{ - {Name: "", Type: "uint256"}, - {Name: "", Type: "uint256[]"}, + {Name: "", FieldType: "uint256"}, + {Name: "", FieldType: "uint256[]"}, }, AggregationMethod: "weighted-mode", }, @@ -223,8 +223,8 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "string", AbiComponents: []*ABIComponent{ - {Name: "", Type: "string"}, - {Name: "", Type: "string[]"}, + {Name: "", FieldType: "string"}, + {Name: "", FieldType: "string[]"}, }, AggregationMethod: "weighted-mode", }, @@ -238,9 +238,9 @@ func TestMixedEncoding(t *testing.T) { DataSpec{ ResponseValueType: "string", AbiComponents: []*ABIComponent{ - {Name: "", Type: "uint256"}, - {Name: "", Type: "address"}, - {Name: "", Type: "bytes"}, + {Name: "", FieldType: "uint256"}, + {Name: "", FieldType: "address"}, + {Name: "", FieldType: "bytes"}, }, AggregationMethod: "weighted-mode", }, diff --git a/x/registry/types/decoding.go b/x/registry/types/decoding.go index aa5a2065c..46ff657be 100644 --- a/x/registry/types/decoding.go +++ b/x/registry/types/decoding.go @@ -116,7 +116,7 @@ func convertToArgumentMarshaling(comp ABIComponent) abi.ArgumentMarshaling { return abi.ArgumentMarshaling{ Name: comp.Name, - Type: comp.Type, + Type: comp.FieldType, Components: nestedArgMarshallings, } } diff --git a/x/reporter/types/token_origin.pb.go b/x/reporter/types/token_origin.pb.go index 2a1ae5052..5b25e286c 100644 --- a/x/reporter/types/token_origin.pb.go +++ b/x/reporter/types/token_origin.pb.go @@ -74,31 +74,139 @@ func (m *TokenOrigin) GetValidatorAddress() string { return "" } +type TokenOriginInfo struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` +} + +func (m *TokenOriginInfo) Reset() { *m = TokenOriginInfo{} } +func (m *TokenOriginInfo) String() string { return proto.CompactTextString(m) } +func (*TokenOriginInfo) ProtoMessage() {} +func (*TokenOriginInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_bf34edebb26f68f4, []int{1} +} +func (m *TokenOriginInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenOriginInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenOriginInfo.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 *TokenOriginInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenOriginInfo.Merge(m, src) +} +func (m *TokenOriginInfo) XXX_Size() int { + return m.Size() +} +func (m *TokenOriginInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TokenOriginInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenOriginInfo proto.InternalMessageInfo + +func (m *TokenOriginInfo) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *TokenOriginInfo) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +// reporter's snapshot of delegators' sources pre unbonding +type DelegationsPreUpdate struct { + // token_origin is the origin of the tokens that are about to be updated + TokenOrigins []*TokenOriginInfo `protobuf:"bytes,1,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` +} + +func (m *DelegationsPreUpdate) Reset() { *m = DelegationsPreUpdate{} } +func (m *DelegationsPreUpdate) String() string { return proto.CompactTextString(m) } +func (*DelegationsPreUpdate) ProtoMessage() {} +func (*DelegationsPreUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_bf34edebb26f68f4, []int{2} +} +func (m *DelegationsPreUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationsPreUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationsPreUpdate.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 *DelegationsPreUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationsPreUpdate.Merge(m, src) +} +func (m *DelegationsPreUpdate) XXX_Size() int { + return m.Size() +} +func (m *DelegationsPreUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationsPreUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationsPreUpdate proto.InternalMessageInfo + +func (m *DelegationsPreUpdate) GetTokenOrigins() []*TokenOriginInfo { + if m != nil { + return m.TokenOrigins + } + return nil +} + func init() { proto.RegisterType((*TokenOrigin)(nil), "layer.reporter.TokenOrigin") + proto.RegisterType((*TokenOriginInfo)(nil), "layer.reporter.TokenOriginInfo") + proto.RegisterType((*DelegationsPreUpdate)(nil), "layer.reporter.DelegationsPreUpdate") } func init() { proto.RegisterFile("layer/reporter/token_origin.proto", fileDescriptor_bf34edebb26f68f4) } var fileDescriptor_bf34edebb26f68f4 = []byte{ - // 267 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcc, 0x49, 0xac, 0x4c, - 0x2d, 0xd2, 0x2f, 0x4a, 0x2d, 0xc8, 0x2f, 0x2a, 0x49, 0x2d, 0xd2, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, - 0x8b, 0xcf, 0x2f, 0xca, 0x4c, 0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, - 0x2b, 0xd1, 0x83, 0x29, 0x91, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x25, - 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x95, 0x12, - 0x49, 0xcf, 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x10, 0x51, 0xa5, 0x7a, 0x2e, 0xee, 0x10, 0x90, - 0x4d, 0xfe, 0x60, 0x8b, 0x84, 0xb4, 0xb9, 0x04, 0xcb, 0x12, 0x73, 0x32, 0x53, 0x12, 0x4b, 0xf2, - 0x8b, 0xe2, 0x13, 0x53, 0x52, 0x8a, 0x52, 0x8b, 0x8b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, - 0x04, 0xe0, 0x12, 0x8e, 0x10, 0x71, 0x21, 0x67, 0x2e, 0xb6, 0xc4, 0xdc, 0xfc, 0xd2, 0xbc, 0x12, - 0x09, 0x26, 0x90, 0x0a, 0x27, 0xed, 0x13, 0xf7, 0xe4, 0x19, 0x6e, 0xdd, 0x93, 0x17, 0x85, 0xd8, - 0x5b, 0x9c, 0x92, 0xad, 0x97, 0x99, 0xaf, 0x9f, 0x9b, 0x58, 0x92, 0xa1, 0xe7, 0x99, 0x57, 0x72, - 0x69, 0x8b, 0x2e, 0x17, 0xd4, 0x41, 0x9e, 0x79, 0x25, 0x41, 0x50, 0xad, 0x4e, 0xae, 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, 0x9d, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, - 0x97, 0x9c, 0x9f, 0xab, 0x5f, 0x92, 0x9a, 0x93, 0x93, 0x5f, 0xa4, 0x9b, 0x99, 0xaf, 0x0f, 0x09, - 0xa6, 0x0a, 0xa4, 0x80, 0xaa, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x7b, 0xc7, 0x18, 0x10, 0x00, - 0x00, 0xff, 0xff, 0x3d, 0xaa, 0x87, 0xd5, 0x47, 0x01, 0x00, 0x00, + // 384 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcd, 0x6a, 0xea, 0x40, + 0x14, 0x4e, 0xae, 0x20, 0xdc, 0xf1, 0xfe, 0x68, 0xf0, 0x82, 0x57, 0xb8, 0xf1, 0xea, 0x4a, 0x90, + 0x24, 0xd0, 0x3e, 0x41, 0xad, 0x2e, 0xdc, 0xb4, 0x25, 0xfd, 0x59, 0x94, 0x82, 0x8c, 0x66, 0x1a, + 0x07, 0x93, 0x39, 0x61, 0x66, 0x2c, 0x75, 0xd5, 0x57, 0xe8, 0xc3, 0xf8, 0x10, 0x2e, 0xc5, 0x55, + 0xe9, 0x42, 0x8a, 0xae, 0xfb, 0x0e, 0x25, 0x99, 0x68, 0xad, 0x2d, 0x5d, 0x74, 0x13, 0x72, 0xbe, + 0xf3, 0x9d, 0x73, 0xbe, 0x6f, 0xce, 0x41, 0xd5, 0x00, 0x8f, 0x09, 0x77, 0x38, 0x89, 0x80, 0x4b, + 0xc2, 0x1d, 0x09, 0x43, 0xc2, 0xba, 0xc0, 0xa9, 0x4f, 0x99, 0x1d, 0x71, 0x90, 0x60, 0xfc, 0x4a, + 0x28, 0xf6, 0x9a, 0x52, 0x2e, 0xe0, 0x90, 0x32, 0x70, 0x92, 0xaf, 0xa2, 0x94, 0xff, 0xf6, 0x41, + 0x84, 0x20, 0xba, 0x49, 0xe4, 0xa8, 0x20, 0x4d, 0x15, 0x7d, 0xf0, 0x41, 0xe1, 0xf1, 0x9f, 0x42, + 0x6b, 0x77, 0x28, 0x77, 0x16, 0x4f, 0x3a, 0x4e, 0x06, 0x19, 0x0d, 0x54, 0xb8, 0xc1, 0x01, 0xf5, + 0xb0, 0x04, 0xde, 0xc5, 0x9e, 0xc7, 0x89, 0x10, 0x25, 0xfd, 0xbf, 0x5e, 0xff, 0xee, 0xe6, 0x37, + 0x89, 0x03, 0x85, 0x1b, 0x87, 0x28, 0x8b, 0x43, 0x18, 0x31, 0x59, 0xfa, 0x16, 0x33, 0x9a, 0x8d, + 0xe9, 0xa2, 0xa2, 0x3d, 0x2e, 0x2a, 0x7f, 0xd4, 0x5c, 0xe1, 0x0d, 0x6d, 0x0a, 0x4e, 0x88, 0xe5, + 0xc0, 0xee, 0x30, 0x39, 0x9f, 0x58, 0x28, 0x15, 0xd4, 0x61, 0xd2, 0x4d, 0x4b, 0x6b, 0xcf, 0x3a, + 0xfa, 0xbd, 0xa5, 0xa0, 0xc3, 0xae, 0xc1, 0x68, 0xa3, 0x82, 0x47, 0x02, 0xe2, 0xbf, 0x57, 0xd1, + 0x2c, 0xcd, 0x27, 0x56, 0x31, 0x6d, 0x93, 0xea, 0x38, 0x95, 0x9c, 0x32, 0xdf, 0xcd, 0x6f, 0x4a, + 0xd6, 0xfa, 0x8e, 0x3e, 0x32, 0xa3, 0xa4, 0x56, 0xe7, 0x13, 0xeb, 0x5f, 0xda, 0xe6, 0x62, 0xc7, + 0xd7, 0xba, 0xdf, 0x27, 0x7e, 0x33, 0x5f, 0xf7, 0x7b, 0x85, 0x8a, 0x2d, 0x25, 0x94, 0x02, 0x13, + 0x27, 0x9c, 0x9c, 0x47, 0x1e, 0x96, 0xc4, 0x68, 0xa1, 0x9f, 0xdb, 0x2b, 0x8f, 0xfd, 0x66, 0xea, + 0xb9, 0xbd, 0x8a, 0xfd, 0x76, 0xe9, 0xf6, 0xce, 0x5b, 0xb9, 0x3f, 0xe4, 0x2b, 0x20, 0x9a, 0xed, + 0xe9, 0xd2, 0xd4, 0x67, 0x4b, 0x53, 0x7f, 0x5a, 0x9a, 0xfa, 0xfd, 0xca, 0xd4, 0x66, 0x2b, 0x53, + 0x7b, 0x58, 0x99, 0xda, 0x65, 0xc3, 0xa7, 0x72, 0x30, 0xea, 0xd9, 0x7d, 0x08, 0x1d, 0x49, 0x82, + 0x00, 0xb8, 0x45, 0xc1, 0x51, 0x47, 0x77, 0xbb, 0x75, 0x76, 0xe3, 0x88, 0x88, 0x5e, 0x36, 0x39, + 0x8e, 0xfd, 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xda, 0x93, 0x48, 0x95, 0x02, 0x00, 0x00, } func (m *TokenOrigin) Marshal() (dAtA []byte, err error) { @@ -141,6 +249,90 @@ func (m *TokenOrigin) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TokenOriginInfo) 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 *TokenOriginInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenOriginInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTokenOrigin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTokenOrigin(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTokenOrigin(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegationsPreUpdate) 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 *DelegationsPreUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationsPreUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenOrigins) > 0 { + for iNdEx := len(m.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenOrigins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTokenOrigin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintTokenOrigin(dAtA []byte, offset int, v uint64) int { offset -= sovTokenOrigin(v) base := offset @@ -167,6 +359,40 @@ func (m *TokenOrigin) Size() (n int) { return n } +func (m *TokenOriginInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTokenOrigin(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTokenOrigin(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTokenOrigin(uint64(l)) + return n +} + +func (m *DelegationsPreUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TokenOrigins) > 0 { + for _, e := range m.TokenOrigins { + l = e.Size() + n += 1 + l + sovTokenOrigin(uint64(l)) + } + } + return n +} + func sovTokenOrigin(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -289,6 +515,238 @@ func (m *TokenOrigin) Unmarshal(dAtA []byte) error { } return nil } +func (m *TokenOriginInfo) 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 ErrIntOverflowTokenOrigin + } + 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: TokenOriginInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenOriginInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTokenOrigin + } + 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 ErrInvalidLengthTokenOrigin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTokenOrigin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTokenOrigin + } + 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 ErrInvalidLengthTokenOrigin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTokenOrigin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 ErrIntOverflowTokenOrigin + } + 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 ErrInvalidLengthTokenOrigin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTokenOrigin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTokenOrigin(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTokenOrigin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationsPreUpdate) 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 ErrIntOverflowTokenOrigin + } + 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: DelegationsPreUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationsPreUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTokenOrigin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTokenOrigin + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTokenOrigin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenOrigins = append(m.TokenOrigins, &TokenOriginInfo{}) + if err := m.TokenOrigins[len(m.TokenOrigins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTokenOrigin(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTokenOrigin + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTokenOrigin(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From e8be7e7d2e3e1164dbdf92cf35457b83970a3fc4 Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 18 Mar 2024 07:09:04 -0400 Subject: [PATCH 13/31] add reporting timeframe --- proto/layer/oracle/commit_report.proto | 19 +-- proto/layer/oracle/genesis.proto | 1 + proto/layer/oracle/micro_report.proto | 13 +- proto/layer/oracle/params.proto | 3 +- proto/layer/oracle/query_meta.proto | 31 +++++ proto/layer/oracle/tx.proto | 15 +++ tests/integration/keeper_test.go | 6 +- tests/integration/oracle_keeper_test.go | 56 ++++---- testutil/keeper/oracle.go | 3 +- testutil/utils.go | 2 +- utils/queryid.go | 8 +- x/oracle/abci.go | 5 +- x/oracle/genesis.go | 9 +- x/oracle/keeper/aggregate.go | 111 ++++++++-------- x/oracle/keeper/cycle_list.go | 121 ++++++++++++------ x/oracle/keeper/indexes.go | 42 ++++-- x/oracle/keeper/keeper.go | 73 ++++++++--- x/oracle/keeper/msg_server_commit_report.go | 101 +++++++++++---- x/oracle/keeper/msg_server_submit_value.go | 120 ++++++++++++----- x/oracle/keeper/msg_server_tip.go | 47 ++++++- x/oracle/keeper/msg_update_cyclelist.go | 26 ++++ x/oracle/keeper/params.go | 9 -- .../keeper/query_get_aggregated_report.go | 2 +- x/oracle/keeper/query_get_reports.go | 12 +- x/oracle/keeper/submit_value.go | 12 +- x/oracle/keeper/tip.go | 12 +- x/oracle/types/codec.go | 4 + x/oracle/types/cyclelist.go | 12 ++ x/oracle/types/errors.go | 3 + x/oracle/types/genesis.go | 3 +- x/oracle/types/keys.go | 11 +- x/oracle/types/message_submit_value.go | 3 - x/oracle/types/params.go | 33 +---- 33 files changed, 621 insertions(+), 307 deletions(-) create mode 100644 proto/layer/oracle/query_meta.proto create mode 100644 x/oracle/keeper/msg_update_cyclelist.go create mode 100644 x/oracle/types/cyclelist.go diff --git a/proto/layer/oracle/commit_report.proto b/proto/layer/oracle/commit_report.proto index 043b12b19..1ddafada7 100644 --- a/proto/layer/oracle/commit_report.proto +++ b/proto/layer/oracle/commit_report.proto @@ -2,21 +2,12 @@ syntax = "proto3"; package layer.oracle; import "layer/oracle/tx.proto"; -option go_package = "github.com/tellor-io/layer/x/oracle/types"; +option go_package = "github.com/tellor-io/layer/x/oracle/types"; message Commit { - string creator = 1; - bytes queryId = 2; - string hash = 3; + string reporter = 1; + bytes queryId = 2; + string hash = 3; + bool incycle = 4; } - -message CommitReport { - - Commit report = 1; - int64 block = 2; -} - -message CommitsByHeight { - repeated Commit commits = 1; -} \ No newline at end of file diff --git a/proto/layer/oracle/genesis.proto b/proto/layer/oracle/genesis.proto index 38ab88505..317ceaba5 100644 --- a/proto/layer/oracle/genesis.proto +++ b/proto/layer/oracle/genesis.proto @@ -9,4 +9,5 @@ option go_package = "github.com/tellor-io/layer/x/oracle/types"; // GenesisState defines the oracle module's genesis state. message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; + repeated string cyclelist = 2 [(gogoproto.nullable) = false]; } diff --git a/proto/layer/oracle/micro_report.proto b/proto/layer/oracle/micro_report.proto index 5eada3f27..c7655a61e 100644 --- a/proto/layer/oracle/micro_report.proto +++ b/proto/layer/oracle/micro_report.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package layer.oracle; -import "google/protobuf/timestamp.proto"; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; @@ -10,9 +10,12 @@ message MicroReport { string reporter = 1; int64 power = 2; string queryType = 3; - string queryId = 4; + string queryId = 4; string aggregateMethod = 5; - string value = 6; - int64 blockNumber = 7; - google.protobuf.Timestamp timestamp = 8 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string value = 6; + google.protobuf.Timestamp timestamp = 7 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + bool cyclelist = 8; } diff --git a/proto/layer/oracle/params.proto b/proto/layer/oracle/params.proto index e0b669be3..d27a45e6e 100644 --- a/proto/layer/oracle/params.proto +++ b/proto/layer/oracle/params.proto @@ -9,9 +9,8 @@ option go_package = "github.com/tellor-io/layer/x/oracle/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; - repeated string cycle_list = 1; - string minStakeAmount = 2 [ + string minStakeAmount = 1 [ (gogoproto.moretags) = "yaml:\"min_stake_amount\"", (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", diff --git a/proto/layer/oracle/query_meta.proto b/proto/layer/oracle/query_meta.proto new file mode 100644 index 000000000..c565351bc --- /dev/null +++ b/proto/layer/oracle/query_meta.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package layer.oracle; + +import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/tellor-io/layer/x/oracle/types"; + +message QueryMeta { + uint64 id = 1; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + google.protobuf.Timestamp expiration = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + google.protobuf.Duration registry_spec_timeframe = 4 [ + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + bool hasRevealedReports = 5; + bytes query_id = 6; +} diff --git a/proto/layer/oracle/tx.proto b/proto/layer/oracle/tx.proto index c9d3b1bbf..57965329c 100644 --- a/proto/layer/oracle/tx.proto +++ b/proto/layer/oracle/tx.proto @@ -20,6 +20,7 @@ service Msg { rpc SubmitValue(MsgSubmitValue) returns (MsgSubmitValueResponse); rpc CommitReport(MsgCommitReport) returns (MsgCommitReportResponse); rpc Tip(MsgTip) returns (MsgTipResponse); + rpc UpdateCyclelist(MsgUpdateCyclelist) returns (MsgUpdateCyclelistResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -66,3 +67,17 @@ message MsgTip { } message MsgTipResponse {} + +// MsgUpdateCycleRequest is the Msg/UpdateCycle request type. +message MsgUpdateCyclelist { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "layer/x/oracle/MsgUpdateCyclelist"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // list of query data hex strings + repeated string cyclelist = 2; +} + +// MsgUpdateCycleResponse defines the Msg/UpdateCycle response type. +message MsgUpdateCyclelistResponse {} diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index 967bbb97a..aec881bd0 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -76,9 +76,9 @@ import ( ) const ( - ethQueryData = "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - btcQueryData = "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - trbQueryData = "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + ethQueryData = "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + btcQueryData = "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + trbQueryData = "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706f745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" ) type IntegrationTestSuite struct { diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index fdc768cbb..87bd25886 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -2,19 +2,18 @@ package integration_test import ( "encoding/hex" + "strings" "testing" "time" "cosmossdk.io/collections" "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/x/gov" - - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/gov" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/tellor-io/layer/utils" minttypes "github.com/tellor-io/layer/x/mint/types" @@ -106,6 +105,7 @@ func (s *IntegrationTestSuite) TestGetCurrentTip() { // test tipping, reporting and allocation of rewards func (s *IntegrationTestSuite) TestTippingReporting() { + s.ctx = s.ctx.WithBlockTime(time.Now()) msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) addr := s.newKeysWithTokens() @@ -136,9 +136,10 @@ func (s *IntegrationTestSuite) TestTippingReporting() { commit, reveal := report(newReporter.String(), value, salt, hash, ethQueryData) _, err = msgServer.CommitReport(s.ctx, &commit) s.Nil(err) - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) _, err = msgServer.SubmitValue(s.ctx, &reveal) s.Nil(err) + // advance time to expire the query and aggregate report + s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 3)) // bypassing offset that expires time to commit/reveal err = s.oraclekeeper.SetAggregatedReport(s.ctx) s.Nil(err) res, err := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(queryId)}) @@ -201,9 +202,9 @@ func (s *IntegrationTestSuite) TestSmallTip() { } func (s *IntegrationTestSuite) TestMedianReports() { + s.ctx = s.ctx.WithBlockTime(time.Now()) msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) tipper := s.newKeysWithTokens() - s.ctx = s.ctx.WithBlockHeight(2) reporters := []struct { name string @@ -263,12 +264,13 @@ func (s *IntegrationTestSuite) TestMedianReports() { commit, reveal := report(newReporter.String(), r.value, salt, hash, ethQueryData) _, err = msgServer.CommitReport(s.ctx, &commit) s.Nil(err) - _, err = msgServer.SubmitValue(s.ctx.WithBlockHeight(s.ctx.BlockHeight()+1), &reveal) + _, err = msgServer.SubmitValue(s.ctx, &reveal) s.Nil(err) }) } - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.app.EndBlocker(s.ctx) + // advance time to expire query and aggregate report + s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 3)) // bypass time to expire query so it can be aggregated + s.app.EndBlocker(s.ctx) // EndBlocker aggregates reports // check median qId := "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992" res, err := s.oraclekeeper.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: qId}) @@ -297,13 +299,14 @@ func report(creator, value, salt, hash, qdata string) (types.MsgCommitReport, ty func (s *IntegrationTestSuite) TestGetCylceListQueries() { accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) // Get supported queries - resp, err := s.oraclekeeper.Params.Get(s.ctx) + resp, err := s.oraclekeeper.GetCyclelist(s.ctx) s.NoError(err) - s.Equal(resp.CycleList, []string{ethQueryData[2:], btcQueryData[2:], trbQueryData[2:]}) - fakeQueryData := "000001" - msgContent := &types.MsgUpdateParams{ + s.Equal(resp, []string{trbQueryData[2:], ethQueryData[2:], btcQueryData[2:]}) + + matic := "00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000056D6174696300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + msgContent := &types.MsgUpdateCyclelist{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), - Params: types.Params{CycleList: []string{fakeQueryData}}, + Cyclelist: []string{matic}, } proposal1, err := s.govKeeper.SubmitProposal(s.ctx, []sdk.Msg{msgContent}, "", "test", "description", accs[0], false) s.NoError(err) @@ -329,9 +332,9 @@ func (s *IntegrationTestSuite) TestGetCylceListQueries() { proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal1.Id) s.NoError(err) s.True(proposal1.Status == v1.StatusPassed) - resp, err = s.oraclekeeper.Params.Get(s.ctx) + resp, err = s.oraclekeeper.GetCyclelist(s.ctx) s.NoError(err) - s.Equal(resp.CycleList, []string{fakeQueryData}) + s.Equal([]string{strings.ToLower(matic)}, resp) } func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { @@ -547,11 +550,12 @@ func (s *IntegrationTestSuite) TestCommitQueryMixed() { // commit report with query data not in cycle list and has no tip commit, _ = report(reporterAddr.String(), value, salt, hash, queryData3) _, err = msgServer.CommitReport(s.ctx, &commit) - s.ErrorContains(err, "query does not have tips and is not in cycle") + s.ErrorContains(err, "query not part of cyclelist") } // test tipping a query id not in cycle list and observe the reporters' delegators stake increase in staking module func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { + s.ctx = s.ctx.WithBlockTime(time.Now()) msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) repAccs := s.CreateAccountsWithTokens(2, 100*1e6) @@ -590,15 +594,19 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { reporterPower := int64(1) value := []string{"000001"} reports := testutil.GenerateReports(repAccs[1:], value, []int64{reporterPower}, hex.EncodeToString(queryId)) - - err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), s.ctx.BlockHeight()), reports[0]) + query, err := s.oraclekeeper.Query.Get(s.ctx, queryId) s.Nil(err) + query.HasRevealedReports = true + s.Nil(s.oraclekeeper.Query.Set(s.ctx, queryId, query)) + err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), query.Id), reports[0]) + s.Nil(err) + s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 3)) // bypassing offset that expires time to commit/reveal err = s.oraclekeeper.SetAggregatedReport(s.ctx) s.Nil(err) // delegation shares should increase after reporting delAfter, err := s.stakingKeeper.Delegation(s.ctx, repAcc.Bytes(), valAddr) s.Nil(err) - s.True(delAfter.GetShares().Equal(delBefore.GetShares().Add(math.LegacyNewDec(980))), "delegation shares should the tip added") // 1000 - 2% tip + s.True(delAfter.GetShares().Equal(delBefore.GetShares().Add(math.LegacyNewDec(980))), "delegation shares plus the tip added") // 1000 - 2% tip } func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { @@ -649,9 +657,13 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { reporterPower := int64(2) // normalize by sdk.DefaultPowerReduction value := []string{"000001"} reports := testutil.GenerateReports([]sdk.AccAddress{repAcc}, value, []int64{reporterPower}, hex.EncodeToString(queryId)) - - err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), s.ctx.BlockHeight()), reports[0]) + query, err := s.oraclekeeper.Query.Get(s.ctx, queryId) + s.Nil(err) + query.HasRevealedReports = true + s.oraclekeeper.Query.Set(s.ctx, queryId, query) + err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), query.Id), reports[0]) s.Nil(err) + s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 3)) // bypassing offset that expires time to commit/reveal err = s.oraclekeeper.SetAggregatedReport(s.ctx) s.Nil(err) // delegation shares should increase after reporting diff --git a/testutil/keeper/oracle.go b/testutil/keeper/oracle.go index e05709d21..b4aaa21c7 100644 --- a/testutil/keeper/oracle.go +++ b/testutil/keeper/oracle.go @@ -53,7 +53,8 @@ func OracleKeeper(t testing.TB) (keeper.Keeper, *mocks.ReporterKeeper, *mocks.Re ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.Nil(t, k.SetParams(ctx, types.DefaultParams())) + require.Nil(t, k.GenesisCycleList(ctx, types.InitialCycleList())) return k, reporterKeeper, registryKeeper, accountKeeper, bankKeeper, ctx } diff --git a/testutil/utils.go b/testutil/utils.go index a46971376..5c20678a1 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -12,7 +12,7 @@ import ( func GenerateReports(reporters []sdk.AccAddress, values []string, powers []int64, qId string) []oracletypes.MicroReport { var reports []oracletypes.MicroReport - queryId, err := utils.QueryIDFromString(qId) + queryId, err := utils.QueryBytesFromString(qId) if err != nil { panic(fmt.Sprintf("failed to decode query ID string: %v", err)) } diff --git a/utils/queryid.go b/utils/queryid.go index 04f01b327..9f69946e2 100644 --- a/utils/queryid.go +++ b/utils/queryid.go @@ -12,7 +12,7 @@ func QueryIDFromData(queryData []byte) []byte { } func QueryIDFromDataString(queryData string) ([]byte, error) { - bz, err := hex.DecodeString(Remove0xPrefix(queryData)) + bz, err := QueryBytesFromString(queryData) if err != nil { return nil, err } @@ -20,10 +20,12 @@ func QueryIDFromDataString(queryData string) ([]byte, error) { return QueryIDFromData(bz), nil } -func QueryIDFromString(queryID string) ([]byte, error) { - return hex.DecodeString(Remove0xPrefix(queryID)) +// converts a hex string to bytes (query data or query ID) +func QueryBytesFromString(query string) ([]byte, error) { + return hex.DecodeString(Remove0xPrefix(query)) } +// Remove0xPrefix removes the '0x' prefix from a hex string and returns the result in lower case. func Remove0xPrefix(hexString string) string { if has0xPrefix(hexString) { hexString = hexString[2:] diff --git a/x/oracle/abci.go b/x/oracle/abci.go index b4cc15b82..e6209c452 100644 --- a/x/oracle/abci.go +++ b/x/oracle/abci.go @@ -1,11 +1,12 @@ package oracle import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + "github.com/tellor-io/layer/x/oracle/keeper" ) -func BeginBlocker(ctx sdk.Context, k keeper.Keeper) error { +func BeginBlocker(ctx context.Context, k keeper.Keeper) error { // Rotate through the cycle list and set the current query index return k.RotateQueries(ctx) } diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index add8fcfee..067cfe473 100644 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -9,7 +9,14 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + err := k.SetParams(ctx, genState.Params) + if err != nil { + panic(err) + } + err = k.GenesisCycleList(ctx, genState.Cyclelist) + if err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 7a35e77d0..92467b845 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -4,96 +4,85 @@ import ( "context" "encoding/hex" "errors" - "strings" "time" "cosmossdk.io/collections" "cosmossdk.io/collections/indexes" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" ) // SetAggregatedReport calculates and allocates rewards to reporters based on aggregated reports. -// at a specific blockchain height (to be ran in begin-blocker) -// It retrieves the revealed reports from the reports store, sorts them by query ID, and then +// at a specific blockchain height (to be ran in end-blocker) +// It retrieves the revealed reports from the reports store, by query. // calculates the aggregate report for each query using either the weighted-median or weighted-mode method. // Rewards based on the source are then allocated to the reporters. func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { - // Get the current block height of the blockchain. - currentHeight := ctx.BlockHeight() - // Retrieve the stored reports for the current block height. - iter, err := k.Reports.Indexes.BlockHeight.MatchExact(ctx, currentHeight) + // aggregate + idsIterator, err := k.Query.Indexes.HasReveals.MatchExact(ctx, true) if err != nil { return err } - kvs, err := indexes.CollectKeyValues(ctx, k.Reports, iter) + defer idsIterator.Close() + queries, err := indexes.CollectValues(ctx, k.Query, idsIterator) if err != nil { return err } - revealedReportsByQueryID := map[string][]types.MicroReport{} - for _, kv := range kvs { - // key is queryId, reporter - qIdStr := hex.EncodeToString(kv.Key.K1()) - if _, ok := revealedReportsByQueryID[qIdStr]; !ok { - revealedReportsByQueryID[qIdStr] = []types.MicroReport{kv.Value} - } else { - revealedReportsByQueryID[qIdStr] = append(revealedReportsByQueryID[qIdStr], kv.Value) - } - } - - // Prepare a list to keep track of reporters who are eligible for tbr. + var aggrFunc func(ctx sdk.Context, reports []types.MicroReport) (*types.Aggregate, error) reportersToPay := make([]*types.AggregateReporter, 0) - cycleList, err := k.CycleListAsQueryIds(ctx) - if err != nil { - return err - } - // Process each set of reports based on their aggregation method. - for queryIdStr, reports := range revealedReportsByQueryID { - // Handle weighted-median aggregation method. - var aggrFunc func(ctx sdk.Context, reports []types.MicroReport) (*types.Aggregate, error) - if reports[0].AggregateMethod == "weighted-median" { - // Calculate the aggregated report. - aggrFunc = k.WeightedMedian - } else { - // default to weighted-mode aggregation method. - // Calculate the aggregated report. - aggrFunc = k.WeightedMode - } - report, err := aggrFunc(ctx, reports) - if err != nil { - return err - } - - // Get the tip for this query. - queryIdBytes, err := hex.DecodeString(queryIdStr) - if err != nil { - return err - } - tip, err := k.GetQueryTip(ctx, queryIdBytes) - if err != nil { - return err - } - // Allocate rewards if there is a tip. - if !tip.IsZero() { - err = k.AllocateRewards(ctx, report.Reporters, tip, true) + for _, query := range queries { + if query.Expiration.Add(offset).Before(ctx.BlockTime()) { + reportsIterator, err := k.Reports.Indexes.Id.MatchExact(ctx, query.Id) if err != nil { return err } - // remove the tip from the store - err = k.CurrentTip.Remove(ctx, queryIdBytes) + defer reportsIterator.Close() + reports, err := indexes.CollectValues(ctx, k.Reports, reportsIterator) if err != nil { return err } - } - // Add reporters to the tbr payment list. - if cycleList[strings.ToLower(queryIdStr)] { - reportersToPay = append(reportersToPay, report.Reporters...) + + if reports[0].AggregateMethod == "weighted-median" { + // Calculate the aggregated report. + aggrFunc = k.WeightedMedian + } else { + // default to weighted-mode aggregation method. + // Calculate the aggregated report. + aggrFunc = k.WeightedMode + } + + report, err := aggrFunc(ctx, reports) + if err != nil { + return err + } + + if !query.Amount.IsZero() { + err = k.AllocateRewards(ctx, report.Reporters, query.Amount, true) + if err != nil { + return err + } + query.Amount = math.ZeroInt() + err = k.Query.Set(ctx, query.QueryId, query) + if err != nil { + return err + } + } + // Add reporters to the tbr payment list. + // incyclelist, err := k.Cyclelist.Has(ctx, queryIdBytes) + // if err != nil { + // return err + // } + if reports[0].Cyclelist { + reportersToPay = append(reportersToPay, report.Reporters...) + } } } + // Process time-based rewards for reporters. tbr := k.getTimeBasedRewards(ctx) // Allocate time-based rewards to all eligible reporters. @@ -101,7 +90,7 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { } func (k Keeper) SetAggregate(ctx sdk.Context, report *types.Aggregate) error { - queryId, err := utils.QueryIDFromString(report.QueryId) + queryId, err := utils.QueryBytesFromString(report.QueryId) if err != nil { return err } @@ -114,7 +103,7 @@ func (k Keeper) SetAggregate(ctx sdk.Context, report *types.Aggregate) error { if err != nil { return err } - report.Nonce = nonce // TODO: do we want to use int64 for nonce? ***Done switch to uint64*** + report.Nonce = nonce currentTimestamp := ctx.BlockTime().Unix() diff --git a/x/oracle/keeper/cycle_list.go b/x/oracle/keeper/cycle_list.go index 091205c0e..0572fad7e 100644 --- a/x/oracle/keeper/cycle_list.go +++ b/x/oracle/keeper/cycle_list.go @@ -1,67 +1,116 @@ package keeper import ( + "context" "encoding/hex" - "errors" - "strings" - "cosmossdk.io/collections" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/utils" + "github.com/tellor-io/layer/x/oracle/types" ) -// rotation what query is next -func (k Keeper) RotateQueries(ctx sdk.Context) error { - params, err := k.Params.Get(ctx) +func (k Keeper) GetCyclelist(ctx context.Context) ([]string, error) { + + iter, err := k.Cyclelist.Iterate(ctx, nil) if err != nil { - return err + return nil, err } - currentIndex, err := k.CycleIndex.Get(ctx) + q, err := iter.Values() if err != nil { - if errors.Is(err, collections.ErrNotFound) { - err = k.CycleIndex.Set(ctx, 0) - if err != nil { - return err - } - return nil - } - return err + return nil, err } - if currentIndex >= int64(len(params.CycleList)) { - currentIndex = 0 + return q, nil +} + +// rotation of the cycle list +func (k Keeper) RotateQueries(ctx context.Context) error { + // todo: better to set length of cycle list as an item and read that + // so we don't do this read operation every time + + q, err := k.GetCyclelist(ctx) + if err != nil { + return err } - i := (currentIndex + 1) % int64(len(params.CycleList)) - err = k.CycleIndex.Set(ctx, i) + n, err := k.CyclelistSequencer.Next(ctx) if err != nil { return err } - return nil + + max := len(q) + switch { + case n == uint64(max): + return k.CyclelistSequencer.Set(ctx, 1) + default: + return nil + } + } -func (k Keeper) GetCurrentQueryInCycleList(ctx sdk.Context) (string, error) { - currentIndex, err := k.CycleIndex.Get(ctx) +func (k Keeper) GetCurrentQueryInCycleList(ctx context.Context) (string, error) { + idx, err := k.CyclelistSequencer.Peek(ctx) if err != nil { return "", err } - params, err := k.Params.Get(ctx) + + q, err := k.GetCyclelist(ctx) if err != nil { return "", err } - return params.CycleList[currentIndex], nil + + return q[idx], nil } -func (k Keeper) CycleListAsQueryIds(ctx sdk.Context) (map[string]bool, error) { - params, err := k.Params.Get(ctx) - if err != nil { - return nil, err +// should be called only once when updating the cycle list +func (k Keeper) InitCycleListQuery(ctx context.Context, queries []string) error { + + for _, querydata := range queries { + + query, err := k.initializeQuery(ctx, querydata) + if err != nil { + return err + } + queryId, err := utils.QueryIDFromDataString(querydata) + if err != nil { + return err + } + err = k.Query.Set(ctx, queryId, query) + if err != nil { + return err + } + err = k.Cyclelist.Set(ctx, queryId, utils.Remove0xPrefix(querydata)) + if err != nil { + return err + } } - queryIds := make(map[string]bool, len(params.CycleList)) - for _, q := range params.CycleList { - queryId, err := utils.QueryIDFromDataString(q) + return nil +} + +func (k Keeper) GenesisCycleList(ctx context.Context, cyclelist []string) error { + + for _, query := range cyclelist { + query := utils.Remove0xPrefix(query) + queryDataBytes, err := hex.DecodeString(query) + if err != nil { + return err + } + queryId := HashQueryData(queryDataBytes) + + nextId, err := k.QuerySequnecer.Next(ctx) + if err != nil { + return err + } + meta := types.QueryMeta{ + Id: nextId, + RegistrySpecTimeframe: 0, + QueryId: queryId, + } + err = k.Query.Set(ctx, queryId, meta) if err != nil { - return nil, err + return err + } + err = k.Cyclelist.Set(ctx, queryId, query) + if err != nil { + return err } - queryIds[strings.ToLower(hex.EncodeToString(queryId))] = true } - return queryIds, nil + return nil } diff --git a/x/oracle/keeper/indexes.go b/x/oracle/keeper/indexes.go index 2fbe48f0d..49ed22c15 100644 --- a/x/oracle/keeper/indexes.go +++ b/x/oracle/keeper/indexes.go @@ -28,32 +28,52 @@ func NewTipsIndex(sb *collections.SchemaBuilder) tipsIndex { } type reportsIndex struct { - BlockHeight *indexes.Multi[int64, collections.Triple[[]byte, []byte, int64], types.MicroReport] - Reporter *indexes.Multi[[]byte, collections.Triple[[]byte, []byte, int64], types.MicroReport] + Id *indexes.Multi[uint64, collections.Triple[[]byte, []byte, uint64], types.MicroReport] + Reporter *indexes.Multi[[]byte, collections.Triple[[]byte, []byte, uint64], types.MicroReport] } -func (a reportsIndex) IndexesList() []collections.Index[collections.Triple[[]byte, []byte, int64], types.MicroReport] { - return []collections.Index[collections.Triple[[]byte, []byte, int64], types.MicroReport]{ - a.BlockHeight, +func (a reportsIndex) IndexesList() []collections.Index[collections.Triple[[]byte, []byte, uint64], types.MicroReport] { + return []collections.Index[collections.Triple[[]byte, []byte, uint64], types.MicroReport]{ + a.Id, a.Reporter, } } func NewReportsIndex(sb *collections.SchemaBuilder) reportsIndex { return reportsIndex{ - BlockHeight: indexes.NewMulti( - sb, types.ReportsHeightIndexPrefix, "reports_by_height", - collections.Int64Key, collections.TripleKeyCodec[[]byte, []byte, int64](collections.BytesKey, collections.BytesKey, collections.Int64Key), - func(k collections.Triple[[]byte, []byte, int64], _ types.MicroReport) (int64, error) { + Id: indexes.NewMulti( + sb, types.ReportsHeightIndexPrefix, "reports_by_id", + collections.Uint64Key, collections.TripleKeyCodec[[]byte, []byte, uint64](collections.BytesKey, collections.BytesKey, collections.Uint64Key), + func(k collections.Triple[[]byte, []byte, uint64], _ types.MicroReport) (uint64, error) { return k.K3(), nil }, ), Reporter: indexes.NewMulti( sb, types.ReportsReporterIndexPrefix, "reports_by_reporter", - collections.BytesKey, collections.TripleKeyCodec[[]byte, []byte, int64](collections.BytesKey, collections.BytesKey, collections.Int64Key), - func(k collections.Triple[[]byte, []byte, int64], _ types.MicroReport) ([]byte, error) { + collections.BytesKey, collections.TripleKeyCodec[[]byte, []byte, uint64](collections.BytesKey, collections.BytesKey, collections.Uint64Key), + func(k collections.Triple[[]byte, []byte, uint64], _ types.MicroReport) ([]byte, error) { return k.K2(), nil }, ), } } + +type queryMetaIndex struct { + HasReveals *indexes.Multi[bool, []byte, types.QueryMeta] +} + +func (a queryMetaIndex) IndexesList() []collections.Index[[]byte, types.QueryMeta] { + return []collections.Index[[]byte, types.QueryMeta]{a.HasReveals} +} + +func NewQueryIndex(sb *collections.SchemaBuilder) queryMetaIndex { + return queryMetaIndex{ + HasReveals: indexes.NewMulti( + sb, types.QueryRevealedIdsIndexPrefix, "query_by_revealed", + collections.BoolKey, collections.BytesKey, + func(_ []byte, v types.QueryMeta) (bool, error) { + return v.HasRevealedReports, nil + }, + ), + } +} diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 3f673e45d..56bd72aea 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -1,7 +1,9 @@ package keeper import ( + "context" "fmt" + "time" "cosmossdk.io/collections" "cosmossdk.io/core/store" @@ -10,9 +12,13 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/crypto" + "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" + regTypes "github.com/tellor-io/layer/x/registry/types" ) +var offset = time.Second * 2 + type ( Keeper struct { cdc codec.BinaryCodec @@ -22,19 +28,20 @@ type ( bankKeeper types.BankKeeper registryKeeper types.RegistryKeeper reporterKeeper types.ReporterKeeper + Schema collections.Schema + Commits collections.Map[collections.Pair[[]byte, uint64], types.Commit] // key: reporter, queryid + Tips *collections.IndexedMap[collections.Pair[[]byte, []byte], math.Int, tipsIndex] // key: queryId, tipper + TotalTips collections.Item[math.Int] // keep track of the total tips + Aggregates collections.Map[collections.Pair[[]byte, int64], types.Aggregate] // key: queryId, timestamp + Nonces collections.Map[[]byte, uint64] // key: queryId + Reports *collections.IndexedMap[collections.Triple[[]byte, []byte, uint64], types.MicroReport, reportsIndex] // key: queryId, reporter, query.id + QuerySequnecer collections.Sequence + Query *collections.IndexedMap[[]byte, types.QueryMeta, queryMetaIndex] // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. - Schema collections.Schema - Commits collections.Map[collections.Pair[[]byte, []byte], types.CommitReport] // key: reporter, queryid - CurrentTip collections.Map[[]byte, math.Int] // key: queryId - Tips *collections.IndexedMap[collections.Pair[[]byte, []byte], math.Int, tipsIndex] // key: queryId, tipper - TotalTips collections.Item[math.Int] // keep track of the total tips - Aggregates collections.Map[collections.Pair[[]byte, int64], types.Aggregate] // key: queryId, timestamp - Nonces collections.Map[[]byte, uint64] // key: queryId - Reports *collections.IndexedMap[collections.Triple[[]byte, []byte, int64], types.MicroReport, reportsIndex] // key: queryId, reporter, blockHeight - CycleIndex collections.Item[int64] // keep track of the current cycle - - authority string + authority string + Cyclelist collections.Map[[]byte, string] + CyclelistSequencer collections.Sequence } ) @@ -65,8 +72,7 @@ func NewKeeper( authority: authority, - Commits: collections.NewMap(sb, types.CommitsPrefix, "commits", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), codec.CollValue[types.CommitReport](cdc)), - CurrentTip: collections.NewMap(sb, types.CurrentTipPrefix, "current_tip", collections.BytesKey, sdk.IntValue), + Commits: collections.NewMap(sb, types.CommitsPrefix, "commits", collections.PairKeyCodec(collections.BytesKey, collections.Uint64Key), codec.CollValue[types.Commit](cdc)), Tips: collections.NewIndexedMap(sb, types.TipsPrefix, "tips", @@ -80,11 +86,20 @@ func NewKeeper( Reports: collections.NewIndexedMap(sb, types.ReportsPrefix, "reports", - collections.TripleKeyCodec(collections.BytesKey, collections.BytesKey, collections.Int64Key), + collections.TripleKeyCodec(collections.BytesKey, collections.BytesKey, collections.Uint64Key), codec.CollValue[types.MicroReport](cdc), NewReportsIndex(sb), ), - CycleIndex: collections.NewItem(sb, types.CycleIndexPrefix, "cycle_index", collections.Int64Value), + QuerySequnecer: collections.NewSequence(sb, types.QuerySeqPrefix, "sequencer"), + Query: collections.NewIndexedMap(sb, + types.QueryTipPrefix, + "query", + collections.BytesKey, + codec.CollValue[types.QueryMeta](cdc), + NewQueryIndex(sb), + ), + Cyclelist: collections.NewMap(sb, types.CyclelistPrefix, "cyclelist", collections.BytesKey, collections.StringValue), + CyclelistSequencer: collections.NewSequence(sb, types.CycleSeqPrefix, "cycle_sequencer"), } schema, err := sb.Build() @@ -108,3 +123,31 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { func HashQueryData(queryData []byte) []byte { return crypto.Keccak256(queryData) } + +// initialize query for a given query data +func (k Keeper) initializeQuery(ctx context.Context, querydata string) (types.QueryMeta, error) { + // initialize query tip first time + + queryDataBytes, err := utils.QueryBytesFromString(querydata) + if err != nil { + return types.QueryMeta{}, err + } + queryType, _, err := regTypes.DecodeQueryType(queryDataBytes) + if err != nil { + return types.QueryMeta{}, err + } + dataSpec, err := k.GetDataSpec(sdk.UnwrapSDKContext(ctx), queryType) + if err != nil { + return types.QueryMeta{}, err + } + id, err := k.QuerySequnecer.Next(ctx) + if err != nil { + return types.QueryMeta{}, err + } + query := types.QueryMeta{ + Id: id, + RegistrySpecTimeframe: dataSpec.ReportBufferWindow, + QueryId: HashQueryData(queryDataBytes), + } + return query, nil +} diff --git a/x/oracle/keeper/msg_server_commit_report.go b/x/oracle/keeper/msg_server_commit_report.go index ff03f4b47..4cda5c8bb 100644 --- a/x/oracle/keeper/msg_server_commit_report.go +++ b/x/oracle/keeper/msg_server_commit_report.go @@ -2,15 +2,15 @@ package keeper import ( "context" - "fmt" + "errors" "cosmossdk.io/collections" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) func (k msgServer) CommitReport(goCtx context.Context, msg *types.MsgCommitReport) (*types.MsgCommitReportResponse, error) { @@ -21,51 +21,98 @@ func (k msgServer) CommitReport(goCtx context.Context, msg *types.MsgCommitRepor return nil, err } - queryId, err := utils.QueryIDFromDataString(msg.QueryData) + // get reporter + reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) if err != nil { - return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("invalid query data: %s", err)) + return nil, err + } + if reporter.Jailed { + return nil, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", reporterAddr) } - currentCycleQuery, err := k.GetCurrentQueryInCycleList(ctx) + params, err := k.Params.Get(ctx) if err != nil { return nil, err } - tip, err := k.GetQueryTip(ctx, queryId) + + if reporter.TotalTokens.LT(params.MinStakeAmount) { + return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required amount is %s", reporter.TotalTokens, params.MinStakeAmount) + } + // normalize by removing 0x prefix and lowercasing + msg.QueryData = utils.Remove0xPrefix(msg.QueryData) + + // get query id bytes hash from query data + queryId, err := utils.QueryIDFromDataString(msg.QueryData) + if err != nil { + return nil, types.ErrInvalidQueryData.Wrapf("invalid query data: %s", err) + } + // get query info by query id + query, err := k.Keeper.Query.Get(ctx, queryId) + if err != nil { + // if no query it means its not a cyclelist query and doesn't have tips (cyclelist queries are initialized in genesis) + if errors.Is(err, collections.ErrNotFound) { + return nil, types.ErrNoTipsNotInCycle.Wrapf("query not part of cyclelist") + } + return nil, err + } + // get current query in cycle + cycleQuery, err := k.Keeper.GetCurrentQueryInCycleList(ctx) if err != nil { return nil, err } + // bool to check if query is in cycle + incycle := msg.QueryData == cycleQuery - if currentCycleQuery != msg.QueryData && tip.IsZero() { - return nil, status.Error(codes.Unavailable, "query does not have tips and is not in cycle") + if query.Amount.IsZero() && query.Expiration.Before(ctx.BlockTime()) && !incycle { + return nil, types.ErrNoTipsNotInCycle.Wrapf("query does not have tips and is not in cycle") } - reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) - if err != nil { - return nil, err + if query.Amount.GT(math.ZeroInt()) && query.Expiration.Before(ctx.BlockTime()) && !incycle { + return nil, errors.New("query's tip is expired and is not in cycle") } - if reporter.Jailed { - return nil, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", reporterAddr) + // if tip is zero and expired, move query forward only if in cycle + // if tip amount is zero and query timeframe is expired, it means one of two things + // the tip has been paid out because the query has expired and there were revealed reports + // or the query was in cycle and expired (either revealed or not) + // in either case move query forward by incrementing id and setting expiration + if query.Amount.IsZero() && query.Expiration.Before(ctx.BlockTime()) && incycle { + nextId, err := k.Keeper.QuerySequnecer.Next(ctx) + if err != nil { + return nil, err + } + query.Id = nextId + query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) + err = k.Query.Set(ctx, queryId, query) + if err != nil { + return nil, err + } } - params, err := k.Params.Get(ctx) - if err != nil { - return nil, err + // if there is tip but window expired, only incycle can extend the window, otherwise requires tip vi msgTip tx + // if tip amount is greater than zero and query timeframe is expired, it means that the query didn't have any revealed reports + // and the tip is still there and so the time can be extended only if the query is in cycle or via a tip transaction + // maintains the same id until the query is paid out + if query.Amount.GT(math.ZeroInt()) && query.Expiration.Before(ctx.BlockTime()) && incycle { + query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) + err = k.Query.Set(ctx, queryId, query) + if err != nil { + return nil, err + } } - if reporter.TotalTokens.LT(params.MinStakeAmount) { - return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required %s", reporter.TotalTokens, params.MinStakeAmount) + // if tip is zero and not expired, this could only mean that the query is still accepting submissions + if query.Amount.IsZero() && ctx.BlockTime().Before(query.Expiration) { + incycle = true } - report := types.CommitReport{ - Report: &types.Commit{ - Creator: msg.Creator, - QueryId: queryId, - Hash: msg.Hash, - }, - Block: ctx.BlockHeight(), + commit := types.Commit{ + Reporter: msg.Creator, + QueryId: queryId, + Hash: msg.Hash, + Incycle: incycle, } - err = k.Commits.Set(ctx, collections.Join(reporterAddr.Bytes(), queryId), report) + err = k.Commits.Set(ctx, collections.Join(reporterAddr.Bytes(), query.Id), commit) if err != nil { return nil, err } diff --git a/x/oracle/keeper/msg_server_submit_value.go b/x/oracle/keeper/msg_server_submit_value.go index 17e7f2486..c52ffdbdb 100644 --- a/x/oracle/keeper/msg_server_submit_value.go +++ b/x/oracle/keeper/msg_server_submit_value.go @@ -7,9 +7,12 @@ import ( "fmt" "cosmossdk.io/collections" + "cosmossdk.io/math" + + errorsmod "cosmossdk.io/errors" + "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" - "github.com/tellor-io/layer/x/oracle/utils" - regtypes "github.com/tellor-io/layer/x/registry/types" + oracleutils "github.com/tellor-io/layer/x/oracle/utils" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" @@ -28,53 +31,104 @@ func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) if err != nil { return nil, err } + if reporter.Jailed { + return nil, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", reporterAddr) + } + params, err := k.Params.Get(ctx) + if err != nil { + return nil, err + } + + if reporter.TotalTokens.LT(params.MinStakeAmount) { + return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required %s", reporter.TotalTokens, params.MinStakeAmount) + } votingPower := reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64() - // check if querydata has prefix 0x - msg.QueryData = regtypes.Remove0xPrefix(msg.QueryData) // decode query data hex string to bytes + msg.QueryData = utils.Remove0xPrefix(msg.QueryData) qDataBytes, err := hex.DecodeString(msg.QueryData) if err != nil { return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("failed to decode query data string: %v", err)) } - // get commit from store - commitValue, err := k.Commits.Get(ctx, collections.Join(reporterAddr.Bytes(), HashQueryData(qDataBytes))) + queryId := utils.QueryIDFromData(qDataBytes) + + query, err := k.Keeper.Query.Get(ctx, queryId) if err != nil { - if errors.Is(err, collections.ErrNotFound) { - return nil, status.Error(codes.NotFound, "no commits to reveal found") - } + // if entered here it means that there is no tip because in cycle query are initialized in genesis return nil, err } - currentBlock := ctx.BlockHeight() - // check if value is being revealed in the one block after commit - if currentBlock == commitValue.Block { - return nil, types.ErrCommitRevealWindowEarly + var incycle bool + // get commit by identifier + commit, err := k.Keeper.Commits.Get(ctx, collections.Join(reporterAddr.Bytes(), query.Id)) + if err != nil { + if !errors.Is(err, collections.ErrNotFound) { + return nil, err + } else { + // if there is no commit check if in cycle + cycleQuery, err := k.Keeper.GetCurrentQueryInCycleList(ctx) + if err != nil { + return nil, err + } + incycle = msg.QueryData == cycleQuery + err = k.directReveal(ctx, query, qDataBytes, msg.Value, reporterAddr, votingPower, incycle) + if err != nil { + return nil, err + } + return &types.MsgSubmitValueResponse{}, nil + } } - if currentBlock-1 != commitValue.Block { - return nil, types.ErrMissedCommitRevealWindow + // if there is a commit then check if its expired and verify commit, and add in cycle from commit.incycle + if query.Expiration.Add(offset).Before(ctx.BlockTime()) { + return nil, errors.New("missed commit reveal window") } - // if commitValue.Block < ctx.BlockHeight()-5 || commitValue.Block > ctx.BlockHeight() { - // return nil, status.Error(codes.InvalidArgument, "missed block height window to reveal") - // } - - commit := utils.CalculateCommitment(msg.Value, msg.Salt) - if commit != commitValue.Report.Hash { + genHash := oracleutils.CalculateCommitment(msg.Value, msg.Salt) + if genHash != commit.Hash { return nil, errors.New("submitted value doesn't match commitment, are you a cheater?") } + incycle = commit.Incycle - // set value - if err := k.setValue(ctx, reporterAddr, msg.Value, qDataBytes, votingPower, currentBlock); err != nil { + err = k.setValue(ctx, reporterAddr, query, msg.Value, qDataBytes, votingPower, incycle) + if err != nil { return nil, err } - // emit event - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - "NewReport", - sdk.NewAttribute("reporter", msg.Creator), - sdk.NewAttribute("query_data", msg.QueryData), - sdk.NewAttribute("value", msg.Value), - ), - }) - return &types.MsgSubmitValueResponse{}, nil } + +func (k Keeper) directReveal(ctx sdk.Context, + query types.QueryMeta, + qDataBytes []byte, + value string, + reporterAddr sdk.AccAddress, + votingPower int64, + incycle bool) error { + + if query.Amount.IsZero() && query.Expiration.Add(offset).Before(ctx.BlockTime()) && !incycle { + return types.ErrNoTipsNotInCycle + } + + if query.Amount.IsZero() && query.Expiration.Add(offset).Before(ctx.BlockTime()) && incycle { + nextId, err := k.QuerySequnecer.Next(ctx) + if err != nil { + return err + } + query.Id = nextId + query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) + } + + if query.Amount.GT(math.ZeroInt()) && query.Expiration.Add(offset).Before(ctx.BlockTime()) && !incycle { + return errors.New("tip submission window expired and query is not in cycle") + } + + if query.Amount.GT(math.ZeroInt()) && query.Expiration.Add(offset).Before(ctx.BlockTime()) && incycle { + query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) + } + if query.Amount.IsZero() && ctx.BlockTime().Before(query.Expiration.Add(offset)) { + incycle = true + } + err := k.setValue(ctx, reporterAddr, query, value, qDataBytes, votingPower, incycle) + if err != nil { + return err + } + + return nil +} diff --git a/x/oracle/keeper/msg_server_tip.go b/x/oracle/keeper/msg_server_tip.go index d99f6771c..f151f1b5c 100644 --- a/x/oracle/keeper/msg_server_tip.go +++ b/x/oracle/keeper/msg_server_tip.go @@ -26,20 +26,55 @@ func (k msgServer) Tip(goCtx context.Context, msg *types.MsgTip) (*types.MsgTipR return nil, err } + // get query id bytes hash from query data queryId, err := utils.QueryIDFromDataString(msg.QueryData) if err != nil { return nil, err } - - err = k.Keeper.AddtoTotalTips(ctx, tip.Amount) + // get query info for the query id + query, err := k.Keeper.Query.Get(ctx, queryId) if err != nil { - return nil, err + if !errors.Is(err, collections.ErrNotFound) { + return nil, err + } + // initialize query tip first time + query, err := k.Keeper.initializeQuery(ctx, msg.QueryData) + if err != nil { + return nil, err + } + + query.Amount = tip.Amount + query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) + err = k.Keeper.Query.Set(ctx, queryId, query) + if err != nil { + return nil, err + } + return &types.MsgTipResponse{}, nil } - err = k.Keeper.SetQueryTip(ctx, queryId, tip.Amount) + query.Amount = query.Amount.Add(tip.Amount) + + // expired submission window + if query.Expiration.Before(ctx.BlockTime()) { + // add time + query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) + // if revealed reports exist means tip will be allocated + // so reset tip and generate new id + if query.HasRevealedReports { + id, err := k.QuerySequnecer.Next(ctx) + if err != nil { + return nil, err + } + query.Id = id + query.Amount = tip.Amount + query.HasRevealedReports = false + } + } + err = k.Keeper.Query.Set(ctx, queryId, query) if err != nil { return nil, err } + prevTip, err := k.Keeper.Tips.Get(ctx, collections.Join(queryId, tipper.Bytes())) if err != nil && !errors.Is(err, collections.ErrNotFound) { return nil, fmt.Errorf("failed to get previous tip: %w", err) @@ -52,6 +87,10 @@ func (k msgServer) Tip(goCtx context.Context, msg *types.MsgTip) (*types.MsgTipR if err != nil { return nil, err } + err = k.Keeper.AddtoTotalTips(ctx, tip.Amount) + if err != nil { + return nil, err + } return &types.MsgTipResponse{}, nil } diff --git a/x/oracle/keeper/msg_update_cyclelist.go b/x/oracle/keeper/msg_update_cyclelist.go new file mode 100644 index 000000000..cae3c01f6 --- /dev/null +++ b/x/oracle/keeper/msg_update_cyclelist.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/tellor-io/layer/x/oracle/types" +) + +func (k msgServer) UpdateCyclelist(goCtx context.Context, req *types.MsgUpdateCyclelist) (*types.MsgUpdateCyclelistResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.Cyclelist.Clear(ctx, nil); err != nil { + return nil, err + } + if err := k.InitCycleListQuery(ctx, req.Cyclelist); err != nil { + return nil, err + } + + return &types.MsgUpdateCyclelistResponse{}, nil +} diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go index 97cc0e305..179da5b49 100644 --- a/x/oracle/keeper/params.go +++ b/x/oracle/keeper/params.go @@ -4,7 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/x/oracle/types" - regtypes "github.com/tellor-io/layer/x/registry/types" ) // SetParams sets the x/oracle module parameters. @@ -12,14 +11,6 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { if err := params.Validate(); err != nil { return err } - for i, query := range params.CycleList { - query = regtypes.Remove0xPrefix(query) - params.CycleList[i] = query - } - // initially set the cycle index to 0 - if err := k.CycleIndex.Set(ctx, 0); err != nil { - return err - } return k.Params.Set(ctx, params) } diff --git a/x/oracle/keeper/query_get_aggregated_report.go b/x/oracle/keeper/query_get_aggregated_report.go index be9525840..3b9a52c5a 100644 --- a/x/oracle/keeper/query_get_aggregated_report.go +++ b/x/oracle/keeper/query_get_aggregated_report.go @@ -14,7 +14,7 @@ func (k Keeper) GetAggregatedReport(goCtx context.Context, req *types.QueryGetCu return nil, status.Error(codes.InvalidArgument, "invalid request") } - queryId, err := utils.QueryIDFromString(req.QueryId) + queryId, err := utils.QueryBytesFromString(req.QueryId) if err != nil { panic(err) } diff --git a/x/oracle/keeper/query_get_reports.go b/x/oracle/keeper/query_get_reports.go index 821dc1f78..ec9e209cc 100644 --- a/x/oracle/keeper/query_get_reports.go +++ b/x/oracle/keeper/query_get_reports.go @@ -20,12 +20,12 @@ func (k Querier) GetReportsbyQid(goCtx context.Context, req *types.QueryGetRepor reports := types.Reports{ MicroReports: []*types.MicroReport{}, } - queryIdBytes, err := utils.QueryIDFromString(req.QueryId) + queryIdBytes, err := utils.QueryBytesFromString(req.QueryId) if err != nil { return nil, status.Error(codes.InvalidArgument, "failed to decode query ID") } - rng := collections.NewPrefixedTripleRange[[]byte, []byte, int64](queryIdBytes) - err = k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, int64], value types.MicroReport) (stop bool, err error) { + rng := collections.NewPrefixedTripleRange[[]byte, []byte, uint64](queryIdBytes) + err = k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, uint64], value types.MicroReport) (stop bool, err error) { reports.MicroReports = append(reports.MicroReports, &value) return false, nil }) @@ -66,14 +66,14 @@ func (k Querier) GetReportsbyReporterQid(goCtx context.Context, req *types.Query return nil, status.Error(codes.InvalidArgument, "failed to decode reporter address") } - qId, err := utils.QueryIDFromString(req.QueryId) + qId, err := utils.QueryBytesFromString(req.QueryId) if err != nil { return nil, status.Error(codes.InvalidArgument, "failed to decode query ID") } microReports := []*types.MicroReport{} - rng := collections.NewSuperPrefixedTripleRange[[]byte, []byte, int64](qId, reporterAdd.Bytes()) - err = k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, int64], value types.MicroReport) (stop bool, err error) { + rng := collections.NewSuperPrefixedTripleRange[[]byte, []byte, uint64](qId, reporterAdd.Bytes()) + err = k.Reports.Walk(goCtx, rng, func(key collections.Triple[[]byte, []byte, uint64], value types.MicroReport) (stop bool, err error) { microReports = append(microReports, &value) return false, nil }) diff --git a/x/oracle/keeper/submit_value.go b/x/oracle/keeper/submit_value.go index 04b215ebc..da1d1227e 100644 --- a/x/oracle/keeper/submit_value.go +++ b/x/oracle/keeper/submit_value.go @@ -14,7 +14,7 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) setValue(ctx sdk.Context, reporter sdk.AccAddress, val string, queryData []byte, power, block int64) error { +func (k Keeper) setValue(ctx sdk.Context, reporter sdk.AccAddress, query types.QueryMeta, val string, queryData []byte, power int64, incycle bool) error { // decode query data hex to get query type, returns interface array queryType, _, err := regTypes.DecodeQueryType(queryData) if err != nil { @@ -37,11 +37,17 @@ func (k Keeper) setValue(ctx sdk.Context, reporter sdk.AccAddress, val string, q QueryId: hex.EncodeToString(queryId), Value: val, AggregateMethod: dataSpec.AggregationMethod, - BlockNumber: block, Timestamp: ctx.BlockTime(), + Cyclelist: incycle, } - return k.Reports.Set(ctx, collections.Join3(queryId, reporter.Bytes(), ctx.BlockHeight()), report) + query.HasRevealedReports = true + err = k.Query.Set(ctx, queryId, query) + if err != nil { + return err + } + + return k.Reports.Set(ctx, collections.Join3(queryId, reporter.Bytes(), query.Id), report) } func (k Keeper) VerifyCommit(ctx sdk.Context, reporter string, value, salt, hash string) bool { diff --git a/x/oracle/keeper/tip.go b/x/oracle/keeper/tip.go index a5e09c631..567898d39 100644 --- a/x/oracle/keeper/tip.go +++ b/x/oracle/keeper/tip.go @@ -25,7 +25,7 @@ func (k Keeper) transfer(ctx sdk.Context, tipper sdk.AccAddress, tip sdk.Coin) ( } func (k Keeper) GetQueryTip(ctx sdk.Context, queryId []byte) (math.Int, error) { - tip, err := k.CurrentTip.Get(ctx, queryId) + tip, err := k.Query.Get(ctx, queryId) if err != nil { if errors.Is(err, collections.ErrNotFound) { return math.ZeroInt(), nil @@ -33,15 +33,7 @@ func (k Keeper) GetQueryTip(ctx sdk.Context, queryId []byte) (math.Int, error) { return math.Int{}, err } } - return tip, nil -} - -func (k Keeper) SetQueryTip(ctx sdk.Context, queryId []byte, tip math.Int) error { - existingTip, err := k.GetQueryTip(ctx, queryId) - if err != nil { - return err - } - return k.CurrentTip.Set(ctx, queryId, existingTip.Add(tip)) + return tip.Amount, nil } func (k Keeper) GetUserTips(ctx context.Context, tipper sdk.AccAddress) (types.UserTipTotal, error) { diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index d31e2872c..99a2235e2 100644 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -12,6 +12,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCommitReport{}, "oracle/CommitReport", nil) cdc.RegisterConcrete(&MsgTip{}, "oracle/Tip", nil) cdc.RegisterConcrete(&MsgUpdateParams{}, "oracle/UpdateParams", nil) + cdc.RegisterConcrete(&MsgUpdateCyclelist{}, "oracle/UpdateCyclelist", nil) // this line is used by starport scaffolding # 2 } @@ -28,6 +29,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateParams{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateCyclelist{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/oracle/types/cyclelist.go b/x/oracle/types/cyclelist.go new file mode 100644 index 000000000..335ceb52f --- /dev/null +++ b/x/oracle/types/cyclelist.go @@ -0,0 +1,12 @@ +package types + +func InitialCycleList() []string { + return []string{ + //ETH/USD + "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", + //BTC/USD + "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", + //TRB/USD + "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", + } +} diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index 53fcdad4d..16ee54737 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -18,4 +18,7 @@ var ( ErrReporterJailed = sdkerrors.Register(ModuleName, 1106, "reporter is jailed") ErrNoAvailableReports = sdkerrors.Register(ModuleName, 1107, "no available reports") ErrNoReportsToAggregate = sdkerrors.Register(ModuleName, 1108, "no reports to aggregate") + ErrQueryNotFound = sdkerrors.Register(ModuleName, 1109, "query not found") + ErrNoTipsNotInCycle = sdkerrors.Register(ModuleName, 1110, "no tips not in cycle") + ErrInvalidQueryData = sdkerrors.Register(ModuleName, 1111, "invalid query data") ) diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go index 2c15cd92a..f3cb79ad3 100644 --- a/x/oracle/types/genesis.go +++ b/x/oracle/types/genesis.go @@ -9,7 +9,8 @@ const DefaultIndex uint64 = 1 func DefaultGenesis() *GenesisState { return &GenesisState{ // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), + Params: DefaultParams(), + Cyclelist: InitialCycleList(), } } diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index ed79f72cf..6a149cc23 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -34,8 +34,15 @@ var ( NoncesPrefix = collections.NewPrefix(7) TotalTipsPrefix = collections.NewPrefix(8) - CycleIndexPrefix = collections.NewPrefix(9) - CurrentTipPrefix = collections.NewPrefix(10) + QuerySeqPrefix = collections.NewPrefix(9) + QueryTipPrefix = collections.NewPrefix(10) + ReportsIdIndexPrefix = collections.NewPrefix(11) + QueryCyclePrefix = collections.NewPrefix(12) + CycleSeqPrefix = collections.NewPrefix(13) + QueryTipPrefix2 = collections.NewPrefix(14) + NextInListPrefix = collections.NewPrefix(15) + QueryRevealedIdsIndexPrefix = collections.NewPrefix(16) + CyclelistPrefix = collections.NewPrefix(17) ) func KeyPrefix(p string) []byte { diff --git a/x/oracle/types/message_submit_value.go b/x/oracle/types/message_submit_value.go index 75c291c94..e82988d25 100644 --- a/x/oracle/types/message_submit_value.go +++ b/x/oracle/types/message_submit_value.go @@ -59,8 +59,5 @@ func (msg *MsgSubmitValue) GetSignerAndValidateMsg() (sdk.AccAddress, error) { if msg.Value == "" { return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "value cannot be empty") } - if msg.Salt == "" { - return nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "salt cannot be empty") - } return addr, nil } diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index d04aa238b..97308fe4e 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -1,7 +1,6 @@ package types import ( - "encoding/hex" "fmt" "cosmossdk.io/math" @@ -12,18 +11,9 @@ import ( var _ paramtypes.ParamSet = (*Params)(nil) var ( - KeyCycleList = []byte("CycleList") KeyMinStakeAmount = []byte("MinStakeAmount") // TODO: Determine the default value DefaultMinStakeAmount = math.NewInt(1_000_000) // one TRB - InitialCycleList = []string{ - //ETH/USD - "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", - //BTC/USD - "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003627463000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", - //TRB/USD - "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003747262000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000", - } ) // ParamKeyTable the param key table for launch module @@ -32,22 +22,20 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams(cycleList []string, minStakeAmount math.Int) Params { +func NewParams(minStakeAmount math.Int) Params { return Params{ - CycleList: cycleList, MinStakeAmount: minStakeAmount, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams(InitialCycleList, DefaultMinStakeAmount) + return NewParams(DefaultMinStakeAmount) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyCycleList, &p.CycleList, validateCycleList), paramtypes.NewParamSetPair(KeyMinStakeAmount, &p.MinStakeAmount, validateMinStakeAmount), } } @@ -63,23 +51,6 @@ func (p Params) String() string { return string(out) } -// validate cycleList queries param -func validateCycleList(v interface{}) error { - cycleList, ok := v.([]string) - if !ok { - return fmt.Errorf("invalid parameter type: %T", v) - } - - for _, query := range cycleList { - // try encoding the query to ensure it's valid - _, err := hex.DecodeString(query) - if err != nil { - return fmt.Errorf("invalid query in cyclelist: %s", err) - } - } - return nil -} - // validateMinStakeAmount validates the MinStakeAmount param func validateMinStakeAmount(v interface{}) error { _, ok := v.(math.Int) From 706d6367178f3763a74fd9b4cfbe46b6412830b8 Mon Sep 17 00:00:00 2001 From: akrem Date: Mon, 18 Mar 2024 07:15:17 -0400 Subject: [PATCH 14/31] fix tests --- .../keeper/msg_server_commit_report_test.go | 32 +- .../keeper/msg_server_submit_value_test.go | 166 +++-- x/oracle/keeper/query_get_reports_test.go | 2 +- x/oracle/types/commit_report.pb.go | 453 ++------------ x/oracle/types/genesis.pb.go | 75 ++- x/oracle/types/micro_report.pb.go | 122 ++-- x/oracle/types/params.pb.go | 87 +-- x/oracle/types/query_meta.pb.go | 567 ++++++++++++++++++ x/oracle/types/tx.pb.go | 466 ++++++++++++-- 9 files changed, 1289 insertions(+), 681 deletions(-) create mode 100644 x/oracle/types/query_meta.pb.go diff --git a/x/oracle/keeper/msg_server_commit_report_test.go b/x/oracle/keeper/msg_server_commit_report_test.go index 48f58c1f2..8f2341486 100644 --- a/x/oracle/keeper/msg_server_commit_report_test.go +++ b/x/oracle/keeper/msg_server_commit_report_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "encoding/hex" + "time" "cosmossdk.io/collections" "cosmossdk.io/math" @@ -13,11 +14,13 @@ import ( "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/types" "github.com/tellor-io/layer/x/oracle/utils" + registrytypes "github.com/tellor-io/layer/x/registry/types" reportertypes "github.com/tellor-io/layer/x/reporter/types" ) -func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, string) { +func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, string, string) { // get the current query in cycle list + s.ctx = s.ctx.WithBlockTime(time.Now()) queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) s.Nil(err) // value 100000000000000000000 in hex @@ -33,7 +36,7 @@ func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, strin math.NewInt(1_000_000), nil, ) - + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) var commitreq = types.MsgCommitReport{ @@ -42,16 +45,20 @@ func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, strin Hash: hash, } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - s.NoError(err) + s.Nil(err) _hexxy, err := hex.DecodeString(queryData) s.Nil(err) - commitValue, err := s.oracleKeeper.Commits.Get(s.ctx, collections.Join(addr.Bytes(), keeper.HashQueryData(_hexxy))) - s.NoError(err) + qId := keeper.HashQueryData(_hexxy) + query, err := s.oracleKeeper.Query.Get(s.ctx, qId) + s.Nil(err) + s.NotNil(query) + commitValue, err := s.oracleKeeper.Commits.Get(s.ctx, collections.Join(addr.Bytes(), query.Id)) + s.Nil(err) s.Equal(true, s.oracleKeeper.VerifyCommit(s.ctx, addr.String(), value, salt, hash)) - s.Equal(commitValue.Report.Creator, addr.String()) - return stakedReporter, salt + s.Equal(commitValue.Reporter, addr.String()) + return stakedReporter, salt, queryData } func (s *KeeperTestSuite) TestCommitQueryNotInCycleList() { @@ -71,6 +78,8 @@ func (s *KeeperTestSuite) TestCommitQueryNotInCycleList() { math.NewInt(1_000_000), nil, ) + + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) var commitreq = types.MsgCommitReport{ @@ -79,10 +88,11 @@ func (s *KeeperTestSuite) TestCommitQueryNotInCycleList() { Hash: hash, } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - s.ErrorContains(err, "query does not have tips and is not in cycle") + s.ErrorContains(err, "query not part of cyclelist") } func (s *KeeperTestSuite) TestCommitQueryInCycleListPlusTippedQuery() { + s.ctx = s.ctx.WithBlockTime(time.Now()) // commit query in cycle list queryData1, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) s.Nil(err) @@ -100,6 +110,7 @@ func (s *KeeperTestSuite) TestCommitQueryInCycleListPlusTippedQuery() { math.NewInt(1_000_000), nil, ) + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) var commitreq = types.MsgCommitReport{ @@ -181,6 +192,7 @@ func (s *KeeperTestSuite) TestCommitWithReporterWithLowStake() { math.NewInt(1), // below the min stake amount nil, ) + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) var commitreq = types.MsgCommitReport{ @@ -190,7 +202,7 @@ func (s *KeeperTestSuite) TestCommitWithReporterWithLowStake() { } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - s.ErrorContains(err, "reporter has 1, required 1000000: not enough stake") + s.ErrorContains(err, "reporter has 1, required amount is 1000000: not enough stake") } func (s *KeeperTestSuite) TestCommitWithJailedValidator() { @@ -281,5 +293,3 @@ func (s *KeeperTestSuite) TestCommitWithMissingHash() { _, err = s.msgServer.CommitReport(s.ctx, &commitreq) // no error s.ErrorContains(err, "hash field cannot be empty") } - -// // todo: check emitted events diff --git a/x/oracle/keeper/msg_server_submit_value_test.go b/x/oracle/keeper/msg_server_submit_value_test.go index ad6fbcfe4..86ae8e61d 100644 --- a/x/oracle/keeper/msg_server_submit_value_test.go +++ b/x/oracle/keeper/msg_server_submit_value_test.go @@ -2,24 +2,21 @@ package keeper_test import ( "encoding/hex" - - "cosmossdk.io/math" + "time" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tellor-io/layer/testutil/sample" "github.com/tellor-io/layer/utils" "github.com/tellor-io/layer/x/oracle/types" - oracleutils "github.com/tellor-io/layer/x/oracle/utils" + registrytypes "github.com/tellor-io/layer/x/registry/types" reportertypes "github.com/tellor-io/layer/x/reporter/types" ) func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, string) { - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" // Commit value transaction first - stakedReporter, salt := s.TestCommitValue() + stakedReporter, salt, queryData := s.TestCommitValue() // forward block by 1 and reveal value s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) @@ -33,8 +30,8 @@ func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, strin Salt: salt, } res, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - s.Equal(&types.MsgSubmitValueResponse{}, res) s.Nil(err) + s.Equal(&types.MsgSubmitValueResponse{}, res) queryId, err := utils.QueryIDFromDataString(queryData) s.NoError(err) @@ -50,8 +47,8 @@ func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, strin QueryId: queryIdStr, AggregateMethod: "weighted-median", Value: value, - BlockNumber: s.ctx.BlockHeight(), Timestamp: s.ctx.BlockTime(), + Cyclelist: true, } expectedReport := types.QueryGetReportsbyQidResponse{ Reports: types.Reports{ @@ -63,32 +60,33 @@ func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, strin return stakedReporter, queryIdStr } -func (s *KeeperTestSuite) TestSubmitFromWrongAddr() { +// Note: this test fails because logic allows for submit value with no commit +// func (s *KeeperTestSuite) TestSubmitFromWrongAddr() { - // submit from different address than commit - randomAddr := sample.AccAddressBytes() +// // submit from different address than commit +// randomAddr := sample.AccAddressBytes() - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - value := "000000000000000000000000000000000000000000000058528649cf80ee0000" +// queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" +// value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - stakedReporter, salt := s.TestCommitValue() - stakedReporter.Reporter = randomAddr.String() +// stakedReporter, salt := s.TestCommitValue() +// stakedReporter.Reporter = randomAddr.String() - var submitreq = types.MsgSubmitValue{ - Creator: randomAddr.String(), - QueryData: queryData, - Value: value, - Salt: salt, - } +// var submitreq = types.MsgSubmitValue{ +// Creator: randomAddr.String(), +// QueryData: queryData, +// Value: value, +// Salt: salt, +// } - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) +// s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) - _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) +// _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) +// _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) - _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - s.Error(err) -} +// _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) +// s.Error(err) +// } func (s *KeeperTestSuite) TestSubmitWithBadQueryData() { @@ -96,7 +94,7 @@ func (s *KeeperTestSuite) TestSubmitWithBadQueryData() { badQueryData := "stupidQueryData" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - stakedReporter, salt := s.TestCommitValue() + stakedReporter, salt, _ := s.TestCommitValue() var submitreq = types.MsgSubmitValue{ Creator: stakedReporter.GetReporter(), @@ -115,10 +113,10 @@ func (s *KeeperTestSuite) TestSubmitWithBadQueryData() { func (s *KeeperTestSuite) TestSubmitWithBadValue() { // submit wrong value but correct salt - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" + badValue := "00000F4240" - stakedReporter, salt := s.TestCommitValue() + stakedReporter, salt, queryData := s.TestCommitValue() var submitreq = types.MsgSubmitValue{ Creator: stakedReporter.GetReporter(), @@ -137,10 +135,9 @@ func (s *KeeperTestSuite) TestSubmitWithBadValue() { func (s *KeeperTestSuite) TestSubmitWithWrongSalt() { // submit correct value but wrong salt - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - stakedReporter, _ := s.TestCommitValue() + stakedReporter, _, queryData := s.TestCommitValue() badSalt, err := oracleutils.Salt(32) s.Nil(err) @@ -162,10 +159,9 @@ func (s *KeeperTestSuite) TestSubmitWithWrongSalt() { func (s *KeeperTestSuite) TestSubmitAtWrongBlock() { // try to submit value in same block as commit - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - stakedReporter, salt := s.TestCommitValue() + stakedReporter, salt, queryData := s.TestCommitValue() var submitreq = types.MsgSubmitValue{ Creator: stakedReporter.GetReporter(), @@ -173,55 +169,57 @@ func (s *KeeperTestSuite) TestSubmitAtWrongBlock() { Value: value, Salt: salt, } - - _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - s.ErrorContains(err, "commit reveal window is too early") + // Note: No longer relevant since you can reveal early + // _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) + // s.ErrorContains(err, "commit reveal window is too early") // try to submit value 2 blocks after commit - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 2) + s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour)) + _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(stakedReporter.GetReporter())).Return(&stakedReporter, nil) // submitreq.Salt = salt - _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) + _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) s.ErrorContains(err, "missed commit reveal window") } -func (s *KeeperTestSuite) TestSubmitWithNoCommit() { +// Note: no longer relevant since you can reveal without commit - // try to submit value without commit - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - salt, err := oracleutils.Salt(32) - s.Nil(err) +// func (s *KeeperTestSuite) TestSubmitWithNoCommit() { - addr := sample.AccAddressBytes() +// // try to submit value without commit +// queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" +// value := "000000000000000000000000000000000000000000000058528649cf80ee0000" +// salt, err := oracleutils.Salt(32) +// s.Nil(err) - var submitreq = types.MsgSubmitValue{ - Creator: addr.String(), - QueryData: queryData, - Value: value, - Salt: salt, - } - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) +// addr := sample.AccAddressBytes() - stakedReporter := reportertypes.NewOracleReporter( - addr.String(), - math.NewInt(1_000_000), - nil, - ) - _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) +// var submitreq = types.MsgSubmitValue{ +// Creator: addr.String(), +// QueryData: queryData, +// Value: value, +// Salt: salt, +// } +// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour)) - _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) - s.ErrorContains(err, "no commits to reveal found") -} +// stakedReporter := reportertypes.NewOracleReporter( +// addr.String(), +// math.NewInt(1_000_000), +// nil, +// ) +// _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + +// _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) +// s.ErrorContains(err, "no commits to reveal found") +// } func (s *KeeperTestSuite) TestSubmitWithNoCreator() { // submit value with no creator - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - _, salt := s.TestCommitValue() + _, salt, queryData := s.TestCommitValue() var submitreq = types.MsgSubmitValue{ QueryData: queryData, @@ -239,7 +237,7 @@ func (s *KeeperTestSuite) TestSubmitWithNoQueryData() { // submit value with no query data value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - stakedReporter, salt := s.TestCommitValue() + stakedReporter, salt, _ := s.TestCommitValue() var submitreq = types.MsgSubmitValue{ Creator: stakedReporter.GetReporter(), @@ -255,9 +253,7 @@ func (s *KeeperTestSuite) TestSubmitWithNoQueryData() { func (s *KeeperTestSuite) TestSubmitWithNoValue() { // submit value with no value - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - - stakedReporter, salt := s.TestCommitValue() + stakedReporter, salt, queryData := s.TestCommitValue() var submitreq = types.MsgSubmitValue{ Creator: stakedReporter.GetReporter(), @@ -270,21 +266,19 @@ func (s *KeeperTestSuite) TestSubmitWithNoValue() { s.ErrorContains(err, "value cannot be empty") } -func (s *KeeperTestSuite) TestSubmitWithNoSalt() { - - // submit value with no salt - queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" - value := "000000000000000000000000000000000000000000000058528649cf80ee0000" - - stakedReporter, _ := s.TestCommitValue() - - var submitreq = types.MsgSubmitValue{ - Creator: stakedReporter.GetReporter(), - QueryData: queryData, - Value: value, - } - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - - _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) - s.ErrorContains(err, "salt cannot be empty") -} +// Note: this test fails because logic allows for submit value with no salt + +// func (s *KeeperTestSuite) TestSubmitWithbadSalt() { +// // submit value with no salt +// queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" +// value := "000000000000000000000000000000000000000000000058528649cf80ee0000" +// stakedReporter, _, queryData := s.TestCommitValue() +// var submitreq = types.MsgSubmitValue{ +// Creator: stakedReporter.GetReporter(), +// QueryData: queryData, +// Value: value, +// } +// _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) +// s.ErrorContains(err, "salt cannot be empty") + +// } diff --git a/x/oracle/keeper/query_get_reports_test.go b/x/oracle/keeper/query_get_reports_test.go index 012ca2310..57cad0121 100644 --- a/x/oracle/keeper/query_get_reports_test.go +++ b/x/oracle/keeper/query_get_reports_test.go @@ -24,8 +24,8 @@ func (s *KeeperTestSuite) TestGetReportsByQueryId() { QueryId: queryIdStr, AggregateMethod: "weighted-median", Value: value, - BlockNumber: s.ctx.BlockHeight(), Timestamp: s.ctx.BlockTime(), + Cyclelist: true, } expectedReports := types.Reports{ MicroReports: []*types.MicroReport{MicroReport}, diff --git a/x/oracle/types/commit_report.pb.go b/x/oracle/types/commit_report.pb.go index 003e5d3eb..04042f638 100644 --- a/x/oracle/types/commit_report.pb.go +++ b/x/oracle/types/commit_report.pb.go @@ -23,9 +23,10 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Commit struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - QueryId []byte `protobuf:"bytes,2,opt,name=queryId,proto3" json:"queryId,omitempty"` - Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + QueryId []byte `protobuf:"bytes,2,opt,name=queryId,proto3" json:"queryId,omitempty"` + Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` + Incycle bool `protobuf:"varint,4,opt,name=incycle,proto3" json:"incycle,omitempty"` } func (m *Commit) Reset() { *m = Commit{} } @@ -61,9 +62,9 @@ func (m *Commit) XXX_DiscardUnknown() { var xxx_messageInfo_Commit proto.InternalMessageInfo -func (m *Commit) GetCreator() string { +func (m *Commit) GetReporter() string { if m != nil { - return m.Creator + return m.Reporter } return "" } @@ -82,129 +83,35 @@ func (m *Commit) GetHash() string { return "" } -type CommitReport struct { - Report *Commit `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` - Block int64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` -} - -func (m *CommitReport) Reset() { *m = CommitReport{} } -func (m *CommitReport) String() string { return proto.CompactTextString(m) } -func (*CommitReport) ProtoMessage() {} -func (*CommitReport) Descriptor() ([]byte, []int) { - return fileDescriptor_b56672e00badb6a1, []int{1} -} -func (m *CommitReport) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CommitReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CommitReport.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 *CommitReport) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommitReport.Merge(m, src) -} -func (m *CommitReport) XXX_Size() int { - return m.Size() -} -func (m *CommitReport) XXX_DiscardUnknown() { - xxx_messageInfo_CommitReport.DiscardUnknown(m) -} - -var xxx_messageInfo_CommitReport proto.InternalMessageInfo - -func (m *CommitReport) GetReport() *Commit { - if m != nil { - return m.Report - } - return nil -} - -func (m *CommitReport) GetBlock() int64 { - if m != nil { - return m.Block - } - return 0 -} - -type CommitsByHeight struct { - Commits []*Commit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"` -} - -func (m *CommitsByHeight) Reset() { *m = CommitsByHeight{} } -func (m *CommitsByHeight) String() string { return proto.CompactTextString(m) } -func (*CommitsByHeight) ProtoMessage() {} -func (*CommitsByHeight) Descriptor() ([]byte, []int) { - return fileDescriptor_b56672e00badb6a1, []int{2} -} -func (m *CommitsByHeight) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CommitsByHeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CommitsByHeight.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 *CommitsByHeight) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommitsByHeight.Merge(m, src) -} -func (m *CommitsByHeight) XXX_Size() int { - return m.Size() -} -func (m *CommitsByHeight) XXX_DiscardUnknown() { - xxx_messageInfo_CommitsByHeight.DiscardUnknown(m) -} - -var xxx_messageInfo_CommitsByHeight proto.InternalMessageInfo - -func (m *CommitsByHeight) GetCommits() []*Commit { +func (m *Commit) GetIncycle() bool { if m != nil { - return m.Commits + return m.Incycle } - return nil + return false } func init() { proto.RegisterType((*Commit)(nil), "layer.oracle.Commit") - proto.RegisterType((*CommitReport)(nil), "layer.oracle.CommitReport") - proto.RegisterType((*CommitsByHeight)(nil), "layer.oracle.CommitsByHeight") } func init() { proto.RegisterFile("layer/oracle/commit_report.proto", fileDescriptor_b56672e00badb6a1) } var fileDescriptor_b56672e00badb6a1 = []byte{ - // 268 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xc1, 0x4a, 0xc4, 0x30, - 0x18, 0x84, 0x1b, 0xab, 0x5d, 0x8c, 0x05, 0x21, 0xac, 0x50, 0x3c, 0x84, 0xd2, 0xd3, 0x0a, 0x9a, - 0x82, 0x3e, 0x81, 0xbb, 0x17, 0xbd, 0x49, 0x8e, 0x5e, 0xa4, 0x8d, 0x61, 0x5b, 0x4c, 0xf9, 0xeb, - 0xdf, 0x2c, 0x6c, 0xdf, 0xc2, 0xc7, 0xf2, 0xb8, 0x47, 0x8f, 0xd2, 0xbe, 0x88, 0x98, 0x6c, 0x45, - 0x0f, 0xde, 0x32, 0xe4, 0x9b, 0xc9, 0x64, 0x68, 0x6a, 0x8a, 0x5e, 0x63, 0x0e, 0x58, 0x28, 0xa3, - 0x73, 0x05, 0x4d, 0x53, 0xdb, 0x27, 0xd4, 0x2d, 0xa0, 0x15, 0x2d, 0x82, 0x05, 0x16, 0x3b, 0x42, - 0x78, 0xe2, 0xfc, 0xec, 0x0f, 0x6f, 0xb7, 0x1e, 0xca, 0x1e, 0x68, 0xb4, 0x72, 0x5e, 0x96, 0xd0, - 0x99, 0x42, 0x5d, 0x58, 0xc0, 0x84, 0xa4, 0x64, 0x71, 0x2c, 0x27, 0xf9, 0x7d, 0xf3, 0xba, 0xd1, - 0xd8, 0xdf, 0x3f, 0x27, 0x07, 0x29, 0x59, 0xc4, 0x72, 0x92, 0x8c, 0xd1, 0xc3, 0xaa, 0xe8, 0xaa, - 0x24, 0x74, 0x06, 0x77, 0xce, 0x24, 0x8d, 0x7d, 0xa2, 0x74, 0x65, 0xd8, 0x25, 0x8d, 0x7c, 0x2d, - 0x17, 0x7b, 0x72, 0x3d, 0x17, 0xbf, 0x7b, 0x89, 0x3d, 0xbb, 0x67, 0xd8, 0x9c, 0x1e, 0x95, 0x06, - 0xd4, 0x8b, 0x7b, 0x29, 0x94, 0x5e, 0x64, 0xb7, 0xf4, 0xd4, 0x73, 0xdd, 0xb2, 0xbf, 0xd3, 0xf5, - 0xba, 0xb2, 0x4c, 0xd0, 0x99, 0xff, 0x74, 0x97, 0x90, 0x34, 0xfc, 0x37, 0x77, 0x82, 0x96, 0xab, - 0xf7, 0x81, 0x93, 0xdd, 0xc0, 0xc9, 0xe7, 0xc0, 0xc9, 0xdb, 0xc8, 0x83, 0xdd, 0xc8, 0x83, 0x8f, - 0x91, 0x07, 0x8f, 0x17, 0xeb, 0xda, 0x56, 0x9b, 0x52, 0x28, 0x68, 0x72, 0xab, 0x8d, 0x01, 0xbc, - 0xaa, 0x21, 0xf7, 0x73, 0x6d, 0x7f, 0x06, 0xeb, 0x5b, 0xdd, 0x95, 0x91, 0x1b, 0xed, 0xe6, 0x2b, - 0x00, 0x00, 0xff, 0xff, 0x0f, 0x9f, 0x80, 0xac, 0x7d, 0x01, 0x00, 0x00, + // 213 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x49, 0xac, 0x4c, + 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0x2c, 0x89, + 0x2f, 0x4a, 0x2d, 0xc8, 0x2f, 0x2a, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0xab, + 0xd0, 0x83, 0xa8, 0x90, 0x12, 0x45, 0x51, 0x5f, 0x52, 0x01, 0x51, 0xa4, 0x94, 0xc3, 0xc5, 0xe6, + 0x0c, 0xd6, 0x2b, 0x24, 0xc5, 0xc5, 0x01, 0xd1, 0x9e, 0x5a, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x19, 0x04, 0xe7, 0x0b, 0x49, 0x70, 0xb1, 0x17, 0x96, 0xa6, 0x16, 0x55, 0x7a, 0xa6, 0x48, 0x30, + 0x29, 0x30, 0x6a, 0xf0, 0x04, 0xc1, 0xb8, 0x42, 0x42, 0x5c, 0x2c, 0x19, 0x89, 0xc5, 0x19, 0x12, + 0xcc, 0x60, 0x1d, 0x60, 0x36, 0x48, 0x75, 0x66, 0x5e, 0x72, 0x65, 0x72, 0x4e, 0xaa, 0x04, 0x8b, + 0x02, 0xa3, 0x06, 0x47, 0x10, 0x8c, 0xeb, 0xe4, 0x7c, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, + 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, + 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x25, + 0xa9, 0x39, 0x39, 0xf9, 0x45, 0xba, 0x99, 0xf9, 0xfa, 0x10, 0x37, 0x57, 0xc0, 0x5d, 0x5d, 0x59, + 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0xb9, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x93, 0x44, + 0x83, 0x02, 0x01, 0x00, 0x00, } func (m *Commit) Marshal() (dAtA []byte, err error) { @@ -227,6 +134,16 @@ func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Incycle { + i-- + if m.Incycle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(m.Hash) > 0 { i -= len(m.Hash) copy(dAtA[i:], m.Hash) @@ -241,93 +158,16 @@ func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintCommitReport(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CommitReport) 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 *CommitReport) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Block != 0 { - i = encodeVarintCommitReport(dAtA, i, uint64(m.Block)) - i-- - dAtA[i] = 0x10 - } - if m.Report != nil { - { - size, err := m.Report.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCommitReport(dAtA, i, uint64(size)) - } + if len(m.Reporter) > 0 { + i -= len(m.Reporter) + copy(dAtA[i:], m.Reporter) + i = encodeVarintCommitReport(dAtA, i, uint64(len(m.Reporter))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *CommitsByHeight) 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 *CommitsByHeight) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitsByHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Commits) > 0 { - for iNdEx := len(m.Commits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Commits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCommitReport(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func encodeVarintCommitReport(dAtA []byte, offset int, v uint64) int { offset -= sovCommitReport(v) base := offset @@ -345,7 +185,7 @@ func (m *Commit) Size() (n int) { } var l int _ = l - l = len(m.Creator) + l = len(m.Reporter) if l > 0 { n += 1 + l + sovCommitReport(uint64(l)) } @@ -357,36 +197,8 @@ func (m *Commit) Size() (n int) { if l > 0 { n += 1 + l + sovCommitReport(uint64(l)) } - return n -} - -func (m *CommitReport) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Report != nil { - l = m.Report.Size() - n += 1 + l + sovCommitReport(uint64(l)) - } - if m.Block != 0 { - n += 1 + sovCommitReport(uint64(m.Block)) - } - return n -} - -func (m *CommitsByHeight) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Commits) > 0 { - for _, e := range m.Commits { - l = e.Size() - n += 1 + l + sovCommitReport(uint64(l)) - } + if m.Incycle { + n += 2 } return n } @@ -428,7 +240,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -456,7 +268,7 @@ func (m *Commit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.Reporter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -524,97 +336,11 @@ func (m *Commit) Unmarshal(dAtA []byte) error { } m.Hash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCommitReport(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommitReport - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommitReport) 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 ErrIntOverflowCommitReport - } - 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: CommitReport: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommitReport: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Report", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommitReport - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCommitReport - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCommitReport - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Report == nil { - m.Report = &Commit{} - } - if err := m.Report.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Incycle", wireType) } - m.Block = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCommitReport @@ -624,95 +350,12 @@ func (m *CommitReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Block |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - default: - iNdEx = preIndex - skippy, err := skipCommitReport(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommitReport - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommitsByHeight) 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 ErrIntOverflowCommitReport - } - 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: CommitsByHeight: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommitsByHeight: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommitReport - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCommitReport - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCommitReport - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Commits = append(m.Commits, &Commit{}) - if err := m.Commits[len(m.Commits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex + m.Incycle = bool(v != 0) default: iNdEx = preIndex skippy, err := skipCommitReport(dAtA[iNdEx:]) diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 2231390c1..b55d534ba 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -25,7 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the oracle module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Cyclelist []string `protobuf:"bytes,2,rep,name=cyclelist,proto3" json:"cyclelist,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -68,6 +69,13 @@ func (m *GenesisState) GetParams() Params { return Params{} } +func (m *GenesisState) GetCyclelist() []string { + if m != nil { + return m.Cyclelist + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "layer.oracle.GenesisState") } @@ -75,19 +83,21 @@ func init() { func init() { proto.RegisterFile("layer/oracle/genesis.proto", fileDescriptor_ae3e046083fcf09b) } var fileDescriptor_ae3e046083fcf09b = []byte{ - // 191 bytes of a gzipped FileDescriptorProto + // 214 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0xcb, 0xe9, 0x41, 0xe4, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x12, 0xfa, 0x20, 0x16, 0x44, 0x8d, 0x94, 0x24, 0x8a, 0xfe, 0x82, 0xc4, - 0xa2, 0xc4, 0x5c, 0xa8, 0x76, 0x25, 0x27, 0x2e, 0x1e, 0x77, 0x88, 0x79, 0xc1, 0x25, 0x89, 0x25, + 0xa2, 0xc4, 0x5c, 0xa8, 0x76, 0xa5, 0x34, 0x2e, 0x1e, 0x77, 0x88, 0x79, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x46, 0x5c, 0x6c, 0x10, 0x79, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x11, 0x3d, - 0x64, 0xf3, 0xf5, 0x02, 0xc0, 0x72, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x55, 0x3a, - 0x39, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, - 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x66, 0x7a, 0x66, 0x49, - 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x49, 0x6a, 0x4e, 0x4e, 0x7e, 0x91, 0x6e, 0x66, - 0xbe, 0x3e, 0xc4, 0x35, 0x15, 0x30, 0xf7, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xdd, - 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xf6, 0x7f, 0x01, 0xec, 0x00, 0x00, 0x00, + 0x64, 0xf3, 0xf5, 0x02, 0xc0, 0x72, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x55, 0x0a, + 0x29, 0x71, 0x71, 0x26, 0x57, 0x26, 0xe7, 0xa4, 0xe6, 0x64, 0x16, 0x97, 0x48, 0x30, 0x29, 0x30, + 0x6b, 0x70, 0x42, 0x15, 0x20, 0x84, 0x9d, 0x9c, 0x4f, 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, 0x4a, 0x33, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xbf, 0x24, + 0x35, 0x27, 0x27, 0xbf, 0x48, 0x37, 0x33, 0x5f, 0x1f, 0xe2, 0xe2, 0x0a, 0x98, 0x9b, 0x4b, 0x2a, + 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x6e, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x69, 0x41, + 0x9c, 0xdb, 0x10, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -110,6 +120,15 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Cyclelist) > 0 { + for iNdEx := len(m.Cyclelist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Cyclelist[iNdEx]) + copy(dAtA[i:], m.Cyclelist[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Cyclelist[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -142,6 +161,12 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if len(m.Cyclelist) > 0 { + for _, s := range m.Cyclelist { + l = len(s) + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -213,6 +238,38 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cyclelist", 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.Cyclelist = append(m.Cyclelist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/oracle/types/micro_report.pb.go b/x/oracle/types/micro_report.pb.go index 6b101078b..a77e5a170 100644 --- a/x/oracle/types/micro_report.pb.go +++ b/x/oracle/types/micro_report.pb.go @@ -34,8 +34,8 @@ type MicroReport struct { QueryId string `protobuf:"bytes,4,opt,name=queryId,proto3" json:"queryId,omitempty"` AggregateMethod string `protobuf:"bytes,5,opt,name=aggregateMethod,proto3" json:"aggregateMethod,omitempty"` Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - BlockNumber int64 `protobuf:"varint,7,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"` - Timestamp time.Time `protobuf:"bytes,8,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + Timestamp time.Time `protobuf:"bytes,7,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + Cyclelist bool `protobuf:"varint,8,opt,name=cyclelist,proto3" json:"cyclelist,omitempty"` } func (m *MicroReport) Reset() { *m = MicroReport{} } @@ -113,18 +113,18 @@ func (m *MicroReport) GetValue() string { return "" } -func (m *MicroReport) GetBlockNumber() int64 { +func (m *MicroReport) GetTimestamp() time.Time { if m != nil { - return m.BlockNumber + return m.Timestamp } - return 0 + return time.Time{} } -func (m *MicroReport) GetTimestamp() time.Time { +func (m *MicroReport) GetCyclelist() bool { if m != nil { - return m.Timestamp + return m.Cyclelist } - return time.Time{} + return false } func init() { @@ -134,28 +134,28 @@ func init() { func init() { proto.RegisterFile("layer/oracle/micro_report.proto", fileDescriptor_c39350954f878191) } var fileDescriptor_c39350954f878191 = []byte{ - // 329 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x51, 0xbd, 0x4e, 0xeb, 0x30, - 0x14, 0x8e, 0xdb, 0xdb, 0x3f, 0xf7, 0x4a, 0x57, 0xb2, 0x3a, 0x58, 0xd1, 0x55, 0x12, 0x31, 0x85, - 0x81, 0x44, 0x82, 0x37, 0x28, 0x13, 0x43, 0x19, 0xa2, 0x4e, 0x2c, 0x28, 0x49, 0x0f, 0x6e, 0x84, - 0xa3, 0x13, 0x5c, 0x07, 0xc8, 0x5b, 0xf4, 0x05, 0x78, 0x9f, 0x8e, 0x1d, 0x99, 0x00, 0xb5, 0x2f, - 0x82, 0x6a, 0x2b, 0x2d, 0x62, 0xf3, 0xf7, 0x73, 0xce, 0x67, 0x7d, 0x87, 0xfa, 0x32, 0x6d, 0x40, - 0xc5, 0xa8, 0xd2, 0x5c, 0x42, 0x5c, 0x16, 0xb9, 0xc2, 0x7b, 0x05, 0x15, 0x2a, 0x1d, 0x55, 0x0a, - 0x35, 0xb2, 0xbf, 0xc6, 0x10, 0x59, 0x83, 0xeb, 0x0b, 0x44, 0x21, 0x21, 0x36, 0x5a, 0x56, 0x3f, - 0xc4, 0xba, 0x28, 0x61, 0xa5, 0xd3, 0xb2, 0xb2, 0x76, 0x77, 0x22, 0x50, 0xa0, 0x79, 0xc6, 0x87, - 0x97, 0x65, 0xcf, 0xde, 0x3a, 0x74, 0x3c, 0x3b, 0xec, 0x4e, 0xcc, 0x6a, 0xe6, 0xd2, 0xa1, 0x0d, - 0x01, 0xc5, 0x49, 0x40, 0xc2, 0x51, 0x72, 0xc4, 0x6c, 0x42, 0x7b, 0x15, 0xbe, 0x80, 0xe2, 0x9d, - 0x80, 0x84, 0xdd, 0xc4, 0x02, 0xf6, 0x9f, 0x8e, 0x9e, 0x6a, 0x50, 0xcd, 0xbc, 0xa9, 0x80, 0x77, - 0xcd, 0xc8, 0x89, 0x60, 0x9c, 0x0e, 0x0c, 0xb8, 0x59, 0xf0, 0x3f, 0x46, 0x6b, 0x21, 0x0b, 0xe9, - 0xbf, 0x54, 0x08, 0x05, 0x22, 0xd5, 0x30, 0x03, 0xbd, 0xc4, 0x05, 0xef, 0x19, 0xc7, 0x6f, 0xfa, - 0x90, 0xfb, 0x9c, 0xca, 0x1a, 0x78, 0xdf, 0xe8, 0x16, 0xb0, 0x80, 0x8e, 0x33, 0x89, 0xf9, 0xe3, - 0x6d, 0x5d, 0x66, 0xa0, 0xf8, 0xc0, 0xfc, 0xe9, 0x27, 0xc5, 0xa6, 0x74, 0x74, 0x2c, 0x81, 0x0f, - 0x03, 0x12, 0x8e, 0x2f, 0xdd, 0xc8, 0xd6, 0x14, 0xb5, 0x35, 0x45, 0xf3, 0xd6, 0x31, 0x1d, 0x6e, - 0x3e, 0x7c, 0x67, 0xfd, 0xe9, 0x93, 0xe4, 0x34, 0x36, 0xbd, 0xde, 0xec, 0x3c, 0xb2, 0xdd, 0x79, - 0xe4, 0x6b, 0xe7, 0x91, 0xf5, 0xde, 0x73, 0xb6, 0x7b, 0xcf, 0x79, 0xdf, 0x7b, 0xce, 0xdd, 0xb9, - 0x28, 0xf4, 0xb2, 0xce, 0xa2, 0x1c, 0xcb, 0x58, 0x83, 0x94, 0xa8, 0x2e, 0x0a, 0x8c, 0xed, 0xd1, - 0x5e, 0xdb, 0xb3, 0xe9, 0xa6, 0x82, 0x55, 0xd6, 0x37, 0x69, 0x57, 0xdf, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x7f, 0xcf, 0x7e, 0x15, 0xd3, 0x01, 0x00, 0x00, + // 326 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xbf, 0x4e, 0xf3, 0x30, + 0x10, 0xc0, 0xe3, 0xf6, 0x6b, 0x9b, 0xba, 0x9f, 0x84, 0x14, 0x75, 0xb0, 0x22, 0x94, 0x44, 0x4c, + 0x61, 0x20, 0x96, 0xe0, 0x0d, 0xca, 0xc4, 0xd0, 0x25, 0xea, 0xc4, 0x82, 0xd2, 0xf4, 0x70, 0x23, + 0x39, 0xba, 0xe0, 0x3a, 0x40, 0xde, 0xa2, 0x2b, 0x6f, 0xd4, 0xb1, 0x23, 0x13, 0xa0, 0xf6, 0x45, + 0x50, 0x6c, 0xa5, 0x95, 0xd8, 0xfc, 0xbb, 0xfb, 0xf9, 0xfe, 0xe8, 0x68, 0x28, 0xb3, 0x06, 0x14, + 0x47, 0x95, 0xe5, 0x12, 0x78, 0x59, 0xe4, 0x0a, 0x9f, 0x14, 0x54, 0xa8, 0x74, 0x52, 0x29, 0xd4, + 0xe8, 0xfd, 0x37, 0x42, 0x62, 0x05, 0x7f, 0x2a, 0x50, 0xa0, 0x49, 0xf0, 0xf6, 0x65, 0x1d, 0x3f, + 0x14, 0x88, 0x42, 0x02, 0x37, 0xb4, 0xac, 0x9f, 0xb9, 0x2e, 0x4a, 0xd8, 0xe8, 0xac, 0xac, 0xac, + 0x70, 0xf5, 0xd1, 0xa3, 0x93, 0x79, 0x5b, 0x3b, 0x35, 0xa5, 0x3d, 0x9f, 0xba, 0xb6, 0x09, 0x28, + 0x46, 0x22, 0x12, 0x8f, 0xd3, 0x13, 0x7b, 0x53, 0x3a, 0xa8, 0xf0, 0x0d, 0x14, 0xeb, 0x45, 0x24, + 0xee, 0xa7, 0x16, 0xbc, 0x4b, 0x3a, 0x7e, 0xa9, 0x41, 0x35, 0x8b, 0xa6, 0x02, 0xd6, 0x37, 0x5f, + 0xce, 0x01, 0x8f, 0xd1, 0x91, 0x81, 0x87, 0x15, 0xfb, 0x67, 0x72, 0x1d, 0x7a, 0x31, 0xbd, 0xc8, + 0x84, 0x50, 0x20, 0x32, 0x0d, 0x73, 0xd0, 0x6b, 0x5c, 0xb1, 0x81, 0x31, 0xfe, 0x86, 0xdb, 0xbe, + 0xaf, 0x99, 0xac, 0x81, 0x0d, 0x4d, 0xde, 0x82, 0x37, 0xa3, 0xe3, 0xd3, 0x32, 0x6c, 0x14, 0x91, + 0x78, 0x72, 0xeb, 0x27, 0x76, 0xdd, 0xa4, 0x5b, 0x37, 0x59, 0x74, 0xc6, 0xcc, 0xdd, 0x7d, 0x85, + 0xce, 0xf6, 0x3b, 0x24, 0xe9, 0xf9, 0x5b, 0x3b, 0x7b, 0xde, 0xe4, 0x12, 0x64, 0xb1, 0xd1, 0xcc, + 0x8d, 0x48, 0xec, 0xa6, 0xe7, 0xc0, 0xec, 0x7e, 0x77, 0x08, 0xc8, 0xfe, 0x10, 0x90, 0x9f, 0x43, + 0x40, 0xb6, 0xc7, 0xc0, 0xd9, 0x1f, 0x03, 0xe7, 0xf3, 0x18, 0x38, 0x8f, 0xd7, 0xa2, 0xd0, 0xeb, + 0x7a, 0x99, 0xe4, 0x58, 0x72, 0x0d, 0x52, 0xa2, 0xba, 0x29, 0x90, 0xdb, 0x83, 0xbd, 0x77, 0x27, + 0xd3, 0x4d, 0x05, 0x9b, 0xe5, 0xd0, 0xcc, 0x72, 0xf7, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x11, 0x5c, + 0x66, 0xd4, 0xcf, 0x01, 0x00, 0x00, } func (m *MicroReport) Marshal() (dAtA []byte, err error) { @@ -178,6 +178,16 @@ func (m *MicroReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Cyclelist { + i-- + if m.Cyclelist { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) if err1 != nil { return 0, err1 @@ -185,12 +195,7 @@ func (m *MicroReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n1 i = encodeVarintMicroReport(dAtA, i, uint64(n1)) i-- - dAtA[i] = 0x42 - if m.BlockNumber != 0 { - i = encodeVarintMicroReport(dAtA, i, uint64(m.BlockNumber)) - i-- - dAtA[i] = 0x38 - } + dAtA[i] = 0x3a if len(m.Value) > 0 { i -= len(m.Value) copy(dAtA[i:], m.Value) @@ -274,11 +279,11 @@ func (m *MicroReport) Size() (n int) { if l > 0 { n += 1 + l + sovMicroReport(uint64(l)) } - if m.BlockNumber != 0 { - n += 1 + sovMicroReport(uint64(m.BlockNumber)) - } l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovMicroReport(uint64(l)) + if m.Cyclelist { + n += 2 + } return n } @@ -497,25 +502,6 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - m.BlockNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMicroReport - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockNumber |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } @@ -548,6 +534,26 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Cyclelist", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMicroReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Cyclelist = bool(v != 0) default: iNdEx = preIndex skippy, err := skipMicroReport(dAtA[iNdEx:]) diff --git a/x/oracle/types/params.pb.go b/x/oracle/types/params.pb.go index fdfc301d8..2315a3756 100644 --- a/x/oracle/types/params.pb.go +++ b/x/oracle/types/params.pb.go @@ -27,8 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { - CycleList []string `protobuf:"bytes,1,rep,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` - MinStakeAmount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=minStakeAmount,proto3,customtype=cosmossdk.io/math.Int" json:"minStakeAmount" yaml:"min_stake_amount"` + MinStakeAmount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=minStakeAmount,proto3,customtype=cosmossdk.io/math.Int" json:"minStakeAmount" yaml:"min_stake_amount"` } func (m *Params) Reset() { *m = Params{} } @@ -63,13 +62,6 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetCycleList() []string { - if m != nil { - return m.CycleList - } - return nil -} - func init() { proto.RegisterType((*Params)(nil), "layer.oracle.Params") } @@ -77,25 +69,23 @@ func init() { func init() { proto.RegisterFile("layer/oracle/params.proto", fileDescriptor_ac0e3bcb871977fd) } var fileDescriptor_ac0e3bcb871977fd = []byte{ - // 280 bytes of a gzipped FileDescriptorProto + // 251 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x01, 0x4b, 0xe9, 0x41, 0xa4, 0xa4, 0x24, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xe3, 0xc1, 0x72, 0xfa, 0x10, 0x0e, 0x44, 0xa1, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x44, 0x1c, 0xc4, 0x82, 0x88, 0x2a, 0xcd, 0x65, 0xe4, 0x62, 0x0b, 0x00, 0x9b, 0x27, - 0x24, 0xcb, 0xc5, 0x95, 0x5c, 0x99, 0x9c, 0x93, 0x1a, 0x9f, 0x93, 0x59, 0x5c, 0x22, 0xc1, 0xa8, - 0xc0, 0xac, 0xc1, 0x19, 0xc4, 0x09, 0x16, 0xf1, 0xc9, 0x2c, 0x2e, 0x11, 0xca, 0xe3, 0xe2, 0xcb, - 0xcd, 0xcc, 0x0b, 0x2e, 0x49, 0xcc, 0x4e, 0x75, 0xcc, 0xcd, 0x2f, 0xcd, 0x2b, 0x91, 0x60, 0x52, - 0x60, 0xd4, 0xe0, 0x74, 0x72, 0x3b, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x51, 0x88, 0x6d, - 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, 0x9e, 0x79, 0x25, 0x9f, - 0xee, 0xc9, 0x8b, 0x57, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xe5, 0x66, 0xe6, 0xc5, 0x17, 0x83, 0x74, - 0xc7, 0x27, 0x82, 0xb5, 0x2b, 0x5d, 0xda, 0xa2, 0xcb, 0x05, 0x75, 0xa1, 0x67, 0x5e, 0x49, 0x10, - 0x9a, 0xe9, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x39, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, - 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, - 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x66, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, - 0x7e, 0x49, 0x6a, 0x4e, 0x4e, 0x7e, 0x91, 0x6e, 0x66, 0xbe, 0x3e, 0x24, 0xa0, 0x2a, 0x60, 0x41, - 0x55, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, - 0x3e, 0x62, 0xeb, 0xb4, 0x47, 0x01, 0x00, 0x00, + 0x7a, 0x3e, 0x44, 0x1c, 0xc4, 0x82, 0x88, 0x2a, 0xd5, 0x71, 0xb1, 0x05, 0x80, 0x8d, 0x13, 0xca, + 0xe3, 0xe2, 0xcb, 0xcd, 0xcc, 0x0b, 0x2e, 0x49, 0xcc, 0x4e, 0x75, 0xcc, 0xcd, 0x2f, 0xcd, 0x2b, + 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x72, 0x3b, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, + 0x51, 0x88, 0x69, 0xc5, 0x29, 0xd9, 0x7a, 0x99, 0xf9, 0xfa, 0xb9, 0x89, 0x25, 0x19, 0x7a, 0x9e, + 0x79, 0x25, 0x9f, 0xee, 0xc9, 0x8b, 0x57, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xe5, 0x66, 0xe6, 0xc5, + 0x17, 0x83, 0x74, 0xc7, 0x27, 0x82, 0xb5, 0x2b, 0x5d, 0xda, 0xa2, 0xcb, 0x05, 0x75, 0x81, 0x67, + 0x5e, 0x49, 0x10, 0x9a, 0xe9, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x39, 0x9f, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x66, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x7e, 0x49, 0x6a, 0x4e, 0x4e, 0x7e, 0x91, 0x6e, 0x66, 0xbe, 0x3e, 0x24, 0x20, + 0x2a, 0x60, 0x41, 0x51, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0x8b, 0x31, 0x20, 0x00, + 0x00, 0xff, 0xff, 0x56, 0x75, 0x93, 0x84, 0x27, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -127,16 +117,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if len(m.CycleList) > 0 { - for iNdEx := len(m.CycleList) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.CycleList[iNdEx]) - copy(dAtA[i:], m.CycleList[iNdEx]) - i = encodeVarintParams(dAtA, i, uint64(len(m.CycleList[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -157,12 +138,6 @@ func (m *Params) Size() (n int) { } var l int _ = l - if len(m.CycleList) > 0 { - for _, s := range m.CycleList { - l = len(s) - n += 1 + l + sovParams(uint64(l)) - } - } l = m.MinStakeAmount.Size() n += 1 + l + sovParams(uint64(l)) return n @@ -204,38 +179,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CycleList", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CycleList = append(m.CycleList, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MinStakeAmount", wireType) } diff --git a/x/oracle/types/query_meta.pb.go b/x/oracle/types/query_meta.pb.go new file mode 100644 index 000000000..0227f4979 --- /dev/null +++ b/x/oracle/types/query_meta.pb.go @@ -0,0 +1,567 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: layer/oracle/query_meta.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// 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 + +type QueryMeta struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + Expiration time.Time `protobuf:"bytes,3,opt,name=expiration,proto3,stdtime" json:"expiration"` + RegistrySpecTimeframe time.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3,stdduration" json:"registry_spec_timeframe"` + HasRevealedReports bool `protobuf:"varint,5,opt,name=hasRevealedReports,proto3" json:"hasRevealedReports,omitempty"` + QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` +} + +func (m *QueryMeta) Reset() { *m = QueryMeta{} } +func (m *QueryMeta) String() string { return proto.CompactTextString(m) } +func (*QueryMeta) ProtoMessage() {} +func (*QueryMeta) Descriptor() ([]byte, []int) { + return fileDescriptor_072f14e329c22246, []int{0} +} +func (m *QueryMeta) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMeta.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 *QueryMeta) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMeta.Merge(m, src) +} +func (m *QueryMeta) XXX_Size() int { + return m.Size() +} +func (m *QueryMeta) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMeta.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMeta proto.InternalMessageInfo + +func (m *QueryMeta) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *QueryMeta) GetExpiration() time.Time { + if m != nil { + return m.Expiration + } + return time.Time{} +} + +func (m *QueryMeta) GetRegistrySpecTimeframe() time.Duration { + if m != nil { + return m.RegistrySpecTimeframe + } + return 0 +} + +func (m *QueryMeta) GetHasRevealedReports() bool { + if m != nil { + return m.HasRevealedReports + } + return false +} + +func (m *QueryMeta) GetQueryId() []byte { + if m != nil { + return m.QueryId + } + return nil +} + +func init() { + proto.RegisterType((*QueryMeta)(nil), "layer.oracle.QueryMeta") +} + +func init() { proto.RegisterFile("layer/oracle/query_meta.proto", fileDescriptor_072f14e329c22246) } + +var fileDescriptor_072f14e329c22246 = []byte{ + // 423 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0xb3, 0xa1, 0x84, 0x74, 0x29, 0x48, 0x58, 0x54, 0x38, 0x91, 0xb0, 0x2d, 0x4e, 0x06, + 0xd4, 0x5d, 0x09, 0xde, 0x20, 0xed, 0x25, 0x07, 0x0e, 0x98, 0x9e, 0xb8, 0x84, 0x8d, 0x3d, 0x75, + 0x56, 0x78, 0x3d, 0x66, 0x77, 0x8d, 0x9a, 0xb7, 0xe8, 0x91, 0x47, 0xe0, 0xc8, 0x81, 0x87, 0xe8, + 0xb1, 0x82, 0x0b, 0xe2, 0xd0, 0xa0, 0xe4, 0xc0, 0x6b, 0x20, 0x7b, 0x6d, 0x09, 0x41, 0x2f, 0x96, + 0xff, 0xfd, 0x67, 0x7e, 0x7f, 0xe3, 0x1d, 0xfa, 0xb8, 0x10, 0x6b, 0xd0, 0x1c, 0xb5, 0x48, 0x0b, + 0xe0, 0x1f, 0x6a, 0xd0, 0xeb, 0x85, 0x02, 0x2b, 0x58, 0xa5, 0xd1, 0xa2, 0x77, 0xd0, 0xda, 0xcc, + 0xd9, 0xd3, 0x07, 0x42, 0xc9, 0x12, 0x79, 0xfb, 0x74, 0x05, 0xd3, 0x49, 0x8a, 0x46, 0xa1, 0x59, + 0xb4, 0x8a, 0x3b, 0xd1, 0x59, 0x0f, 0x73, 0xcc, 0xd1, 0x9d, 0x37, 0x6f, 0xdd, 0x69, 0x90, 0x23, + 0xe6, 0x05, 0xf0, 0x56, 0x2d, 0xeb, 0x33, 0x9e, 0xd5, 0x5a, 0x58, 0x89, 0x65, 0xe7, 0x87, 0xff, + 0xfa, 0x56, 0x2a, 0x30, 0x56, 0xa8, 0xca, 0x15, 0x3c, 0xf9, 0x3e, 0xa4, 0xfb, 0xaf, 0x1b, 0xce, + 0x57, 0x60, 0x85, 0x77, 0x9f, 0x0e, 0x65, 0xe6, 0x93, 0x88, 0xc4, 0x7b, 0xc9, 0x50, 0x66, 0xde, + 0x31, 0x1d, 0x09, 0x85, 0x75, 0x69, 0xfd, 0x61, 0x44, 0xe2, 0xfd, 0xd9, 0xf3, 0xcb, 0xeb, 0x70, + 0xf0, 0xf3, 0x3a, 0x3c, 0x74, 0x68, 0x26, 0x7b, 0xcf, 0x24, 0x72, 0x25, 0xec, 0x8a, 0xcd, 0x4b, + 0xfb, 0xed, 0xeb, 0x11, 0xed, 0x98, 0xe7, 0xa5, 0x4d, 0xba, 0x56, 0xef, 0x84, 0x52, 0x38, 0xaf, + 0xa4, 0xe3, 0xf2, 0x6f, 0x45, 0x24, 0xbe, 0xfb, 0x62, 0xca, 0x1c, 0x18, 0xeb, 0xc1, 0xd8, 0x69, + 0x0f, 0x36, 0x1b, 0x37, 0x1f, 0xb9, 0xd8, 0x84, 0x24, 0xf9, 0xab, 0xcf, 0x7b, 0x47, 0x1f, 0x69, + 0xc8, 0xa5, 0xb1, 0x7a, 0xbd, 0x30, 0x15, 0xa4, 0x8b, 0x66, 0x92, 0x33, 0x2d, 0x14, 0xf8, 0x7b, + 0x6d, 0xe4, 0xe4, 0xbf, 0xc8, 0x93, 0xee, 0x5f, 0xcc, 0xee, 0x35, 0x89, 0x9f, 0x36, 0x21, 0xf9, + 0xfc, 0xfb, 0xcb, 0x33, 0x92, 0x1c, 0xf6, 0x41, 0x6f, 0x2a, 0x48, 0x4f, 0xfb, 0x18, 0x8f, 0x51, + 0x6f, 0x25, 0x4c, 0x02, 0x1f, 0x41, 0x14, 0x90, 0x25, 0x50, 0xa1, 0xb6, 0xc6, 0xbf, 0x1d, 0x91, + 0x78, 0x9c, 0xdc, 0xe0, 0x78, 0x13, 0x3a, 0x76, 0x37, 0x2c, 0x33, 0x7f, 0x14, 0x91, 0xf8, 0x20, + 0xb9, 0xd3, 0xea, 0x79, 0x36, 0x3b, 0xbe, 0xdc, 0x06, 0xe4, 0x6a, 0x1b, 0x90, 0x5f, 0xdb, 0x80, + 0x5c, 0xec, 0x82, 0xc1, 0xd5, 0x2e, 0x18, 0xfc, 0xd8, 0x05, 0x83, 0xb7, 0x4f, 0x73, 0x69, 0x57, + 0xf5, 0x92, 0xa5, 0xa8, 0xb8, 0x85, 0xa2, 0x40, 0x7d, 0x24, 0x91, 0xbb, 0xb5, 0x39, 0xef, 0x17, + 0xc7, 0xae, 0x2b, 0x30, 0xcb, 0x51, 0x3b, 0xc8, 0xcb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, + 0x07, 0x2e, 0xd1, 0x55, 0x02, 0x00, 0x00, +} + +func (m *QueryMeta) 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 *QueryMeta) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.QueryId) > 0 { + i -= len(m.QueryId) + copy(dAtA[i:], m.QueryId) + i = encodeVarintQueryMeta(dAtA, i, uint64(len(m.QueryId))) + i-- + dAtA[i] = 0x32 + } + if m.HasRevealedReports { + i-- + if m.HasRevealedReports { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.RegistrySpecTimeframe, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RegistrySpecTimeframe):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintQueryMeta(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x22 + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Expiration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiration):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintQueryMeta(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQueryMeta(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Id != 0 { + i = encodeVarintQueryMeta(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintQueryMeta(dAtA []byte, offset int, v uint64) int { + offset -= sovQueryMeta(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryMeta) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovQueryMeta(uint64(m.Id)) + } + l = m.Amount.Size() + n += 1 + l + sovQueryMeta(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Expiration) + n += 1 + l + sovQueryMeta(uint64(l)) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.RegistrySpecTimeframe) + n += 1 + l + sovQueryMeta(uint64(l)) + if m.HasRevealedReports { + n += 2 + } + l = len(m.QueryId) + if l > 0 { + n += 1 + l + sovQueryMeta(uint64(l)) + } + return n +} + +func sovQueryMeta(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQueryMeta(x uint64) (n int) { + return sovQueryMeta(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryMeta) 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 ErrIntOverflowQueryMeta + } + 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: QueryMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 ErrIntOverflowQueryMeta + } + 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 ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Expiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegistrySpecTimeframe", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.RegistrySpecTimeframe, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasRevealedReports", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasRevealedReports = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryId", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QueryId = append(m.QueryId[:0], dAtA[iNdEx:postIndex]...) + if m.QueryId == nil { + m.QueryId = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryMeta(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryMeta + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQueryMeta(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, ErrIntOverflowQueryMeta + } + 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, ErrIntOverflowQueryMeta + } + 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, ErrIntOverflowQueryMeta + } + 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, ErrInvalidLengthQueryMeta + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQueryMeta + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQueryMeta + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQueryMeta = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQueryMeta = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQueryMeta = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 79bcace8c..02204a619 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -421,6 +421,98 @@ func (m *MsgTipResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgTipResponse proto.InternalMessageInfo +// MsgUpdateCycleRequest is the Msg/UpdateCycle request type. +type MsgUpdateCyclelist struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // list of query data hex strings + Cyclelist []string `protobuf:"bytes,2,rep,name=cyclelist,proto3" json:"cyclelist,omitempty"` +} + +func (m *MsgUpdateCyclelist) Reset() { *m = MsgUpdateCyclelist{} } +func (m *MsgUpdateCyclelist) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCyclelist) ProtoMessage() {} +func (*MsgUpdateCyclelist) Descriptor() ([]byte, []int) { + return fileDescriptor_85ff275c542a231a, []int{8} +} +func (m *MsgUpdateCyclelist) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCyclelist) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCyclelist.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 *MsgUpdateCyclelist) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCyclelist.Merge(m, src) +} +func (m *MsgUpdateCyclelist) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCyclelist) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCyclelist.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateCyclelist proto.InternalMessageInfo + +func (m *MsgUpdateCyclelist) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateCyclelist) GetCyclelist() []string { + if m != nil { + return m.Cyclelist + } + return nil +} + +// MsgUpdateCycleResponse defines the Msg/UpdateCycle response type. +type MsgUpdateCyclelistResponse struct { +} + +func (m *MsgUpdateCyclelistResponse) Reset() { *m = MsgUpdateCyclelistResponse{} } +func (m *MsgUpdateCyclelistResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateCyclelistResponse) ProtoMessage() {} +func (*MsgUpdateCyclelistResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_85ff275c542a231a, []int{9} +} +func (m *MsgUpdateCyclelistResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateCyclelistResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateCyclelistResponse.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 *MsgUpdateCyclelistResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateCyclelistResponse.Merge(m, src) +} +func (m *MsgUpdateCyclelistResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateCyclelistResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateCyclelistResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateCyclelistResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "layer.oracle.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "layer.oracle.MsgUpdateParamsResponse") @@ -430,50 +522,56 @@ func init() { proto.RegisterType((*MsgCommitReportResponse)(nil), "layer.oracle.MsgCommitReportResponse") proto.RegisterType((*MsgTip)(nil), "layer.oracle.MsgTip") proto.RegisterType((*MsgTipResponse)(nil), "layer.oracle.MsgTipResponse") + proto.RegisterType((*MsgUpdateCyclelist)(nil), "layer.oracle.MsgUpdateCyclelist") + proto.RegisterType((*MsgUpdateCyclelistResponse)(nil), "layer.oracle.MsgUpdateCyclelistResponse") } func init() { proto.RegisterFile("layer/oracle/tx.proto", fileDescriptor_85ff275c542a231a) } var fileDescriptor_85ff275c542a231a = []byte{ - // 601 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4d, 0x8f, 0xd2, 0x40, - 0x18, 0xc7, 0xe9, 0xc2, 0x62, 0x18, 0x88, 0x2f, 0x13, 0xdc, 0x2d, 0xcd, 0x6e, 0xdd, 0x10, 0x4d, - 0x56, 0x92, 0x6d, 0x03, 0x26, 0x6e, 0xe4, 0x26, 0x78, 0x25, 0xd1, 0x2e, 0x7a, 0xf0, 0xb2, 0x19, - 0x60, 0x52, 0x26, 0x69, 0x3b, 0x75, 0x66, 0x4a, 0x96, 0x9b, 0x9a, 0x78, 0xf1, 0xe4, 0xc7, 0xf0, - 0xc8, 0x41, 0xbf, 0x82, 0xd9, 0xe3, 0xc6, 0x93, 0x27, 0x63, 0xe0, 0xc0, 0xd7, 0x30, 0x9d, 0x4e, - 0x59, 0xde, 0xb2, 0x26, 0x5e, 0x60, 0x9e, 0xe7, 0xff, 0xbc, 0xfc, 0x3a, 0xcf, 0xd3, 0x82, 0xfb, - 0x1e, 0x1a, 0x63, 0x66, 0x53, 0x86, 0xfa, 0x1e, 0xb6, 0xc5, 0x85, 0x15, 0x32, 0x2a, 0x28, 0x2c, - 0x49, 0xb7, 0x95, 0xb8, 0x8d, 0x7b, 0xc8, 0x27, 0x01, 0xb5, 0xe5, 0x6f, 0x12, 0x60, 0x98, 0x7d, - 0xca, 0x7d, 0xca, 0xed, 0x1e, 0xe2, 0xd8, 0x1e, 0xd5, 0x7b, 0x58, 0xa0, 0xba, 0xdd, 0xa7, 0x24, - 0x50, 0xfa, 0xbe, 0xd2, 0x7d, 0xee, 0xda, 0xa3, 0x7a, 0xfc, 0xa7, 0x84, 0x4a, 0x22, 0x9c, 0x4b, - 0xcb, 0x4e, 0x0c, 0x25, 0x95, 0x5d, 0xea, 0xd2, 0xc4, 0x1f, 0x9f, 0xd2, 0x84, 0x15, 0xc2, 0x10, - 0x31, 0xe4, 0xab, 0x84, 0xea, 0x77, 0x0d, 0xdc, 0xe9, 0x70, 0xf7, 0x75, 0x38, 0x40, 0x02, 0xbf, - 0x94, 0x0a, 0x7c, 0x0a, 0x0a, 0x28, 0x12, 0x43, 0xca, 0x88, 0x18, 0xeb, 0xda, 0x91, 0x76, 0x5c, - 0x68, 0xe9, 0x3f, 0xbf, 0x9d, 0x94, 0x55, 0xa7, 0xe7, 0x83, 0x01, 0xc3, 0x9c, 0x9f, 0x09, 0x46, - 0x02, 0xd7, 0xb9, 0x0e, 0x85, 0xa7, 0x20, 0x9f, 0xd4, 0xd6, 0x77, 0x8e, 0xb4, 0xe3, 0x62, 0xa3, - 0x6c, 0x2d, 0x5f, 0x81, 0x95, 0x54, 0x6f, 0x15, 0x2e, 0x7f, 0x3f, 0xc8, 0x7c, 0x9d, 0x4f, 0x6a, - 0x9a, 0xa3, 0xc2, 0x9b, 0xf5, 0x8f, 0xf3, 0x49, 0xed, 0xba, 0xd0, 0xe7, 0xf9, 0xa4, 0x66, 0x26, - 0xc8, 0x17, 0x29, 0xf4, 0x1a, 0x63, 0xb5, 0x02, 0xf6, 0xd7, 0x5c, 0x0e, 0xe6, 0x21, 0x0d, 0x38, - 0xae, 0x7e, 0xd0, 0xc0, 0xed, 0x0e, 0x77, 0xcf, 0xa2, 0x9e, 0x4f, 0xc4, 0x1b, 0xe4, 0x45, 0x18, - 0xea, 0xe0, 0x56, 0x9f, 0x61, 0x24, 0x28, 0x4b, 0x9e, 0xc7, 0x49, 0x4d, 0x78, 0x08, 0xc0, 0xbb, - 0x08, 0xb3, 0xf1, 0xf9, 0x00, 0x09, 0x24, 0xb9, 0x0b, 0x4e, 0x41, 0x7a, 0x5e, 0x20, 0x81, 0x60, - 0x19, 0xec, 0x8e, 0xe2, 0x0a, 0x7a, 0x56, 0x2a, 0x89, 0x01, 0x21, 0xc8, 0x71, 0xe4, 0x09, 0x3d, - 0x27, 0x9d, 0xf2, 0xdc, 0x2c, 0xc5, 0xcf, 0x90, 0x96, 0xad, 0xea, 0x60, 0x6f, 0x15, 0x61, 0x41, - 0xe7, 0xc9, 0xfb, 0x6e, 0x53, 0xdf, 0x27, 0xc2, 0xc1, 0x21, 0x65, 0xe2, 0xff, 0xe9, 0x20, 0xc8, - 0x0d, 0x11, 0x1f, 0x2a, 0x38, 0x79, 0x5e, 0xe3, 0x48, 0xae, 0x69, 0xb9, 0xdb, 0x02, 0xe4, 0x93, - 0x06, 0xf2, 0x1d, 0xee, 0x76, 0x49, 0x08, 0xf7, 0x40, 0x5e, 0x90, 0x30, 0xc4, 0x69, 0x7f, 0x65, - 0xfd, 0xab, 0xfd, 0x29, 0xc8, 0x23, 0x9f, 0x46, 0x81, 0x90, 0x00, 0xc5, 0x46, 0xc5, 0x52, 0x1b, - 0x12, 0x6f, 0xb4, 0xa5, 0x36, 0xda, 0x6a, 0x53, 0x12, 0xb4, 0x72, 0xf1, 0xd0, 0x1d, 0x15, 0xde, - 0x2c, 0xc6, 0x8c, 0xaa, 0x49, 0xf5, 0xae, 0x9c, 0x56, 0x97, 0x84, 0x29, 0x59, 0xe3, 0xc7, 0x0e, - 0xc8, 0x76, 0xb8, 0x0b, 0xbb, 0xa0, 0xb4, 0xb2, 0x97, 0x87, 0xab, 0xfb, 0xb4, 0x36, 0x7f, 0xe3, - 0xd1, 0x8d, 0x72, 0x5a, 0x1d, 0xbe, 0x02, 0xc5, 0xe5, 0xd5, 0x38, 0xd8, 0xc8, 0x5a, 0x52, 0x8d, - 0x87, 0x37, 0xa9, 0x8b, 0x92, 0x5d, 0x50, 0x5a, 0x19, 0xe8, 0x26, 0xe8, 0xb2, 0xbc, 0x05, 0x74, - 0xdb, 0x80, 0xe0, 0x33, 0x90, 0x8d, 0x87, 0x53, 0xde, 0x88, 0xee, 0x92, 0xd0, 0x38, 0xd8, 0xe6, - 0x4d, 0x53, 0x8d, 0xdd, 0xf7, 0xf1, 0xfb, 0xd5, 0x6a, 0x5f, 0x4e, 0x4d, 0xed, 0x6a, 0x6a, 0x6a, - 0x7f, 0xa6, 0xa6, 0xf6, 0x65, 0x66, 0x66, 0xae, 0x66, 0x66, 0xe6, 0xd7, 0xcc, 0xcc, 0xbc, 0x7d, - 0xec, 0x12, 0x31, 0x8c, 0x7a, 0x56, 0x9f, 0xfa, 0xb6, 0xc0, 0x9e, 0x47, 0xd9, 0x09, 0xa1, 0xf6, - 0xda, 0x3b, 0x27, 0xc6, 0x21, 0xe6, 0xbd, 0xbc, 0xfc, 0x50, 0x3c, 0xf9, 0x1b, 0x00, 0x00, 0xff, - 0xff, 0xcc, 0x4f, 0xd9, 0xf4, 0xe7, 0x04, 0x00, 0x00, + // 669 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x8d, 0x9b, 0x34, 0x4f, 0xb9, 0x89, 0x5e, 0xdf, 0x1b, 0xe5, 0xb5, 0xae, 0x95, 0xfa, 0x85, + 0x08, 0xa4, 0x52, 0xa9, 0xb6, 0x52, 0x10, 0x15, 0xd9, 0x91, 0xb0, 0x8d, 0x04, 0x6e, 0x60, 0x81, + 0x84, 0xaa, 0x89, 0x33, 0x72, 0x46, 0xb2, 0x33, 0xc6, 0x33, 0xa9, 0x9a, 0x1d, 0x20, 0xb1, 0x61, + 0xc5, 0x4f, 0x60, 0x83, 0xc4, 0xb2, 0x0b, 0xf8, 0x0f, 0x5d, 0x56, 0xac, 0x58, 0x21, 0xd4, 0x2e, + 0xfa, 0x37, 0x90, 0xc7, 0x63, 0x37, 0x1f, 0xfd, 0x90, 0xba, 0x49, 0x7c, 0xcf, 0xb9, 0x73, 0xee, + 0x99, 0x99, 0x63, 0xc3, 0x7f, 0x3e, 0x9e, 0x90, 0xc8, 0x66, 0x11, 0x76, 0x7d, 0x62, 0x8b, 0x43, + 0x2b, 0x8c, 0x98, 0x60, 0xa8, 0x22, 0x61, 0x2b, 0x81, 0x8d, 0x7f, 0x71, 0x40, 0x47, 0xcc, 0x96, + 0xbf, 0x49, 0x83, 0x61, 0xba, 0x8c, 0x07, 0x8c, 0xdb, 0x7d, 0xcc, 0x89, 0x7d, 0xd0, 0xec, 0x13, + 0x81, 0x9b, 0xb6, 0xcb, 0xe8, 0x48, 0xf1, 0x6b, 0x8a, 0x0f, 0xb8, 0x67, 0x1f, 0x34, 0xe3, 0x3f, + 0x45, 0xac, 0x27, 0xc4, 0xbe, 0xac, 0xec, 0xa4, 0x50, 0x54, 0xd5, 0x63, 0x1e, 0x4b, 0xf0, 0xf8, + 0x29, 0x5d, 0x30, 0xe3, 0x30, 0xc4, 0x11, 0x0e, 0xd4, 0x82, 0xc6, 0x77, 0x0d, 0x56, 0xba, 0xdc, + 0x7b, 0x11, 0x0e, 0xb0, 0x20, 0xcf, 0x24, 0x83, 0x1e, 0x41, 0x09, 0x8f, 0xc5, 0x90, 0x45, 0x54, + 0x4c, 0x74, 0xad, 0xae, 0x6d, 0x96, 0xda, 0xfa, 0x8f, 0x6f, 0xdb, 0x55, 0x35, 0xe9, 0xc9, 0x60, + 0x10, 0x11, 0xce, 0xf7, 0x44, 0x44, 0x47, 0x9e, 0x73, 0xd1, 0x8a, 0x76, 0xa1, 0x98, 0x68, 0xeb, + 0x4b, 0x75, 0x6d, 0xb3, 0xbc, 0x53, 0xb5, 0xa6, 0x8f, 0xc0, 0x4a, 0xd4, 0xdb, 0xa5, 0xe3, 0x5f, + 0xff, 0xe7, 0xbe, 0x9e, 0x1f, 0x6d, 0x69, 0x8e, 0x6a, 0x6f, 0x35, 0xdf, 0x9f, 0x1f, 0x6d, 0x5d, + 0x08, 0x7d, 0x3c, 0x3f, 0xda, 0x32, 0x13, 0xcb, 0x87, 0xa9, 0xe9, 0x39, 0x8f, 0x8d, 0x75, 0x58, + 0x9b, 0x83, 0x1c, 0xc2, 0x43, 0x36, 0xe2, 0xa4, 0xf1, 0x4e, 0x83, 0xbf, 0xbb, 0xdc, 0xdb, 0x1b, + 0xf7, 0x03, 0x2a, 0x5e, 0x62, 0x7f, 0x4c, 0x90, 0x0e, 0x7f, 0xb9, 0x11, 0xc1, 0x82, 0x45, 0xc9, + 0x7e, 0x9c, 0xb4, 0x44, 0x1b, 0x00, 0x6f, 0xc6, 0x24, 0x9a, 0xec, 0x0f, 0xb0, 0xc0, 0xd2, 0x77, + 0xc9, 0x29, 0x49, 0xe4, 0x29, 0x16, 0x18, 0x55, 0x61, 0xf9, 0x20, 0x56, 0xd0, 0xf3, 0x92, 0x49, + 0x0a, 0x84, 0xa0, 0xc0, 0xb1, 0x2f, 0xf4, 0x82, 0x04, 0xe5, 0x73, 0xab, 0x12, 0xef, 0x21, 0x95, + 0x6d, 0xe8, 0xb0, 0x3a, 0x6b, 0x21, 0x73, 0xe7, 0xcb, 0xf3, 0xee, 0xb0, 0x20, 0xa0, 0xc2, 0x21, + 0x21, 0x8b, 0xc4, 0xed, 0xdd, 0x21, 0x28, 0x0c, 0x31, 0x1f, 0x2a, 0x73, 0xf2, 0x79, 0xce, 0x47, + 0x72, 0x4c, 0xd3, 0xd3, 0x32, 0x23, 0x1f, 0x34, 0x28, 0x76, 0xb9, 0xd7, 0xa3, 0x21, 0x5a, 0x85, + 0xa2, 0xa0, 0x61, 0x48, 0xd2, 0xf9, 0xaa, 0xba, 0x69, 0xfc, 0x2e, 0x14, 0x71, 0xc0, 0xc6, 0x23, + 0x21, 0x0d, 0x94, 0x77, 0xd6, 0x2d, 0x95, 0x90, 0x38, 0xd1, 0x96, 0x4a, 0xb4, 0xd5, 0x61, 0x74, + 0xd4, 0x2e, 0xc4, 0x97, 0xee, 0xa8, 0xf6, 0x56, 0x39, 0xf6, 0xa8, 0x86, 0x34, 0xfe, 0x91, 0xb7, + 0xd5, 0xa3, 0x61, 0xe6, 0xec, 0xb3, 0x06, 0x28, 0xbb, 0xdc, 0xce, 0xc4, 0xf5, 0x89, 0x4f, 0xb9, + 0xb8, 0x75, 0x2c, 0x6b, 0x50, 0x72, 0x53, 0x11, 0x7d, 0xa9, 0x9e, 0x8f, 0x37, 0x91, 0x01, 0xad, + 0x87, 0x8b, 0xd9, 0xbb, 0x73, 0x55, 0xf6, 0x32, 0x2f, 0x8d, 0x1a, 0x18, 0x8b, 0x68, 0xba, 0x81, + 0x9d, 0x2f, 0x79, 0xc8, 0x77, 0xb9, 0x87, 0x7a, 0x50, 0x99, 0x79, 0xb1, 0x36, 0x66, 0x5f, 0x88, + 0xb9, 0x00, 0x1b, 0xf7, 0xae, 0xa5, 0x53, 0x75, 0xf4, 0x1c, 0xca, 0xd3, 0xd9, 0xae, 0x2d, 0xac, + 0x9a, 0x62, 0x8d, 0xbb, 0xd7, 0xb1, 0x99, 0x64, 0x0f, 0x2a, 0x33, 0x89, 0x5c, 0x34, 0x3a, 0x4d, + 0x5f, 0x62, 0xf4, 0xb2, 0x84, 0xa1, 0xc7, 0x90, 0x8f, 0xd3, 0x55, 0x5d, 0xe8, 0xee, 0xd1, 0xd0, + 0xa8, 0x5d, 0x86, 0x66, 0x4b, 0x5f, 0xc3, 0xca, 0xfc, 0xf5, 0xd7, 0xaf, 0x38, 0x9d, 0xac, 0xc3, + 0xd8, 0xbc, 0xa9, 0x23, 0x95, 0x37, 0x96, 0xdf, 0xc6, 0xdf, 0x9f, 0x76, 0xe7, 0xf8, 0xd4, 0xd4, + 0x4e, 0x4e, 0x4d, 0xed, 0xf7, 0xa9, 0xa9, 0x7d, 0x3a, 0x33, 0x73, 0x27, 0x67, 0x66, 0xee, 0xe7, + 0x99, 0x99, 0x7b, 0x75, 0xdf, 0xa3, 0x62, 0x38, 0xee, 0x5b, 0x2e, 0x0b, 0x6c, 0x41, 0x7c, 0x9f, + 0x45, 0xdb, 0x94, 0xd9, 0x73, 0xb9, 0x10, 0x93, 0x90, 0xf0, 0x7e, 0x51, 0x7e, 0x48, 0x1f, 0xfc, + 0x09, 0x00, 0x00, 0xff, 0xff, 0xde, 0xde, 0x2f, 0xab, 0x07, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -494,6 +592,7 @@ type MsgClient interface { SubmitValue(ctx context.Context, in *MsgSubmitValue, opts ...grpc.CallOption) (*MsgSubmitValueResponse, error) CommitReport(ctx context.Context, in *MsgCommitReport, opts ...grpc.CallOption) (*MsgCommitReportResponse, error) Tip(ctx context.Context, in *MsgTip, opts ...grpc.CallOption) (*MsgTipResponse, error) + UpdateCyclelist(ctx context.Context, in *MsgUpdateCyclelist, opts ...grpc.CallOption) (*MsgUpdateCyclelistResponse, error) } type msgClient struct { @@ -540,6 +639,15 @@ func (c *msgClient) Tip(ctx context.Context, in *MsgTip, opts ...grpc.CallOption return out, nil } +func (c *msgClient) UpdateCyclelist(ctx context.Context, in *MsgUpdateCyclelist, opts ...grpc.CallOption) (*MsgUpdateCyclelistResponse, error) { + out := new(MsgUpdateCyclelistResponse) + err := c.cc.Invoke(ctx, "/layer.oracle.Msg/UpdateCyclelist", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module @@ -548,6 +656,7 @@ type MsgServer interface { SubmitValue(context.Context, *MsgSubmitValue) (*MsgSubmitValueResponse, error) CommitReport(context.Context, *MsgCommitReport) (*MsgCommitReportResponse, error) Tip(context.Context, *MsgTip) (*MsgTipResponse, error) + UpdateCyclelist(context.Context, *MsgUpdateCyclelist) (*MsgUpdateCyclelistResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -566,6 +675,9 @@ func (*UnimplementedMsgServer) CommitReport(ctx context.Context, req *MsgCommitR func (*UnimplementedMsgServer) Tip(ctx context.Context, req *MsgTip) (*MsgTipResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Tip not implemented") } +func (*UnimplementedMsgServer) UpdateCyclelist(ctx context.Context, req *MsgUpdateCyclelist) (*MsgUpdateCyclelistResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCyclelist not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -643,6 +755,24 @@ func _Msg_Tip_Handler(srv interface{}, ctx context.Context, dec func(interface{} return interceptor(ctx, in, info, handler) } +func _Msg_UpdateCyclelist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateCyclelist) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateCyclelist(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/layer.oracle.Msg/UpdateCyclelist", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateCyclelist(ctx, req.(*MsgUpdateCyclelist)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "layer.oracle.Msg", HandlerType: (*MsgServer)(nil), @@ -663,6 +793,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Tip", Handler: _Msg_Tip_Handler, }, + { + MethodName: "UpdateCyclelist", + Handler: _Msg_UpdateCyclelist_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "layer/oracle/tx.proto", @@ -942,6 +1076,68 @@ func (m *MsgTipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateCyclelist) 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 *MsgUpdateCyclelist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateCyclelist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Cyclelist) > 0 { + for iNdEx := len(m.Cyclelist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Cyclelist[iNdEx]) + copy(dAtA[i:], m.Cyclelist[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Cyclelist[iNdEx]))) + 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 *MsgUpdateCyclelistResponse) 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 *MsgUpdateCyclelistResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateCyclelistResponse) 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 @@ -1069,6 +1265,34 @@ func (m *MsgTipResponse) Size() (n int) { return n } +func (m *MsgUpdateCyclelist) 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)) + } + if len(m.Cyclelist) > 0 { + for _, s := range m.Cyclelist { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgUpdateCyclelistResponse) 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 } @@ -1861,6 +2085,170 @@ func (m *MsgTipResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateCyclelist) 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: MsgUpdateCyclelist: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateCyclelist: 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 Cyclelist", 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.Cyclelist = append(m.Cyclelist, 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 *MsgUpdateCyclelistResponse) 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: MsgUpdateCyclelistResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateCyclelistResponse: 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 From ced427b191d4c60b0cb65b19de316446b1648db7 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 08:35:21 -0400 Subject: [PATCH 15/31] fix auto reporter --- app/app.go | 21 +- cmd/layerd/cmd/root.go | 8 +- daemons/reporter/client/client.go | 302 +++++++------------- daemons/reporter/client/current_query.go | 25 ++ daemons/reporter/client/median.go | 37 +++ daemons/reporter/client/tx_handler.go | 147 ++++++++++ x/oracle/abci.go | 8 +- x/oracle/keeper/aggregate.go | 16 +- x/oracle/keeper/cycle_list.go | 4 +- x/oracle/keeper/msg_server_commit_report.go | 2 + x/oracle/module.go | 5 +- 11 files changed, 341 insertions(+), 234 deletions(-) create mode 100644 daemons/reporter/client/current_query.go create mode 100644 daemons/reporter/client/median.go create mode 100644 daemons/reporter/client/tx_handler.go diff --git a/app/app.go b/app/app.go index 466fa316d..970168da0 100644 --- a/app/app.go +++ b/app/app.go @@ -549,6 +549,16 @@ func New( ) registryModule := registrymodule.NewAppModule(appCodec, app.RegistryKeeper, app.AccountKeeper, app.BankKeeper) + app.ReporterKeeper = reportermodulekeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(keys[reportermoduletypes.StoreKey]), + logger, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + app.StakingKeeper, + app.BankKeeper, + ) + reporterModule := reportermodule.NewAppModule(appCodec, app.ReporterKeeper, app.AccountKeeper, app.BankKeeper) + app.OracleKeeper = oraclemodulekeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[oraclemoduletypes.StoreKey]), @@ -572,17 +582,6 @@ func New( app.ReporterKeeper, ) disputeModule := disputemodule.NewAppModule(appCodec, app.DisputeKeeper, app.AccountKeeper, app.BankKeeper) - - app.ReporterKeeper = reportermodulekeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[reportermoduletypes.StoreKey]), - logger, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - app.StakingKeeper, - app.BankKeeper, - ) - reporterModule := reportermodule.NewAppModule(appCodec, app.ReporterKeeper, app.AccountKeeper, app.BankKeeper) - // this line is used by starport scaffolding # stargate/app/keeperDefinition appFlags := appflags.GetFlagValuesFromOptions(appOpts) // Panic if this is not a full node and gRPC is disabled. diff --git a/cmd/layerd/cmd/root.go b/cmd/layerd/cmd/root.go index 9e3715a58..96f87520c 100644 --- a/cmd/layerd/cmd/root.go +++ b/cmd/layerd/cmd/root.go @@ -125,7 +125,13 @@ func initRootCmd( app.DefaultNodeHome, newApp, appExport, - addModuleInitFlags, + func(cmd *cobra.Command) { + addModuleInitFlags(cmd) + + if option.startCmdCustomizer != nil { + option.startCmdCustomizer(cmd) + } + }, ) // add keybase, auxiliary RPC, query, and tx child commands diff --git a/daemons/reporter/client/client.go b/daemons/reporter/client/client.go index 49cbd34a5..d77c94942 100644 --- a/daemons/reporter/client/client.go +++ b/daemons/reporter/client/client.go @@ -2,27 +2,24 @@ package client import ( "context" - "encoding/hex" "fmt" - "strings" "time" "cosmossdk.io/log" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" appflags "github.com/tellor-io/layer/app/flags" "github.com/tellor-io/layer/daemons/flags" daemontypes "github.com/tellor-io/layer/daemons/types" oracletypes "github.com/tellor-io/layer/x/oracle/types" + reportertypes "github.com/tellor-io/layer/x/reporter/types" - cmttypes "github.com/cometbft/cometbft/rpc/core/types" pricefeedtypes "github.com/tellor-io/layer/daemons/pricefeed/client/types" pricefeedservertypes "github.com/tellor-io/layer/daemons/server/types/pricefeed" - helper "github.com/tellor-io/layer/lib/prices" - "github.com/tellor-io/layer/utils" + oracleutils "github.com/tellor-io/layer/x/oracle/utils" ) @@ -33,19 +30,25 @@ type Client struct { AccountName string // Query clients OracleQueryClient oracletypes.QueryClient - cosmosCtx client.Context - MarketParams []pricefeedtypes.MarketParam - MarketToExchange *pricefeedservertypes.MarketToExchangePrices + StakingClient stakingtypes.QueryClient + ReporterClient reportertypes.QueryClient + + cosmosCtx client.Context + MarketParams []pricefeedtypes.MarketParam + MarketToExchange *pricefeedservertypes.MarketToExchangePrices + + accAddr sdk.AccAddress // logger is the logger for the daemon. logger log.Logger } func NewClient(clctx client.Context, logger log.Logger, accountName string) *Client { - return &Client{ + c := &Client{ AccountName: accountName, cosmosCtx: clctx, logger: logger, } + return c } func (c *Client) Start( @@ -78,16 +81,27 @@ func (c *Client) Start( // Initialize the query clients. These are used to query the Cosmos gRPC query services. c.OracleQueryClient = oracletypes.NewQueryClient(queryConn) + c.StakingClient = stakingtypes.NewQueryClient(queryConn) + c.ReporterClient = reportertypes.NewQueryClient(queryConn) ticker := time.NewTicker(time.Second) stop := make(chan bool) - s := &SubTaskRunnerImpl{} + // get account + accountName := c.AccountName + c.cosmosCtx = c.cosmosCtx.WithChainID("layer") + fromAddr, fromName, _, err := client.GetFromFields(c.cosmosCtx, c.cosmosCtx.Keyring, accountName) + if err != nil { + panic(fmt.Errorf("error getting address from keyring: %v", err)) + } + c.cosmosCtx = c.cosmosCtx.WithFrom(accountName).WithFromAddress(fromAddr).WithFromName(fromName) + c.accAddr = c.cosmosCtx.GetFromAddress() + StartReporterDaemonTaskLoop( c, ctx, c.cosmosCtx, - s, + &SubTaskRunnerImpl{}, flags, ticker, stop, @@ -105,6 +119,11 @@ func StartReporterDaemonTaskLoop( ticker *time.Ticker, stop <-chan bool, ) { + if err := client.CreateReporter(ctx); err != nil { + client.logger.Error("Error creating reporter: %w", err) + panic(err) + } + for { select { case <-ticker.C: @@ -123,29 +142,66 @@ func StartReporterDaemonTaskLoop( } } -func (c *Client) SubmitReport(ctx context.Context) error { - accountName := c.AccountName - c.cosmosCtx = c.cosmosCtx.WithChainID("layer") - fromAddr, fromName, _, err := client.GetFromFields(c.cosmosCtx, c.cosmosCtx.Keyring, accountName) - if err != nil { - panic(fmt.Errorf("error getting address from keyring: %v", err)) +// MsgCreateReporter creates a staked reporter +func (c *Client) CreateReporter(ctx context.Context) error { + for { + latestHeight, err := c.LatestBlockHeight(ctx) + if err != nil { + c.logger.Error("Error getting latest block height: %v", err) + panic(err) + } + + if latestHeight < 1 { + time.Sleep(time.Second) + } else { + break + } + } + + // get reporter + req := &reportertypes.QueryReporterRequest{ReporterAddress: c.accAddr.String()} + reporter, err := c.ReporterClient.Reporter(ctx, req) + if err == nil { + return nil } - c.cosmosCtx = c.cosmosCtx.WithFrom(accountName).WithFromAddress(fromAddr).WithFromName(fromName) - accAddr := c.cosmosCtx.GetFromAddress() - c.logger.Info("SubmitReport", "Account address to sign messages", accAddr.String()) - response, err := c.OracleQueryClient.CurrentCyclelistQuery(ctx, &oracletypes.QueryCurrentCyclelistQueryRequest{}) + c.logger.Info("ReporterDaemon", "reporter address", reporter.GetReporter()) + + // just getting the first validator, should probably require user to specify validator/s when creating reporter + valreq := &stakingtypes.QueryDelegatorValidatorsRequest{ + DelegatorAddr: c.accAddr.String(), + Pagination: nil, + } + resp, err := c.StakingClient.DelegatorValidators(ctx, valreq) if err != nil { - return fmt.Errorf("error calling 'CurrentCyclelistQuery': %v", err) + return err } - qid, err := utils.QueryIDFromDataString(response.Querydata) + val := resp.Validators[0] + + c.logger.Info("ReporterDaemon", "staked tokens source validator", val.GetOperator()) + // stake reporter transaction, reporter is alice + + // should make this configurable by user :todo + // staking 1 TRB + amtToStake := math.NewInt(1_000_000) // one TRB + commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), + math.LegacyNewDecWithPrec(1, 1), time.Now()) + source := reportertypes.TokenOrigin{ValidatorAddress: val.GetOperator(), Amount: amtToStake} + msgCreateReporter := &reportertypes.MsgCreateReporter{ + Reporter: c.accAddr.String(), + Amount: amtToStake, + TokenOrigins: []*reportertypes.TokenOrigin{&source}, + Commission: &commission, + } + return c.sendTx(ctx, msgCreateReporter, nil) +} + +func (c *Client) SubmitReport(ctx context.Context) error { + querydata, err := c.CurrentQuery(ctx) if err != nil { - c.logger.Error("error getting query id from data string: %v", err) + return fmt.Errorf("error calling 'CurrentQuery': %v", err) } - c.logger.Info("SubmitReport", "next query id in cycle list", hex.EncodeToString(qid)) - // needed to wait because it kept missing the query - time.Sleep(2 * time.Second) - value, err := c.median(ctx, strings.ToLower(response.Querydata)) + value, err := c.median(querydata) if err != nil { return fmt.Errorf("error getting median from median client': %v", err) } @@ -159,194 +215,28 @@ func (c *Client) SubmitReport(ctx context.Context) error { // ***********************MsgCommitReport*************************** msgCommit := &oracletypes.MsgCommitReport{ - Creator: accAddr.String(), - QueryData: response.Querydata, + Creator: c.accAddr.String(), + QueryData: querydata, Hash: hash, } - txf := newFactory(c.cosmosCtx) - _, seq, err := c.cosmosCtx.AccountRetriever.GetAccountNumberSequence(c.cosmosCtx, accAddr) + _, seq, err := c.cosmosCtx.AccountRetriever.GetAccountNumberSequence(c.cosmosCtx, c.accAddr) if err != nil { return fmt.Errorf("error getting account number sequence for 'MsgCommitReport': %v", err) } - txf = txf.WithSequence(seq) - txf, err = txf.Prepare(c.cosmosCtx) + err = c.sendTx(ctx, msgCommit, &seq) if err != nil { - return fmt.Errorf("error preparing transaction during 'MsgCommitReport': %v", err) + return fmt.Errorf("error generating 'MsgCommitReport': %v", err) } - txn, err := txf.BuildUnsignedTx(msgCommit) - if err != nil { - return fmt.Errorf("error building 'MsgCommitReport' unsigned transaction: %v", err) - } - if err = tx.Sign(c.cosmosCtx.CmdContext, txf, c.cosmosCtx.FromName, txn, true); err != nil { - return fmt.Errorf("error when signing 'MsgCommitReport' transaction: %v", err) - } - - txBytes, err := c.cosmosCtx.TxConfig.TxEncoder()(txn.GetTx()) - if err != nil { - return fmt.Errorf("error encoding 'MsgCommitReport' transaction: %v", err) - } - res, err := c.cosmosCtx.BroadcastTx(txBytes) - if err := handleBroadcastResult(res, err); err != nil { - return fmt.Errorf("error broadcasting 'MsgCommitReport' transaction after 'handleBroadcastResult': %v", err) - } - txnResult, err := c.WaitForTx(ctx, res.TxHash) - if err != nil { - return fmt.Errorf("error waiting for 'MsgCommitReport' transaction: %v", err) - } - c.logger.Info("CommitReportTxResult", "TxResult", txnResult) - // ***********************MsgSubmitValue*************************** msgSubmit := &oracletypes.MsgSubmitValue{ - Creator: accAddr.String(), - QueryData: response.Querydata, + Creator: c.accAddr.String(), + QueryData: querydata, Value: value, Salt: salt, } - // increment sequence by 1 for next transaction - seq += 1 - txf = txf.WithSequence(seq) - txf, err = txf.Prepare(c.cosmosCtx) - if err != nil { - return fmt.Errorf("error preparing transaction during 'MsgCommitReport': %v", err) - } - - txn, err = txf.BuildUnsignedTx(msgSubmit) - if err != nil { - return fmt.Errorf("error building 'MsgSubmitValue' unsigned transaction: %v", err) - } - if err = tx.Sign(c.cosmosCtx.CmdContext, txf, c.cosmosCtx.FromName, txn, true); err != nil { - return fmt.Errorf("error when signing 'MsgSubmitValue' transaction: %v", err) - } - txBytes, err = c.cosmosCtx.TxConfig.TxEncoder()(txn.GetTx()) - if err != nil { - return fmt.Errorf("error encoding 'MsgSubmitValue' transaction: %v", err) - } - // broadcast to a CometBFT node - res, err = c.cosmosCtx.BroadcastTx(txBytes) - if err := handleBroadcastResult(res, err); err != nil { - return fmt.Errorf("error broadcasting 'MsgSubmitValue' transaction after 'handleBroadcastResult': %v", err) - } - txnResult, err = c.WaitForTx(ctx, res.TxHash) - if err != nil { - return fmt.Errorf("error waiting for 'MsgSubmitValue' transaction: %v", err) - } - c.logger.Info("SubmitValueTxResult", "TxResult", txnResult) - return nil -} - -func newFactory(clientCtx client.Context) tx.Factory { - return tx.Factory{}. - WithChainID(clientCtx.ChainID). - WithKeybase(clientCtx.Keyring). - WithGasAdjustment(1.1). - WithGas(defaultGas). - WithSignMode(signing.SignMode_SIGN_MODE_DIRECT). - WithAccountRetriever(clientCtx.AccountRetriever). - WithTxConfig(clientCtx.TxConfig) -} - -func (c *Client) median(ctx context.Context, querydata string) (string, error) { - params := c.MarketParams - prices := c.MarketToExchange - mapping := prices.GetValidMedianPrices(params, time.Now()) - fmt.Println("Mapping:", mapping) - - mapQueryDataToMarketParams := make(map[string]pricefeedtypes.MarketParam) - for _, marketParam := range c.MarketParams { - mapQueryDataToMarketParams[strings.ToLower(marketParam.QueryData)] = marketParam - } - mp, found := mapQueryDataToMarketParams[querydata] - if !found { - return "", fmt.Errorf("no market param found for query data: %s", querydata) - } - mv := c.MarketToExchange.GetValidMedianPrices([]pricefeedtypes.MarketParam{mp}, time.Now()) - val, found := mv[mp.Id] - if !found { - return "", fmt.Errorf("no median values found for query data: %s", querydata) - } - - value, err := helper.EncodePrice(float64(val), mp.Exponent) - if err != nil { - return "", err - } - return value, nil -} - -func handleBroadcastResult(resp *sdk.TxResponse, err error) error { - if err != nil { - if strings.Contains(err.Error(), "not found") { - return fmt.Errorf("make sure that your account has enough balance") - } - return err - } - - if resp.Code > 0 { - return fmt.Errorf("error code: '%d' msg: '%s'", resp.Code, resp.RawLog) - } - return nil -} -func (c *Client) WaitForTx(ctx context.Context, hash string) (*cmttypes.ResultTx, error) { - bz, err := hex.DecodeString(hash) - if err != nil { - return nil, fmt.Errorf("unable to decode tx hash '%s'; err: %v", hash, err) - } - for { - resp, err := c.cosmosCtx.Client.Tx(ctx, bz, false) - if err != nil { - if strings.Contains(err.Error(), "not found") { - // Tx not found, wait for next block and try again - err := c.WaitForNextBlock(ctx) - if err != nil { - return nil, fmt.Errorf("waiting for next block: err: %v", err) - } - continue - } - return nil, fmt.Errorf("fetching tx '%s'; err: %v", hash, err) - } - // Tx found - return resp, nil - } -} - -func (c Client) WaitForNextBlock(ctx context.Context) error { - return c.WaitForNBlocks(ctx, 1) -} -func (c Client) WaitForNBlocks(ctx context.Context, n int64) error { - start, err := c.LatestBlockHeight(ctx) - if err != nil { - return err - } - return c.WaitForBlockHeight(ctx, start+n) -} -func (c Client) LatestBlockHeight(ctx context.Context) (int64, error) { - resp, err := c.Status(ctx) - if err != nil { - return 0, err - } - return resp.SyncInfo.LatestBlockHeight, nil -} - -func (c Client) Status(ctx context.Context) (*cmttypes.ResultStatus, error) { - return c.cosmosCtx.Client.Status(ctx) -} -func (c Client) WaitForBlockHeight(ctx context.Context, h int64) error { - ticker := time.NewTicker(time.Second) - defer ticker.Stop() - - for { - latestHeight, err := c.LatestBlockHeight(ctx) - if err != nil { - return err - } - if latestHeight >= h { - return nil - } - select { - case <-ctx.Done(): - return fmt.Errorf("timeout exceeded waiting for block, err: %v", ctx.Err()) - case <-ticker.C: - } - } + // no need to call GetAccountNumberSequence here, just increment sequence by 1 for next transaction + seq++ + return c.sendTx(ctx, msgSubmit, &seq) } diff --git a/daemons/reporter/client/current_query.go b/daemons/reporter/client/current_query.go new file mode 100644 index 000000000..2469e9e9f --- /dev/null +++ b/daemons/reporter/client/current_query.go @@ -0,0 +1,25 @@ +package client + +import ( + "context" + "encoding/hex" + "fmt" + "strings" + + "github.com/tellor-io/layer/utils" + oracletypes "github.com/tellor-io/layer/x/oracle/types" +) + +func (c *Client) CurrentQuery(ctx context.Context) (string, error) { + response, err := c.OracleQueryClient.CurrentCyclelistQuery(ctx, &oracletypes.QueryCurrentCyclelistQueryRequest{}) + if err != nil { + return "", fmt.Errorf("error calling 'CurrentCyclelistQuery': %v", err) + } + qid, err := utils.QueryIDFromDataString(response.Querydata) + if err != nil { + return "", fmt.Errorf("error getting query id from data string: %v", err) + } + + c.logger.Info("ReporterDaemon", "next query id in cycle list", hex.EncodeToString(qid)) + return strings.ToLower(response.Querydata), nil +} diff --git a/daemons/reporter/client/median.go b/daemons/reporter/client/median.go new file mode 100644 index 000000000..60f624825 --- /dev/null +++ b/daemons/reporter/client/median.go @@ -0,0 +1,37 @@ +package client + +import ( + "fmt" + "strings" + "time" + + "github.com/tellor-io/layer/daemons/pricefeed/client/types" + "github.com/tellor-io/layer/lib/prices" +) + +func (c *Client) median(querydata string) (string, error) { + params := c.MarketParams + exchPrices := c.MarketToExchange + mapping := exchPrices.GetValidMedianPrices(params, time.Now()) + fmt.Println("Price Mapping:", mapping) + + mapQueryDataToMarketParams := make(map[string]types.MarketParam) + for _, marketParam := range c.MarketParams { + mapQueryDataToMarketParams[strings.ToLower(marketParam.QueryData)] = marketParam + } + mp, found := mapQueryDataToMarketParams[querydata] + if !found { + return "", fmt.Errorf("no market param found for query data: %s", querydata) + } + mv := c.MarketToExchange.GetValidMedianPrices([]types.MarketParam{mp}, time.Now()) + val, found := mv[mp.Id] + if !found { + return "", fmt.Errorf("no median values found for query data: %s", querydata) + } + + value, err := prices.EncodePrice(float64(val), mp.Exponent) + if err != nil { + return "", fmt.Errorf("faild to encode price: %v", err) + } + return value, nil +} diff --git a/daemons/reporter/client/tx_handler.go b/daemons/reporter/client/tx_handler.go new file mode 100644 index 000000000..7e8c43c43 --- /dev/null +++ b/daemons/reporter/client/tx_handler.go @@ -0,0 +1,147 @@ +package client + +import ( + "context" + "encoding/hex" + "fmt" + "strings" + "time" + + cmttypes "github.com/cometbft/cometbft/rpc/core/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" +) + +func newFactory(clientCtx client.Context) tx.Factory { + return tx.Factory{}. + WithChainID(clientCtx.ChainID). + WithKeybase(clientCtx.Keyring). + WithGasAdjustment(1.1). + WithGas(defaultGas). + WithSignMode(signing.SignMode_SIGN_MODE_DIRECT). + WithAccountRetriever(clientCtx.AccountRetriever). + WithTxConfig(clientCtx.TxConfig) +} + +func handleBroadcastResult(resp *sdk.TxResponse, err error) error { + if err != nil { + if strings.Contains(err.Error(), "not found") { + return fmt.Errorf("make sure that your account has enough balance") + } + return err + } + + if resp.Code > 0 { + return fmt.Errorf("error code: '%d' msg: '%s'", resp.Code, resp.RawLog) + } + return nil +} + +func (c *Client) WaitForTx(ctx context.Context, hash string) (*cmttypes.ResultTx, error) { + bz, err := hex.DecodeString(hash) + if err != nil { + return nil, fmt.Errorf("unable to decode tx hash '%s'; err: %v", hash, err) + } + for { + resp, err := c.cosmosCtx.Client.Tx(ctx, bz, false) + if err != nil { + if strings.Contains(err.Error(), "not found") { + // Tx not found, wait for next block and try again + err := c.WaitForNextBlock(ctx) + if err != nil { + return nil, fmt.Errorf("waiting for next block: err: %v", err) + } + continue + } + return nil, fmt.Errorf("fetching tx '%s'; err: %v", hash, err) + } + // Tx found + return resp, nil + } +} + +func (c Client) WaitForNextBlock(ctx context.Context) error { + return c.WaitForNBlocks(ctx, 1) +} +func (c Client) WaitForNBlocks(ctx context.Context, n int64) error { + start, err := c.LatestBlockHeight(ctx) + if err != nil { + return err + } + return c.WaitForBlockHeight(ctx, start+n) +} +func (c Client) LatestBlockHeight(ctx context.Context) (int64, error) { + resp, err := c.Status(ctx) + if err != nil { + return 0, err + } + return resp.SyncInfo.LatestBlockHeight, nil +} + +func (c Client) Status(ctx context.Context) (*cmttypes.ResultStatus, error) { + return c.cosmosCtx.Client.Status(ctx) +} +func (c Client) WaitForBlockHeight(ctx context.Context, h int64) error { + ticker := time.NewTicker(time.Second) + defer ticker.Stop() + + for { + latestHeight, err := c.LatestBlockHeight(ctx) + if err != nil { + return err + } + if latestHeight >= h { + return nil + } + select { + case <-ctx.Done(): + return fmt.Errorf("timeout exceeded waiting for block, err: %v", ctx.Err()) + case <-ticker.C: + } + } +} + +func (c *Client) sendTx(ctx context.Context, msg sdk.Msg, seq *uint64) error { + txf := newFactory(c.cosmosCtx) + + if seq == nil { + var accountSeq uint64 + _, accountSeq, err := c.cosmosCtx.AccountRetriever.GetAccountNumberSequence(c.cosmosCtx, c.accAddr) + if err != nil { + return fmt.Errorf("error getting account number sequence for: %v", err) + } + + seq = &accountSeq + } + + txf = txf.WithSequence(*seq) + txf, err := txf.Prepare(c.cosmosCtx) + if err != nil { + return fmt.Errorf("error preparing transaction during: %v", err) + } + + txn, err := txf.BuildUnsignedTx(msg) + if err != nil { + return fmt.Errorf("error building unsigned transaction: %v", err) + } + if err = tx.Sign(c.cosmosCtx.CmdContext, txf, c.cosmosCtx.FromName, txn, true); err != nil { + return fmt.Errorf("error when signing transaction: %v", err) + } + + txBytes, err := c.cosmosCtx.TxConfig.TxEncoder()(txn.GetTx()) + if err != nil { + return fmt.Errorf("error encoding transaction: %v", err) + } + res, err := c.cosmosCtx.BroadcastTx(txBytes) + if err := handleBroadcastResult(res, err); err != nil { + return fmt.Errorf("error broadcasting 'MsgCreateReporter' transaction after 'handleBroadcastResult': %v", err) + } + txnResult, err := c.WaitForTx(ctx, res.TxHash) + if err != nil { + return fmt.Errorf("error waiting for 'MsgCreateReporter' transaction: %v", err) + } + c.logger.Info(sdk.MsgTypeURL(msg), "TxResult", txnResult) + return nil +} diff --git a/x/oracle/abci.go b/x/oracle/abci.go index e6209c452..e9340e1d7 100644 --- a/x/oracle/abci.go +++ b/x/oracle/abci.go @@ -4,9 +4,13 @@ import ( "context" "github.com/tellor-io/layer/x/oracle/keeper" + + sdk "github.com/cosmos/cosmos-sdk/types" ) -func BeginBlocker(ctx context.Context, k keeper.Keeper) error { +func EndBlocker(ctx context.Context, k keeper.Keeper) error { + sdkctx := sdk.UnwrapSDKContext(ctx) // Rotate through the cycle list and set the current query index - return k.RotateQueries(ctx) + _ = k.RotateQueries(ctx) + return k.SetAggregatedReport(sdkctx) } diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 92467b845..578dcea8b 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -46,7 +46,7 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { if err != nil { return err } - + // there should always be at least one report otherwise how did the query set hasrevealedreports to true if reports[0].AggregateMethod == "weighted-median" { // Calculate the aggregated report. aggrFunc = k.WeightedMedian @@ -67,19 +67,17 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { return err } query.Amount = math.ZeroInt() - err = k.Query.Set(ctx, query.QueryId, query) - if err != nil { - return err - } } // Add reporters to the tbr payment list. - // incyclelist, err := k.Cyclelist.Has(ctx, queryIdBytes) - // if err != nil { - // return err - // } if reports[0].Cyclelist { reportersToPay = append(reportersToPay, report.Reporters...) } + // add paid field instead + query.HasRevealedReports = false + err = k.Query.Set(ctx, query.QueryId, query) + if err != nil { + return err + } } } diff --git a/x/oracle/keeper/cycle_list.go b/x/oracle/keeper/cycle_list.go index 0572fad7e..230c949f7 100644 --- a/x/oracle/keeper/cycle_list.go +++ b/x/oracle/keeper/cycle_list.go @@ -37,8 +37,8 @@ func (k Keeper) RotateQueries(ctx context.Context) error { max := len(q) switch { - case n == uint64(max): - return k.CyclelistSequencer.Set(ctx, 1) + case n == uint64(max-1): + return k.CyclelistSequencer.Set(ctx, 0) default: return nil } diff --git a/x/oracle/keeper/msg_server_commit_report.go b/x/oracle/keeper/msg_server_commit_report.go index 4cda5c8bb..e240c44ca 100644 --- a/x/oracle/keeper/msg_server_commit_report.go +++ b/x/oracle/keeper/msg_server_commit_report.go @@ -82,6 +82,8 @@ func (k msgServer) CommitReport(goCtx context.Context, msg *types.MsgCommitRepor return nil, err } query.Id = nextId + // reset query fields when generating next id + query.HasRevealedReports = false query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) err = k.Query.Set(ctx, queryId, query) if err != nil { diff --git a/x/oracle/module.go b/x/oracle/module.go index b7aef1002..b8f8ff36e 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -153,13 +153,12 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(ctx context.Context) error { - return BeginBlocker(sdk.UnwrapSDKContext(ctx), am.keeper) + return nil } // EndBlock contains the logic that is automatically triggered at the end of each block func (am AppModule) EndBlock(ctx context.Context) error { - sdkCtx := sdk.UnwrapSDKContext(ctx) - return am.keeper.SetAggregatedReport(sdkCtx) + return EndBlocker(ctx, am.keeper) } // ---------------------------------------------------------------------------- From 39612271516484da111ca324d0fa9ea731228e6f Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 09:04:22 -0400 Subject: [PATCH 16/31] handle zero amt in tip tx --- x/oracle/keeper/aggregate.go | 3 ++- x/oracle/keeper/msg_server_tip.go | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 578dcea8b..dfcf8dca6 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -66,13 +66,14 @@ func (k Keeper) SetAggregatedReport(ctx sdk.Context) (err error) { if err != nil { return err } + // zero out the amount in the query query.Amount = math.ZeroInt() } // Add reporters to the tbr payment list. if reports[0].Cyclelist { reportersToPay = append(reportersToPay, report.Reporters...) } - // add paid field instead + query.HasRevealedReports = false err = k.Query.Set(ctx, query.QueryId, query) if err != nil { diff --git a/x/oracle/keeper/msg_server_tip.go b/x/oracle/keeper/msg_server_tip.go index f151f1b5c..b007fe9ff 100644 --- a/x/oracle/keeper/msg_server_tip.go +++ b/x/oracle/keeper/msg_server_tip.go @@ -51,16 +51,16 @@ func (k msgServer) Tip(goCtx context.Context, msg *types.MsgTip) (*types.MsgTipR } return &types.MsgTipResponse{}, nil } - + prevAmt := query.Amount query.Amount = query.Amount.Add(tip.Amount) // expired submission window if query.Expiration.Before(ctx.BlockTime()) { - // add time + // query expired, create new expiration time and new id query.Expiration = ctx.BlockTime().Add(query.RegistrySpecTimeframe) - // if revealed reports exist means tip will be allocated - // so reset tip and generate new id - if query.HasRevealedReports { + // in aggregate you set revealed reports to false after pay out + // so if query either has reports or is paid out then new id should be generated + if query.HasRevealedReports || prevAmt.IsZero() { id, err := k.QuerySequnecer.Next(ctx) if err != nil { return nil, err From 12081e14e06bfb6c06a84fd05c9a37dfc1db1385 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 10:20:30 -0400 Subject: [PATCH 17/31] add registry hooks for when spec is updated --- app/app.go | 6 ++ proto/layer/oracle/query_meta.proto | 1 + x/oracle/keeper/hooks.go | 25 +++++ x/oracle/keeper/indexes.go | 10 +- x/oracle/keeper/keeper.go | 21 ++++ x/oracle/keeper/msg_server_submit_value.go | 6 ++ x/oracle/types/expected_keepers.go | 4 + x/oracle/types/keys.go | 1 + x/oracle/types/query_meta.pb.go | 108 +++++++++++++++------ x/registry/keeper/keeper.go | 9 ++ x/registry/keeper/msg_update_spec.go | 8 +- x/registry/types/expected_keepers.go | 4 + x/registry/types/hooks.go | 24 +++++ 13 files changed, 197 insertions(+), 30 deletions(-) create mode 100644 x/oracle/keeper/hooks.go create mode 100644 x/registry/types/hooks.go diff --git a/app/app.go b/app/app.go index 970168da0..120d7fc51 100644 --- a/app/app.go +++ b/app/app.go @@ -709,6 +709,12 @@ func New( ), ) + app.RegistryKeeper.SetHooks( + registrymoduletypes.NewMultiRegistryHooks( + app.OracleKeeper.Hooks(), + ), + ) + /**** Module Options ****/ // NOTE: Any module instantiated in the module manager that is later modified // must be passed by reference here. diff --git a/proto/layer/oracle/query_meta.proto b/proto/layer/oracle/query_meta.proto index c565351bc..b348d3231 100644 --- a/proto/layer/oracle/query_meta.proto +++ b/proto/layer/oracle/query_meta.proto @@ -28,4 +28,5 @@ message QueryMeta { ]; bool hasRevealedReports = 5; bytes query_id = 6; + string query_type = 7; } diff --git a/x/oracle/keeper/hooks.go b/x/oracle/keeper/hooks.go new file mode 100644 index 000000000..e919ec618 --- /dev/null +++ b/x/oracle/keeper/hooks.go @@ -0,0 +1,25 @@ +package keeper + +import ( + "context" + + "github.com/tellor-io/layer/x/oracle/types" + + rtypes "github.com/tellor-io/layer/x/registry/types" +) + +var _ types.RegistryHooks = Hooks{} + +// Hooks wrapper struct for oracle keeper +type Hooks struct { + k Keeper +} + +// Return the oracle hooks +func (k Keeper) Hooks() Hooks { + return Hooks{k} +} + +func (h Hooks) AfterDataSpecUpdated(ctx context.Context, querytype string, dataspec rtypes.DataSpec) error { + return h.k.UpdateQuery(ctx, querytype, dataspec.ReportBufferWindow) +} diff --git a/x/oracle/keeper/indexes.go b/x/oracle/keeper/indexes.go index 49ed22c15..fdf8ba534 100644 --- a/x/oracle/keeper/indexes.go +++ b/x/oracle/keeper/indexes.go @@ -60,10 +60,11 @@ func NewReportsIndex(sb *collections.SchemaBuilder) reportsIndex { type queryMetaIndex struct { HasReveals *indexes.Multi[bool, []byte, types.QueryMeta] + QueryType *indexes.Multi[string, []byte, types.QueryMeta] } func (a queryMetaIndex) IndexesList() []collections.Index[[]byte, types.QueryMeta] { - return []collections.Index[[]byte, types.QueryMeta]{a.HasReveals} + return []collections.Index[[]byte, types.QueryMeta]{a.HasReveals, a.QueryType} } func NewQueryIndex(sb *collections.SchemaBuilder) queryMetaIndex { @@ -75,5 +76,12 @@ func NewQueryIndex(sb *collections.SchemaBuilder) queryMetaIndex { return v.HasRevealedReports, nil }, ), + QueryType: indexes.NewMulti( + sb, types.QueryTypeIndexPrefix, "query_by_type", + collections.StringKey, collections.BytesKey, + func(_ []byte, v types.QueryMeta) (string, error) { + return v.QueryType, nil + }, + ), } } diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 56bd72aea..dda1dc657 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -6,6 +6,7 @@ import ( "time" "cosmossdk.io/collections" + "cosmossdk.io/collections/indexes" "cosmossdk.io/core/store" "cosmossdk.io/log" "cosmossdk.io/math" @@ -151,3 +152,23 @@ func (k Keeper) initializeQuery(ctx context.Context, querydata string) (types.Qu } return query, nil } + +func (k Keeper) UpdateQuery(ctx context.Context, queryType string, newTimeframe time.Duration) error { + iter, err := k.Query.Indexes.QueryType.MatchExact(ctx, queryType) + if err != nil { + return err + } + + queries, err := indexes.CollectValues(ctx, k.Query, iter) + if err != nil { + return err + } + for _, query := range queries { + query.RegistrySpecTimeframe = newTimeframe + err = k.Query.Set(ctx, query.QueryId, query) + if err != nil { + return err + } + } + return nil +} diff --git a/x/oracle/keeper/msg_server_submit_value.go b/x/oracle/keeper/msg_server_submit_value.go index c52ffdbdb..692e2852f 100644 --- a/x/oracle/keeper/msg_server_submit_value.go +++ b/x/oracle/keeper/msg_server_submit_value.go @@ -91,6 +91,12 @@ func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) if err != nil { return nil, err } + // todo: do we need to keep all the commits? also whats best do it here or aggregation? + // remove commit from store + // err = k.Keeper.Commits.Remove(ctx, collections.Join(reporterAddr.Bytes(), query.Id)) + // if err != nil { + // return nil, err + // } return &types.MsgSubmitValueResponse{}, nil } diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index daa3f8cc0..8637a47f2 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -38,3 +38,7 @@ type ReporterKeeper interface { AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error Reporter(ctx context.Context, repAddress sdk.AccAddress) (*reportertypes.OracleReporter, error) } + +type RegistryHooks interface { + AfterDataSpecUpdated(ctx context.Context, querytype string, dataspec rktypes.DataSpec) error +} diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 6a149cc23..275bca991 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -43,6 +43,7 @@ var ( NextInListPrefix = collections.NewPrefix(15) QueryRevealedIdsIndexPrefix = collections.NewPrefix(16) CyclelistPrefix = collections.NewPrefix(17) + QueryTypeIndexPrefix = collections.NewPrefix(18) ) func KeyPrefix(p string) []byte { diff --git a/x/oracle/types/query_meta.pb.go b/x/oracle/types/query_meta.pb.go index 0227f4979..ee8b75f3f 100644 --- a/x/oracle/types/query_meta.pb.go +++ b/x/oracle/types/query_meta.pb.go @@ -38,6 +38,7 @@ type QueryMeta struct { RegistrySpecTimeframe time.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3,stdduration" json:"registry_spec_timeframe"` HasRevealedReports bool `protobuf:"varint,5,opt,name=hasRevealedReports,proto3" json:"hasRevealedReports,omitempty"` QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` } func (m *QueryMeta) Reset() { *m = QueryMeta{} } @@ -108,6 +109,13 @@ func (m *QueryMeta) GetQueryId() []byte { return nil } +func (m *QueryMeta) GetQueryType() string { + if m != nil { + return m.QueryType + } + return "" +} + func init() { proto.RegisterType((*QueryMeta)(nil), "layer.oracle.QueryMeta") } @@ -115,34 +123,35 @@ func init() { func init() { proto.RegisterFile("layer/oracle/query_meta.proto", fileDescriptor_072f14e329c22246) } var fileDescriptor_072f14e329c22246 = []byte{ - // 423 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xb3, 0xa1, 0x84, 0x74, 0x29, 0x48, 0x58, 0x54, 0x38, 0x91, 0xb0, 0x2d, 0x4e, 0x06, - 0xd4, 0x5d, 0x09, 0xde, 0x20, 0xed, 0x25, 0x07, 0x0e, 0x98, 0x9e, 0xb8, 0x84, 0x8d, 0x3d, 0x75, - 0x56, 0x78, 0x3d, 0x66, 0x77, 0x8d, 0x9a, 0xb7, 0xe8, 0x91, 0x47, 0xe0, 0xc8, 0x81, 0x87, 0xe8, - 0xb1, 0x82, 0x0b, 0xe2, 0xd0, 0xa0, 0xe4, 0xc0, 0x6b, 0x20, 0x7b, 0x6d, 0x09, 0x41, 0x2f, 0x96, - 0xff, 0xfd, 0x67, 0x7e, 0x7f, 0xe3, 0x1d, 0xfa, 0xb8, 0x10, 0x6b, 0xd0, 0x1c, 0xb5, 0x48, 0x0b, - 0xe0, 0x1f, 0x6a, 0xd0, 0xeb, 0x85, 0x02, 0x2b, 0x58, 0xa5, 0xd1, 0xa2, 0x77, 0xd0, 0xda, 0xcc, - 0xd9, 0xd3, 0x07, 0x42, 0xc9, 0x12, 0x79, 0xfb, 0x74, 0x05, 0xd3, 0x49, 0x8a, 0x46, 0xa1, 0x59, - 0xb4, 0x8a, 0x3b, 0xd1, 0x59, 0x0f, 0x73, 0xcc, 0xd1, 0x9d, 0x37, 0x6f, 0xdd, 0x69, 0x90, 0x23, - 0xe6, 0x05, 0xf0, 0x56, 0x2d, 0xeb, 0x33, 0x9e, 0xd5, 0x5a, 0x58, 0x89, 0x65, 0xe7, 0x87, 0xff, - 0xfa, 0x56, 0x2a, 0x30, 0x56, 0xa8, 0xca, 0x15, 0x3c, 0xf9, 0x3e, 0xa4, 0xfb, 0xaf, 0x1b, 0xce, - 0x57, 0x60, 0x85, 0x77, 0x9f, 0x0e, 0x65, 0xe6, 0x93, 0x88, 0xc4, 0x7b, 0xc9, 0x50, 0x66, 0xde, - 0x31, 0x1d, 0x09, 0x85, 0x75, 0x69, 0xfd, 0x61, 0x44, 0xe2, 0xfd, 0xd9, 0xf3, 0xcb, 0xeb, 0x70, - 0xf0, 0xf3, 0x3a, 0x3c, 0x74, 0x68, 0x26, 0x7b, 0xcf, 0x24, 0x72, 0x25, 0xec, 0x8a, 0xcd, 0x4b, - 0xfb, 0xed, 0xeb, 0x11, 0xed, 0x98, 0xe7, 0xa5, 0x4d, 0xba, 0x56, 0xef, 0x84, 0x52, 0x38, 0xaf, - 0xa4, 0xe3, 0xf2, 0x6f, 0x45, 0x24, 0xbe, 0xfb, 0x62, 0xca, 0x1c, 0x18, 0xeb, 0xc1, 0xd8, 0x69, - 0x0f, 0x36, 0x1b, 0x37, 0x1f, 0xb9, 0xd8, 0x84, 0x24, 0xf9, 0xab, 0xcf, 0x7b, 0x47, 0x1f, 0x69, - 0xc8, 0xa5, 0xb1, 0x7a, 0xbd, 0x30, 0x15, 0xa4, 0x8b, 0x66, 0x92, 0x33, 0x2d, 0x14, 0xf8, 0x7b, - 0x6d, 0xe4, 0xe4, 0xbf, 0xc8, 0x93, 0xee, 0x5f, 0xcc, 0xee, 0x35, 0x89, 0x9f, 0x36, 0x21, 0xf9, - 0xfc, 0xfb, 0xcb, 0x33, 0x92, 0x1c, 0xf6, 0x41, 0x6f, 0x2a, 0x48, 0x4f, 0xfb, 0x18, 0x8f, 0x51, - 0x6f, 0x25, 0x4c, 0x02, 0x1f, 0x41, 0x14, 0x90, 0x25, 0x50, 0xa1, 0xb6, 0xc6, 0xbf, 0x1d, 0x91, - 0x78, 0x9c, 0xdc, 0xe0, 0x78, 0x13, 0x3a, 0x76, 0x37, 0x2c, 0x33, 0x7f, 0x14, 0x91, 0xf8, 0x20, - 0xb9, 0xd3, 0xea, 0x79, 0x36, 0x3b, 0xbe, 0xdc, 0x06, 0xe4, 0x6a, 0x1b, 0x90, 0x5f, 0xdb, 0x80, - 0x5c, 0xec, 0x82, 0xc1, 0xd5, 0x2e, 0x18, 0xfc, 0xd8, 0x05, 0x83, 0xb7, 0x4f, 0x73, 0x69, 0x57, - 0xf5, 0x92, 0xa5, 0xa8, 0xb8, 0x85, 0xa2, 0x40, 0x7d, 0x24, 0x91, 0xbb, 0xb5, 0x39, 0xef, 0x17, - 0xc7, 0xae, 0x2b, 0x30, 0xcb, 0x51, 0x3b, 0xc8, 0xcb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, - 0x07, 0x2e, 0xd1, 0x55, 0x02, 0x00, 0x00, + // 439 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xc1, 0x6e, 0xd4, 0x30, + 0x10, 0x5d, 0x2f, 0x65, 0xbb, 0x6b, 0x0a, 0x12, 0x11, 0x15, 0xd9, 0x95, 0x9a, 0x44, 0x9c, 0x02, + 0xa8, 0xb6, 0x04, 0x7f, 0xb0, 0xed, 0x65, 0x0f, 0x1c, 0x30, 0x7b, 0xe2, 0xb2, 0x78, 0x93, 0x69, + 0xd6, 0x22, 0x8e, 0x83, 0xed, 0xa0, 0xe6, 0x2f, 0x7a, 0xe4, 0x13, 0x38, 0x72, 0xe0, 0x23, 0x7a, + 0xac, 0x38, 0x21, 0x0e, 0x2d, 0xda, 0x3d, 0x70, 0xe7, 0x0b, 0x50, 0xe2, 0x44, 0x42, 0xd0, 0x8b, + 0xe5, 0x37, 0x6f, 0xe6, 0xf9, 0xcd, 0x78, 0xf0, 0x51, 0xce, 0x6b, 0xd0, 0x54, 0x69, 0x9e, 0xe4, + 0x40, 0x3f, 0x54, 0xa0, 0xeb, 0x95, 0x04, 0xcb, 0x49, 0xa9, 0x95, 0x55, 0xde, 0x41, 0x4b, 0x13, + 0x47, 0xcf, 0x1e, 0x72, 0x29, 0x0a, 0x45, 0xdb, 0xd3, 0x25, 0xcc, 0xa6, 0x89, 0x32, 0x52, 0x99, + 0x55, 0x8b, 0xa8, 0x03, 0x1d, 0xf5, 0x28, 0x53, 0x99, 0x72, 0xf1, 0xe6, 0xd6, 0x45, 0x83, 0x4c, + 0xa9, 0x2c, 0x07, 0xda, 0xa2, 0x75, 0x75, 0x46, 0xd3, 0x4a, 0x73, 0x2b, 0x54, 0xd1, 0xf1, 0xe1, + 0xbf, 0xbc, 0x15, 0x12, 0x8c, 0xe5, 0xb2, 0x74, 0x09, 0x4f, 0x7e, 0x0f, 0xf1, 0xe4, 0x75, 0xe3, + 0xf3, 0x15, 0x58, 0xee, 0x3d, 0xc0, 0x43, 0x91, 0xfa, 0x28, 0x42, 0xf1, 0x1e, 0x1b, 0x8a, 0xd4, + 0x3b, 0xc1, 0x23, 0x2e, 0x55, 0x55, 0x58, 0x7f, 0x18, 0xa1, 0x78, 0x32, 0x7f, 0x7e, 0x79, 0x1d, + 0x0e, 0x7e, 0x5c, 0x87, 0x87, 0xce, 0x9a, 0x49, 0xdf, 0x13, 0xa1, 0xa8, 0xe4, 0x76, 0x43, 0x16, + 0x85, 0xfd, 0xf6, 0xf5, 0x18, 0x77, 0x9e, 0x17, 0x85, 0x65, 0x5d, 0xa9, 0x77, 0x8a, 0x31, 0x9c, + 0x97, 0xc2, 0xf9, 0xf2, 0xef, 0x44, 0x28, 0xbe, 0xf7, 0x62, 0x46, 0x9c, 0x31, 0xd2, 0x1b, 0x23, + 0xcb, 0xde, 0xd8, 0x7c, 0xdc, 0x3c, 0x72, 0x71, 0x13, 0x22, 0xf6, 0x57, 0x9d, 0xf7, 0x0e, 0x3f, + 0xd6, 0x90, 0x09, 0x63, 0x75, 0xbd, 0x32, 0x25, 0x24, 0xab, 0xa6, 0x93, 0x33, 0xcd, 0x25, 0xf8, + 0x7b, 0xad, 0xe4, 0xf4, 0x3f, 0xc9, 0xd3, 0x6e, 0x16, 0xf3, 0xfb, 0x8d, 0xe2, 0xa7, 0x9b, 0x10, + 0x7d, 0xfe, 0xf5, 0xe5, 0x19, 0x62, 0x87, 0xbd, 0xd0, 0x9b, 0x12, 0x92, 0x65, 0x2f, 0xe3, 0x11, + 0xec, 0x6d, 0xb8, 0x61, 0xf0, 0x11, 0x78, 0x0e, 0x29, 0x83, 0x52, 0x69, 0x6b, 0xfc, 0xbb, 0x11, + 0x8a, 0xc7, 0xec, 0x16, 0xc6, 0x9b, 0xe2, 0xb1, 0xfb, 0x61, 0x91, 0xfa, 0xa3, 0x08, 0xc5, 0x07, + 0x6c, 0xbf, 0xc5, 0x8b, 0xd4, 0x3b, 0xc2, 0xd8, 0x51, 0xb6, 0x2e, 0xc1, 0xdf, 0x6f, 0x66, 0xc7, + 0x26, 0x6d, 0x64, 0x59, 0x97, 0x30, 0x3f, 0xb9, 0xdc, 0x06, 0xe8, 0x6a, 0x1b, 0xa0, 0x9f, 0xdb, + 0x00, 0x5d, 0xec, 0x82, 0xc1, 0xd5, 0x2e, 0x18, 0x7c, 0xdf, 0x05, 0x83, 0xb7, 0x4f, 0x33, 0x61, + 0x37, 0xd5, 0x9a, 0x24, 0x4a, 0x52, 0x0b, 0x79, 0xae, 0xf4, 0xb1, 0x50, 0xd4, 0x6d, 0xd5, 0x79, + 0xbf, 0x57, 0x8d, 0xa8, 0x59, 0x8f, 0xda, 0x3e, 0x5f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xed, + 0xe1, 0x4d, 0xcb, 0x74, 0x02, 0x00, 0x00, } func (m *QueryMeta) Marshal() (dAtA []byte, err error) { @@ -165,6 +174,13 @@ func (m *QueryMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.QueryType) > 0 { + i -= len(m.QueryType) + copy(dAtA[i:], m.QueryType) + i = encodeVarintQueryMeta(dAtA, i, uint64(len(m.QueryType))) + i-- + dAtA[i] = 0x3a + } if len(m.QueryId) > 0 { i -= len(m.QueryId) copy(dAtA[i:], m.QueryId) @@ -249,6 +265,10 @@ func (m *QueryMeta) Size() (n int) { if l > 0 { n += 1 + l + sovQueryMeta(uint64(l)) } + l = len(m.QueryType) + if l > 0 { + n += 1 + l + sovQueryMeta(uint64(l)) + } return n } @@ -460,6 +480,38 @@ func (m *QueryMeta) Unmarshal(dAtA []byte) error { m.QueryId = []byte{} } iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QueryType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryMeta + } + 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 ErrInvalidLengthQueryMeta + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryMeta + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QueryType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQueryMeta(dAtA[iNdEx:]) diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index 4d634c429..5b888142e 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -21,6 +21,7 @@ type ( Params collections.Item[types.Params] SpecRegistry collections.Map[string, types.DataSpec] Schema collections.Schema + hooks types.RegistryHooks authority string } @@ -61,3 +62,11 @@ func (k Keeper) GetAuthority() string { func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +func (k *Keeper) SetHooks(sh types.RegistryHooks) { + if k.hooks != nil { + panic("cannot set registry hooks twice") + } + + k.hooks = sh +} diff --git a/x/registry/keeper/msg_update_spec.go b/x/registry/keeper/msg_update_spec.go index be40402b0..68ef54604 100644 --- a/x/registry/keeper/msg_update_spec.go +++ b/x/registry/keeper/msg_update_spec.go @@ -16,8 +16,10 @@ func (k msgServer) UpdateDataSpec(goCtx context.Context, req *types.MsgUpdateDat } ctx := sdk.UnwrapSDKContext(goCtx) + // normalize query type + req.QueryType = strings.ToLower(req.QueryType) // check if the query type exists - querytypeExists, err := k.Keeper.HasSpec(ctx, strings.ToLower(req.QueryType)) + querytypeExists, err := k.Keeper.HasSpec(ctx, req.QueryType) if err != nil { return nil, err } @@ -28,5 +30,9 @@ func (k msgServer) UpdateDataSpec(goCtx context.Context, req *types.MsgUpdateDat return nil, err } + if err := k.Keeper.hooks.AfterDataSpecUpdated(ctx, req.QueryType, req.Spec); err != nil { + return nil, err + } + return &types.MsgUpdateDataSpecResponse{}, nil } diff --git a/x/registry/types/expected_keepers.go b/x/registry/types/expected_keepers.go index b052d3608..de91ae6a5 100644 --- a/x/registry/types/expected_keepers.go +++ b/x/registry/types/expected_keepers.go @@ -17,3 +17,7 @@ type BankKeeper interface { SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins // Methods imported from bank should be defined here } + +type RegistryHooks interface { + AfterDataSpecUpdated(ctx context.Context, querytype string, dataspec DataSpec) error +} diff --git a/x/registry/types/hooks.go b/x/registry/types/hooks.go new file mode 100644 index 000000000..a29b01f5b --- /dev/null +++ b/x/registry/types/hooks.go @@ -0,0 +1,24 @@ +package types + +import ( + context "context" +) + +// combine multiple registry hooks, all hook functions are run in array sequence +var _ RegistryHooks = &MultiRegistryHooks{} + +type MultiRegistryHooks []RegistryHooks + +func NewMultiRegistryHooks(hooks ...RegistryHooks) MultiRegistryHooks { + return hooks +} + +func (h MultiRegistryHooks) AfterDataSpecUpdated(ctx context.Context, querytype string, dataspec DataSpec) error { + for i := range h { + if err := h[i].AfterDataSpecUpdated(ctx, querytype, dataspec); err != nil { + return err + } + } + + return nil +} From 733cb1bc2ee4c85965f2307589d0690e14279b6b Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 13:03:59 -0400 Subject: [PATCH 18/31] fix test --- tests/integration/keeper_test.go | 5 +++++ x/registry/keeper/keeper.go | 13 +++++++++++-- x/registry/keeper/msg_update_spec.go | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index aec881bd0..956619b6b 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -180,6 +180,11 @@ func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[str suite.reporterkeeper.Hooks(), ), ) + suite.registrykeeper.SetHooks( + registrytypes.NewMultiRegistryHooks( + suite.oraclekeeper.Hooks(), + ), + ) } func (s *IntegrationTestSuite) SetupTest() { diff --git a/x/registry/keeper/keeper.go b/x/registry/keeper/keeper.go index 5b888142e..3670fc92b 100644 --- a/x/registry/keeper/keeper.go +++ b/x/registry/keeper/keeper.go @@ -63,10 +63,19 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -func (k *Keeper) SetHooks(sh types.RegistryHooks) { +func (k *Keeper) SetHooks(rh types.RegistryHooks) { if k.hooks != nil { panic("cannot set registry hooks twice") } - k.hooks = sh + k.hooks = rh +} + +func (k *Keeper) Hooks() types.RegistryHooks { + if k.hooks == nil { + // return a no-op implementation if no hooks are set + return types.MultiRegistryHooks{} + } + + return k.hooks } diff --git a/x/registry/keeper/msg_update_spec.go b/x/registry/keeper/msg_update_spec.go index 68ef54604..c9e05fe32 100644 --- a/x/registry/keeper/msg_update_spec.go +++ b/x/registry/keeper/msg_update_spec.go @@ -30,7 +30,7 @@ func (k msgServer) UpdateDataSpec(goCtx context.Context, req *types.MsgUpdateDat return nil, err } - if err := k.Keeper.hooks.AfterDataSpecUpdated(ctx, req.QueryType, req.Spec); err != nil { + if err := k.Keeper.Hooks().AfterDataSpecUpdated(ctx, req.QueryType, req.Spec); err != nil { return nil, err } From d77a84d369c53c9619163ea33a6410cb210a4caa Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 13:30:51 -0400 Subject: [PATCH 19/31] registry test --- tests/integration/registry_keeper_test.go | 55 +++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/integration/registry_keeper_test.go diff --git a/tests/integration/registry_keeper_test.go b/tests/integration/registry_keeper_test.go new file mode 100644 index 000000000..a49990f06 --- /dev/null +++ b/tests/integration/registry_keeper_test.go @@ -0,0 +1,55 @@ +package integration_test + +import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/tellor-io/layer/x/registry/types" + + "github.com/tellor-io/layer/x/registry/keeper" +) + +func (s *IntegrationTestSuite) TestRegistryKeeper() { + ms := keeper.NewMsgServerImpl(s.registrykeeper) + authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + queryType := "testQueryType" + spec := types.DataSpec{ + DocumentHash: "testHash", + ResponseValueType: "uint256", + AggregationMethod: "weighted-median", + } + + // Register spec + registerSpecInput := &types.MsgRegisterSpec{ + Registrar: "creator1", + QueryType: queryType, + Spec: spec, + } + _, err := ms.RegisterSpec(s.ctx, registerSpecInput) + s.NoError(err) + // Update spec + spec.ResponseValueType = "uint128" + updateSpecInput := &types.MsgUpdateDataSpec{ + Authority: authority, + QueryType: queryType, + Spec: spec, + } + _, err = ms.UpdateDataSpec(s.ctx, updateSpecInput) + s.NoError(err) + + // Check if spec is updated + getSpec, err := s.registrykeeper.GetSpec(s.ctx, queryType) + s.NoError(err) + s.Equal("uint128", getSpec.ResponseValueType) + + // Update spec with invalid authority + authority = "invalidAuthority" + // update spec + spec.ResponseValueType = "int256" + updateSpecInput = &types.MsgUpdateDataSpec{ + Authority: authority, + QueryType: queryType, + Spec: spec, + } + _, err = ms.UpdateDataSpec(s.ctx, updateSpecInput) + s.ErrorContains(err, "invalidAuthority") +} From 9eef7e1a99176e5fba9b89a49ada1b9641739166 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 14:58:55 -0400 Subject: [PATCH 20/31] withdraw to stake --- app/app.go | 27 +- docs/static/openapi.yml | 226 ++++---- proto/layer/reporter/tx.proto | 18 +- tests/setup.go | 1 + x/oracle/keeper/rewards.go | 7 +- x/oracle/mocks/ReporterKeeper.go | 20 +- x/oracle/types/expected_keepers.go | 3 +- x/reporter/keeper/distribution.go | 44 ++ x/reporter/keeper/keeper.go | 2 + x/reporter/keeper/msg_server_withdraw_tip.go | 46 ++ x/reporter/module/autocli.go | 6 + x/reporter/module/simulation.go | 23 + x/reporter/simulation/withdraw_tip.go | 29 + x/reporter/types/codec.go | 3 + x/reporter/types/keys.go | 3 + x/reporter/types/message_withdraw_tip.go | 24 + x/reporter/types/message_withdraw_tip_test.go | 40 ++ x/reporter/types/tx.pb.go | 494 ++++++++++++++++-- 18 files changed, 796 insertions(+), 220 deletions(-) create mode 100644 x/reporter/keeper/msg_server_withdraw_tip.go create mode 100644 x/reporter/simulation/withdraw_tip.go create mode 100644 x/reporter/types/message_withdraw_tip.go create mode 100644 x/reporter/types/message_withdraw_tip_test.go diff --git a/app/app.go b/app/app.go index 120d7fc51..5acd94383 100644 --- a/app/app.go +++ b/app/app.go @@ -163,19 +163,20 @@ var ( // module account permissions maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - icatypes.ModuleName: nil, - minttypes.TimeBasedRewards: nil, - minttypes.MintToTeam: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - oraclemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - disputemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, - reportermoduletypes.ModuleName: nil, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + icatypes.ModuleName: nil, + minttypes.TimeBasedRewards: nil, + minttypes.MintToTeam: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + oraclemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, + disputemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking}, + reportermoduletypes.ModuleName: nil, + reportermoduletypes.TipsEscrowPool: nil, // this line is used by starport scaffolding # stargate/app/maccPerms } ) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 6a5c26ce8..2ad25c389 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -3917,51 +3917,13 @@ definitions: description: |- Version defines the versioning scheme used to negotiate the IBC verison in the connection handshake. - layer.daemons.ExchangePrice: - type: object - properties: - exchange_id: - type: string - price: - type: string - format: uint64 - last_update_time: - type: string - format: date-time - title: ExchangePrice represents a specific exchange's market price - layer.daemons.MarketPriceUpdate: - type: object - properties: - market_id: - type: integer - format: int64 - exchange_prices: - type: array - items: - type: object - properties: - exchange_id: - type: string - price: - type: string - format: uint64 - last_update_time: - type: string - format: date-time - title: ExchangePrice represents a specific exchange's market price - title: MarketPriceUpdate represents an update to a single market - layer.daemons.UpdateMarketPricesResponse: - type: object - description: >- - UpdateMarketPricesResponse is a response message for updating market - prices. layer.registry.ABIComponent: type: object properties: name: type: string title: name - type: + field_type: type: string title: type nested_component: @@ -4019,18 +3981,6 @@ definitions: description: MsgRegisterSpecResponse defines the Msg/RegisterSpec response type. layer.registry.MsgUpdateDataSpecResponse: type: object - cosmos.base.v1beta1.DecCoin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. cosmos.staking.v1beta1.Commission: type: object properties: @@ -4058,6 +4008,100 @@ definitions: format: date-time description: update_time is the last time the commission rate was changed. description: Commission defines commission parameters for a given validator. + layer.reporter.MsgCreateReporterResponse: + type: object + layer.reporter.MsgDelegateReporterResponse: + type: object + description: >- + MsgDelegateReporterResponse defines the response structure for executing a + MsgDelegateReporter message. + layer.reporter.MsgUndelegateReporterResponse: + type: object + layer.reporter.MsgUnjailReporterResponse: + type: object + description: MsgUnjailReporterResponse defines the Msg/UnjailReporter response type. + layer.reporter.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + layer.reporter.MsgWithdrawDelegatorRewardResponse: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + response type. + layer.reporter.MsgWithdrawReporterCommissionResponse: + type: object + properties: + amount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + description: |- + MsgWithdrawReporterCommissionResponse defines the + Msg/WithdrawReporterCommission response type. + layer.reporter.MsgWithdrawTipResponse: + type: object + layer.reporter.Params: + type: object + properties: + min_commission_rate: + type: string + title: >- + min_commission_rate, adopted from staking module, is the minimum + commission rate a reporter can their delegators + description: Params defines the parameters for the module. + layer.reporter.TokenOrigin: + type: object + properties: + validator_address: + type: string + title: >- + validator_address is the address of the validator that tokens in + staking are delegated to + amount: + type: string + title: >- + amount is the amount of tokens to be delegated to a reporter from a + delegation in staking + title: TokenOrigin is a message to store the origin of a token + cosmos.base.v1beta1.DecCoin: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + DecCoin defines a token with a denomination and a decimal amount. + + NOTE: The amount field is an Dec which implements the custom method + signatures required by gogoproto. layer.reporter.OracleReporter: type: object properties: @@ -4105,15 +4149,6 @@ definitions: format: date-time title: jailed_until is the time the reporter is jailed until title: OracleReporter is the struct that holds the data for a reporter - layer.reporter.Params: - type: object - properties: - min_commission_rate: - type: string - title: >- - min_commission_rate, adopted from staking module, is the minimum - commission rate a reporter can their delegators - description: Params defines the parameters for the module. layer.reporter.QueryDelegationRewardsResponse: type: object properties: @@ -4384,74 +4419,3 @@ definitions: description: |- ReporterOutstandingRewards represents outstanding (un-withdrawn) rewards for a reporter inexpensive to track, allows simple sanity checks. - layer.reporter.MsgCreateReporterResponse: - type: object - layer.reporter.MsgDelegateReporterResponse: - type: object - description: >- - MsgDelegateReporterResponse defines the response structure for executing a - MsgDelegateReporter message. - layer.reporter.MsgUndelegateReporterResponse: - type: object - layer.reporter.MsgUnjailReporterResponse: - type: object - description: MsgUnjailReporterResponse defines the Msg/UnjailReporter response type. - layer.reporter.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - layer.reporter.MsgWithdrawDelegatorRewardResponse: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: |- - MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward - response type. - layer.reporter.MsgWithdrawReporterCommissionResponse: - type: object - properties: - amount: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - description: |- - MsgWithdrawReporterCommissionResponse defines the - Msg/WithdrawReporterCommission response type. - layer.reporter.TokenOrigin: - type: object - properties: - validator_address: - type: string - title: >- - validator_address is the address of the validator that tokens in - staking are delegated to - amount: - type: string - title: >- - amount is the amount of tokens to be delegated to a reporter from a - delegation in staking - title: TokenOrigin is a message to store the origin of a token diff --git a/proto/layer/reporter/tx.proto b/proto/layer/reporter/tx.proto index 34b158a22..11ae9039d 100644 --- a/proto/layer/reporter/tx.proto +++ b/proto/layer/reporter/tx.proto @@ -26,18 +26,21 @@ service Msg { // DelegateReporter defines a (reporter) operation for delegating to a reporter. rpc DelegateReporter(MsgDelegateReporter) returns (MsgDelegateReporterResponse); + // UndelegateReporter defines a (reporter) operation for undelegating from a reporter. rpc UndelegateReporter(MsgUndelegateReporter) returns (MsgUndelegateReporterResponse); // WithdrawReporterCommission defines a method to withdraw the // full commission to the reporter address. rpc WithdrawReporterCommission(MsgWithdrawReporterCommission) returns (MsgWithdrawReporterCommissionResponse); + // WithdrawDelegatorReward defines a method to withdraw rewards of delegator // from a reporter. rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse); // UnjailReporter defines a method to unjail a jailed reporter. rpc UnjailReporter(MsgUnjailReporter) returns (MsgUnjailReporterResponse); + rpc WithdrawTip(MsgWithdrawTip) returns (MsgWithdrawTipResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. @@ -94,6 +97,7 @@ message MsgDelegateReporterResponse {} message MsgUndelegateReporter { option (cosmos.msg.v1.signer) = "delegator"; string delegator = 1; + // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, // else the amount field will be the amount to undelegate from the specified token origin. repeated TokenOrigin token_origins = 2; @@ -107,7 +111,6 @@ message MsgWithdrawReporterCommission { option (cosmos.msg.v1.signer) = "reporter_address"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -125,10 +128,8 @@ message MsgWithdrawReporterCommissionResponse { // from a reporter. message MsgWithdrawDelegatorReward { option (cosmos.msg.v1.signer) = "delegator_address"; - option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string reporter_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -148,9 +149,18 @@ message MsgUnjailReporter { option (cosmos.msg.v1.signer) = "reporter_address"; option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } // MsgUnjailReporterResponse defines the Msg/UnjailReporter response type. message MsgUnjailReporterResponse {} + +// MsgWithdrawTip defines the Msg/WithdrawTip request type. +message MsgWithdrawTip { + option (cosmos.msg.v1.signer) = "delegator_address"; + string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.ValidatorAddressString"]; +} + +// MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. +message MsgWithdrawTipResponse {} diff --git a/tests/setup.go b/tests/setup.go index 59fb7e4d8..bd5d626fd 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -38,6 +38,7 @@ func AuthModule() configurator.ModuleOption { {Account: "gov", Permissions: []string{"burner"}}, {Account: "nft"}, {Account: "reporter"}, + {Account: "tips_escrow_pool"}, }, }), } diff --git a/x/oracle/keeper/rewards.go b/x/oracle/keeper/rewards.go index 3eae59038..48180acf9 100644 --- a/x/oracle/keeper/rewards.go +++ b/x/oracle/keeper/rewards.go @@ -3,7 +3,6 @@ package keeper import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" layer "github.com/tellor-io/layer/types" minttypes "github.com/tellor-io/layer/x/mint/types" "github.com/tellor-io/layer/x/oracle/types" @@ -17,7 +16,7 @@ type ReportersReportCount struct { // AllocateRewards distributes rewards to reporters based on their power and number of reports. // It calculates the reward amount for each reporter and allocates the rewards. -// Finally, it sends the allocated rewards to the appropriate module based on the source of the reward. +// Finally, it sends the allocated rewards to the apprppopriate module based on the source of the reward. func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateReporter, reward math.Int, toStake bool) error { // Initialize totalPower to keep track of the total power of all reporters. totalPower := int64(0) @@ -44,7 +43,7 @@ func (k Keeper) AllocateRewards(ctx sdk.Context, reporters []*types.AggregateRep if toStake { allocateReward = k.AllocateTip from = types.ModuleName - to = stakingtypes.BondedPoolName + to = reportertypes.TipsEscrowPool } else { allocateReward = k.AllocateTBR from = minttypes.TimeBasedRewards @@ -88,5 +87,5 @@ func (k Keeper) AllocateTBR(ctx sdk.Context, addr []byte, amount math.Int) error } func (k Keeper) AllocateTip(ctx sdk.Context, addr []byte, amount math.Int) error { - return k.reporterKeeper.AllocateRewardsToStake(ctx, addr, amount) + return k.reporterKeeper.DivvyingTips(ctx, addr, amount) } diff --git a/x/oracle/mocks/ReporterKeeper.go b/x/oracle/mocks/ReporterKeeper.go index 7b420d9f3..fdcb2f600 100644 --- a/x/oracle/mocks/ReporterKeeper.go +++ b/x/oracle/mocks/ReporterKeeper.go @@ -19,13 +19,13 @@ type ReporterKeeper struct { mock.Mock } -// AllocateRewardsToStake provides a mock function with given fields: ctx, reporterAddr, reward -func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAddr types.AccAddress, reward math.Int) error { - ret := _m.Called(ctx, reporterAddr, reward) +// AllocateTokensToReporter provides a mock function with given fields: ctx, reporterAddr, tokens +func (_m *ReporterKeeper) AllocateTokensToReporter(ctx context.Context, reporterAddr types.ValAddress, tokens types.DecCoins) error { + ret := _m.Called(ctx, reporterAddr, tokens) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { - r0 = rf(ctx, reporterAddr, reward) + if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress, types.DecCoins) error); ok { + r0 = rf(ctx, reporterAddr, tokens) } else { r0 = ret.Error(0) } @@ -33,13 +33,13 @@ func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAd return r0 } -// AllocateTokensToReporter provides a mock function with given fields: ctx, reporterAddr, tokens -func (_m *ReporterKeeper) AllocateTokensToReporter(ctx context.Context, reporterAddr types.ValAddress, tokens types.DecCoins) error { - ret := _m.Called(ctx, reporterAddr, tokens) +// DivvyingTips provides a mock function with given fields: ctx, reporterAddr, reward +func (_m *ReporterKeeper) DivvyingTips(ctx context.Context, reporterAddr types.AccAddress, reward math.Int) error { + ret := _m.Called(ctx, reporterAddr, reward) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress, types.DecCoins) error); ok { - r0 = rf(ctx, reporterAddr, tokens) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { + r0 = rf(ctx, reporterAddr, reward) } else { r0 = ret.Error(0) } diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 8637a47f2..202e743f8 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -35,8 +35,9 @@ type RegistryKeeper interface { type ReporterKeeper interface { // Methods imported from reporter should be defined here AllocateTokensToReporter(ctx context.Context, reporterAddr sdk.ValAddress, tokens sdk.DecCoins) error - AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error + // AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error Reporter(ctx context.Context, repAddress sdk.AccAddress) (*reportertypes.OracleReporter, error) + DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error } type RegistryHooks interface { diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 513fae43b..007532c9e 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -800,6 +800,7 @@ func (k Keeper) AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.Acc if err != nil { return err } + // todo: move coins to escrow instead newShares, err := k.stakingKeeper.Delegate(ctx, key, _share.TruncateInt(), stakingtypes.Bonded, val, false) // ignore dust??? if err != nil { return err @@ -882,3 +883,46 @@ func (k Keeper) RewardReporterBondToFeePayers(ctx context.Context, recipients [] } return nil } + +func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error { + reporter, err := k.Reporters.Get(ctx, reporterAddr) + if err != nil { + return err + } + // Calculate commission + commission := math.LegacyNewDecFromInt(reward).Mul(reporter.Commission.Rate) + + // Calculate net reward + netReward := math.LegacyNewDecFromInt(reward).Sub(commission) + + // Calculate each delegator's share (including the reporter as a self-delegator) + repAddr, err := sdk.AccAddressFromBech32(reporter.Reporter) + if err != nil { + return err + } + delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + if err != nil { + return err + } + defer delAddrs.Close() + for ; delAddrs.Valid(); delAddrs.Next() { + key, err := delAddrs.PrimaryKey() + if err != nil { + return err + } + del, err := k.Delegators.Get(ctx, key) + if err != nil { + return err + } + delegatorShare := netReward.Mul(math.LegacyNewDecFromInt(del.Amount)).Quo(math.LegacyNewDecFromInt(reporter.TotalTokens)) + if key.Equals(repAddr) { + delegatorShare = delegatorShare.Add(commission) + } + err = k.DelegatorTips.Set(ctx, key, delegatorShare.TruncateInt()) + if err != nil { + return err + } + } + + return nil +} diff --git a/x/reporter/keeper/keeper.go b/x/reporter/keeper/keeper.go index f841b474e..c7eb395c6 100644 --- a/x/reporter/keeper/keeper.go +++ b/x/reporter/keeper/keeper.go @@ -19,6 +19,7 @@ type ( storeService store.KVStoreService Params collections.Item[types.Params] Reporters collections.Map[sdk.AccAddress, types.OracleReporter] + DelegatorTips collections.Map[sdk.AccAddress, math.Int] Delegators *collections.IndexedMap[sdk.AccAddress, types.Delegation, ReporterDelegatorsIndex] TokenOrigin collections.Map[collections.Pair[sdk.AccAddress, sdk.ValAddress], math.Int] ReportersAccumulatedCommission collections.Map[sdk.ValAddress, types.ReporterAccumulatedCommission] @@ -73,6 +74,7 @@ func NewKeeper( logger: logger, stakingKeeper: stakingKeeper, bankKeeper: bankKeeper, + DelegatorTips: collections.NewMap(sb, types.DelegatorTipsPrefix, "delegator_tips", sdk.AccAddressKey, sdk.IntValue), } schema, err := sb.Build() if err != nil { diff --git a/x/reporter/keeper/msg_server_withdraw_tip.go b/x/reporter/keeper/msg_server_withdraw_tip.go new file mode 100644 index 000000000..448cada74 --- /dev/null +++ b/x/reporter/keeper/msg_server_withdraw_tip.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/tellor-io/layer/x/reporter/types" + + layertypes "github.com/tellor-io/layer/types" +) + +func (k msgServer) WithdrawTip(goCtx context.Context, msg *types.MsgWithdrawTip) (*types.MsgWithdrawTipResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + shares, err := k.Keeper.DelegatorTips.Get(ctx, delAddr) + if err != nil { + return nil, err + } + + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return nil, err + } + val, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return nil, err + } + _, err = k.Keeper.stakingKeeper.Delegate(ctx, delAddr, shares, stakingtypes.Unbonding, val, false) + if err != nil { + return nil, err + } + + err = k.Keeper.DelegatorTips.Remove(ctx, delAddr) + if err != nil { + return nil, err + } + + // send coins + err = k.Keeper.bankKeeper.SendCoinsFromModuleToModule(ctx, types.TipsEscrowPool, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, shares))) + if err != nil { + return nil, err + } + + return &types.MsgWithdrawTipResponse{}, nil +} diff --git a/x/reporter/module/autocli.go b/x/reporter/module/autocli.go index 16eaac3d7..4c2588bae 100644 --- a/x/reporter/module/autocli.go +++ b/x/reporter/module/autocli.go @@ -94,6 +94,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Execute the UnjailReporter RPC method", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, }, + { + RpcMethod: "WithdrawTip", + Use: "withdraw-tip [delegator-address] [validator-address]", + Short: "Send a WithdrawTip tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "delegator_address"}, {ProtoField: "validator_address"}}, + }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/reporter/module/simulation.go b/x/reporter/module/simulation.go index ffbb1cd78..4f212dad4 100644 --- a/x/reporter/module/simulation.go +++ b/x/reporter/module/simulation.go @@ -35,6 +35,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUndelegateReporter int = 100 + opWeightMsgWithdrawTip = "op_weight_msg_withdraw_tip" + // TODO: Determine the simulation weight value + defaultWeightMsgWithdrawTip int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -96,6 +100,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp reportersimulation.SimulateMsgUndelegateReporter(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgWithdrawTip int + simState.AppParams.GetOrGenerate(opWeightMsgWithdrawTip, &weightMsgWithdrawTip, nil, + func(_ *rand.Rand) { + weightMsgWithdrawTip = defaultWeightMsgWithdrawTip + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgWithdrawTip, + reportersimulation.SimulateMsgWithdrawTip(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -128,6 +143,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgWithdrawTip, + defaultWeightMsgWithdrawTip, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + reportersimulation.SimulateMsgWithdrawTip(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/reporter/simulation/withdraw_tip.go b/x/reporter/simulation/withdraw_tip.go new file mode 100644 index 000000000..143f10176 --- /dev/null +++ b/x/reporter/simulation/withdraw_tip.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/tellor-io/layer/x/reporter/keeper" + "github.com/tellor-io/layer/x/reporter/types" +) + +func SimulateMsgWithdrawTip( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgWithdrawTip{ + DelegatorAddress: simAccount.Address.String(), + } + + // TODO: Handling the WithdrawTip simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "WithdrawTip simulation not implemented"), nil, nil + } +} diff --git a/x/reporter/types/codec.go b/x/reporter/types/codec.go index 2c90b4b78..e08f4de2c 100644 --- a/x/reporter/types/codec.go +++ b/x/reporter/types/codec.go @@ -16,6 +16,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgWithdrawDelegatorReward{}, &MsgWithdrawReporterCommission{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgWithdrawTip{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/reporter/types/keys.go b/x/reporter/types/keys.go index e19912a1b..0cd1237cc 100644 --- a/x/reporter/types/keys.go +++ b/x/reporter/types/keys.go @@ -13,6 +13,8 @@ const ( MemStoreKey = "mem_reporter" Denom = "loya" + + TipsEscrowPool = "tips_escrow_pool" ) var ( @@ -28,6 +30,7 @@ var ( ReporterDisputeEventPrefix = collections.NewPrefix(19) ReporterDelegatorsIndexPrefix = collections.NewPrefix(20) TokenOriginSnapshotPrefix = collections.NewPrefix(21) + DelegatorTipsPrefix = collections.NewPrefix(22) ) func KeyPrefix(p string) []byte { diff --git a/x/reporter/types/message_withdraw_tip.go b/x/reporter/types/message_withdraw_tip.go new file mode 100644 index 000000000..71f206057 --- /dev/null +++ b/x/reporter/types/message_withdraw_tip.go @@ -0,0 +1,24 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgWithdrawTip{} + +func NewMsgWithdrawTip(validatorAddress string, delegatorAddress string) *MsgWithdrawTip { + return &MsgWithdrawTip{ + ValidatorAddress: validatorAddress, + DelegatorAddress: delegatorAddress, + } +} + +func (msg *MsgWithdrawTip) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/reporter/types/message_withdraw_tip_test.go b/x/reporter/types/message_withdraw_tip_test.go new file mode 100644 index 000000000..60b518fac --- /dev/null +++ b/x/reporter/types/message_withdraw_tip_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/tellor-io/layer/testutil/sample" +) + +func TestMsgWithdrawTip_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgWithdrawTip + err error + }{ + { + name: "invalid address", + msg: MsgWithdrawTip{ + DelegatorAddress: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgWithdrawTip{ + DelegatorAddress: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/reporter/types/tx.pb.go b/x/reporter/types/tx.pb.go index 2d1bbb12d..ae94d9f42 100644 --- a/x/reporter/types/tx.pb.go +++ b/x/reporter/types/tx.pb.go @@ -660,6 +660,94 @@ func (m *MsgUnjailReporterResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnjailReporterResponse proto.InternalMessageInfo +type MsgWithdrawTip struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +} + +func (m *MsgWithdrawTip) Reset() { *m = MsgWithdrawTip{} } +func (m *MsgWithdrawTip) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawTip) ProtoMessage() {} +func (*MsgWithdrawTip) Descriptor() ([]byte, []int) { + return fileDescriptor_67b904a7aa978eb1, []int{14} +} +func (m *MsgWithdrawTip) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawTip) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawTip.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 *MsgWithdrawTip) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawTip.Merge(m, src) +} +func (m *MsgWithdrawTip) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawTip) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawTip.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawTip proto.InternalMessageInfo + +func (m *MsgWithdrawTip) GetDelegatorAddress() string { + if m != nil { + return m.DelegatorAddress + } + return "" +} + +func (m *MsgWithdrawTip) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +type MsgWithdrawTipResponse struct { +} + +func (m *MsgWithdrawTipResponse) Reset() { *m = MsgWithdrawTipResponse{} } +func (m *MsgWithdrawTipResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawTipResponse) ProtoMessage() {} +func (*MsgWithdrawTipResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_67b904a7aa978eb1, []int{15} +} +func (m *MsgWithdrawTipResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawTipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawTipResponse.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 *MsgWithdrawTipResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawTipResponse.Merge(m, src) +} +func (m *MsgWithdrawTipResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawTipResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawTipResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawTipResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "layer.reporter.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "layer.reporter.MsgUpdateParamsResponse") @@ -675,68 +763,74 @@ func init() { proto.RegisterType((*MsgWithdrawDelegatorRewardResponse)(nil), "layer.reporter.MsgWithdrawDelegatorRewardResponse") proto.RegisterType((*MsgUnjailReporter)(nil), "layer.reporter.MsgUnjailReporter") proto.RegisterType((*MsgUnjailReporterResponse)(nil), "layer.reporter.MsgUnjailReporterResponse") + proto.RegisterType((*MsgWithdrawTip)(nil), "layer.reporter.MsgWithdrawTip") + proto.RegisterType((*MsgWithdrawTipResponse)(nil), "layer.reporter.MsgWithdrawTipResponse") } func init() { proto.RegisterFile("layer/reporter/tx.proto", fileDescriptor_67b904a7aa978eb1) } var fileDescriptor_67b904a7aa978eb1 = []byte{ - // 893 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0xcf, 0x24, 0xed, 0x8a, 0x4c, 0xdb, 0xed, 0xae, 0x69, 0x49, 0xe2, 0xb0, 0x4e, 0xd6, 0x50, - 0x11, 0xb2, 0x8a, 0xad, 0x4d, 0x55, 0x24, 0x72, 0x82, 0xa4, 0x3d, 0xf4, 0x10, 0x81, 0x0c, 0x15, - 0x88, 0x03, 0xab, 0x49, 0x3c, 0x72, 0xdc, 0xc4, 0x9e, 0xc8, 0x33, 0xdb, 0x6d, 0x6e, 0xa8, 0x1c, - 0xf8, 0x73, 0x40, 0xf0, 0x0d, 0x7a, 0x44, 0x9c, 0xf6, 0xd0, 0x0b, 0xdf, 0x60, 0x8f, 0xd5, 0x9e, - 0x10, 0x87, 0x05, 0xed, 0x4a, 0x2c, 0x1f, 0x81, 0x23, 0xb2, 0x3d, 0x9e, 0x38, 0x8e, 0xb3, 0x9b, - 0x08, 0x10, 0x97, 0x38, 0xf3, 0xde, 0xef, 0xbd, 0xf9, 0xbd, 0x9f, 0xde, 0x7b, 0x36, 0x2c, 0x8c, - 0xd0, 0x04, 0x7b, 0xba, 0x87, 0xc7, 0xc4, 0x63, 0xd8, 0xd3, 0xd9, 0x53, 0x6d, 0xec, 0x11, 0x46, - 0xa4, 0xf5, 0xc0, 0xa1, 0x45, 0x0e, 0x79, 0x13, 0x39, 0xb6, 0x4b, 0xf4, 0xe0, 0x37, 0x84, 0xc8, - 0x4a, 0x9f, 0x50, 0x87, 0x50, 0xbd, 0x87, 0x28, 0xd6, 0x9f, 0xec, 0xf6, 0x30, 0x43, 0xbb, 0x7a, - 0x9f, 0xd8, 0x2e, 0xf7, 0x17, 0xb8, 0xdf, 0xa1, 0x96, 0xfe, 0x64, 0xd7, 0x7f, 0x70, 0xc7, 0x9b, - 0xdc, 0x41, 0x19, 0x1a, 0xda, 0xae, 0x25, 0x62, 0xf9, 0x99, 0xa3, 0x4a, 0x21, 0x6a, 0x2f, 0x38, - 0xe9, 0xe1, 0x81, 0xbb, 0x6e, 0x59, 0xc4, 0x22, 0xa1, 0xdd, 0xff, 0xc7, 0xad, 0xe5, 0x44, 0x2d, - 0x63, 0xe4, 0x21, 0x27, 0x0a, 0xd9, 0x4e, 0x16, 0x4a, 0x86, 0xd8, 0xdd, 0x23, 0x9e, 0x6d, 0x45, - 0x7c, 0xd5, 0x9f, 0x01, 0xbc, 0xd9, 0xa5, 0xd6, 0xa3, 0xb1, 0x89, 0x18, 0xfe, 0x30, 0x08, 0x96, - 0xde, 0x81, 0x79, 0xb4, 0xcf, 0x06, 0xc4, 0xb3, 0xd9, 0xa4, 0x08, 0xaa, 0xa0, 0x96, 0x6f, 0x17, - 0x8f, 0x5f, 0x34, 0x6e, 0x71, 0x3a, 0xef, 0x9b, 0xa6, 0x87, 0x29, 0xfd, 0x88, 0x79, 0xb6, 0x6b, - 0x19, 0x53, 0xa8, 0xf4, 0x2e, 0x5c, 0x0b, 0xaf, 0x2f, 0x66, 0xab, 0xa0, 0x76, 0xad, 0xf9, 0x9a, - 0x36, 0xab, 0xa7, 0x16, 0xe6, 0x6f, 0xe7, 0x8f, 0x4e, 0x2a, 0x99, 0x1f, 0xcf, 0x0f, 0xeb, 0xc0, - 0xe0, 0x01, 0xad, 0xbb, 0xcf, 0xce, 0x0f, 0xeb, 0xd3, 0x54, 0xdf, 0x9e, 0x1f, 0xd6, 0xab, 0x21, - 0xf9, 0xa7, 0x53, 0xfa, 0x09, 0x9e, 0x6a, 0x09, 0x16, 0x12, 0x26, 0x03, 0xd3, 0x31, 0x71, 0x29, - 0x56, 0xbf, 0xc9, 0xc2, 0xcd, 0x2e, 0xb5, 0x3a, 0x1e, 0x46, 0x0c, 0x1b, 0x3c, 0x81, 0x24, 0xc3, - 0x57, 0xa2, 0x64, 0x61, 0x5d, 0x86, 0x38, 0x4b, 0x1d, 0xb8, 0x86, 0x1c, 0xb2, 0xef, 0xb2, 0x80, - 0x7c, 0xbe, 0xbd, 0xe3, 0x93, 0xfc, 0xf5, 0xa4, 0x72, 0x3b, 0xac, 0x9a, 0x9a, 0x43, 0xcd, 0x26, - 0xba, 0x83, 0xd8, 0x40, 0x7b, 0xe8, 0xb2, 0xe3, 0x17, 0x0d, 0xc8, 0xe5, 0x78, 0xe8, 0x32, 0x83, - 0x87, 0x4a, 0xef, 0xc1, 0x1b, 0x71, 0x8d, 0x69, 0x31, 0x57, 0xcd, 0xd5, 0xae, 0x35, 0xcb, 0x49, - 0x21, 0x3e, 0xf6, 0x41, 0x1f, 0x04, 0x18, 0xe3, 0x3a, 0x9b, 0x1e, 0xa8, 0xd4, 0x86, 0xb0, 0x4f, - 0x1c, 0xc7, 0xa6, 0xd4, 0x26, 0x6e, 0xf1, 0x4a, 0xa0, 0xa3, 0xaa, 0xf1, 0xab, 0xa2, 0x5e, 0xe1, - 0xbd, 0xa3, 0x75, 0x04, 0xd2, 0x88, 0x45, 0xb5, 0x6e, 0xf8, 0x62, 0x8a, 0xca, 0xd4, 0x32, 0x2c, - 0xcd, 0x49, 0x21, 0x84, 0xfa, 0x03, 0xc0, 0x57, 0xbb, 0xd4, 0xba, 0x8f, 0x47, 0xd8, 0x8a, 0x4b, - 0xf5, 0x3a, 0xcc, 0x9b, 0xa1, 0x8d, 0x44, 0x5a, 0x4d, 0x0d, 0x33, 0x42, 0x66, 0x17, 0x0a, 0x99, - 0xfb, 0x17, 0x85, 0xbc, 0xb2, 0xa2, 0x90, 0xad, 0xf5, 0xa0, 0xa3, 0x04, 0x65, 0x75, 0x0b, 0x96, - 0x53, 0xea, 0x14, 0x3a, 0x7c, 0x05, 0xe0, 0x6d, 0xbf, 0x99, 0x5c, 0x73, 0x35, 0x25, 0xe6, 0x88, - 0x66, 0xff, 0x29, 0xd1, 0x0a, 0xdc, 0x4a, 0x25, 0x22, 0xa8, 0x7e, 0x09, 0x02, 0xc4, 0x27, 0x36, - 0x1b, 0x98, 0x1e, 0x3a, 0x88, 0xfc, 0xd3, 0x66, 0x90, 0x3a, 0x70, 0x23, 0xba, 0x78, 0x0f, 0x85, - 0xd3, 0x7a, 0xe9, 0x1c, 0xdf, 0x8c, 0x22, 0xb8, 0xb9, 0xb5, 0xf5, 0xf5, 0xf3, 0x4a, 0xe6, 0xcf, - 0xe7, 0x95, 0x8c, 0xcf, 0x6f, 0x2e, 0x9f, 0xfa, 0x03, 0x80, 0x77, 0x2e, 0x64, 0x11, 0xf1, 0x95, - 0x06, 0xa2, 0x21, 0x40, 0xa0, 0x4d, 0x29, 0x6a, 0x67, 0x7f, 0x87, 0xc6, 0x7a, 0xd9, 0x76, 0xdb, - 0xf7, 0xfc, 0x5e, 0xf9, 0xe9, 0xb7, 0x4a, 0xcd, 0xb2, 0xd9, 0x60, 0xbf, 0xa7, 0xf5, 0x89, 0xc3, - 0x97, 0x20, 0x7f, 0x34, 0xa8, 0x39, 0xd4, 0xd9, 0x64, 0x8c, 0x69, 0x10, 0x40, 0xf9, 0x16, 0x09, - 0xf3, 0xab, 0x47, 0x00, 0xca, 0x31, 0x4e, 0xf7, 0x23, 0x4d, 0x0d, 0x7c, 0x80, 0x3c, 0x53, 0x7a, - 0x00, 0x37, 0x85, 0xcc, 0x4b, 0xeb, 0xb2, 0x21, 0x42, 0xb8, 0x3d, 0x55, 0xdd, 0xec, 0xaa, 0xea, - 0x2a, 0x71, 0x75, 0xe7, 0x69, 0xa9, 0xdf, 0x01, 0xa8, 0x2e, 0x2e, 0xe5, 0x7f, 0xd0, 0xf6, 0x20, - 0x58, 0xa8, 0x8f, 0xdc, 0xc7, 0xc8, 0x1e, 0x19, 0xd3, 0x59, 0xff, 0xef, 0x1b, 0x2d, 0x5c, 0x5f, - 0xb3, 0x17, 0x47, 0xf5, 0x37, 0xff, 0xba, 0x0a, 0x73, 0x5d, 0x6a, 0x49, 0x9f, 0xc2, 0xeb, 0x33, - 0xaf, 0xb0, 0x4a, 0x72, 0xfe, 0x12, 0x2f, 0x0a, 0xf9, 0xad, 0x4b, 0x00, 0x42, 0xe1, 0xcf, 0xe1, - 0x7a, 0xe2, 0x2d, 0xb2, 0x9d, 0x12, 0x3a, 0x0b, 0x91, 0xdf, 0xbe, 0x14, 0x22, 0xf2, 0x9b, 0x70, - 0x63, 0x6e, 0xf9, 0xbe, 0x91, 0x12, 0x9e, 0x04, 0xc9, 0x3b, 0x4b, 0x80, 0xc4, 0x2d, 0x8f, 0xa1, - 0x94, 0xb2, 0xda, 0xee, 0xa4, 0x89, 0x30, 0x07, 0x93, 0x1b, 0x4b, 0xc1, 0xc4, 0x5d, 0xcf, 0x00, - 0x94, 0x2f, 0x58, 0x4e, 0x69, 0xd9, 0x16, 0xc3, 0xe5, 0x7b, 0x2b, 0xc1, 0x05, 0x89, 0x09, 0x2c, - 0x2c, 0x5a, 0x03, 0xf5, 0x0b, 0x32, 0x26, 0xb0, 0x72, 0x73, 0x79, 0x6c, 0xbc, 0x63, 0x12, 0x63, - 0xb2, 0x9d, 0x2a, 0x60, 0x1c, 0x92, 0xda, 0x31, 0xe9, 0x3d, 0x2f, 0x5f, 0xfd, 0xc2, 0x1f, 0xcc, - 0xf6, 0x83, 0xa3, 0x53, 0x05, 0xbc, 0x3c, 0x55, 0xc0, 0xef, 0xa7, 0x0a, 0xf8, 0xfe, 0x4c, 0xc9, - 0xbc, 0x3c, 0x53, 0x32, 0xbf, 0x9c, 0x29, 0x99, 0xcf, 0x76, 0x62, 0x13, 0xce, 0xf0, 0x68, 0x44, - 0xbc, 0x86, 0x4d, 0xf4, 0xb9, 0xcf, 0xa9, 0x60, 0xd4, 0x7b, 0x6b, 0xc1, 0x77, 0xe0, 0xdd, 0xbf, - 0x03, 0x00, 0x00, 0xff, 0xff, 0x56, 0xa9, 0x6a, 0xc5, 0x15, 0x0b, 0x00, 0x00, + // 960 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x53, 0xe4, 0x44, + 0x14, 0x9e, 0x86, 0x95, 0x72, 0x1e, 0xbb, 0x2c, 0xc4, 0x5d, 0x18, 0x82, 0x64, 0x20, 0xba, 0x8a, + 0x50, 0x93, 0x14, 0x6c, 0xad, 0x55, 0xce, 0x49, 0x87, 0xdd, 0xc3, 0x1e, 0x50, 0x2b, 0x82, 0x5a, + 0x1e, 0xa4, 0x1a, 0xd2, 0x95, 0xe9, 0x65, 0x92, 0x9e, 0x4a, 0x37, 0xb0, 0xdc, 0xac, 0xf5, 0xe0, + 0x8f, 0x83, 0xa5, 0xff, 0xc1, 0x1e, 0x2d, 0x4f, 0x1c, 0xb8, 0x78, 0xf2, 0xca, 0xcd, 0x2d, 0x4e, + 0x96, 0x87, 0xd5, 0x82, 0x2a, 0xf1, 0xcf, 0xb0, 0x92, 0x74, 0x7a, 0x32, 0x99, 0xcc, 0x00, 0xe5, + 0x5a, 0x5e, 0x26, 0xd3, 0xef, 0x7d, 0xef, 0xf5, 0xf7, 0xbe, 0xbc, 0x7e, 0x1d, 0x98, 0x6a, 0xe1, + 0x03, 0x12, 0xda, 0x21, 0x69, 0xb3, 0x50, 0x90, 0xd0, 0x16, 0x8f, 0xad, 0x76, 0xc8, 0x04, 0xd3, + 0xc6, 0x62, 0x87, 0x95, 0x3a, 0xf4, 0x09, 0xec, 0xd3, 0x80, 0xd9, 0xf1, 0x6f, 0x02, 0xd1, 0x8d, + 0x6d, 0xc6, 0x7d, 0xc6, 0xed, 0x2d, 0xcc, 0x89, 0xbd, 0xb7, 0xbc, 0x45, 0x04, 0x5e, 0xb6, 0xb7, + 0x19, 0x0d, 0xa4, 0x7f, 0x4a, 0xfa, 0x7d, 0xee, 0xd9, 0x7b, 0xcb, 0xd1, 0x43, 0x3a, 0x5e, 0x97, + 0x0e, 0x2e, 0xf0, 0x0e, 0x0d, 0x3c, 0x15, 0x2b, 0xd7, 0x12, 0x35, 0x9d, 0xa0, 0x36, 0xe3, 0x95, + 0x9d, 0x2c, 0xa4, 0xeb, 0x96, 0xc7, 0x3c, 0x96, 0xd8, 0xa3, 0x7f, 0xd2, 0x3a, 0x93, 0xab, 0xa5, + 0x8d, 0x43, 0xec, 0xa7, 0x21, 0xf3, 0xf9, 0x42, 0xd9, 0x0e, 0x09, 0x36, 0x59, 0x48, 0xbd, 0x94, + 0xaf, 0xf9, 0x33, 0x82, 0x9b, 0x6b, 0xdc, 0xdb, 0x68, 0xbb, 0x58, 0x90, 0x0f, 0xe3, 0x60, 0xed, + 0x6d, 0x28, 0xe3, 0x5d, 0xd1, 0x64, 0x21, 0x15, 0x07, 0x15, 0x34, 0x87, 0x16, 0xca, 0x8d, 0xca, + 0xc9, 0x51, 0xed, 0x96, 0xa4, 0xf3, 0x9e, 0xeb, 0x86, 0x84, 0xf3, 0x8f, 0x44, 0x48, 0x03, 0xcf, + 0xe9, 0x40, 0xb5, 0x77, 0x60, 0x24, 0xd9, 0xbe, 0x32, 0x34, 0x87, 0x16, 0x46, 0x57, 0x26, 0xad, + 0x6e, 0x3d, 0xad, 0x24, 0x7f, 0xa3, 0x7c, 0xfc, 0xbc, 0x5a, 0xfa, 0xf1, 0xfc, 0x70, 0x11, 0x39, + 0x32, 0xa0, 0x7e, 0xf7, 0xc9, 0xf9, 0xe1, 0x62, 0x27, 0xd5, 0xb7, 0xe7, 0x87, 0x8b, 0x73, 0x09, + 0xf9, 0xc7, 0x1d, 0xfa, 0x39, 0x9e, 0xe6, 0x34, 0x4c, 0xe5, 0x4c, 0x0e, 0xe1, 0x6d, 0x16, 0x70, + 0x62, 0x7e, 0x33, 0x04, 0x13, 0x6b, 0xdc, 0x5b, 0x0d, 0x09, 0x16, 0xc4, 0x91, 0x09, 0x34, 0x1d, + 0x5e, 0x4e, 0x93, 0x25, 0x75, 0x39, 0x6a, 0xad, 0xad, 0xc2, 0x08, 0xf6, 0xd9, 0x6e, 0x20, 0x62, + 0xf2, 0xe5, 0xc6, 0x52, 0x44, 0xf2, 0xf7, 0xe7, 0xd5, 0xdb, 0x49, 0xd5, 0xdc, 0xdd, 0xb1, 0x28, + 0xb3, 0x7d, 0x2c, 0x9a, 0xd6, 0xc3, 0x40, 0x9c, 0x1c, 0xd5, 0x40, 0xca, 0xf1, 0x30, 0x10, 0x8e, + 0x0c, 0xd5, 0xde, 0x85, 0x1b, 0x59, 0x8d, 0x79, 0x65, 0x78, 0x6e, 0x78, 0x61, 0x74, 0x65, 0x26, + 0x2f, 0xc4, 0x7a, 0x04, 0xfa, 0x20, 0xc6, 0x38, 0xd7, 0x45, 0x67, 0xc1, 0xb5, 0x06, 0xc0, 0x36, + 0xf3, 0x7d, 0xca, 0x39, 0x65, 0x41, 0xe5, 0x5a, 0xac, 0xa3, 0x69, 0xc9, 0xad, 0xd2, 0x5e, 0x91, + 0xbd, 0x63, 0xad, 0x2a, 0xa4, 0x93, 0x89, 0xaa, 0xdf, 0x88, 0xc4, 0x54, 0x95, 0x99, 0x33, 0x30, + 0xdd, 0x23, 0x85, 0x12, 0xea, 0x2f, 0x04, 0xaf, 0xac, 0x71, 0xef, 0x3e, 0x69, 0x11, 0x2f, 0x2b, + 0xd5, 0xab, 0x50, 0x76, 0x13, 0x1b, 0x4b, 0xb5, 0xea, 0x18, 0xba, 0x84, 0x1c, 0xea, 0x2b, 0xe4, + 0xf0, 0x0b, 0x14, 0xf2, 0xda, 0x15, 0x85, 0xac, 0x8f, 0xc5, 0x1d, 0xa5, 0x28, 0x9b, 0xb3, 0x30, + 0x53, 0x50, 0xa7, 0xd2, 0xe1, 0x2b, 0x04, 0xb7, 0xa3, 0x66, 0x0a, 0xdc, 0xab, 0x29, 0xd1, 0x43, + 0x74, 0xe8, 0xdf, 0x12, 0xad, 0xc2, 0x6c, 0x21, 0x11, 0x45, 0xf5, 0x4b, 0x14, 0x23, 0x3e, 0xa1, + 0xa2, 0xe9, 0x86, 0x78, 0x3f, 0xf5, 0x77, 0x9a, 0x41, 0x5b, 0x85, 0xf1, 0x74, 0xe3, 0x4d, 0x9c, + 0x9c, 0xd6, 0x0b, 0xcf, 0xf1, 0xcd, 0x34, 0x42, 0x9a, 0xeb, 0xb3, 0x5f, 0x3f, 0xad, 0x96, 0xfe, + 0x7e, 0x5a, 0x2d, 0x45, 0xfc, 0x7a, 0xf2, 0x99, 0x3f, 0x20, 0xb8, 0x33, 0x90, 0x45, 0xca, 0x57, + 0x6b, 0xaa, 0x86, 0x40, 0xb1, 0x36, 0xd3, 0x69, 0x3b, 0x47, 0x33, 0x34, 0xd3, 0xcb, 0x34, 0x68, + 0xdc, 0x8b, 0x7a, 0xe5, 0xa7, 0x3f, 0xaa, 0x0b, 0x1e, 0x15, 0xcd, 0xdd, 0x2d, 0x6b, 0x9b, 0xf9, + 0x72, 0x08, 0xca, 0x47, 0x8d, 0xbb, 0x3b, 0xb6, 0x38, 0x68, 0x13, 0x1e, 0x07, 0x70, 0x39, 0x45, + 0x92, 0xfc, 0xe6, 0x31, 0x02, 0x3d, 0xc3, 0xe9, 0x7e, 0xaa, 0xa9, 0x43, 0xf6, 0x71, 0xe8, 0x6a, + 0x0f, 0x60, 0x42, 0xc9, 0x7c, 0x69, 0x5d, 0xc6, 0x55, 0x88, 0xb4, 0x17, 0xaa, 0x3b, 0x74, 0x55, + 0x75, 0x8d, 0xac, 0xba, 0xbd, 0xb4, 0xcc, 0xef, 0x10, 0x98, 0xfd, 0x4b, 0xf9, 0x1f, 0xb4, 0xdd, + 0x8f, 0x07, 0xea, 0x46, 0xf0, 0x08, 0xd3, 0x96, 0xd3, 0x39, 0xeb, 0xff, 0x7d, 0xa3, 0x25, 0xe3, + 0xab, 0x7b, 0x63, 0x75, 0x16, 0x7e, 0x41, 0x30, 0x96, 0x91, 0x69, 0x9d, 0xb6, 0x5f, 0xd4, 0x5b, + 0x7e, 0x1f, 0x26, 0xf6, 0x70, 0x8b, 0xba, 0x5d, 0x69, 0x92, 0xd7, 0x3c, 0x7f, 0x72, 0x54, 0x9b, + 0x95, 0x69, 0x3e, 0x4e, 0x31, 0xb9, 0x7c, 0x7b, 0x39, 0x7b, 0x7d, 0xb2, 0xcf, 0x8b, 0xae, 0xc0, + 0x64, 0x77, 0x01, 0x69, 0x6d, 0x2b, 0xbf, 0x8e, 0xc0, 0xf0, 0x1a, 0xf7, 0xb4, 0x4f, 0xe1, 0x7a, + 0xd7, 0xf5, 0x5c, 0xcd, 0xcf, 0x96, 0xdc, 0x25, 0xa8, 0xbf, 0x79, 0x01, 0x40, 0x75, 0xcf, 0xe7, + 0x30, 0x96, 0xbb, 0x21, 0xe7, 0x0b, 0x42, 0xbb, 0x21, 0xfa, 0x5b, 0x17, 0x42, 0x54, 0x7e, 0x17, + 0xc6, 0x7b, 0x2e, 0x96, 0xd7, 0x0a, 0xc2, 0xf3, 0x20, 0x7d, 0xe9, 0x12, 0x20, 0xb5, 0xcb, 0x23, + 0xd0, 0x0a, 0xc6, 0xf6, 0x9d, 0x22, 0x11, 0x7a, 0x60, 0x7a, 0xed, 0x52, 0x30, 0xb5, 0xd7, 0x13, + 0x04, 0xfa, 0x80, 0xc1, 0x5b, 0x94, 0xad, 0x3f, 0x5c, 0xbf, 0x77, 0x25, 0xb8, 0x22, 0x71, 0x00, + 0x53, 0xfd, 0x46, 0xdc, 0xe2, 0x80, 0x8c, 0x39, 0xac, 0xbe, 0x72, 0x79, 0x6c, 0xb6, 0x63, 0x72, + 0x23, 0x60, 0xbe, 0x50, 0xc0, 0x2c, 0xa4, 0xb0, 0x63, 0x8a, 0xcf, 0xb3, 0xb6, 0x01, 0xa3, 0xd9, + 0xb3, 0x6c, 0x0c, 0xa0, 0xb8, 0x4e, 0xdb, 0xfa, 0x1b, 0x83, 0xfd, 0x69, 0x5a, 0xfd, 0xa5, 0x2f, + 0xa2, 0x59, 0xd6, 0x78, 0x70, 0x7c, 0x6a, 0xa0, 0x67, 0xa7, 0x06, 0xfa, 0xf3, 0xd4, 0x40, 0xdf, + 0x9f, 0x19, 0xa5, 0x67, 0x67, 0x46, 0xe9, 0xb7, 0x33, 0xa3, 0xf4, 0xd9, 0x52, 0x66, 0x28, 0x0a, + 0xd2, 0x6a, 0xb1, 0xb0, 0x46, 0x99, 0xdd, 0xf3, 0x05, 0x1a, 0x4f, 0xc7, 0xad, 0x91, 0xf8, 0xd3, + 0xf9, 0xee, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0xf1, 0x41, 0x60, 0x48, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -768,6 +862,7 @@ type MsgClient interface { WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(ctx context.Context, in *MsgUnjailReporter, opts ...grpc.CallOption) (*MsgUnjailReporterResponse, error) + WithdrawTip(ctx context.Context, in *MsgWithdrawTip, opts ...grpc.CallOption) (*MsgWithdrawTipResponse, error) } type msgClient struct { @@ -841,6 +936,15 @@ func (c *msgClient) UnjailReporter(ctx context.Context, in *MsgUnjailReporter, o return out, nil } +func (c *msgClient) WithdrawTip(ctx context.Context, in *MsgWithdrawTip, opts ...grpc.CallOption) (*MsgWithdrawTipResponse, error) { + out := new(MsgWithdrawTipResponse) + err := c.cc.Invoke(ctx, "/layer.reporter.Msg/WithdrawTip", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module @@ -860,6 +964,7 @@ type MsgServer interface { WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) + WithdrawTip(context.Context, *MsgWithdrawTip) (*MsgWithdrawTipResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -887,6 +992,9 @@ func (*UnimplementedMsgServer) WithdrawDelegatorReward(ctx context.Context, req func (*UnimplementedMsgServer) UnjailReporter(ctx context.Context, req *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnjailReporter not implemented") } +func (*UnimplementedMsgServer) WithdrawTip(ctx context.Context, req *MsgWithdrawTip) (*MsgWithdrawTipResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawTip not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1018,6 +1126,24 @@ func _Msg_UnjailReporter_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_WithdrawTip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawTip) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawTip(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/layer.reporter.Msg/WithdrawTip", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawTip(ctx, req.(*MsgWithdrawTip)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "layer.reporter.Msg", HandlerType: (*MsgServer)(nil), @@ -1050,6 +1176,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UnjailReporter", Handler: _Msg_UnjailReporter_Handler, }, + { + MethodName: "WithdrawTip", + Handler: _Msg_WithdrawTip_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "layer/reporter/tx.proto", @@ -1552,6 +1682,66 @@ func (m *MsgUnjailReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgWithdrawTip) 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 *MsgWithdrawTip) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawTip) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawTipResponse) 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 *MsgWithdrawTipResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawTipResponse) 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 @@ -1765,6 +1955,32 @@ func (m *MsgUnjailReporterResponse) Size() (n int) { return n } +func (m *MsgWithdrawTip) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgWithdrawTipResponse) 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 } @@ -3066,6 +3282,170 @@ func (m *MsgUnjailReporterResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgWithdrawTip) 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: MsgWithdrawTip: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawTip: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = 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 *MsgWithdrawTipResponse) 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: MsgWithdrawTipResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawTipResponse: 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 From c78f2397d65481b6d3e4d494808ea0a54e1e63d1 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 15:16:27 -0400 Subject: [PATCH 21/31] fix proto gen stuff --- api/layer/oracle/commit_report.pulsar.go | 1374 +++------------------- api/layer/oracle/genesis.pulsar.go | 164 ++- api/layer/oracle/micro_report.pulsar.go | 162 +-- api/layer/oracle/params.pulsar.go | 144 +-- api/layer/oracle/query_meta.pulsar.go | 1041 ++++++++++++++++ api/layer/oracle/tx.pulsar.go | 1109 ++++++++++++++++- api/layer/oracle/tx_grpc.pb.go | 36 + api/layer/reporter/tx.pulsar.go | 1030 +++++++++++++++- api/layer/reporter/tx_grpc.pb.go | 38 + proto/buf.gen.pulsar.yaml | 4 +- proto/layer/reporter/tx.proto | 2 + x/reporter/types/codec.go | 2 - x/reporter/types/tx.pb.go | 4 + 13 files changed, 3593 insertions(+), 1517 deletions(-) create mode 100644 api/layer/oracle/query_meta.pulsar.go diff --git a/api/layer/oracle/commit_report.pulsar.go b/api/layer/oracle/commit_report.pulsar.go index 7fac68ad3..f2ef9695c 100644 --- a/api/layer/oracle/commit_report.pulsar.go +++ b/api/layer/oracle/commit_report.pulsar.go @@ -13,18 +13,20 @@ import ( ) var ( - md_Commit protoreflect.MessageDescriptor - fd_Commit_creator protoreflect.FieldDescriptor - fd_Commit_queryId protoreflect.FieldDescriptor - fd_Commit_hash protoreflect.FieldDescriptor + md_Commit protoreflect.MessageDescriptor + fd_Commit_reporter protoreflect.FieldDescriptor + fd_Commit_queryId protoreflect.FieldDescriptor + fd_Commit_hash protoreflect.FieldDescriptor + fd_Commit_incycle protoreflect.FieldDescriptor ) func init() { file_layer_oracle_commit_report_proto_init() md_Commit = File_layer_oracle_commit_report_proto.Messages().ByName("Commit") - fd_Commit_creator = md_Commit.Fields().ByName("creator") + fd_Commit_reporter = md_Commit.Fields().ByName("reporter") fd_Commit_queryId = md_Commit.Fields().ByName("queryId") fd_Commit_hash = md_Commit.Fields().ByName("hash") + fd_Commit_incycle = md_Commit.Fields().ByName("incycle") } var _ protoreflect.Message = (*fastReflection_Commit)(nil) @@ -92,9 +94,9 @@ func (x *fastReflection_Commit) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Commit) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Creator != "" { - value := protoreflect.ValueOfString(x.Creator) - if !f(fd_Commit_creator, value) { + if x.Reporter != "" { + value := protoreflect.ValueOfString(x.Reporter) + if !f(fd_Commit_reporter, value) { return } } @@ -110,6 +112,12 @@ func (x *fastReflection_Commit) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.Incycle != false { + value := protoreflect.ValueOfBool(x.Incycle) + if !f(fd_Commit_incycle, value) { + return + } + } } // Has reports whether a field is populated. @@ -125,12 +133,14 @@ func (x *fastReflection_Commit) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Commit) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.oracle.Commit.creator": - return x.Creator != "" + case "layer.oracle.Commit.reporter": + return x.Reporter != "" case "layer.oracle.Commit.queryId": return len(x.QueryId) != 0 case "layer.oracle.Commit.hash": return x.Hash != "" + case "layer.oracle.Commit.incycle": + return x.Incycle != false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Commit")) @@ -147,12 +157,14 @@ func (x *fastReflection_Commit) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Commit) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.oracle.Commit.creator": - x.Creator = "" + case "layer.oracle.Commit.reporter": + x.Reporter = "" case "layer.oracle.Commit.queryId": x.QueryId = nil case "layer.oracle.Commit.hash": x.Hash = "" + case "layer.oracle.Commit.incycle": + x.Incycle = false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Commit")) @@ -169,8 +181,8 @@ func (x *fastReflection_Commit) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Commit) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.oracle.Commit.creator": - value := x.Creator + case "layer.oracle.Commit.reporter": + value := x.Reporter return protoreflect.ValueOfString(value) case "layer.oracle.Commit.queryId": value := x.QueryId @@ -178,6 +190,9 @@ func (x *fastReflection_Commit) Get(descriptor protoreflect.FieldDescriptor) pro case "layer.oracle.Commit.hash": value := x.Hash return protoreflect.ValueOfString(value) + case "layer.oracle.Commit.incycle": + value := x.Incycle + return protoreflect.ValueOfBool(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Commit")) @@ -198,12 +213,14 @@ func (x *fastReflection_Commit) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Commit) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.oracle.Commit.creator": - x.Creator = value.Interface().(string) + case "layer.oracle.Commit.reporter": + x.Reporter = value.Interface().(string) case "layer.oracle.Commit.queryId": x.QueryId = value.Bytes() case "layer.oracle.Commit.hash": x.Hash = value.Interface().(string) + case "layer.oracle.Commit.incycle": + x.Incycle = value.Bool() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Commit")) @@ -224,12 +241,14 @@ func (x *fastReflection_Commit) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Commit) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.oracle.Commit.creator": - panic(fmt.Errorf("field creator of message layer.oracle.Commit is not mutable")) + case "layer.oracle.Commit.reporter": + panic(fmt.Errorf("field reporter of message layer.oracle.Commit is not mutable")) case "layer.oracle.Commit.queryId": panic(fmt.Errorf("field queryId of message layer.oracle.Commit is not mutable")) case "layer.oracle.Commit.hash": panic(fmt.Errorf("field hash of message layer.oracle.Commit is not mutable")) + case "layer.oracle.Commit.incycle": + panic(fmt.Errorf("field incycle of message layer.oracle.Commit is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Commit")) @@ -243,12 +262,14 @@ func (x *fastReflection_Commit) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Commit) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.oracle.Commit.creator": + case "layer.oracle.Commit.reporter": return protoreflect.ValueOfString("") case "layer.oracle.Commit.queryId": return protoreflect.ValueOfBytes(nil) case "layer.oracle.Commit.hash": return protoreflect.ValueOfString("") + case "layer.oracle.Commit.incycle": + return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.Commit")) @@ -318,7 +339,7 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Creator) + l = len(x.Reporter) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -330,6 +351,9 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.Incycle { + n += 2 + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -359,6 +383,16 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Incycle { + i-- + if x.Incycle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } if len(x.Hash) > 0 { i -= len(x.Hash) copy(dAtA[i:], x.Hash) @@ -373,10 +407,10 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x12 } - if len(x.Creator) > 0 { - i -= len(x.Creator) - copy(dAtA[i:], x.Creator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Creator))) + if len(x.Reporter) > 0 { + i -= len(x.Reporter) + copy(dAtA[i:], x.Reporter) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) i-- dAtA[i] = 0xa } @@ -431,7 +465,7 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -459,7 +493,7 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Creator = string(dAtA[iNdEx:postIndex]) + x.Reporter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -527,6 +561,26 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { } x.Hash = 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 Incycle", 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.Incycle = bool(v != 0) default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -562,1191 +616,133 @@ func (x *fastReflection_Commit) ProtoMethods() *protoiface.Methods { } } -var ( - md_CommitReport protoreflect.MessageDescriptor - fd_CommitReport_report protoreflect.FieldDescriptor - fd_CommitReport_block protoreflect.FieldDescriptor -) - -func init() { - file_layer_oracle_commit_report_proto_init() - md_CommitReport = File_layer_oracle_commit_report_proto.Messages().ByName("CommitReport") - fd_CommitReport_report = md_CommitReport.Fields().ByName("report") - fd_CommitReport_block = md_CommitReport.Fields().ByName("block") -} +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: layer/oracle/commit_report.proto -var _ protoreflect.Message = (*fastReflection_CommitReport)(nil) +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) +) -type fastReflection_CommitReport CommitReport +type Commit struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (x *CommitReport) ProtoReflect() protoreflect.Message { - return (*fastReflection_CommitReport)(x) + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + QueryId []byte `protobuf:"bytes,2,opt,name=queryId,proto3" json:"queryId,omitempty"` + Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` + Incycle bool `protobuf:"varint,4,opt,name=incycle,proto3" json:"incycle,omitempty"` } -func (x *CommitReport) slowProtoReflect() protoreflect.Message { - mi := &file_layer_oracle_commit_report_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { +func (x *Commit) Reset() { + *x = Commit{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_oracle_commit_report_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms + ms.StoreMessageInfo(mi) } - return mi.MessageOf(x) -} - -var _fastReflection_CommitReport_messageType fastReflection_CommitReport_messageType -var _ protoreflect.MessageType = fastReflection_CommitReport_messageType{} - -type fastReflection_CommitReport_messageType struct{} - -func (x fastReflection_CommitReport_messageType) Zero() protoreflect.Message { - return (*fastReflection_CommitReport)(nil) -} -func (x fastReflection_CommitReport_messageType) New() protoreflect.Message { - return new(fastReflection_CommitReport) -} -func (x fastReflection_CommitReport_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_CommitReport -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_CommitReport) Descriptor() protoreflect.MessageDescriptor { - return md_CommitReport -} - -// 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_CommitReport) Type() protoreflect.MessageType { - return _fastReflection_CommitReport_messageType } -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_CommitReport) New() protoreflect.Message { - return new(fastReflection_CommitReport) +func (x *Commit) String() string { + return protoimpl.X.MessageStringOf(x) } -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_CommitReport) Interface() protoreflect.ProtoMessage { - return (*CommitReport)(x) -} +func (*Commit) ProtoMessage() {} -// 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_CommitReport) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Report != nil { - value := protoreflect.ValueOfMessage(x.Report.ProtoReflect()) - if !f(fd_CommitReport_report, value) { - return - } - } - if x.Block != int64(0) { - value := protoreflect.ValueOfInt64(x.Block) - if !f(fd_CommitReport_block, value) { - return - } - } +// Deprecated: Use Commit.ProtoReflect.Descriptor instead. +func (*Commit) Descriptor() ([]byte, []int) { + return file_layer_oracle_commit_report_proto_rawDescGZIP(), []int{0} } -// 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_CommitReport) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.oracle.CommitReport.report": - return x.Report != nil - case "layer.oracle.CommitReport.block": - return x.Block != int64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitReport")) - } - panic(fmt.Errorf("message layer.oracle.CommitReport does not contain field %s", fd.FullName())) +func (x *Commit) GetReporter() string { + if x != nil { + return x.Reporter } + return "" } -// 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_CommitReport) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.oracle.CommitReport.report": - x.Report = nil - case "layer.oracle.CommitReport.block": - x.Block = int64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitReport")) - } - panic(fmt.Errorf("message layer.oracle.CommitReport does not contain field %s", fd.FullName())) +func (x *Commit) GetQueryId() []byte { + if x != nil { + return x.QueryId } + return nil } -// 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_CommitReport) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.oracle.CommitReport.report": - value := x.Report - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "layer.oracle.CommitReport.block": - value := x.Block - return protoreflect.ValueOfInt64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitReport")) - } - panic(fmt.Errorf("message layer.oracle.CommitReport does not contain field %s", descriptor.FullName())) +func (x *Commit) GetHash() string { + if x != nil { + return x.Hash } + return "" } -// 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_CommitReport) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.oracle.CommitReport.report": - x.Report = value.Message().Interface().(*Commit) - case "layer.oracle.CommitReport.block": - x.Block = value.Int() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitReport")) - } - panic(fmt.Errorf("message layer.oracle.CommitReport does not contain field %s", fd.FullName())) +func (x *Commit) GetIncycle() bool { + if x != nil { + return x.Incycle } + return false } -// 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_CommitReport) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.oracle.CommitReport.report": - if x.Report == nil { - x.Report = new(Commit) - } - return protoreflect.ValueOfMessage(x.Report.ProtoReflect()) - case "layer.oracle.CommitReport.block": - panic(fmt.Errorf("field block of message layer.oracle.CommitReport is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitReport")) - } - panic(fmt.Errorf("message layer.oracle.CommitReport does not contain field %s", fd.FullName())) - } -} +var File_layer_oracle_commit_report_proto protoreflect.FileDescriptor -// 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_CommitReport) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.oracle.CommitReport.report": - m := new(Commit) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "layer.oracle.CommitReport.block": - return protoreflect.ValueOfInt64(int64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitReport")) - } - panic(fmt.Errorf("message layer.oracle.CommitReport does not contain field %s", fd.FullName())) - } +var file_layer_oracle_commit_report_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x63, + 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0x1a, 0x15, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x74, + 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, + 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x69, + 0x6e, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x6e, + 0x63, 0x79, 0x63, 0x6c, 0x65, 0x42, 0x95, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x11, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, + 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } -// 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_CommitReport) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.oracle.CommitReport", d.FullName())) - } - panic("unreachable") -} +var ( + file_layer_oracle_commit_report_proto_rawDescOnce sync.Once + file_layer_oracle_commit_report_proto_rawDescData = file_layer_oracle_commit_report_proto_rawDesc +) -// 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_CommitReport) GetUnknown() protoreflect.RawFields { - return x.unknownFields +func file_layer_oracle_commit_report_proto_rawDescGZIP() []byte { + file_layer_oracle_commit_report_proto_rawDescOnce.Do(func() { + file_layer_oracle_commit_report_proto_rawDescData = protoimpl.X.CompressGZIP(file_layer_oracle_commit_report_proto_rawDescData) + }) + return file_layer_oracle_commit_report_proto_rawDescData } -// 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_CommitReport) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields +var file_layer_oracle_commit_report_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_layer_oracle_commit_report_proto_goTypes = []interface{}{ + (*Commit)(nil), // 0: layer.oracle.Commit } - -// 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_CommitReport) IsValid() bool { - return x != nil +var file_layer_oracle_commit_report_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 } -// 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_CommitReport) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*CommitReport) - 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.Report != nil { - l = options.Size(x.Report) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Block != 0 { - n += 1 + runtime.Sov(uint64(x.Block)) - } - 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().(*CommitReport) - 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.Block != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Block)) - i-- - dAtA[i] = 0x10 - } - if x.Report != nil { - encoded, err := options.Marshal(x.Report) - 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().(*CommitReport) - 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: CommitReport: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CommitReport: 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 Report", 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.Report == nil { - x.Report = &Commit{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Report); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) - } - x.Block = 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.Block |= int64(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 = (*_CommitsByHeight_1_list)(nil) - -type _CommitsByHeight_1_list struct { - list *[]*Commit -} - -func (x *_CommitsByHeight_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_CommitsByHeight_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_CommitsByHeight_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Commit) - (*x.list)[i] = concreteValue -} - -func (x *_CommitsByHeight_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Commit) - *x.list = append(*x.list, concreteValue) -} - -func (x *_CommitsByHeight_1_list) AppendMutable() protoreflect.Value { - v := new(Commit) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_CommitsByHeight_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_CommitsByHeight_1_list) NewElement() protoreflect.Value { - v := new(Commit) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_CommitsByHeight_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_CommitsByHeight protoreflect.MessageDescriptor - fd_CommitsByHeight_commits protoreflect.FieldDescriptor -) - -func init() { - file_layer_oracle_commit_report_proto_init() - md_CommitsByHeight = File_layer_oracle_commit_report_proto.Messages().ByName("CommitsByHeight") - fd_CommitsByHeight_commits = md_CommitsByHeight.Fields().ByName("commits") -} - -var _ protoreflect.Message = (*fastReflection_CommitsByHeight)(nil) - -type fastReflection_CommitsByHeight CommitsByHeight - -func (x *CommitsByHeight) ProtoReflect() protoreflect.Message { - return (*fastReflection_CommitsByHeight)(x) -} - -func (x *CommitsByHeight) slowProtoReflect() protoreflect.Message { - mi := &file_layer_oracle_commit_report_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_CommitsByHeight_messageType fastReflection_CommitsByHeight_messageType -var _ protoreflect.MessageType = fastReflection_CommitsByHeight_messageType{} - -type fastReflection_CommitsByHeight_messageType struct{} - -func (x fastReflection_CommitsByHeight_messageType) Zero() protoreflect.Message { - return (*fastReflection_CommitsByHeight)(nil) -} -func (x fastReflection_CommitsByHeight_messageType) New() protoreflect.Message { - return new(fastReflection_CommitsByHeight) -} -func (x fastReflection_CommitsByHeight_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_CommitsByHeight -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_CommitsByHeight) Descriptor() protoreflect.MessageDescriptor { - return md_CommitsByHeight -} - -// 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_CommitsByHeight) Type() protoreflect.MessageType { - return _fastReflection_CommitsByHeight_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_CommitsByHeight) New() protoreflect.Message { - return new(fastReflection_CommitsByHeight) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_CommitsByHeight) Interface() protoreflect.ProtoMessage { - return (*CommitsByHeight)(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_CommitsByHeight) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Commits) != 0 { - value := protoreflect.ValueOfList(&_CommitsByHeight_1_list{list: &x.Commits}) - if !f(fd_CommitsByHeight_commits, 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_CommitsByHeight) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.oracle.CommitsByHeight.commits": - return len(x.Commits) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitsByHeight")) - } - panic(fmt.Errorf("message layer.oracle.CommitsByHeight 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_CommitsByHeight) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.oracle.CommitsByHeight.commits": - x.Commits = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitsByHeight")) - } - panic(fmt.Errorf("message layer.oracle.CommitsByHeight 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_CommitsByHeight) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.oracle.CommitsByHeight.commits": - if len(x.Commits) == 0 { - return protoreflect.ValueOfList(&_CommitsByHeight_1_list{}) - } - listValue := &_CommitsByHeight_1_list{list: &x.Commits} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitsByHeight")) - } - panic(fmt.Errorf("message layer.oracle.CommitsByHeight 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_CommitsByHeight) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.oracle.CommitsByHeight.commits": - lv := value.List() - clv := lv.(*_CommitsByHeight_1_list) - x.Commits = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitsByHeight")) - } - panic(fmt.Errorf("message layer.oracle.CommitsByHeight 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_CommitsByHeight) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.oracle.CommitsByHeight.commits": - if x.Commits == nil { - x.Commits = []*Commit{} - } - value := &_CommitsByHeight_1_list{list: &x.Commits} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitsByHeight")) - } - panic(fmt.Errorf("message layer.oracle.CommitsByHeight 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_CommitsByHeight) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.oracle.CommitsByHeight.commits": - list := []*Commit{} - return protoreflect.ValueOfList(&_CommitsByHeight_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.CommitsByHeight")) - } - panic(fmt.Errorf("message layer.oracle.CommitsByHeight 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_CommitsByHeight) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.oracle.CommitsByHeight", 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_CommitsByHeight) 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_CommitsByHeight) 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_CommitsByHeight) 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_CommitsByHeight) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*CommitsByHeight) - 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.Commits) > 0 { - for _, e := range x.Commits { - 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().(*CommitsByHeight) - 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.Commits) > 0 { - for iNdEx := len(x.Commits) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Commits[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().(*CommitsByHeight) - 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: CommitsByHeight: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CommitsByHeight: 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 Commits", 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.Commits = append(x.Commits, &Commit{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Commits[len(x.Commits)-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: layer/oracle/commit_report.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) -) - -type Commit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - QueryId []byte `protobuf:"bytes,2,opt,name=queryId,proto3" json:"queryId,omitempty"` - Hash string `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` -} - -func (x *Commit) Reset() { - *x = Commit{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_oracle_commit_report_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Commit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Commit) ProtoMessage() {} - -// Deprecated: Use Commit.ProtoReflect.Descriptor instead. -func (*Commit) Descriptor() ([]byte, []int) { - return file_layer_oracle_commit_report_proto_rawDescGZIP(), []int{0} -} - -func (x *Commit) GetCreator() string { - if x != nil { - return x.Creator - } - return "" -} - -func (x *Commit) GetQueryId() []byte { - if x != nil { - return x.QueryId - } - return nil -} - -func (x *Commit) GetHash() string { - if x != nil { - return x.Hash - } - return "" -} - -type CommitReport struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Report *Commit `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` - Block int64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` -} - -func (x *CommitReport) Reset() { - *x = CommitReport{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_oracle_commit_report_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommitReport) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommitReport) ProtoMessage() {} - -// Deprecated: Use CommitReport.ProtoReflect.Descriptor instead. -func (*CommitReport) Descriptor() ([]byte, []int) { - return file_layer_oracle_commit_report_proto_rawDescGZIP(), []int{1} -} - -func (x *CommitReport) GetReport() *Commit { - if x != nil { - return x.Report - } - return nil -} - -func (x *CommitReport) GetBlock() int64 { - if x != nil { - return x.Block - } - return 0 -} - -type CommitsByHeight struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Commits []*Commit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"` -} - -func (x *CommitsByHeight) Reset() { - *x = CommitsByHeight{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_oracle_commit_report_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommitsByHeight) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommitsByHeight) ProtoMessage() {} - -// Deprecated: Use CommitsByHeight.ProtoReflect.Descriptor instead. -func (*CommitsByHeight) Descriptor() ([]byte, []int) { - return file_layer_oracle_commit_report_proto_rawDescGZIP(), []int{2} -} - -func (x *CommitsByHeight) GetCommits() []*Commit { - if x != nil { - return x.Commits - } - return nil -} - -var File_layer_oracle_commit_report_proto protoreflect.FileDescriptor - -var file_layer_oracle_commit_report_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x63, - 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x1a, 0x15, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x74, - 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x71, - 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x52, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, - 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x41, 0x0a, - 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x42, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, - 0x42, 0x95, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, - 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, - 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_layer_oracle_commit_report_proto_rawDescOnce sync.Once - file_layer_oracle_commit_report_proto_rawDescData = file_layer_oracle_commit_report_proto_rawDesc -) - -func file_layer_oracle_commit_report_proto_rawDescGZIP() []byte { - file_layer_oracle_commit_report_proto_rawDescOnce.Do(func() { - file_layer_oracle_commit_report_proto_rawDescData = protoimpl.X.CompressGZIP(file_layer_oracle_commit_report_proto_rawDescData) - }) - return file_layer_oracle_commit_report_proto_rawDescData -} - -var file_layer_oracle_commit_report_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_layer_oracle_commit_report_proto_goTypes = []interface{}{ - (*Commit)(nil), // 0: layer.oracle.Commit - (*CommitReport)(nil), // 1: layer.oracle.CommitReport - (*CommitsByHeight)(nil), // 2: layer.oracle.CommitsByHeight -} -var file_layer_oracle_commit_report_proto_depIdxs = []int32{ - 0, // 0: layer.oracle.CommitReport.report:type_name -> layer.oracle.Commit - 0, // 1: layer.oracle.CommitsByHeight.commits:type_name -> layer.oracle.Commit - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] 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_layer_oracle_commit_report_proto_init() } -func file_layer_oracle_commit_report_proto_init() { - if File_layer_oracle_commit_report_proto != nil { - return +func init() { file_layer_oracle_commit_report_proto_init() } +func file_layer_oracle_commit_report_proto_init() { + if File_layer_oracle_commit_report_proto != nil { + return } file_layer_oracle_tx_proto_init() if !protoimpl.UnsafeEnabled { @@ -1762,30 +758,6 @@ func file_layer_oracle_commit_report_proto_init() { return nil } } - file_layer_oracle_commit_report_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitReport); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_oracle_commit_report_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitsByHeight); 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{ @@ -1793,7 +765,7 @@ func file_layer_oracle_commit_report_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_oracle_commit_report_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 1, NumExtensions: 0, NumServices: 0, }, diff --git a/api/layer/oracle/genesis.pulsar.go b/api/layer/oracle/genesis.pulsar.go index f78d2b9f1..1d57df04f 100644 --- a/api/layer/oracle/genesis.pulsar.go +++ b/api/layer/oracle/genesis.pulsar.go @@ -13,15 +13,63 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]string +} + +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.ValueOfString((*x.list)[i]) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message GenesisState at list field Cyclelist as it is not of Message kind")) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_cyclelist protoreflect.FieldDescriptor ) func init() { file_layer_oracle_genesis_proto_init() md_GenesisState = File_layer_oracle_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_cyclelist = md_GenesisState.Fields().ByName("cyclelist") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -95,6 +143,12 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } + if len(x.Cyclelist) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Cyclelist}) + if !f(fd_GenesisState_cyclelist, value) { + return + } + } } // Has reports whether a field is populated. @@ -112,6 +166,8 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "layer.oracle.GenesisState.params": return x.Params != nil + case "layer.oracle.GenesisState.cyclelist": + return len(x.Cyclelist) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.GenesisState")) @@ -130,6 +186,8 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "layer.oracle.GenesisState.params": x.Params = nil + case "layer.oracle.GenesisState.cyclelist": + x.Cyclelist = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.GenesisState")) @@ -149,6 +207,12 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "layer.oracle.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "layer.oracle.GenesisState.cyclelist": + if len(x.Cyclelist) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.Cyclelist} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.GenesisState")) @@ -171,6 +235,10 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "layer.oracle.GenesisState.params": x.Params = value.Message().Interface().(*Params) + case "layer.oracle.GenesisState.cyclelist": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.Cyclelist = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.GenesisState")) @@ -196,6 +264,12 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "layer.oracle.GenesisState.cyclelist": + if x.Cyclelist == nil { + x.Cyclelist = []string{} + } + value := &_GenesisState_2_list{list: &x.Cyclelist} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.GenesisState")) @@ -212,6 +286,9 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "layer.oracle.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "layer.oracle.GenesisState.cyclelist": + list := []string{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.GenesisState")) @@ -285,6 +362,12 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } + if len(x.Cyclelist) > 0 { + for _, s := range x.Cyclelist { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -314,6 +397,15 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Cyclelist) > 0 { + for iNdEx := len(x.Cyclelist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Cyclelist[iNdEx]) + copy(dAtA[i:], x.Cyclelist[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Cyclelist[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } if x.Params != nil { encoded, err := options.Marshal(x.Params) if err != nil { @@ -413,6 +505,38 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { 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 Cyclelist", 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.Cyclelist = append(x.Cyclelist, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -467,7 +591,8 @@ type GenesisState struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Cyclelist []string `protobuf:"bytes,2,rep,name=cyclelist,proto3" json:"cyclelist,omitempty"` } func (x *GenesisState) Reset() { @@ -497,6 +622,13 @@ func (x *GenesisState) GetParams() *Params { return nil } +func (x *GenesisState) GetCyclelist() []string { + if x != nil { + return x.Cyclelist + } + return nil +} + var File_layer_oracle_genesis_proto protoreflect.FileDescriptor var file_layer_oracle_genesis_proto_rawDesc = []byte{ @@ -505,21 +637,23 @@ var file_layer_oracle_genesis_proto_rawDesc = []byte{ 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x42, 0x0a, 0x0c, 0x47, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x66, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x22, 0x0a, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, + 0x69, 0x73, 0x74, 0x42, 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/micro_report.pulsar.go b/api/layer/oracle/micro_report.pulsar.go index 8cf97227c..0ba5b3177 100644 --- a/api/layer/oracle/micro_report.pulsar.go +++ b/api/layer/oracle/micro_report.pulsar.go @@ -22,8 +22,8 @@ var ( fd_MicroReport_queryId protoreflect.FieldDescriptor fd_MicroReport_aggregateMethod protoreflect.FieldDescriptor fd_MicroReport_value protoreflect.FieldDescriptor - fd_MicroReport_blockNumber protoreflect.FieldDescriptor fd_MicroReport_timestamp protoreflect.FieldDescriptor + fd_MicroReport_cyclelist protoreflect.FieldDescriptor ) func init() { @@ -35,8 +35,8 @@ func init() { fd_MicroReport_queryId = md_MicroReport.Fields().ByName("queryId") fd_MicroReport_aggregateMethod = md_MicroReport.Fields().ByName("aggregateMethod") fd_MicroReport_value = md_MicroReport.Fields().ByName("value") - fd_MicroReport_blockNumber = md_MicroReport.Fields().ByName("blockNumber") fd_MicroReport_timestamp = md_MicroReport.Fields().ByName("timestamp") + fd_MicroReport_cyclelist = md_MicroReport.Fields().ByName("cyclelist") } var _ protoreflect.Message = (*fastReflection_MicroReport)(nil) @@ -140,18 +140,18 @@ func (x *fastReflection_MicroReport) Range(f func(protoreflect.FieldDescriptor, return } } - if x.BlockNumber != int64(0) { - value := protoreflect.ValueOfInt64(x.BlockNumber) - if !f(fd_MicroReport_blockNumber, value) { - return - } - } if x.Timestamp != nil { value := protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) if !f(fd_MicroReport_timestamp, value) { return } } + if x.Cyclelist != false { + value := protoreflect.ValueOfBool(x.Cyclelist) + if !f(fd_MicroReport_cyclelist, value) { + return + } + } } // Has reports whether a field is populated. @@ -179,10 +179,10 @@ func (x *fastReflection_MicroReport) Has(fd protoreflect.FieldDescriptor) bool { return x.AggregateMethod != "" case "layer.oracle.MicroReport.value": return x.Value != "" - case "layer.oracle.MicroReport.blockNumber": - return x.BlockNumber != int64(0) case "layer.oracle.MicroReport.timestamp": return x.Timestamp != nil + case "layer.oracle.MicroReport.cyclelist": + return x.Cyclelist != false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -211,10 +211,10 @@ func (x *fastReflection_MicroReport) Clear(fd protoreflect.FieldDescriptor) { x.AggregateMethod = "" case "layer.oracle.MicroReport.value": x.Value = "" - case "layer.oracle.MicroReport.blockNumber": - x.BlockNumber = int64(0) case "layer.oracle.MicroReport.timestamp": x.Timestamp = nil + case "layer.oracle.MicroReport.cyclelist": + x.Cyclelist = false default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -249,12 +249,12 @@ func (x *fastReflection_MicroReport) Get(descriptor protoreflect.FieldDescriptor case "layer.oracle.MicroReport.value": value := x.Value return protoreflect.ValueOfString(value) - case "layer.oracle.MicroReport.blockNumber": - value := x.BlockNumber - return protoreflect.ValueOfInt64(value) case "layer.oracle.MicroReport.timestamp": value := x.Timestamp return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "layer.oracle.MicroReport.cyclelist": + value := x.Cyclelist + return protoreflect.ValueOfBool(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -287,10 +287,10 @@ func (x *fastReflection_MicroReport) Set(fd protoreflect.FieldDescriptor, value x.AggregateMethod = value.Interface().(string) case "layer.oracle.MicroReport.value": x.Value = value.Interface().(string) - case "layer.oracle.MicroReport.blockNumber": - x.BlockNumber = value.Int() case "layer.oracle.MicroReport.timestamp": x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) + case "layer.oracle.MicroReport.cyclelist": + x.Cyclelist = value.Bool() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -328,8 +328,8 @@ func (x *fastReflection_MicroReport) Mutable(fd protoreflect.FieldDescriptor) pr panic(fmt.Errorf("field aggregateMethod of message layer.oracle.MicroReport is not mutable")) case "layer.oracle.MicroReport.value": panic(fmt.Errorf("field value of message layer.oracle.MicroReport is not mutable")) - case "layer.oracle.MicroReport.blockNumber": - panic(fmt.Errorf("field blockNumber of message layer.oracle.MicroReport is not mutable")) + case "layer.oracle.MicroReport.cyclelist": + panic(fmt.Errorf("field cyclelist of message layer.oracle.MicroReport is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -355,11 +355,11 @@ func (x *fastReflection_MicroReport) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfString("") case "layer.oracle.MicroReport.value": return protoreflect.ValueOfString("") - case "layer.oracle.MicroReport.blockNumber": - return protoreflect.ValueOfInt64(int64(0)) case "layer.oracle.MicroReport.timestamp": m := new(timestamppb.Timestamp) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "layer.oracle.MicroReport.cyclelist": + return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -452,13 +452,13 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.BlockNumber != 0 { - n += 1 + runtime.Sov(uint64(x.BlockNumber)) - } if x.Timestamp != nil { l = options.Size(x.Timestamp) n += 1 + l + runtime.Sov(uint64(l)) } + if x.Cyclelist { + n += 2 + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -488,6 +488,16 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.Cyclelist { + i-- + if x.Cyclelist { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } if x.Timestamp != nil { encoded, err := options.Marshal(x.Timestamp) if err != nil { @@ -500,12 +510,7 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x42 - } - if x.BlockNumber != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockNumber)) - i-- - dAtA[i] = 0x38 + dAtA[i] = 0x3a } if len(x.Value) > 0 { i -= len(x.Value) @@ -776,25 +781,6 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { x.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 7: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - x.BlockNumber = 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.BlockNumber |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) } @@ -830,6 +816,26 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 8: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Cyclelist", 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.Cyclelist = bool(v != 0) default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -889,8 +895,8 @@ type MicroReport struct { QueryId string `protobuf:"bytes,4,opt,name=queryId,proto3" json:"queryId,omitempty"` AggregateMethod string `protobuf:"bytes,5,opt,name=aggregateMethod,proto3" json:"aggregateMethod,omitempty"` Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - BlockNumber int64 `protobuf:"varint,7,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"` - Timestamp *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Cyclelist bool `protobuf:"varint,8,opt,name=cyclelist,proto3" json:"cyclelist,omitempty"` } func (x *MicroReport) Reset() { @@ -955,18 +961,18 @@ func (x *MicroReport) GetValue() string { return "" } -func (x *MicroReport) GetBlockNumber() int64 { +func (x *MicroReport) GetTimestamp() *timestamppb.Timestamp { if x != nil { - return x.BlockNumber + return x.Timestamp } - return 0 + return nil } -func (x *MicroReport) GetTimestamp() *timestamppb.Timestamp { +func (x *MicroReport) GetCyclelist() bool { if x != nil { - return x.Timestamp + return x.Cyclelist } - return nil + return false } var File_layer_oracle_micro_report_proto protoreflect.FileDescriptor @@ -975,10 +981,10 @@ var file_layer_oracle_micro_report_proto_rawDesc = []byte{ 0x0a, 0x1f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x1a, - 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 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, 0x9d, 0x02, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, + 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x02, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, @@ -990,23 +996,23 @@ var file_layer_oracle_micro_report_proto_rawDesc = []byte{ 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x94, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x10, 0x4d, 0x69, 0x63, - 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, - 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, + 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, + 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, + 0x73, 0x74, 0x42, 0x94, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x10, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, + 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, + 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, + 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/api/layer/oracle/params.pulsar.go b/api/layer/oracle/params.pulsar.go index 95441bd65..833430f0f 100644 --- a/api/layer/oracle/params.pulsar.go +++ b/api/layer/oracle/params.pulsar.go @@ -14,62 +14,14 @@ import ( sync "sync" ) -var _ protoreflect.List = (*_Params_1_list)(nil) - -type _Params_1_list struct { - list *[]string -} - -func (x *_Params_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Params_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_Params_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_Params_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_Params_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message Params at list field CycleList as it is not of Message kind")) -} - -func (x *_Params_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_Params_1_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_Params_1_list) IsValid() bool { - return x.list != nil -} - var ( md_Params protoreflect.MessageDescriptor - fd_Params_cycle_list protoreflect.FieldDescriptor fd_Params_minStakeAmount protoreflect.FieldDescriptor ) func init() { file_layer_oracle_params_proto_init() md_Params = File_layer_oracle_params_proto.Messages().ByName("Params") - fd_Params_cycle_list = md_Params.Fields().ByName("cycle_list") fd_Params_minStakeAmount = md_Params.Fields().ByName("minStakeAmount") } @@ -138,12 +90,6 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // 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 len(x.CycleList) != 0 { - value := protoreflect.ValueOfList(&_Params_1_list{list: &x.CycleList}) - if !f(fd_Params_cycle_list, value) { - return - } - } if x.MinStakeAmount != "" { value := protoreflect.ValueOfString(x.MinStakeAmount) if !f(fd_Params_minStakeAmount, value) { @@ -165,8 +111,6 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.oracle.Params.cycle_list": - return len(x.CycleList) != 0 case "layer.oracle.Params.minStakeAmount": return x.MinStakeAmount != "" default: @@ -185,8 +129,6 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.oracle.Params.cycle_list": - x.CycleList = nil case "layer.oracle.Params.minStakeAmount": x.MinStakeAmount = "" default: @@ -205,12 +147,6 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.oracle.Params.cycle_list": - if len(x.CycleList) == 0 { - return protoreflect.ValueOfList(&_Params_1_list{}) - } - listValue := &_Params_1_list{list: &x.CycleList} - return protoreflect.ValueOfList(listValue) case "layer.oracle.Params.minStakeAmount": value := x.MinStakeAmount return protoreflect.ValueOfString(value) @@ -234,10 +170,6 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // 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 "layer.oracle.Params.cycle_list": - lv := value.List() - clv := lv.(*_Params_1_list) - x.CycleList = *clv.list case "layer.oracle.Params.minStakeAmount": x.MinStakeAmount = value.Interface().(string) default: @@ -260,12 +192,6 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.oracle.Params.cycle_list": - if x.CycleList == nil { - x.CycleList = []string{} - } - value := &_Params_1_list{list: &x.CycleList} - return protoreflect.ValueOfList(value) case "layer.oracle.Params.minStakeAmount": panic(fmt.Errorf("field minStakeAmount of message layer.oracle.Params is not mutable")) default: @@ -281,9 +207,6 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // 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 "layer.oracle.Params.cycle_list": - list := []string{} - return protoreflect.ValueOfList(&_Params_1_list{list: &list}) case "layer.oracle.Params.minStakeAmount": return protoreflect.ValueOfString("") default: @@ -355,12 +278,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if len(x.CycleList) > 0 { - for _, s := range x.CycleList { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } l = len(x.MinStakeAmount) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -399,16 +316,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.MinStakeAmount) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MinStakeAmount))) i-- - dAtA[i] = 0x12 - } - if len(x.CycleList) > 0 { - for iNdEx := len(x.CycleList) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.CycleList[iNdEx]) - copy(dAtA[i:], x.CycleList[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CycleList[iNdEx]))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -460,38 +368,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CycleList", 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.CycleList = append(x.CycleList, 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 MinStakeAmount", wireType) } @@ -577,8 +453,7 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CycleList []string `protobuf:"bytes,1,rep,name=cycle_list,json=cycleList,proto3" json:"cycle_list,omitempty"` - MinStakeAmount string `protobuf:"bytes,2,opt,name=minStakeAmount,proto3" json:"minStakeAmount,omitempty"` + MinStakeAmount string `protobuf:"bytes,1,opt,name=minStakeAmount,proto3" json:"minStakeAmount,omitempty"` } func (x *Params) Reset() { @@ -601,13 +476,6 @@ func (*Params) Descriptor() ([]byte, []int) { return file_layer_oracle_params_proto_rawDescGZIP(), []int{0} } -func (x *Params) GetCycleList() []string { - if x != nil { - return x.CycleList - } - return nil -} - func (x *Params) GetMinStakeAmount() string { if x != nil { return x.MinStakeAmount @@ -623,11 +491,9 @@ var file_layer_oracle_params_proto_rawDesc = []byte{ 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x22, 0x9d, 0x01, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x5f, 0x6c, - 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, - 0x4c, 0x69, 0x73, 0x74, 0x12, 0x6e, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x46, 0xc8, 0xde, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7e, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x6e, 0x0a, 0x0e, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x46, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xf2, 0xde, 0x1f, 0x17, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, diff --git a/api/layer/oracle/query_meta.pulsar.go b/api/layer/oracle/query_meta.pulsar.go new file mode 100644 index 000000000..d73923db3 --- /dev/null +++ b/api/layer/oracle/query_meta.pulsar.go @@ -0,0 +1,1041 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package oracle + +import ( + _ "cosmossdk.io/api/amino" + 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" + durationpb "google.golang.org/protobuf/types/known/durationpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryMeta protoreflect.MessageDescriptor + fd_QueryMeta_id protoreflect.FieldDescriptor + fd_QueryMeta_amount protoreflect.FieldDescriptor + fd_QueryMeta_expiration protoreflect.FieldDescriptor + fd_QueryMeta_registry_spec_timeframe protoreflect.FieldDescriptor + fd_QueryMeta_hasRevealedReports protoreflect.FieldDescriptor + fd_QueryMeta_query_id protoreflect.FieldDescriptor + fd_QueryMeta_query_type protoreflect.FieldDescriptor +) + +func init() { + file_layer_oracle_query_meta_proto_init() + md_QueryMeta = File_layer_oracle_query_meta_proto.Messages().ByName("QueryMeta") + fd_QueryMeta_id = md_QueryMeta.Fields().ByName("id") + fd_QueryMeta_amount = md_QueryMeta.Fields().ByName("amount") + fd_QueryMeta_expiration = md_QueryMeta.Fields().ByName("expiration") + fd_QueryMeta_registry_spec_timeframe = md_QueryMeta.Fields().ByName("registry_spec_timeframe") + fd_QueryMeta_hasRevealedReports = md_QueryMeta.Fields().ByName("hasRevealedReports") + fd_QueryMeta_query_id = md_QueryMeta.Fields().ByName("query_id") + fd_QueryMeta_query_type = md_QueryMeta.Fields().ByName("query_type") +} + +var _ protoreflect.Message = (*fastReflection_QueryMeta)(nil) + +type fastReflection_QueryMeta QueryMeta + +func (x *QueryMeta) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryMeta)(x) +} + +func (x *QueryMeta) slowProtoReflect() protoreflect.Message { + mi := &file_layer_oracle_query_meta_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_QueryMeta_messageType fastReflection_QueryMeta_messageType +var _ protoreflect.MessageType = fastReflection_QueryMeta_messageType{} + +type fastReflection_QueryMeta_messageType struct{} + +func (x fastReflection_QueryMeta_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryMeta)(nil) +} +func (x fastReflection_QueryMeta_messageType) New() protoreflect.Message { + return new(fastReflection_QueryMeta) +} +func (x fastReflection_QueryMeta_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryMeta +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryMeta) Descriptor() protoreflect.MessageDescriptor { + return md_QueryMeta +} + +// 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_QueryMeta) Type() protoreflect.MessageType { + return _fastReflection_QueryMeta_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryMeta) New() protoreflect.Message { + return new(fastReflection_QueryMeta) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryMeta) Interface() protoreflect.ProtoMessage { + return (*QueryMeta)(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_QueryMeta) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Id != uint64(0) { + value := protoreflect.ValueOfUint64(x.Id) + if !f(fd_QueryMeta_id, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_QueryMeta_amount, value) { + return + } + } + if x.Expiration != nil { + value := protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) + if !f(fd_QueryMeta_expiration, value) { + return + } + } + if x.RegistrySpecTimeframe != nil { + value := protoreflect.ValueOfMessage(x.RegistrySpecTimeframe.ProtoReflect()) + if !f(fd_QueryMeta_registry_spec_timeframe, value) { + return + } + } + if x.HasRevealedReports != false { + value := protoreflect.ValueOfBool(x.HasRevealedReports) + if !f(fd_QueryMeta_hasRevealedReports, value) { + return + } + } + if len(x.QueryId) != 0 { + value := protoreflect.ValueOfBytes(x.QueryId) + if !f(fd_QueryMeta_query_id, value) { + return + } + } + if x.QueryType != "" { + value := protoreflect.ValueOfString(x.QueryType) + if !f(fd_QueryMeta_query_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_QueryMeta) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "layer.oracle.QueryMeta.id": + return x.Id != uint64(0) + case "layer.oracle.QueryMeta.amount": + return x.Amount != "" + case "layer.oracle.QueryMeta.expiration": + return x.Expiration != nil + case "layer.oracle.QueryMeta.registry_spec_timeframe": + return x.RegistrySpecTimeframe != nil + case "layer.oracle.QueryMeta.hasRevealedReports": + return x.HasRevealedReports != false + case "layer.oracle.QueryMeta.query_id": + return len(x.QueryId) != 0 + case "layer.oracle.QueryMeta.query_type": + return x.QueryType != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.QueryMeta")) + } + panic(fmt.Errorf("message layer.oracle.QueryMeta 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_QueryMeta) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "layer.oracle.QueryMeta.id": + x.Id = uint64(0) + case "layer.oracle.QueryMeta.amount": + x.Amount = "" + case "layer.oracle.QueryMeta.expiration": + x.Expiration = nil + case "layer.oracle.QueryMeta.registry_spec_timeframe": + x.RegistrySpecTimeframe = nil + case "layer.oracle.QueryMeta.hasRevealedReports": + x.HasRevealedReports = false + case "layer.oracle.QueryMeta.query_id": + x.QueryId = nil + case "layer.oracle.QueryMeta.query_type": + x.QueryType = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.QueryMeta")) + } + panic(fmt.Errorf("message layer.oracle.QueryMeta 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_QueryMeta) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "layer.oracle.QueryMeta.id": + value := x.Id + return protoreflect.ValueOfUint64(value) + case "layer.oracle.QueryMeta.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + case "layer.oracle.QueryMeta.expiration": + value := x.Expiration + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "layer.oracle.QueryMeta.registry_spec_timeframe": + value := x.RegistrySpecTimeframe + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "layer.oracle.QueryMeta.hasRevealedReports": + value := x.HasRevealedReports + return protoreflect.ValueOfBool(value) + case "layer.oracle.QueryMeta.query_id": + value := x.QueryId + return protoreflect.ValueOfBytes(value) + case "layer.oracle.QueryMeta.query_type": + value := x.QueryType + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.QueryMeta")) + } + panic(fmt.Errorf("message layer.oracle.QueryMeta 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_QueryMeta) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "layer.oracle.QueryMeta.id": + x.Id = value.Uint() + case "layer.oracle.QueryMeta.amount": + x.Amount = value.Interface().(string) + case "layer.oracle.QueryMeta.expiration": + x.Expiration = value.Message().Interface().(*timestamppb.Timestamp) + case "layer.oracle.QueryMeta.registry_spec_timeframe": + x.RegistrySpecTimeframe = value.Message().Interface().(*durationpb.Duration) + case "layer.oracle.QueryMeta.hasRevealedReports": + x.HasRevealedReports = value.Bool() + case "layer.oracle.QueryMeta.query_id": + x.QueryId = value.Bytes() + case "layer.oracle.QueryMeta.query_type": + x.QueryType = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.QueryMeta")) + } + panic(fmt.Errorf("message layer.oracle.QueryMeta 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_QueryMeta) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.oracle.QueryMeta.expiration": + if x.Expiration == nil { + x.Expiration = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.Expiration.ProtoReflect()) + case "layer.oracle.QueryMeta.registry_spec_timeframe": + if x.RegistrySpecTimeframe == nil { + x.RegistrySpecTimeframe = new(durationpb.Duration) + } + return protoreflect.ValueOfMessage(x.RegistrySpecTimeframe.ProtoReflect()) + case "layer.oracle.QueryMeta.id": + panic(fmt.Errorf("field id of message layer.oracle.QueryMeta is not mutable")) + case "layer.oracle.QueryMeta.amount": + panic(fmt.Errorf("field amount of message layer.oracle.QueryMeta is not mutable")) + case "layer.oracle.QueryMeta.hasRevealedReports": + panic(fmt.Errorf("field hasRevealedReports of message layer.oracle.QueryMeta is not mutable")) + case "layer.oracle.QueryMeta.query_id": + panic(fmt.Errorf("field query_id of message layer.oracle.QueryMeta is not mutable")) + case "layer.oracle.QueryMeta.query_type": + panic(fmt.Errorf("field query_type of message layer.oracle.QueryMeta is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.QueryMeta")) + } + panic(fmt.Errorf("message layer.oracle.QueryMeta 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_QueryMeta) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.oracle.QueryMeta.id": + return protoreflect.ValueOfUint64(uint64(0)) + case "layer.oracle.QueryMeta.amount": + return protoreflect.ValueOfString("") + case "layer.oracle.QueryMeta.expiration": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "layer.oracle.QueryMeta.registry_spec_timeframe": + m := new(durationpb.Duration) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "layer.oracle.QueryMeta.hasRevealedReports": + return protoreflect.ValueOfBool(false) + case "layer.oracle.QueryMeta.query_id": + return protoreflect.ValueOfBytes(nil) + case "layer.oracle.QueryMeta.query_type": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.QueryMeta")) + } + panic(fmt.Errorf("message layer.oracle.QueryMeta 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_QueryMeta) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.oracle.QueryMeta", 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_QueryMeta) 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_QueryMeta) 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_QueryMeta) 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_QueryMeta) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryMeta) + 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.Id != 0 { + n += 1 + runtime.Sov(uint64(x.Id)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Expiration != nil { + l = options.Size(x.Expiration) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.RegistrySpecTimeframe != nil { + l = options.Size(x.RegistrySpecTimeframe) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.HasRevealedReports { + n += 2 + } + l = len(x.QueryId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.QueryType) + 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().(*QueryMeta) + 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.QueryType) > 0 { + i -= len(x.QueryType) + copy(dAtA[i:], x.QueryType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryType))) + i-- + dAtA[i] = 0x3a + } + if len(x.QueryId) > 0 { + i -= len(x.QueryId) + copy(dAtA[i:], x.QueryId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryId))) + i-- + dAtA[i] = 0x32 + } + if x.HasRevealedReports { + i-- + if x.HasRevealedReports { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if x.RegistrySpecTimeframe != nil { + encoded, err := options.Marshal(x.RegistrySpecTimeframe) + 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 x.Expiration != nil { + encoded, err := options.Marshal(x.Expiration) + 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.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 x.Id != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Id)) + 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().(*QueryMeta) + 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: QueryMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryMeta: 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 Id", wireType) + } + x.Id = 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.Id |= 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 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 + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Expiration", 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.Expiration == nil { + x.Expiration = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Expiration); 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 RegistrySpecTimeframe", 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.RegistrySpecTimeframe == nil { + x.RegistrySpecTimeframe = &durationpb.Duration{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.RegistrySpecTimeframe); 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 HasRevealedReports", 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.HasRevealedReports = bool(v != 0) + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryId", 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.QueryId = append(x.QueryId[:0], dAtA[iNdEx:postIndex]...) + if x.QueryId == nil { + x.QueryId = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryType", 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.QueryType = 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: layer/oracle/query_meta.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) +) + +type QueryMeta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + Expiration *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expiration,proto3" json:"expiration,omitempty"` + RegistrySpecTimeframe *durationpb.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3" json:"registry_spec_timeframe,omitempty"` + HasRevealedReports bool `protobuf:"varint,5,opt,name=hasRevealedReports,proto3" json:"hasRevealedReports,omitempty"` + QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` +} + +func (x *QueryMeta) Reset() { + *x = QueryMeta{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_oracle_query_meta_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryMeta) ProtoMessage() {} + +// Deprecated: Use QueryMeta.ProtoReflect.Descriptor instead. +func (*QueryMeta) Descriptor() ([]byte, []int) { + return file_layer_oracle_query_meta_proto_rawDescGZIP(), []int{0} +} + +func (x *QueryMeta) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *QueryMeta) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +func (x *QueryMeta) GetExpiration() *timestamppb.Timestamp { + if x != nil { + return x.Expiration + } + return nil +} + +func (x *QueryMeta) GetRegistrySpecTimeframe() *durationpb.Duration { + if x != nil { + return x.RegistrySpecTimeframe + } + return nil +} + +func (x *QueryMeta) GetHasRevealedReports() bool { + if x != nil { + return x.HasRevealedReports + } + return false +} + +func (x *QueryMeta) GetQueryId() []byte { + if x != nil { + return x.QueryId + } + return nil +} + +func (x *QueryMeta) GetQueryType() string { + if x != nil { + return x.QueryType + } + return "" +} + +var File_layer_oracle_query_meta_proto protoreflect.FileDescriptor + +var file_layer_oracle_query_meta_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 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, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xf2, 0x02, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, + 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x60, 0x0a, 0x17, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, + 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x15, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x53, 0x70, 0x65, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, + 0x12, 0x68, 0x61, 0x73, 0x52, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x68, 0x61, 0x73, 0x52, 0x65, + 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x19, 0x0a, + 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x92, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, + 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_layer_oracle_query_meta_proto_rawDescOnce sync.Once + file_layer_oracle_query_meta_proto_rawDescData = file_layer_oracle_query_meta_proto_rawDesc +) + +func file_layer_oracle_query_meta_proto_rawDescGZIP() []byte { + file_layer_oracle_query_meta_proto_rawDescOnce.Do(func() { + file_layer_oracle_query_meta_proto_rawDescData = protoimpl.X.CompressGZIP(file_layer_oracle_query_meta_proto_rawDescData) + }) + return file_layer_oracle_query_meta_proto_rawDescData +} + +var file_layer_oracle_query_meta_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_layer_oracle_query_meta_proto_goTypes = []interface{}{ + (*QueryMeta)(nil), // 0: layer.oracle.QueryMeta + (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 2: google.protobuf.Duration +} +var file_layer_oracle_query_meta_proto_depIdxs = []int32{ + 1, // 0: layer.oracle.QueryMeta.expiration:type_name -> google.protobuf.Timestamp + 2, // 1: layer.oracle.QueryMeta.registry_spec_timeframe:type_name -> google.protobuf.Duration + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] 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_layer_oracle_query_meta_proto_init() } +func file_layer_oracle_query_meta_proto_init() { + if File_layer_oracle_query_meta_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_layer_oracle_query_meta_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryMeta); 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_layer_oracle_query_meta_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_layer_oracle_query_meta_proto_goTypes, + DependencyIndexes: file_layer_oracle_query_meta_proto_depIdxs, + MessageInfos: file_layer_oracle_query_meta_proto_msgTypes, + }.Build() + File_layer_oracle_query_meta_proto = out.File + file_layer_oracle_query_meta_proto_rawDesc = nil + file_layer_oracle_query_meta_proto_goTypes = nil + file_layer_oracle_query_meta_proto_depIdxs = nil +} diff --git a/api/layer/oracle/tx.pulsar.go b/api/layer/oracle/tx.pulsar.go index baab03646..749a70dc3 100644 --- a/api/layer/oracle/tx.pulsar.go +++ b/api/layer/oracle/tx.pulsar.go @@ -3663,6 +3663,906 @@ func (x *fastReflection_MsgTipResponse) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.List = (*_MsgUpdateCyclelist_2_list)(nil) + +type _MsgUpdateCyclelist_2_list struct { + list *[]string +} + +func (x *_MsgUpdateCyclelist_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgUpdateCyclelist_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_MsgUpdateCyclelist_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgUpdateCyclelist_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgUpdateCyclelist_2_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgUpdateCyclelist at list field Cyclelist as it is not of Message kind")) +} + +func (x *_MsgUpdateCyclelist_2_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgUpdateCyclelist_2_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_MsgUpdateCyclelist_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgUpdateCyclelist protoreflect.MessageDescriptor + fd_MsgUpdateCyclelist_authority protoreflect.FieldDescriptor + fd_MsgUpdateCyclelist_cyclelist protoreflect.FieldDescriptor +) + +func init() { + file_layer_oracle_tx_proto_init() + md_MsgUpdateCyclelist = File_layer_oracle_tx_proto.Messages().ByName("MsgUpdateCyclelist") + fd_MsgUpdateCyclelist_authority = md_MsgUpdateCyclelist.Fields().ByName("authority") + fd_MsgUpdateCyclelist_cyclelist = md_MsgUpdateCyclelist.Fields().ByName("cyclelist") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateCyclelist)(nil) + +type fastReflection_MsgUpdateCyclelist MsgUpdateCyclelist + +func (x *MsgUpdateCyclelist) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateCyclelist)(x) +} + +func (x *MsgUpdateCyclelist) slowProtoReflect() protoreflect.Message { + mi := &file_layer_oracle_tx_proto_msgTypes[8] + 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_MsgUpdateCyclelist_messageType fastReflection_MsgUpdateCyclelist_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateCyclelist_messageType{} + +type fastReflection_MsgUpdateCyclelist_messageType struct{} + +func (x fastReflection_MsgUpdateCyclelist_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateCyclelist)(nil) +} +func (x fastReflection_MsgUpdateCyclelist_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateCyclelist) +} +func (x fastReflection_MsgUpdateCyclelist_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateCyclelist +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateCyclelist) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateCyclelist +} + +// 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_MsgUpdateCyclelist) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateCyclelist_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateCyclelist) New() protoreflect.Message { + return new(fastReflection_MsgUpdateCyclelist) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateCyclelist) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateCyclelist)(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_MsgUpdateCyclelist) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateCyclelist_authority, value) { + return + } + } + if len(x.Cyclelist) != 0 { + value := protoreflect.ValueOfList(&_MsgUpdateCyclelist_2_list{list: &x.Cyclelist}) + if !f(fd_MsgUpdateCyclelist_cyclelist, 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_MsgUpdateCyclelist) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "layer.oracle.MsgUpdateCyclelist.authority": + return x.Authority != "" + case "layer.oracle.MsgUpdateCyclelist.cyclelist": + return len(x.Cyclelist) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelist")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelist 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_MsgUpdateCyclelist) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "layer.oracle.MsgUpdateCyclelist.authority": + x.Authority = "" + case "layer.oracle.MsgUpdateCyclelist.cyclelist": + x.Cyclelist = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelist")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelist 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_MsgUpdateCyclelist) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "layer.oracle.MsgUpdateCyclelist.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "layer.oracle.MsgUpdateCyclelist.cyclelist": + if len(x.Cyclelist) == 0 { + return protoreflect.ValueOfList(&_MsgUpdateCyclelist_2_list{}) + } + listValue := &_MsgUpdateCyclelist_2_list{list: &x.Cyclelist} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelist")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelist 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_MsgUpdateCyclelist) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "layer.oracle.MsgUpdateCyclelist.authority": + x.Authority = value.Interface().(string) + case "layer.oracle.MsgUpdateCyclelist.cyclelist": + lv := value.List() + clv := lv.(*_MsgUpdateCyclelist_2_list) + x.Cyclelist = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelist")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelist 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_MsgUpdateCyclelist) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.oracle.MsgUpdateCyclelist.cyclelist": + if x.Cyclelist == nil { + x.Cyclelist = []string{} + } + value := &_MsgUpdateCyclelist_2_list{list: &x.Cyclelist} + return protoreflect.ValueOfList(value) + case "layer.oracle.MsgUpdateCyclelist.authority": + panic(fmt.Errorf("field authority of message layer.oracle.MsgUpdateCyclelist is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelist")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelist 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_MsgUpdateCyclelist) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.oracle.MsgUpdateCyclelist.authority": + return protoreflect.ValueOfString("") + case "layer.oracle.MsgUpdateCyclelist.cyclelist": + list := []string{} + return protoreflect.ValueOfList(&_MsgUpdateCyclelist_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelist")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelist 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_MsgUpdateCyclelist) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.oracle.MsgUpdateCyclelist", 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_MsgUpdateCyclelist) 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_MsgUpdateCyclelist) 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_MsgUpdateCyclelist) 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_MsgUpdateCyclelist) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateCyclelist) + 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 len(x.Cyclelist) > 0 { + for _, s := range x.Cyclelist { + l = len(s) + 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().(*MsgUpdateCyclelist) + 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.Cyclelist) > 0 { + for iNdEx := len(x.Cyclelist) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Cyclelist[iNdEx]) + copy(dAtA[i:], x.Cyclelist[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Cyclelist[iNdEx]))) + 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().(*MsgUpdateCyclelist) + 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: MsgUpdateCyclelist: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateCyclelist: 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 Cyclelist", 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.Cyclelist = append(x.Cyclelist, 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_MsgUpdateCyclelistResponse protoreflect.MessageDescriptor +) + +func init() { + file_layer_oracle_tx_proto_init() + md_MsgUpdateCyclelistResponse = File_layer_oracle_tx_proto.Messages().ByName("MsgUpdateCyclelistResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateCyclelistResponse)(nil) + +type fastReflection_MsgUpdateCyclelistResponse MsgUpdateCyclelistResponse + +func (x *MsgUpdateCyclelistResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateCyclelistResponse)(x) +} + +func (x *MsgUpdateCyclelistResponse) slowProtoReflect() protoreflect.Message { + mi := &file_layer_oracle_tx_proto_msgTypes[9] + 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_MsgUpdateCyclelistResponse_messageType fastReflection_MsgUpdateCyclelistResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateCyclelistResponse_messageType{} + +type fastReflection_MsgUpdateCyclelistResponse_messageType struct{} + +func (x fastReflection_MsgUpdateCyclelistResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateCyclelistResponse)(nil) +} +func (x fastReflection_MsgUpdateCyclelistResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateCyclelistResponse) +} +func (x fastReflection_MsgUpdateCyclelistResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateCyclelistResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateCyclelistResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateCyclelistResponse +} + +// 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_MsgUpdateCyclelistResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateCyclelistResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateCyclelistResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateCyclelistResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateCyclelistResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateCyclelistResponse)(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_MsgUpdateCyclelistResponse) 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_MsgUpdateCyclelistResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelistResponse")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelistResponse 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_MsgUpdateCyclelistResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelistResponse")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelistResponse 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_MsgUpdateCyclelistResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelistResponse")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelistResponse 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_MsgUpdateCyclelistResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelistResponse")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelistResponse 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_MsgUpdateCyclelistResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelistResponse")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelistResponse 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_MsgUpdateCyclelistResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MsgUpdateCyclelistResponse")) + } + panic(fmt.Errorf("message layer.oracle.MsgUpdateCyclelistResponse 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_MsgUpdateCyclelistResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.oracle.MsgUpdateCyclelistResponse", 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_MsgUpdateCyclelistResponse) 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_MsgUpdateCyclelistResponse) 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_MsgUpdateCyclelistResponse) 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_MsgUpdateCyclelistResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateCyclelistResponse) + 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().(*MsgUpdateCyclelistResponse) + 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().(*MsgUpdateCyclelistResponse) + 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: MsgUpdateCyclelistResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateCyclelistResponse: 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 @@ -3989,6 +4889,79 @@ func (*MsgTipResponse) Descriptor() ([]byte, []int) { return file_layer_oracle_tx_proto_rawDescGZIP(), []int{7} } +// MsgUpdateCycleRequest is the Msg/UpdateCycle request type. +type MsgUpdateCyclelist struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // list of query data hex strings + Cyclelist []string `protobuf:"bytes,2,rep,name=cyclelist,proto3" json:"cyclelist,omitempty"` +} + +func (x *MsgUpdateCyclelist) Reset() { + *x = MsgUpdateCyclelist{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_oracle_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateCyclelist) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateCyclelist) ProtoMessage() {} + +// Deprecated: Use MsgUpdateCyclelist.ProtoReflect.Descriptor instead. +func (*MsgUpdateCyclelist) Descriptor() ([]byte, []int) { + return file_layer_oracle_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgUpdateCyclelist) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateCyclelist) GetCyclelist() []string { + if x != nil { + return x.Cyclelist + } + return nil +} + +// MsgUpdateCycleResponse defines the Msg/UpdateCycle response type. +type MsgUpdateCyclelistResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateCyclelistResponse) Reset() { + *x = MsgUpdateCyclelistResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_oracle_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateCyclelistResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateCyclelistResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateCyclelistResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateCyclelistResponse) Descriptor() ([]byte, []int) { + return file_layer_oracle_tx_proto_rawDescGZIP(), []int{9} +} + var File_layer_oracle_tx_proto protoreflect.FileDescriptor var file_layer_oracle_tx_proto_rawDesc = []byte{ @@ -4045,26 +5018,44 @@ var file_layer_oracle_tx_proto_rawDesc = []byte{ 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x74, 0x69, 0x70, 0x70, 0x65, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xc6, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x54, 0x0a, 0x0c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x12, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 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, 0x1c, 0x0a, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x34, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, + 0xb0, 0x2a, 0x21, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x78, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x79, 0x63, 0x6c, 0x65, + 0x6c, 0x69, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x32, 0xa5, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x54, 0x0a, 0x0c, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x51, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x24, 0x2e, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x53, - 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x51, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, + 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, + 0x73, 0x67, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x24, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, + 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x12, 0x1d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x03, 0x54, 0x69, 0x70, 0x12, - 0x14, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, - 0x73, 0x67, 0x54, 0x69, 0x70, 0x1a, 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x03, 0x54, 0x69, 0x70, + 0x12, 0x14, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, + 0x4d, 0x73, 0x67, 0x54, 0x69, 0x70, 0x1a, 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5d, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x79, + 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x43, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x8b, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, @@ -4089,35 +5080,39 @@ func file_layer_oracle_tx_proto_rawDescGZIP() []byte { return file_layer_oracle_tx_proto_rawDescData } -var file_layer_oracle_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_layer_oracle_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_layer_oracle_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: layer.oracle.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: layer.oracle.MsgUpdateParamsResponse - (*MsgSubmitValue)(nil), // 2: layer.oracle.MsgSubmitValue - (*MsgSubmitValueResponse)(nil), // 3: layer.oracle.MsgSubmitValueResponse - (*MsgCommitReport)(nil), // 4: layer.oracle.MsgCommitReport - (*MsgCommitReportResponse)(nil), // 5: layer.oracle.MsgCommitReportResponse - (*MsgTip)(nil), // 6: layer.oracle.MsgTip - (*MsgTipResponse)(nil), // 7: layer.oracle.MsgTipResponse - (*Params)(nil), // 8: layer.oracle.Params - (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin + (*MsgUpdateParams)(nil), // 0: layer.oracle.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: layer.oracle.MsgUpdateParamsResponse + (*MsgSubmitValue)(nil), // 2: layer.oracle.MsgSubmitValue + (*MsgSubmitValueResponse)(nil), // 3: layer.oracle.MsgSubmitValueResponse + (*MsgCommitReport)(nil), // 4: layer.oracle.MsgCommitReport + (*MsgCommitReportResponse)(nil), // 5: layer.oracle.MsgCommitReportResponse + (*MsgTip)(nil), // 6: layer.oracle.MsgTip + (*MsgTipResponse)(nil), // 7: layer.oracle.MsgTipResponse + (*MsgUpdateCyclelist)(nil), // 8: layer.oracle.MsgUpdateCyclelist + (*MsgUpdateCyclelistResponse)(nil), // 9: layer.oracle.MsgUpdateCyclelistResponse + (*Params)(nil), // 10: layer.oracle.Params + (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin } var file_layer_oracle_tx_proto_depIdxs = []int32{ - 8, // 0: layer.oracle.MsgUpdateParams.params:type_name -> layer.oracle.Params - 9, // 1: layer.oracle.MsgTip.amount:type_name -> cosmos.base.v1beta1.Coin - 0, // 2: layer.oracle.Msg.UpdateParams:input_type -> layer.oracle.MsgUpdateParams - 2, // 3: layer.oracle.Msg.SubmitValue:input_type -> layer.oracle.MsgSubmitValue - 4, // 4: layer.oracle.Msg.CommitReport:input_type -> layer.oracle.MsgCommitReport - 6, // 5: layer.oracle.Msg.Tip:input_type -> layer.oracle.MsgTip - 1, // 6: layer.oracle.Msg.UpdateParams:output_type -> layer.oracle.MsgUpdateParamsResponse - 3, // 7: layer.oracle.Msg.SubmitValue:output_type -> layer.oracle.MsgSubmitValueResponse - 5, // 8: layer.oracle.Msg.CommitReport:output_type -> layer.oracle.MsgCommitReportResponse - 7, // 9: layer.oracle.Msg.Tip:output_type -> layer.oracle.MsgTipResponse - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] 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 + 10, // 0: layer.oracle.MsgUpdateParams.params:type_name -> layer.oracle.Params + 11, // 1: layer.oracle.MsgTip.amount:type_name -> cosmos.base.v1beta1.Coin + 0, // 2: layer.oracle.Msg.UpdateParams:input_type -> layer.oracle.MsgUpdateParams + 2, // 3: layer.oracle.Msg.SubmitValue:input_type -> layer.oracle.MsgSubmitValue + 4, // 4: layer.oracle.Msg.CommitReport:input_type -> layer.oracle.MsgCommitReport + 6, // 5: layer.oracle.Msg.Tip:input_type -> layer.oracle.MsgTip + 8, // 6: layer.oracle.Msg.UpdateCyclelist:input_type -> layer.oracle.MsgUpdateCyclelist + 1, // 7: layer.oracle.Msg.UpdateParams:output_type -> layer.oracle.MsgUpdateParamsResponse + 3, // 8: layer.oracle.Msg.SubmitValue:output_type -> layer.oracle.MsgSubmitValueResponse + 5, // 9: layer.oracle.Msg.CommitReport:output_type -> layer.oracle.MsgCommitReportResponse + 7, // 10: layer.oracle.Msg.Tip:output_type -> layer.oracle.MsgTipResponse + 9, // 11: layer.oracle.Msg.UpdateCyclelist:output_type -> layer.oracle.MsgUpdateCyclelistResponse + 7, // [7:12] is the sub-list for method output_type + 2, // [2:7] 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_layer_oracle_tx_proto_init() } @@ -4223,6 +5218,30 @@ func file_layer_oracle_tx_proto_init() { return nil } } + file_layer_oracle_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateCyclelist); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_layer_oracle_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateCyclelistResponse); 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{ @@ -4230,7 +5249,7 @@ func file_layer_oracle_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_oracle_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/api/layer/oracle/tx_grpc.pb.go b/api/layer/oracle/tx_grpc.pb.go index 8db8af79f..756206e5e 100644 --- a/api/layer/oracle/tx_grpc.pb.go +++ b/api/layer/oracle/tx_grpc.pb.go @@ -24,6 +24,7 @@ type MsgClient interface { SubmitValue(ctx context.Context, in *MsgSubmitValue, opts ...grpc.CallOption) (*MsgSubmitValueResponse, error) CommitReport(ctx context.Context, in *MsgCommitReport, opts ...grpc.CallOption) (*MsgCommitReportResponse, error) Tip(ctx context.Context, in *MsgTip, opts ...grpc.CallOption) (*MsgTipResponse, error) + UpdateCyclelist(ctx context.Context, in *MsgUpdateCyclelist, opts ...grpc.CallOption) (*MsgUpdateCyclelistResponse, error) } type msgClient struct { @@ -70,6 +71,15 @@ func (c *msgClient) Tip(ctx context.Context, in *MsgTip, opts ...grpc.CallOption return out, nil } +func (c *msgClient) UpdateCyclelist(ctx context.Context, in *MsgUpdateCyclelist, opts ...grpc.CallOption) (*MsgUpdateCyclelistResponse, error) { + out := new(MsgUpdateCyclelistResponse) + err := c.cc.Invoke(ctx, "/layer.oracle.Msg/UpdateCyclelist", in, out, opts...) + 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 @@ -80,6 +90,7 @@ type MsgServer interface { SubmitValue(context.Context, *MsgSubmitValue) (*MsgSubmitValueResponse, error) CommitReport(context.Context, *MsgCommitReport) (*MsgCommitReportResponse, error) Tip(context.Context, *MsgTip) (*MsgTipResponse, error) + UpdateCyclelist(context.Context, *MsgUpdateCyclelist) (*MsgUpdateCyclelistResponse, error) mustEmbedUnimplementedMsgServer() } @@ -99,6 +110,9 @@ func (UnimplementedMsgServer) CommitReport(context.Context, *MsgCommitReport) (* func (UnimplementedMsgServer) Tip(context.Context, *MsgTip) (*MsgTipResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Tip not implemented") } +func (UnimplementedMsgServer) UpdateCyclelist(context.Context, *MsgUpdateCyclelist) (*MsgUpdateCyclelistResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCyclelist not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -184,6 +198,24 @@ func _Msg_Tip_Handler(srv interface{}, ctx context.Context, dec func(interface{} return interceptor(ctx, in, info, handler) } +func _Msg_UpdateCyclelist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateCyclelist) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateCyclelist(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/layer.oracle.Msg/UpdateCyclelist", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateCyclelist(ctx, req.(*MsgUpdateCyclelist)) + } + 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) @@ -207,6 +239,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "Tip", Handler: _Msg_Tip_Handler, }, + { + MethodName: "UpdateCyclelist", + Handler: _Msg_UpdateCyclelist_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "layer/oracle/tx.proto", diff --git a/api/layer/reporter/tx.pulsar.go b/api/layer/reporter/tx.pulsar.go index 8eca39706..e9065ca4f 100644 --- a/api/layer/reporter/tx.pulsar.go +++ b/api/layer/reporter/tx.pulsar.go @@ -6554,6 +6554,846 @@ func (x *fastReflection_MsgUnjailReporterResponse) ProtoMethods() *protoiface.Me } } +var ( + md_MsgWithdrawTip protoreflect.MessageDescriptor + fd_MsgWithdrawTip_delegator_address protoreflect.FieldDescriptor + fd_MsgWithdrawTip_validator_address protoreflect.FieldDescriptor +) + +func init() { + file_layer_reporter_tx_proto_init() + md_MsgWithdrawTip = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTip") + fd_MsgWithdrawTip_delegator_address = md_MsgWithdrawTip.Fields().ByName("delegator_address") + fd_MsgWithdrawTip_validator_address = md_MsgWithdrawTip.Fields().ByName("validator_address") +} + +var _ protoreflect.Message = (*fastReflection_MsgWithdrawTip)(nil) + +type fastReflection_MsgWithdrawTip MsgWithdrawTip + +func (x *MsgWithdrawTip) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdrawTip)(x) +} + +func (x *MsgWithdrawTip) slowProtoReflect() protoreflect.Message { + mi := &file_layer_reporter_tx_proto_msgTypes[14] + 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_MsgWithdrawTip_messageType fastReflection_MsgWithdrawTip_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdrawTip_messageType{} + +type fastReflection_MsgWithdrawTip_messageType struct{} + +func (x fastReflection_MsgWithdrawTip_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdrawTip)(nil) +} +func (x fastReflection_MsgWithdrawTip_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTip) +} +func (x fastReflection_MsgWithdrawTip_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTip +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgWithdrawTip) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTip +} + +// 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_MsgWithdrawTip) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdrawTip_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgWithdrawTip) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTip) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgWithdrawTip) Interface() protoreflect.ProtoMessage { + return (*MsgWithdrawTip)(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_MsgWithdrawTip) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_MsgWithdrawTip_delegator_address, value) { + return + } + } + if x.ValidatorAddress != "" { + value := protoreflect.ValueOfString(x.ValidatorAddress) + if !f(fd_MsgWithdrawTip_validator_address, 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_MsgWithdrawTip) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "layer.reporter.MsgWithdrawTip.delegator_address": + return x.DelegatorAddress != "" + case "layer.reporter.MsgWithdrawTip.validator_address": + return x.ValidatorAddress != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip 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_MsgWithdrawTip) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "layer.reporter.MsgWithdrawTip.delegator_address": + x.DelegatorAddress = "" + case "layer.reporter.MsgWithdrawTip.validator_address": + x.ValidatorAddress = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip 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_MsgWithdrawTip) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "layer.reporter.MsgWithdrawTip.delegator_address": + value := x.DelegatorAddress + return protoreflect.ValueOfString(value) + case "layer.reporter.MsgWithdrawTip.validator_address": + value := x.ValidatorAddress + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip 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_MsgWithdrawTip) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "layer.reporter.MsgWithdrawTip.delegator_address": + x.DelegatorAddress = value.Interface().(string) + case "layer.reporter.MsgWithdrawTip.validator_address": + x.ValidatorAddress = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip 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_MsgWithdrawTip) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.reporter.MsgWithdrawTip.delegator_address": + panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgWithdrawTip is not mutable")) + case "layer.reporter.MsgWithdrawTip.validator_address": + panic(fmt.Errorf("field validator_address of message layer.reporter.MsgWithdrawTip is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip 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_MsgWithdrawTip) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "layer.reporter.MsgWithdrawTip.delegator_address": + return protoreflect.ValueOfString("") + case "layer.reporter.MsgWithdrawTip.validator_address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip 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_MsgWithdrawTip) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawTip", 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_MsgWithdrawTip) 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_MsgWithdrawTip) 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_MsgWithdrawTip) 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_MsgWithdrawTip) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgWithdrawTip) + 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.DelegatorAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ValidatorAddress) + 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().(*MsgWithdrawTip) + 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.ValidatorAddress) > 0 { + i -= len(x.ValidatorAddress) + copy(dAtA[i:], x.ValidatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) + 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().(*MsgWithdrawTip) + 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: MsgWithdrawTip: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTip: 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 DelegatorAddress", 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.DelegatorAddress = 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 ValidatorAddress", 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.ValidatorAddress = 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_MsgWithdrawTipResponse protoreflect.MessageDescriptor +) + +func init() { + file_layer_reporter_tx_proto_init() + md_MsgWithdrawTipResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTipResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgWithdrawTipResponse)(nil) + +type fastReflection_MsgWithdrawTipResponse MsgWithdrawTipResponse + +func (x *MsgWithdrawTipResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdrawTipResponse)(x) +} + +func (x *MsgWithdrawTipResponse) slowProtoReflect() protoreflect.Message { + mi := &file_layer_reporter_tx_proto_msgTypes[15] + 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_MsgWithdrawTipResponse_messageType fastReflection_MsgWithdrawTipResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdrawTipResponse_messageType{} + +type fastReflection_MsgWithdrawTipResponse_messageType struct{} + +func (x fastReflection_MsgWithdrawTipResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdrawTipResponse)(nil) +} +func (x fastReflection_MsgWithdrawTipResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTipResponse) +} +func (x fastReflection_MsgWithdrawTipResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTipResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgWithdrawTipResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTipResponse +} + +// 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_MsgWithdrawTipResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdrawTipResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgWithdrawTipResponse) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTipResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgWithdrawTipResponse) Interface() protoreflect.ProtoMessage { + return (*MsgWithdrawTipResponse)(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_MsgWithdrawTipResponse) 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_MsgWithdrawTipResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse 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_MsgWithdrawTipResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse 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_MsgWithdrawTipResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse 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_MsgWithdrawTipResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse 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_MsgWithdrawTipResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse 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_MsgWithdrawTipResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) + } + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse 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_MsgWithdrawTipResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawTipResponse", 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_MsgWithdrawTipResponse) 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_MsgWithdrawTipResponse) 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_MsgWithdrawTipResponse) 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_MsgWithdrawTipResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgWithdrawTipResponse) + 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().(*MsgWithdrawTipResponse) + 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().(*MsgWithdrawTipResponse) + 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: MsgWithdrawTipResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTipResponse: 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 @@ -7103,6 +7943,77 @@ func (*MsgUnjailReporterResponse) Descriptor() ([]byte, []int) { return file_layer_reporter_tx_proto_rawDescGZIP(), []int{13} } +// MsgWithdrawTip defines the Msg/WithdrawTip request type. +type MsgWithdrawTip struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` +} + +func (x *MsgWithdrawTip) Reset() { + *x = MsgWithdrawTip{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_reporter_tx_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgWithdrawTip) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgWithdrawTip) ProtoMessage() {} + +// Deprecated: Use MsgWithdrawTip.ProtoReflect.Descriptor instead. +func (*MsgWithdrawTip) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{14} +} + +func (x *MsgWithdrawTip) GetDelegatorAddress() string { + if x != nil { + return x.DelegatorAddress + } + return "" +} + +func (x *MsgWithdrawTip) GetValidatorAddress() string { + if x != nil { + return x.ValidatorAddress + } + return "" +} + +// MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. +type MsgWithdrawTipResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgWithdrawTipResponse) Reset() { + *x = MsgWithdrawTipResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_reporter_tx_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgWithdrawTipResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgWithdrawTipResponse) ProtoMessage() {} + +// Deprecated: Use MsgWithdrawTipResponse.ProtoReflect.Descriptor instead. +func (*MsgWithdrawTipResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{15} +} + var File_layer_reporter_tx_proto protoreflect.FileDescriptor var file_layer_reporter_tx_proto_rawDesc = []byte{ @@ -7230,7 +8141,23 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x1d, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf8, 0x05, 0x0a, 0x03, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe3, 0x01, 0x0a, 0x0e, + 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x45, + 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 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, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, + 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x3a, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, + 0x2a, 0x1f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x78, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x2f, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, + 0x70, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, + 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, @@ -7277,18 +8204,23 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, - 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x07, 0x54, - 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x55, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x1e, + 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x1a, 0x26, + 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, + 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7303,7 +8235,7 @@ func file_layer_reporter_tx_proto_rawDescGZIP() []byte { return file_layer_reporter_tx_proto_rawDescData } -var file_layer_reporter_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_layer_reporter_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_layer_reporter_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: layer.reporter.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: layer.reporter.MsgUpdateParamsResponse @@ -7319,19 +8251,21 @@ var file_layer_reporter_tx_proto_goTypes = []interface{}{ (*MsgWithdrawDelegatorRewardResponse)(nil), // 11: layer.reporter.MsgWithdrawDelegatorRewardResponse (*MsgUnjailReporter)(nil), // 12: layer.reporter.MsgUnjailReporter (*MsgUnjailReporterResponse)(nil), // 13: layer.reporter.MsgUnjailReporterResponse - (*Params)(nil), // 14: layer.reporter.Params - (*TokenOrigin)(nil), // 15: layer.reporter.TokenOrigin - (*v1beta1.Commission)(nil), // 16: cosmos.staking.v1beta1.Commission - (*v1beta11.Coin)(nil), // 17: cosmos.base.v1beta1.Coin + (*MsgWithdrawTip)(nil), // 14: layer.reporter.MsgWithdrawTip + (*MsgWithdrawTipResponse)(nil), // 15: layer.reporter.MsgWithdrawTipResponse + (*Params)(nil), // 16: layer.reporter.Params + (*TokenOrigin)(nil), // 17: layer.reporter.TokenOrigin + (*v1beta1.Commission)(nil), // 18: cosmos.staking.v1beta1.Commission + (*v1beta11.Coin)(nil), // 19: cosmos.base.v1beta1.Coin } var file_layer_reporter_tx_proto_depIdxs = []int32{ - 14, // 0: layer.reporter.MsgUpdateParams.params:type_name -> layer.reporter.Params - 15, // 1: layer.reporter.MsgCreateReporter.token_origins:type_name -> layer.reporter.TokenOrigin - 16, // 2: layer.reporter.MsgCreateReporter.commission:type_name -> cosmos.staking.v1beta1.Commission - 15, // 3: layer.reporter.MsgDelegateReporter.token_origins:type_name -> layer.reporter.TokenOrigin - 15, // 4: layer.reporter.MsgUndelegateReporter.token_origins:type_name -> layer.reporter.TokenOrigin - 17, // 5: layer.reporter.MsgWithdrawReporterCommissionResponse.amount:type_name -> cosmos.base.v1beta1.Coin - 17, // 6: layer.reporter.MsgWithdrawDelegatorRewardResponse.amount:type_name -> cosmos.base.v1beta1.Coin + 16, // 0: layer.reporter.MsgUpdateParams.params:type_name -> layer.reporter.Params + 17, // 1: layer.reporter.MsgCreateReporter.token_origins:type_name -> layer.reporter.TokenOrigin + 18, // 2: layer.reporter.MsgCreateReporter.commission:type_name -> cosmos.staking.v1beta1.Commission + 17, // 3: layer.reporter.MsgDelegateReporter.token_origins:type_name -> layer.reporter.TokenOrigin + 17, // 4: layer.reporter.MsgUndelegateReporter.token_origins:type_name -> layer.reporter.TokenOrigin + 19, // 5: layer.reporter.MsgWithdrawReporterCommissionResponse.amount:type_name -> cosmos.base.v1beta1.Coin + 19, // 6: layer.reporter.MsgWithdrawDelegatorRewardResponse.amount:type_name -> cosmos.base.v1beta1.Coin 0, // 7: layer.reporter.Msg.UpdateParams:input_type -> layer.reporter.MsgUpdateParams 2, // 8: layer.reporter.Msg.CreateReporter:input_type -> layer.reporter.MsgCreateReporter 4, // 9: layer.reporter.Msg.DelegateReporter:input_type -> layer.reporter.MsgDelegateReporter @@ -7339,15 +8273,17 @@ var file_layer_reporter_tx_proto_depIdxs = []int32{ 8, // 11: layer.reporter.Msg.WithdrawReporterCommission:input_type -> layer.reporter.MsgWithdrawReporterCommission 10, // 12: layer.reporter.Msg.WithdrawDelegatorReward:input_type -> layer.reporter.MsgWithdrawDelegatorReward 12, // 13: layer.reporter.Msg.UnjailReporter:input_type -> layer.reporter.MsgUnjailReporter - 1, // 14: layer.reporter.Msg.UpdateParams:output_type -> layer.reporter.MsgUpdateParamsResponse - 3, // 15: layer.reporter.Msg.CreateReporter:output_type -> layer.reporter.MsgCreateReporterResponse - 5, // 16: layer.reporter.Msg.DelegateReporter:output_type -> layer.reporter.MsgDelegateReporterResponse - 7, // 17: layer.reporter.Msg.UndelegateReporter:output_type -> layer.reporter.MsgUndelegateReporterResponse - 9, // 18: layer.reporter.Msg.WithdrawReporterCommission:output_type -> layer.reporter.MsgWithdrawReporterCommissionResponse - 11, // 19: layer.reporter.Msg.WithdrawDelegatorReward:output_type -> layer.reporter.MsgWithdrawDelegatorRewardResponse - 13, // 20: layer.reporter.Msg.UnjailReporter:output_type -> layer.reporter.MsgUnjailReporterResponse - 14, // [14:21] is the sub-list for method output_type - 7, // [7:14] is the sub-list for method input_type + 14, // 14: layer.reporter.Msg.WithdrawTip:input_type -> layer.reporter.MsgWithdrawTip + 1, // 15: layer.reporter.Msg.UpdateParams:output_type -> layer.reporter.MsgUpdateParamsResponse + 3, // 16: layer.reporter.Msg.CreateReporter:output_type -> layer.reporter.MsgCreateReporterResponse + 5, // 17: layer.reporter.Msg.DelegateReporter:output_type -> layer.reporter.MsgDelegateReporterResponse + 7, // 18: layer.reporter.Msg.UndelegateReporter:output_type -> layer.reporter.MsgUndelegateReporterResponse + 9, // 19: layer.reporter.Msg.WithdrawReporterCommission:output_type -> layer.reporter.MsgWithdrawReporterCommissionResponse + 11, // 20: layer.reporter.Msg.WithdrawDelegatorReward:output_type -> layer.reporter.MsgWithdrawDelegatorRewardResponse + 13, // 21: layer.reporter.Msg.UnjailReporter:output_type -> layer.reporter.MsgUnjailReporterResponse + 15, // 22: layer.reporter.Msg.WithdrawTip:output_type -> layer.reporter.MsgWithdrawTipResponse + 15, // [15:23] is the sub-list for method output_type + 7, // [7:15] is the sub-list for method input_type 7, // [7:7] is the sub-list for extension type_name 7, // [7:7] is the sub-list for extension extendee 0, // [0:7] is the sub-list for field type_name @@ -7529,6 +8465,30 @@ func file_layer_reporter_tx_proto_init() { return nil } } + file_layer_reporter_tx_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgWithdrawTip); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_layer_reporter_tx_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgWithdrawTipResponse); 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{ @@ -7536,7 +8496,7 @@ func file_layer_reporter_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_reporter_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/api/layer/reporter/tx_grpc.pb.go b/api/layer/reporter/tx_grpc.pb.go index 932f5e7e4..e146d205a 100644 --- a/api/layer/reporter/tx_grpc.pb.go +++ b/api/layer/reporter/tx_grpc.pb.go @@ -35,6 +35,8 @@ type MsgClient interface { WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(ctx context.Context, in *MsgUnjailReporter, opts ...grpc.CallOption) (*MsgUnjailReporterResponse, error) + // WithdrawTip defines a method to withdraw tip from a reporter module. + WithdrawTip(ctx context.Context, in *MsgWithdrawTip, opts ...grpc.CallOption) (*MsgWithdrawTipResponse, error) } type msgClient struct { @@ -108,6 +110,15 @@ func (c *msgClient) UnjailReporter(ctx context.Context, in *MsgUnjailReporter, o return out, nil } +func (c *msgClient) WithdrawTip(ctx context.Context, in *MsgWithdrawTip, opts ...grpc.CallOption) (*MsgWithdrawTipResponse, error) { + out := new(MsgWithdrawTipResponse) + err := c.cc.Invoke(ctx, "/layer.reporter.Msg/WithdrawTip", in, out, opts...) + 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 @@ -129,6 +140,8 @@ type MsgServer interface { WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) + // WithdrawTip defines a method to withdraw tip from a reporter module. + WithdrawTip(context.Context, *MsgWithdrawTip) (*MsgWithdrawTipResponse, error) mustEmbedUnimplementedMsgServer() } @@ -157,6 +170,9 @@ func (UnimplementedMsgServer) WithdrawDelegatorReward(context.Context, *MsgWithd func (UnimplementedMsgServer) UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnjailReporter not implemented") } +func (UnimplementedMsgServer) WithdrawTip(context.Context, *MsgWithdrawTip) (*MsgWithdrawTipResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawTip not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -296,6 +312,24 @@ func _Msg_UnjailReporter_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_WithdrawTip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawTip) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawTip(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/layer.reporter.Msg/WithdrawTip", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawTip(ctx, req.(*MsgWithdrawTip)) + } + 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) @@ -331,6 +365,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UnjailReporter", Handler: _Msg_UnjailReporter_Handler, }, + { + MethodName: "WithdrawTip", + Handler: _Msg_WithdrawTip_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "layer/reporter/tx.proto", diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml index d71f00468..e8fffdb28 100644 --- a/proto/buf.gen.pulsar.yaml +++ b/proto/buf.gen.pulsar.yaml @@ -15,8 +15,8 @@ managed: override: plugins: - name: go-pulsar - out: ../api + out: ./api opt: paths=source_relative - name: go-grpc - out: ../api + out: ./api opt: paths=source_relative diff --git a/proto/layer/reporter/tx.proto b/proto/layer/reporter/tx.proto index 11ae9039d..699c5bbfa 100644 --- a/proto/layer/reporter/tx.proto +++ b/proto/layer/reporter/tx.proto @@ -40,6 +40,8 @@ service Msg { // UnjailReporter defines a method to unjail a jailed reporter. rpc UnjailReporter(MsgUnjailReporter) returns (MsgUnjailReporterResponse); + + // WithdrawTip defines a method to withdraw tip from a reporter module. rpc WithdrawTip(MsgWithdrawTip) returns (MsgWithdrawTipResponse); } diff --git a/x/reporter/types/codec.go b/x/reporter/types/codec.go index e08f4de2c..6e4fa0103 100644 --- a/x/reporter/types/codec.go +++ b/x/reporter/types/codec.go @@ -15,8 +15,6 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgUpdateParams{}, &MsgWithdrawDelegatorReward{}, &MsgWithdrawReporterCommission{}, - ) - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgWithdrawTip{}, ) // this line is used by starport scaffolding # 3 diff --git a/x/reporter/types/tx.pb.go b/x/reporter/types/tx.pb.go index ae94d9f42..3afd1948e 100644 --- a/x/reporter/types/tx.pb.go +++ b/x/reporter/types/tx.pb.go @@ -660,6 +660,7 @@ func (m *MsgUnjailReporterResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnjailReporterResponse proto.InternalMessageInfo +// MsgWithdrawTip defines the Msg/WithdrawTip request type. type MsgWithdrawTip struct { DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` @@ -712,6 +713,7 @@ func (m *MsgWithdrawTip) GetValidatorAddress() string { return "" } +// MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. type MsgWithdrawTipResponse struct { } @@ -862,6 +864,7 @@ type MsgClient interface { WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(ctx context.Context, in *MsgUnjailReporter, opts ...grpc.CallOption) (*MsgUnjailReporterResponse, error) + // WithdrawTip defines a method to withdraw tip from a reporter module. WithdrawTip(ctx context.Context, in *MsgWithdrawTip, opts ...grpc.CallOption) (*MsgWithdrawTipResponse, error) } @@ -964,6 +967,7 @@ type MsgServer interface { WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) + // WithdrawTip defines a method to withdraw tip from a reporter module. WithdrawTip(context.Context, *MsgWithdrawTip) (*MsgWithdrawTipResponse, error) } From 0e5ecaeda4a0bcf35892df1865c253e31f25cb58 Mon Sep 17 00:00:00 2001 From: akrem Date: Tue, 19 Mar 2024 15:16:45 -0400 Subject: [PATCH 22/31] proto stuff --- api/layer/reporter/tx.pulsar.go | 130 ++++++++++++++++---------------- 1 file changed, 64 insertions(+), 66 deletions(-) diff --git a/api/layer/reporter/tx.pulsar.go b/api/layer/reporter/tx.pulsar.go index e9065ca4f..8f4410126 100644 --- a/api/layer/reporter/tx.pulsar.go +++ b/api/layer/reporter/tx.pulsar.go @@ -8141,7 +8141,7 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x1d, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe3, 0x01, 0x0a, 0x0e, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, @@ -8152,75 +8152,73 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x3a, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x8a, 0xe7, 0xb0, - 0x2a, 0x1f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x78, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2f, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, - 0x70, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, - 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x06, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, - 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, - 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, - 0x10, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x12, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x12, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, - 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x1a, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x82, 0x01, 0x0a, 0x1a, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x16, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, + 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x1a, 0x27, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, - 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x35, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x44, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, - 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, - 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, - 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x32, 0x2e, 0x6c, 0x61, + 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x6a, 0x0a, 0x12, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x1a, + 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, + 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, + 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, + 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x79, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, - 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x5e, 0x0a, 0x0e, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x55, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x1e, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, - 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x1a, 0x26, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, - 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, - 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x32, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, + 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x55, + 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x57, + 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, + 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, + 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, 0x0a, 0x12, 0x63, 0x6f, + 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, + 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 7eff42b29605fb4b6b2a6d50ef6bda9dbc4dc0d5 Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 01:19:31 -0400 Subject: [PATCH 23/31] auto generated files --- api/layer/daemons/median_values.pulsar.go | 19 +- api/layer/daemons/pricefeed.pulsar.go | 21 +- api/layer/dispute/dispute.pulsar.go | 1338 +++-------------- api/layer/dispute/dispute_params.pulsar.go | 52 +- api/layer/dispute/genesis.pulsar.go | 21 +- api/layer/dispute/open_disputes.pulsar.go | 19 +- api/layer/dispute/params.pulsar.go | 20 +- api/layer/dispute/query.pulsar.go | 19 +- api/layer/dispute/tally.pulsar.go | 21 +- api/layer/dispute/tx.pulsar.go | 58 +- api/layer/dispute/vote.pulsar.go | 19 +- api/layer/dispute/voter_classes.pulsar.go | 19 +- api/layer/mint/genesis.pulsar.go | 19 +- api/layer/mint/mint.pulsar.go | 17 +- api/layer/mint/module/module.pulsar.go | 22 +- api/layer/mint/query.pulsar.go | 19 +- api/layer/oracle/aggregate.pulsar.go | 19 +- api/layer/oracle/aggregate_reporter.pulsar.go | 20 +- api/layer/oracle/commit_report.pulsar.go | 19 +- api/layer/oracle/genesis.pulsar.go | 19 +- api/layer/oracle/micro_report.pulsar.go | 209 ++- api/layer/oracle/params.pulsar.go | 21 +- api/layer/oracle/query.pulsar.go | 21 +- api/layer/oracle/query_meta.pulsar.go | 67 +- api/layer/oracle/reports.pulsar.go | 19 +- api/layer/oracle/tips.pulsar.go | 21 +- api/layer/oracle/tx.pulsar.go | 19 +- api/layer/oracle/user_tip.pulsar.go | 19 +- api/layer/registry/data_spec.pulsar.go | 21 +- api/layer/registry/genesis.pulsar.go | 21 +- api/layer/registry/params.pulsar.go | 21 +- api/layer/registry/query.pulsar.go | 21 +- api/layer/registry/tx.pulsar.go | 19 +- api/layer/reporter/delegation.pulsar.go | 21 +- api/layer/reporter/distribution.pulsar.go | 21 +- api/layer/reporter/genesis.pulsar.go | 21 +- api/layer/reporter/module/module.pulsar.go | 25 +- api/layer/reporter/oracle_reporter.pulsar.go | 21 +- api/layer/reporter/params.pulsar.go | 21 +- api/layer/reporter/query.pulsar.go | 21 +- api/layer/reporter/token_origin.pulsar.go | 20 +- api/layer/reporter/tx.pulsar.go | 316 ++-- docs/static/openapi.yml | 1 + proto/buf.gen.pulsar.yaml | 3 +- proto/layer/dispute/dispute.proto | 25 +- proto/layer/dispute/dispute_params.proto | 6 +- proto/layer/dispute/tx.proto | 3 +- proto/layer/oracle/micro_report.proto | 17 +- proto/layer/oracle/query_meta.proto | 10 +- proto/layer/oracle/tips.proto | 2 +- proto/layer/reporter/tx.proto | 5 +- x/dispute/mocks/ReporterKeeper.go | 44 +- x/dispute/types/dispute.pb.go | 669 ++------- x/dispute/types/dispute_params.pb.go | 33 +- x/dispute/types/tx.pb.go | 110 +- x/oracle/types/micro_report.pb.go | 107 +- x/oracle/types/query_meta.pb.go | 80 +- x/oracle/types/tips.pb.go | 2 +- x/reporter/mocks/StakingKeeper.go | 27 + x/reporter/types/tx.pb.go | 143 +- 60 files changed, 1435 insertions(+), 2618 deletions(-) diff --git a/api/layer/daemons/median_values.pulsar.go b/api/layer/daemons/median_values.pulsar.go index ebefb1960..1be067ec2 100644 --- a/api/layer/daemons/median_values.pulsar.go +++ b/api/layer/daemons/median_values.pulsar.go @@ -2473,17 +2473,18 @@ var file_layer_daemons_median_values_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x74, 0x5f, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x7b, 0x71, 0x75, 0x65, 0x72, 0x79, - 0x5f, 0x64, 0x61, 0x74, 0x61, 0x7d, 0x42, 0x9b, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, + 0x5f, 0x64, 0x61, 0x74, 0x61, 0x7d, 0x42, 0xa9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x42, 0x11, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, - 0x73, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x61, 0x65, - 0x6d, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, + 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xa2, + 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x61, + 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x61, 0x65, 0x6d, 0x6f, + 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/daemons/pricefeed.pulsar.go b/api/layer/daemons/pricefeed.pulsar.go index 419aabf67..4e5f73335 100644 --- a/api/layer/daemons/pricefeed.pulsar.go +++ b/api/layer/daemons/pricefeed.pulsar.go @@ -2171,17 +2171,18 @@ var file_layer_daemons_pricefeed_proto_rawDesc = []byte{ 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x98, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xa6, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x42, 0x0e, 0x50, 0x72, 0x69, - 0x63, 0x65, 0x66, 0x65, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, - 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x61, 0x65, 0x6d, - 0x6f, 0x6e, 0x73, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x61, 0x65, 0x6d, - 0x6f, 0x6e, 0x73, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x61, 0x65, 0x6d, - 0x6f, 0x6e, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x65, 0x66, 0x65, 0x65, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, + 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0xa2, 0x02, 0x03, 0x4c, 0x44, + 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, + 0x73, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, + 0x73, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, + 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/dispute.pulsar.go b/api/layer/dispute/dispute.pulsar.go index 14287ccb3..dbf729f4d 100644 --- a/api/layer/dispute/dispute.pulsar.go +++ b/api/layer/dispute/dispute.pulsar.go @@ -2,11 +2,12 @@ package dispute import ( - v1beta1 "cosmossdk.io/api/cosmos/base/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" + oracle "github.com/tellor-io/layer/api/layer/oracle" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -508,7 +509,7 @@ func (x *fastReflection_Dispute) Set(fd protoreflect.FieldDescriptor, value prot case "layer.dispute.Dispute.burnAmount": x.BurnAmount = value.Interface().(string) case "layer.dispute.Dispute.reportEvidence": - x.ReportEvidence = value.Message().Interface().(*MicroReport) + x.ReportEvidence = value.Message().Interface().(*oracle.MicroReport) case "layer.dispute.Dispute.feePayers": lv := value.List() clv := lv.(*_Dispute_13_list) @@ -551,7 +552,7 @@ func (x *fastReflection_Dispute) Mutable(fd protoreflect.FieldDescriptor) protor return protoreflect.ValueOfMessage(x.DisputeEndTime.ProtoReflect()) case "layer.dispute.Dispute.reportEvidence": if x.ReportEvidence == nil { - x.ReportEvidence = new(MicroReport) + x.ReportEvidence = new(oracle.MicroReport) } return protoreflect.ValueOfMessage(x.ReportEvidence.ProtoReflect()) case "layer.dispute.Dispute.feePayers": @@ -624,7 +625,7 @@ func (x *fastReflection_Dispute) NewField(fd protoreflect.FieldDescriptor) proto case "layer.dispute.Dispute.burnAmount": return protoreflect.ValueOfString("") case "layer.dispute.Dispute.reportEvidence": - m := new(MicroReport) + m := new(oracle.MicroReport) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "layer.dispute.Dispute.feePayers": list := []*PayerInfo{} @@ -1306,7 +1307,7 @@ func (x *fastReflection_Dispute) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } if x.ReportEvidence == nil { - x.ReportEvidence = &MicroReport{} + x.ReportEvidence = &oracle.MicroReport{} } if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ReportEvidence); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err @@ -1489,862 +1490,12 @@ func (x *fastReflection_Dispute) ProtoMethods() *protoiface.Methods { } } -var ( - md_MicroReport protoreflect.MessageDescriptor - fd_MicroReport_reporter protoreflect.FieldDescriptor - fd_MicroReport_power protoreflect.FieldDescriptor - fd_MicroReport_query_type protoreflect.FieldDescriptor - fd_MicroReport_query_id protoreflect.FieldDescriptor - fd_MicroReport_aggregate_method protoreflect.FieldDescriptor - fd_MicroReport_value protoreflect.FieldDescriptor - fd_MicroReport_block_number protoreflect.FieldDescriptor - fd_MicroReport_timestamp protoreflect.FieldDescriptor -) - -func init() { - file_layer_dispute_dispute_proto_init() - md_MicroReport = File_layer_dispute_dispute_proto.Messages().ByName("MicroReport") - fd_MicroReport_reporter = md_MicroReport.Fields().ByName("reporter") - fd_MicroReport_power = md_MicroReport.Fields().ByName("power") - fd_MicroReport_query_type = md_MicroReport.Fields().ByName("query_type") - fd_MicroReport_query_id = md_MicroReport.Fields().ByName("query_id") - fd_MicroReport_aggregate_method = md_MicroReport.Fields().ByName("aggregate_method") - fd_MicroReport_value = md_MicroReport.Fields().ByName("value") - fd_MicroReport_block_number = md_MicroReport.Fields().ByName("block_number") - fd_MicroReport_timestamp = md_MicroReport.Fields().ByName("timestamp") -} - -var _ protoreflect.Message = (*fastReflection_MicroReport)(nil) - -type fastReflection_MicroReport MicroReport - -func (x *MicroReport) ProtoReflect() protoreflect.Message { - return (*fastReflection_MicroReport)(x) -} - -func (x *MicroReport) slowProtoReflect() protoreflect.Message { - mi := &file_layer_dispute_dispute_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_MicroReport_messageType fastReflection_MicroReport_messageType -var _ protoreflect.MessageType = fastReflection_MicroReport_messageType{} - -type fastReflection_MicroReport_messageType struct{} - -func (x fastReflection_MicroReport_messageType) Zero() protoreflect.Message { - return (*fastReflection_MicroReport)(nil) -} -func (x fastReflection_MicroReport_messageType) New() protoreflect.Message { - return new(fastReflection_MicroReport) -} -func (x fastReflection_MicroReport_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MicroReport -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MicroReport) Descriptor() protoreflect.MessageDescriptor { - return md_MicroReport -} - -// 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_MicroReport) Type() protoreflect.MessageType { - return _fastReflection_MicroReport_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MicroReport) New() protoreflect.Message { - return new(fastReflection_MicroReport) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MicroReport) Interface() protoreflect.ProtoMessage { - return (*MicroReport)(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_MicroReport) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Reporter != "" { - value := protoreflect.ValueOfString(x.Reporter) - if !f(fd_MicroReport_reporter, value) { - return - } - } - if x.Power != int64(0) { - value := protoreflect.ValueOfInt64(x.Power) - if !f(fd_MicroReport_power, value) { - return - } - } - if x.QueryType != "" { - value := protoreflect.ValueOfString(x.QueryType) - if !f(fd_MicroReport_query_type, value) { - return - } - } - if x.QueryId != "" { - value := protoreflect.ValueOfString(x.QueryId) - if !f(fd_MicroReport_query_id, value) { - return - } - } - if x.AggregateMethod != "" { - value := protoreflect.ValueOfString(x.AggregateMethod) - if !f(fd_MicroReport_aggregate_method, value) { - return - } - } - if x.Value != "" { - value := protoreflect.ValueOfString(x.Value) - if !f(fd_MicroReport_value, value) { - return - } - } - if x.BlockNumber != int64(0) { - value := protoreflect.ValueOfInt64(x.BlockNumber) - if !f(fd_MicroReport_block_number, value) { - return - } - } - if x.Timestamp != nil { - value := protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) - if !f(fd_MicroReport_timestamp, 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_MicroReport) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.dispute.MicroReport.reporter": - return x.Reporter != "" - case "layer.dispute.MicroReport.power": - return x.Power != int64(0) - case "layer.dispute.MicroReport.query_type": - return x.QueryType != "" - case "layer.dispute.MicroReport.query_id": - return x.QueryId != "" - case "layer.dispute.MicroReport.aggregate_method": - return x.AggregateMethod != "" - case "layer.dispute.MicroReport.value": - return x.Value != "" - case "layer.dispute.MicroReport.block_number": - return x.BlockNumber != int64(0) - case "layer.dispute.MicroReport.timestamp": - return x.Timestamp != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) - } - panic(fmt.Errorf("message layer.dispute.MicroReport 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_MicroReport) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.dispute.MicroReport.reporter": - x.Reporter = "" - case "layer.dispute.MicroReport.power": - x.Power = int64(0) - case "layer.dispute.MicroReport.query_type": - x.QueryType = "" - case "layer.dispute.MicroReport.query_id": - x.QueryId = "" - case "layer.dispute.MicroReport.aggregate_method": - x.AggregateMethod = "" - case "layer.dispute.MicroReport.value": - x.Value = "" - case "layer.dispute.MicroReport.block_number": - x.BlockNumber = int64(0) - case "layer.dispute.MicroReport.timestamp": - x.Timestamp = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) - } - panic(fmt.Errorf("message layer.dispute.MicroReport 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_MicroReport) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.dispute.MicroReport.reporter": - value := x.Reporter - return protoreflect.ValueOfString(value) - case "layer.dispute.MicroReport.power": - value := x.Power - return protoreflect.ValueOfInt64(value) - case "layer.dispute.MicroReport.query_type": - value := x.QueryType - return protoreflect.ValueOfString(value) - case "layer.dispute.MicroReport.query_id": - value := x.QueryId - return protoreflect.ValueOfString(value) - case "layer.dispute.MicroReport.aggregate_method": - value := x.AggregateMethod - return protoreflect.ValueOfString(value) - case "layer.dispute.MicroReport.value": - value := x.Value - return protoreflect.ValueOfString(value) - case "layer.dispute.MicroReport.block_number": - value := x.BlockNumber - return protoreflect.ValueOfInt64(value) - case "layer.dispute.MicroReport.timestamp": - value := x.Timestamp - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) - } - panic(fmt.Errorf("message layer.dispute.MicroReport 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_MicroReport) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.dispute.MicroReport.reporter": - x.Reporter = value.Interface().(string) - case "layer.dispute.MicroReport.power": - x.Power = value.Int() - case "layer.dispute.MicroReport.query_type": - x.QueryType = value.Interface().(string) - case "layer.dispute.MicroReport.query_id": - x.QueryId = value.Interface().(string) - case "layer.dispute.MicroReport.aggregate_method": - x.AggregateMethod = value.Interface().(string) - case "layer.dispute.MicroReport.value": - x.Value = value.Interface().(string) - case "layer.dispute.MicroReport.block_number": - x.BlockNumber = value.Int() - case "layer.dispute.MicroReport.timestamp": - x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) - } - panic(fmt.Errorf("message layer.dispute.MicroReport 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_MicroReport) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.dispute.MicroReport.timestamp": - if x.Timestamp == nil { - x.Timestamp = new(timestamppb.Timestamp) - } - return protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) - case "layer.dispute.MicroReport.reporter": - panic(fmt.Errorf("field reporter of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.power": - panic(fmt.Errorf("field power of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.query_type": - panic(fmt.Errorf("field query_type of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.query_id": - panic(fmt.Errorf("field query_id of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.aggregate_method": - panic(fmt.Errorf("field aggregate_method of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.value": - panic(fmt.Errorf("field value of message layer.dispute.MicroReport is not mutable")) - case "layer.dispute.MicroReport.block_number": - panic(fmt.Errorf("field block_number of message layer.dispute.MicroReport is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) - } - panic(fmt.Errorf("message layer.dispute.MicroReport 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_MicroReport) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.dispute.MicroReport.reporter": - return protoreflect.ValueOfString("") - case "layer.dispute.MicroReport.power": - return protoreflect.ValueOfInt64(int64(0)) - case "layer.dispute.MicroReport.query_type": - return protoreflect.ValueOfString("") - case "layer.dispute.MicroReport.query_id": - return protoreflect.ValueOfString("") - case "layer.dispute.MicroReport.aggregate_method": - return protoreflect.ValueOfString("") - case "layer.dispute.MicroReport.value": - return protoreflect.ValueOfString("") - case "layer.dispute.MicroReport.block_number": - return protoreflect.ValueOfInt64(int64(0)) - case "layer.dispute.MicroReport.timestamp": - m := new(timestamppb.Timestamp) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.MicroReport")) - } - panic(fmt.Errorf("message layer.dispute.MicroReport 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_MicroReport) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.dispute.MicroReport", 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_MicroReport) 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_MicroReport) 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_MicroReport) 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_MicroReport) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MicroReport) - 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.Reporter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Power != 0 { - n += 1 + runtime.Sov(uint64(x.Power)) - } - l = len(x.QueryType) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.QueryId) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.AggregateMethod) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Value) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.BlockNumber != 0 { - n += 1 + runtime.Sov(uint64(x.BlockNumber)) - } - if x.Timestamp != nil { - l = options.Size(x.Timestamp) - 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().(*MicroReport) - 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.Timestamp != nil { - encoded, err := options.Marshal(x.Timestamp) - 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] = 0x42 - } - if x.BlockNumber != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockNumber)) - i-- - dAtA[i] = 0x38 - } - if len(x.Value) > 0 { - i -= len(x.Value) - copy(dAtA[i:], x.Value) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Value))) - i-- - dAtA[i] = 0x32 - } - if len(x.AggregateMethod) > 0 { - i -= len(x.AggregateMethod) - copy(dAtA[i:], x.AggregateMethod) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AggregateMethod))) - i-- - dAtA[i] = 0x2a - } - if len(x.QueryId) > 0 { - i -= len(x.QueryId) - copy(dAtA[i:], x.QueryId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryId))) - i-- - dAtA[i] = 0x22 - } - if len(x.QueryType) > 0 { - i -= len(x.QueryType) - copy(dAtA[i:], x.QueryType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.QueryType))) - i-- - dAtA[i] = 0x1a - } - if x.Power != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Power)) - i-- - dAtA[i] = 0x10 - } - if len(x.Reporter) > 0 { - i -= len(x.Reporter) - copy(dAtA[i:], x.Reporter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) - 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().(*MicroReport) - 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: MicroReport: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MicroReport: 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 Reporter", 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.Reporter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) - } - x.Power = 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.Power |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryType", 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.QueryType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field QueryId", 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.QueryId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AggregateMethod", 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.AggregateMethod = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) - } - x.BlockNumber = 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.BlockNumber |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", 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.Timestamp == nil { - x.Timestamp = ×tamppb.Timestamp{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Timestamp); 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_PayerInfo protoreflect.MessageDescriptor fd_PayerInfo_payerAddress protoreflect.FieldDescriptor fd_PayerInfo_amount protoreflect.FieldDescriptor fd_PayerInfo_fromBond protoreflect.FieldDescriptor + fd_PayerInfo_block_number protoreflect.FieldDescriptor ) func init() { @@ -2353,6 +1504,7 @@ func init() { fd_PayerInfo_payerAddress = md_PayerInfo.Fields().ByName("payerAddress") fd_PayerInfo_amount = md_PayerInfo.Fields().ByName("amount") fd_PayerInfo_fromBond = md_PayerInfo.Fields().ByName("fromBond") + fd_PayerInfo_block_number = md_PayerInfo.Fields().ByName("block_number") } var _ protoreflect.Message = (*fastReflection_PayerInfo)(nil) @@ -2364,7 +1516,7 @@ func (x *PayerInfo) ProtoReflect() protoreflect.Message { } func (x *PayerInfo) slowProtoReflect() protoreflect.Message { - mi := &file_layer_dispute_dispute_proto_msgTypes[2] + mi := &file_layer_dispute_dispute_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2426,8 +1578,8 @@ func (x *fastReflection_PayerInfo) Range(f func(protoreflect.FieldDescriptor, pr return } } - if x.Amount != nil { - value := protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) if !f(fd_PayerInfo_amount, value) { return } @@ -2438,6 +1590,12 @@ func (x *fastReflection_PayerInfo) Range(f func(protoreflect.FieldDescriptor, pr return } } + if x.BlockNumber != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockNumber) + if !f(fd_PayerInfo_block_number, value) { + return + } + } } // Has reports whether a field is populated. @@ -2456,9 +1614,11 @@ func (x *fastReflection_PayerInfo) Has(fd protoreflect.FieldDescriptor) bool { case "layer.dispute.PayerInfo.payerAddress": return x.PayerAddress != "" case "layer.dispute.PayerInfo.amount": - return x.Amount != nil + return x.Amount != "" case "layer.dispute.PayerInfo.fromBond": return x.FromBond != false + case "layer.dispute.PayerInfo.block_number": + return x.BlockNumber != int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.PayerInfo")) @@ -2478,9 +1638,11 @@ func (x *fastReflection_PayerInfo) Clear(fd protoreflect.FieldDescriptor) { case "layer.dispute.PayerInfo.payerAddress": x.PayerAddress = "" case "layer.dispute.PayerInfo.amount": - x.Amount = nil + x.Amount = "" case "layer.dispute.PayerInfo.fromBond": x.FromBond = false + case "layer.dispute.PayerInfo.block_number": + x.BlockNumber = int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.PayerInfo")) @@ -2502,10 +1664,13 @@ func (x *fastReflection_PayerInfo) Get(descriptor protoreflect.FieldDescriptor) return protoreflect.ValueOfString(value) case "layer.dispute.PayerInfo.amount": value := x.Amount - return protoreflect.ValueOfMessage(value.ProtoReflect()) + return protoreflect.ValueOfString(value) case "layer.dispute.PayerInfo.fromBond": value := x.FromBond return protoreflect.ValueOfBool(value) + case "layer.dispute.PayerInfo.block_number": + value := x.BlockNumber + return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.PayerInfo")) @@ -2529,9 +1694,11 @@ func (x *fastReflection_PayerInfo) Set(fd protoreflect.FieldDescriptor, value pr case "layer.dispute.PayerInfo.payerAddress": x.PayerAddress = value.Interface().(string) case "layer.dispute.PayerInfo.amount": - x.Amount = value.Message().Interface().(*v1beta1.Coin) + x.Amount = value.Interface().(string) case "layer.dispute.PayerInfo.fromBond": x.FromBond = value.Bool() + case "layer.dispute.PayerInfo.block_number": + x.BlockNumber = value.Int() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.PayerInfo")) @@ -2552,15 +1719,14 @@ func (x *fastReflection_PayerInfo) Set(fd protoreflect.FieldDescriptor, value pr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_PayerInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.dispute.PayerInfo.amount": - if x.Amount == nil { - x.Amount = new(v1beta1.Coin) - } - return protoreflect.ValueOfMessage(x.Amount.ProtoReflect()) case "layer.dispute.PayerInfo.payerAddress": panic(fmt.Errorf("field payerAddress of message layer.dispute.PayerInfo is not mutable")) + case "layer.dispute.PayerInfo.amount": + panic(fmt.Errorf("field amount of message layer.dispute.PayerInfo is not mutable")) case "layer.dispute.PayerInfo.fromBond": panic(fmt.Errorf("field fromBond of message layer.dispute.PayerInfo is not mutable")) + case "layer.dispute.PayerInfo.block_number": + panic(fmt.Errorf("field block_number of message layer.dispute.PayerInfo is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.PayerInfo")) @@ -2577,10 +1743,11 @@ func (x *fastReflection_PayerInfo) NewField(fd protoreflect.FieldDescriptor) pro case "layer.dispute.PayerInfo.payerAddress": return protoreflect.ValueOfString("") case "layer.dispute.PayerInfo.amount": - m := new(v1beta1.Coin) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + return protoreflect.ValueOfString("") case "layer.dispute.PayerInfo.fromBond": return protoreflect.ValueOfBool(false) + case "layer.dispute.PayerInfo.block_number": + return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.PayerInfo")) @@ -2654,13 +1821,16 @@ func (x *fastReflection_PayerInfo) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Amount != nil { - l = options.Size(x.Amount) + l = len(x.Amount) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } if x.FromBond { n += 2 } + if x.BlockNumber != 0 { + n += 1 + runtime.Sov(uint64(x.BlockNumber)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2690,6 +1860,11 @@ func (x *fastReflection_PayerInfo) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.BlockNumber != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockNumber)) + i-- + dAtA[i] = 0x20 + } if x.FromBond { i-- if x.FromBond { @@ -2700,17 +1875,10 @@ func (x *fastReflection_PayerInfo) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x18 } - if x.Amount != nil { - encoded, err := options.Marshal(x.Amount) - 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))) + 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 } @@ -2806,7 +1974,7 @@ func (x *fastReflection_PayerInfo) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2816,27 +1984,23 @@ func (x *fastReflection_PayerInfo) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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 } - if x.Amount == nil { - x.Amount = &v1beta1.Coin{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Amount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { @@ -2858,6 +2022,25 @@ func (x *fastReflection_PayerInfo) ProtoMethods() *protoiface.Methods { } } x.FromBond = bool(v != 0) + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + x.BlockNumber = 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.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3038,7 +2221,7 @@ type Dispute struct { DisputeRound uint64 `protobuf:"varint,9,opt,name=disputeRound,proto3" json:"disputeRound,omitempty"` SlashAmount string `protobuf:"bytes,10,opt,name=slashAmount,proto3" json:"slashAmount,omitempty"` BurnAmount string `protobuf:"bytes,11,opt,name=burnAmount,proto3" json:"burnAmount,omitempty"` - ReportEvidence *MicroReport `protobuf:"bytes,12,opt,name=reportEvidence,proto3" json:"reportEvidence,omitempty"` + ReportEvidence *oracle.MicroReport `protobuf:"bytes,12,opt,name=reportEvidence,proto3" json:"reportEvidence,omitempty"` FeePayers []*PayerInfo `protobuf:"bytes,13,rep,name=feePayers,proto3" json:"feePayers,omitempty"` FeeTotal string `protobuf:"bytes,14,opt,name=feeTotal,proto3" json:"feeTotal,omitempty"` PrevDisputeIds []uint64 `protobuf:"varint,15,rep,packed,name=prevDisputeIds,proto3" json:"prevDisputeIds,omitempty"` @@ -3141,7 +2324,7 @@ func (x *Dispute) GetBurnAmount() string { return "" } -func (x *Dispute) GetReportEvidence() *MicroReport { +func (x *Dispute) GetReportEvidence() *oracle.MicroReport { if x != nil { return x.ReportEvidence } @@ -3169,112 +2352,21 @@ func (x *Dispute) GetPrevDisputeIds() []uint64 { return nil } -// TODO: remove this duplicate -type MicroReport struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - QueryType string `protobuf:"bytes,3,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` - QueryId string `protobuf:"bytes,4,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` - AggregateMethod string `protobuf:"bytes,5,opt,name=aggregate_method,json=aggregateMethod,proto3" json:"aggregate_method,omitempty"` - Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - BlockNumber int64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - Timestamp *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` -} - -func (x *MicroReport) Reset() { - *x = MicroReport{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_dispute_dispute_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MicroReport) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MicroReport) ProtoMessage() {} - -// Deprecated: Use MicroReport.ProtoReflect.Descriptor instead. -func (*MicroReport) Descriptor() ([]byte, []int) { - return file_layer_dispute_dispute_proto_rawDescGZIP(), []int{1} -} - -func (x *MicroReport) GetReporter() string { - if x != nil { - return x.Reporter - } - return "" -} - -func (x *MicroReport) GetPower() int64 { - if x != nil { - return x.Power - } - return 0 -} - -func (x *MicroReport) GetQueryType() string { - if x != nil { - return x.QueryType - } - return "" -} - -func (x *MicroReport) GetQueryId() string { - if x != nil { - return x.QueryId - } - return "" -} - -func (x *MicroReport) GetAggregateMethod() string { - if x != nil { - return x.AggregateMethod - } - return "" -} - -func (x *MicroReport) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *MicroReport) GetBlockNumber() int64 { - if x != nil { - return x.BlockNumber - } - return 0 -} - -func (x *MicroReport) GetTimestamp() *timestamppb.Timestamp { - if x != nil { - return x.Timestamp - } - return nil -} - type PayerInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` - Amount *v1beta1.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` - FromBond bool `protobuf:"varint,3,opt,name=fromBond,proto3" json:"fromBond,omitempty"` + PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + FromBond bool `protobuf:"varint,3,opt,name=fromBond,proto3" json:"fromBond,omitempty"` + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (x *PayerInfo) Reset() { *x = PayerInfo{} if protoimpl.UnsafeEnabled { - mi := &file_layer_dispute_dispute_proto_msgTypes[2] + mi := &file_layer_dispute_dispute_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3288,7 +2380,7 @@ func (*PayerInfo) ProtoMessage() {} // Deprecated: Use PayerInfo.ProtoReflect.Descriptor instead. func (*PayerInfo) Descriptor() ([]byte, []int) { - return file_layer_dispute_dispute_proto_rawDescGZIP(), []int{2} + return file_layer_dispute_dispute_proto_rawDescGZIP(), []int{1} } func (x *PayerInfo) GetPayerAddress() string { @@ -3298,11 +2390,11 @@ func (x *PayerInfo) GetPayerAddress() string { return "" } -func (x *PayerInfo) GetAmount() *v1beta1.Coin { +func (x *PayerInfo) GetAmount() string { if x != nil { return x.Amount } - return nil + return "" } func (x *PayerInfo) GetFromBond() bool { @@ -3312,6 +2404,13 @@ func (x *PayerInfo) GetFromBond() bool { return false } +func (x *PayerInfo) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber + } + return 0 +} + var File_layer_dispute_dispute_proto protoreflect.FileDescriptor var file_layer_dispute_dispute_proto_rawDesc = []byte{ @@ -3324,52 +2423,54 @@ var file_layer_dispute_dispute_proto_rawDesc = []byte{ 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, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa1, - 0x07, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, - 0x73, 0x68, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, 0x68, - 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, - 0x12, 0x48, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, - 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x0a, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, - 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, 0x64, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x50, 0x0a, 0x10, 0x64, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x64, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4c, 0x0a, - 0x0e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x64, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x64, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0c, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x4d, 0x0a, - 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, - 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, - 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0a, - 0x62, 0x75, 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, 0x62, - 0x75, 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, 0x69, 0x63, + 0x72, 0x6f, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xa0, 0x07, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, + 0x61, 0x73, 0x68, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, + 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, + 0x64, 0x12, 0x48, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, + 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, + 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x0a, 0x64, + 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, 0x64, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, + 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x64, + 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x50, 0x0a, 0x10, + 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x64, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4c, + 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x64, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x11, + 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x4d, + 0x0a, 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, + 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, + 0x52, 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4b, 0x0a, + 0x0a, 0x62, 0x75, 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, + 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, + 0x62, 0x75, 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0e, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x73, @@ -3383,70 +2484,56 @@ var file_layer_dispute_dispute_proto_rawDesc = []byte{ 0x52, 0x08, 0x66, 0x65, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, - 0x64, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, - 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x29, - 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x79, 0x65, 0x72, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x65, - 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x37, 0x0a, 0x06, 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, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x2a, 0xc3, 0x01, - 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, - 0x79, 0x12, 0x31, 0x0a, 0x1c, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, - 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x1a, 0x0f, 0x8a, 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x18, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, - 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, - 0x10, 0x01, 0x1a, 0x0b, 0x8a, 0x9d, 0x20, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x12, - 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, - 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x49, 0x4e, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x09, 0x8a, 0x9d, 0x20, - 0x05, 0x4d, 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, - 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, - 0x10, 0x03, 0x1a, 0x09, 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x61, 0x6a, 0x6f, 0x72, 0x1a, 0x04, 0x88, - 0xa3, 0x1e, 0x00, 0x2a, 0xe6, 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x27, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, - 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x4f, 0x54, 0x45, 0x10, - 0x00, 0x1a, 0x0b, 0x8a, 0x9d, 0x20, 0x07, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x25, - 0x0a, 0x15, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, - 0x5f, 0x56, 0x4f, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x56, - 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x17, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, - 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, - 0x10, 0x02, 0x1a, 0x0c, 0x8a, 0x9d, 0x20, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, - 0x12, 0x2d, 0x0a, 0x19, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, - 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x03, 0x1a, - 0x0e, 0x8a, 0x9d, 0x20, 0x0a, 0x55, 0x6e, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, - 0x25, 0x0a, 0x15, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, - 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, - 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0x96, 0x01, 0x0a, - 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0x42, 0x0c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, + 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, + 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, + 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x72, 0x6f, + 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0xc3, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x31, 0x0a, 0x1c, + 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x0f, + 0x8a, 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, + 0x29, 0x0a, 0x18, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, + 0x4f, 0x52, 0x59, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0b, 0x8a, + 0x9d, 0x20, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, + 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, + 0x49, 0x4e, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x09, 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x69, 0x6e, 0x6f, + 0x72, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, + 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x10, 0x03, 0x1a, 0x09, 0x8a, + 0x9d, 0x20, 0x05, 0x4d, 0x61, 0x6a, 0x6f, 0x72, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x2a, 0xe6, + 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x27, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x4f, 0x54, 0x45, 0x10, 0x00, 0x1a, 0x0b, 0x8a, 0x9d, + 0x20, 0x07, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, 0x53, + 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x4f, 0x54, 0x49, + 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, + 0x12, 0x29, 0x0a, 0x17, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x55, 0x53, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x02, 0x1a, 0x0c, 0x8a, + 0x9d, 0x20, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x19, 0x44, + 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, + 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x03, 0x1a, 0x0e, 0x8a, 0x9d, 0x20, 0x0a, + 0x55, 0x6e, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, + 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, + 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0xa4, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0c, 0x44, + 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, + 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, + 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3462,30 +2549,27 @@ func file_layer_dispute_dispute_proto_rawDescGZIP() []byte { } var file_layer_dispute_dispute_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_layer_dispute_dispute_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_layer_dispute_dispute_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_layer_dispute_dispute_proto_goTypes = []interface{}{ (DisputeCategory)(0), // 0: layer.dispute.DisputeCategory (DisputeStatus)(0), // 1: layer.dispute.DisputeStatus (*Dispute)(nil), // 2: layer.dispute.Dispute - (*MicroReport)(nil), // 3: layer.dispute.MicroReport - (*PayerInfo)(nil), // 4: layer.dispute.PayerInfo - (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp - (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin + (*PayerInfo)(nil), // 3: layer.dispute.PayerInfo + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*oracle.MicroReport)(nil), // 5: layer.oracle.MicroReport } var file_layer_dispute_dispute_proto_depIdxs = []int32{ 0, // 0: layer.dispute.Dispute.disputeCategory:type_name -> layer.dispute.DisputeCategory 1, // 1: layer.dispute.Dispute.disputeStatus:type_name -> layer.dispute.DisputeStatus - 5, // 2: layer.dispute.Dispute.disputeStartTime:type_name -> google.protobuf.Timestamp - 5, // 3: layer.dispute.Dispute.disputeEndTime:type_name -> google.protobuf.Timestamp - 3, // 4: layer.dispute.Dispute.reportEvidence:type_name -> layer.dispute.MicroReport - 4, // 5: layer.dispute.Dispute.feePayers:type_name -> layer.dispute.PayerInfo - 5, // 6: layer.dispute.MicroReport.timestamp:type_name -> google.protobuf.Timestamp - 6, // 7: layer.dispute.PayerInfo.amount:type_name -> cosmos.base.v1beta1.Coin - 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 + 4, // 2: layer.dispute.Dispute.disputeStartTime:type_name -> google.protobuf.Timestamp + 4, // 3: layer.dispute.Dispute.disputeEndTime:type_name -> google.protobuf.Timestamp + 5, // 4: layer.dispute.Dispute.reportEvidence:type_name -> layer.oracle.MicroReport + 3, // 5: layer.dispute.Dispute.feePayers:type_name -> layer.dispute.PayerInfo + 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_layer_dispute_dispute_proto_init() } @@ -3507,18 +2591,6 @@ func file_layer_dispute_dispute_proto_init() { } } file_layer_dispute_dispute_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MicroReport); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_dispute_dispute_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PayerInfo); i { case 0: return &v.state @@ -3537,7 +2609,7 @@ func file_layer_dispute_dispute_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_dispute_dispute_proto_rawDesc, NumEnums: 2, - NumMessages: 3, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/api/layer/dispute/dispute_params.pulsar.go b/api/layer/dispute/dispute_params.pulsar.go index 527e0c62d..614776204 100644 --- a/api/layer/dispute/dispute_params.pulsar.go +++ b/api/layer/dispute/dispute_params.pulsar.go @@ -4,6 +4,7 @@ package dispute import ( fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" + oracle "github.com/tellor-io/layer/api/layer/oracle" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -184,7 +185,7 @@ func (x *fastReflection_DisputeParams) Get(descriptor protoreflect.FieldDescript func (x *fastReflection_DisputeParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "layer.dispute.DisputeParams.report": - x.Report = value.Message().Interface().(*MicroReport) + x.Report = value.Message().Interface().(*oracle.MicroReport) case "layer.dispute.DisputeParams.category": x.Category = (DisputeCategory)(value.Enum()) default: @@ -209,7 +210,7 @@ func (x *fastReflection_DisputeParams) Mutable(fd protoreflect.FieldDescriptor) switch fd.FullName() { case "layer.dispute.DisputeParams.report": if x.Report == nil { - x.Report = new(MicroReport) + x.Report = new(oracle.MicroReport) } return protoreflect.ValueOfMessage(x.Report.ProtoReflect()) case "layer.dispute.DisputeParams.category": @@ -228,7 +229,7 @@ func (x *fastReflection_DisputeParams) Mutable(fd protoreflect.FieldDescriptor) func (x *fastReflection_DisputeParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "layer.dispute.DisputeParams.report": - m := new(MicroReport) + m := new(oracle.MicroReport) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "layer.dispute.DisputeParams.category": return protoreflect.ValueOfEnum(0) @@ -435,7 +436,7 @@ func (x *fastReflection_DisputeParams) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } if x.Report == nil { - x.Report = &MicroReport{} + x.Report = &oracle.MicroReport{} } if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Report); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err @@ -513,8 +514,8 @@ type DisputeParams struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Report *MicroReport `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` - Category DisputeCategory `protobuf:"varint,2,opt,name=category,proto3,enum=layer.dispute.DisputeCategory" json:"category,omitempty"` + Report *oracle.MicroReport `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` + Category DisputeCategory `protobuf:"varint,2,opt,name=category,proto3,enum=layer.dispute.DisputeCategory" json:"category,omitempty"` } func (x *DisputeParams) Reset() { @@ -537,7 +538,7 @@ func (*DisputeParams) Descriptor() ([]byte, []int) { return file_layer_dispute_dispute_params_proto_rawDescGZIP(), []int{0} } -func (x *DisputeParams) GetReport() *MicroReport { +func (x *DisputeParams) GetReport() *oracle.MicroReport { if x != nil { return x.Report } @@ -559,25 +560,28 @@ var file_layer_dispute_dispute_params_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x1a, 0x1b, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x7f, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x1a, 0x1f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, + 0x69, 0x63, 0x72, 0x6f, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x7e, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3a, 0x0a, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, - 0x79, 0x42, 0x9c, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x79, 0x42, 0xaa, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x12, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, - 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, + 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, + 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -594,12 +598,12 @@ func file_layer_dispute_dispute_params_proto_rawDescGZIP() []byte { var file_layer_dispute_dispute_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_layer_dispute_dispute_params_proto_goTypes = []interface{}{ - (*DisputeParams)(nil), // 0: layer.dispute.DisputeParams - (*MicroReport)(nil), // 1: layer.dispute.MicroReport - (DisputeCategory)(0), // 2: layer.dispute.DisputeCategory + (*DisputeParams)(nil), // 0: layer.dispute.DisputeParams + (*oracle.MicroReport)(nil), // 1: layer.oracle.MicroReport + (DisputeCategory)(0), // 2: layer.dispute.DisputeCategory } var file_layer_dispute_dispute_params_proto_depIdxs = []int32{ - 1, // 0: layer.dispute.DisputeParams.report:type_name -> layer.dispute.MicroReport + 1, // 0: layer.dispute.DisputeParams.report:type_name -> layer.oracle.MicroReport 2, // 1: layer.dispute.DisputeParams.category:type_name -> layer.dispute.DisputeCategory 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type diff --git a/api/layer/dispute/genesis.pulsar.go b/api/layer/dispute/genesis.pulsar.go index 4fddd9440..ccada2ed5 100644 --- a/api/layer/dispute/genesis.pulsar.go +++ b/api/layer/dispute/genesis.pulsar.go @@ -510,17 +510,18 @@ var file_layer_dispute_genesis_proto_rawDesc = []byte{ 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x42, 0x96, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x61, 0x6d, 0x73, 0x42, 0xa4, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, - 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, - 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, - 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, - 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/open_disputes.pulsar.go b/api/layer/dispute/open_disputes.pulsar.go index a2d840190..19c904b7d 100644 --- a/api/layer/dispute/open_disputes.pulsar.go +++ b/api/layer/dispute/open_disputes.pulsar.go @@ -604,17 +604,18 @@ var file_layer_dispute_open_disputes_proto_rawDesc = []byte{ 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x22, 0x20, 0x0a, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, - 0x03, 0x69, 0x64, 0x73, 0x42, 0x9b, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x03, 0x69, 0x64, 0x73, 0x42, 0xa9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x11, 0x4f, 0x70, 0x65, 0x6e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, - 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, + 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, + 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/params.pulsar.go b/api/layer/dispute/params.pulsar.go index bd6079911..5131fa91c 100644 --- a/api/layer/dispute/params.pulsar.go +++ b/api/layer/dispute/params.pulsar.go @@ -417,17 +417,17 @@ var file_layer_dispute_params_proto_rawDesc = []byte{ 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x04, 0x98, 0xa0, 0x1f, - 0x00, 0x42, 0x95, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x00, 0x42, 0xa3, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, + 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/query.pulsar.go b/api/layer/dispute/query.pulsar.go index 3b9370e42..efa054d89 100644 --- a/api/layer/dispute/query.pulsar.go +++ b/api/layer/dispute/query.pulsar.go @@ -910,17 +910,18 @@ var file_layer_dispute_query_proto_rawDesc = []byte{ 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x94, 0x01, 0x0a, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa2, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, - 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, + 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, + 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/tally.pulsar.go b/api/layer/dispute/tally.pulsar.go index 468279569..489bf081a 100644 --- a/api/layer/dispute/tally.pulsar.go +++ b/api/layer/dispute/tally.pulsar.go @@ -688,17 +688,18 @@ var file_layer_dispute_tally_proto_rawDesc = []byte{ 0x73, 0x12, 0x35, 0x0a, 0x07, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x56, 0x6f, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x52, - 0x07, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x42, 0x94, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, + 0x07, 0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x42, 0xa2, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0a, - 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, - 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x54, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, + 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, + 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/tx.pulsar.go b/api/layer/dispute/tx.pulsar.go index e71da7ac3..6280747f2 100644 --- a/api/layer/dispute/tx.pulsar.go +++ b/api/layer/dispute/tx.pulsar.go @@ -7,6 +7,7 @@ import ( fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + oracle "github.com/tellor-io/layer/api/layer/oracle" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -234,7 +235,7 @@ func (x *fastReflection_MsgProposeDispute) Set(fd protoreflect.FieldDescriptor, case "layer.dispute.MsgProposeDispute.creator": x.Creator = value.Interface().(string) case "layer.dispute.MsgProposeDispute.report": - x.Report = value.Message().Interface().(*MicroReport) + x.Report = value.Message().Interface().(*oracle.MicroReport) case "layer.dispute.MsgProposeDispute.disputeCategory": x.DisputeCategory = (DisputeCategory)(value.Enum()) case "layer.dispute.MsgProposeDispute.fee": @@ -263,7 +264,7 @@ func (x *fastReflection_MsgProposeDispute) Mutable(fd protoreflect.FieldDescript switch fd.FullName() { case "layer.dispute.MsgProposeDispute.report": if x.Report == nil { - x.Report = new(MicroReport) + x.Report = new(oracle.MicroReport) } return protoreflect.ValueOfMessage(x.Report.ProtoReflect()) case "layer.dispute.MsgProposeDispute.fee": @@ -293,7 +294,7 @@ func (x *fastReflection_MsgProposeDispute) NewField(fd protoreflect.FieldDescrip case "layer.dispute.MsgProposeDispute.creator": return protoreflect.ValueOfString("") case "layer.dispute.MsgProposeDispute.report": - m := new(MicroReport) + m := new(oracle.MicroReport) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "layer.dispute.MsgProposeDispute.disputeCategory": return protoreflect.ValueOfEnum(0) @@ -579,7 +580,7 @@ func (x *fastReflection_MsgProposeDispute) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } if x.Report == nil { - x.Report = &MicroReport{} + x.Report = &oracle.MicroReport{} } if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Report); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err @@ -2947,11 +2948,11 @@ type MsgProposeDispute struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Report *MicroReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report,omitempty"` - DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"disputeCategory,omitempty"` - Fee *v1beta1.Coin `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee,omitempty"` - PayFromBond bool `protobuf:"varint,5,opt,name=payFromBond,proto3" json:"payFromBond,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Report *oracle.MicroReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report,omitempty"` + DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"disputeCategory,omitempty"` + Fee *v1beta1.Coin `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee,omitempty"` + PayFromBond bool `protobuf:"varint,5,opt,name=payFromBond,proto3" json:"payFromBond,omitempty"` } func (x *MsgProposeDispute) Reset() { @@ -2981,7 +2982,7 @@ func (x *MsgProposeDispute) GetCreator() string { return "" } -func (x *MsgProposeDispute) GetReport() *MicroReport { +func (x *MsgProposeDispute) GetReport() *oracle.MicroReport { if x != nil { return x.Report } @@ -3209,12 +3210,14 @@ var file_layer_dispute_tx_proto_rawDesc = []byte{ 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x02, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x6f, - 0x73, 0x65, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x6f, 0x72, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, + 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x02, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x50, 0x72, 0x6f, 0x70, + 0x6f, 0x73, 0x65, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x6f, 0x72, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x48, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, @@ -3270,16 +3273,17 @@ var file_layer_dispute_tx_proto_rawDesc = []byte{ 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x1a, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x56, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, - 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x91, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x9f, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, - 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, + 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3304,12 +3308,12 @@ var file_layer_dispute_tx_proto_goTypes = []interface{}{ (*MsgAddFeeToDisputeResponse)(nil), // 4: layer.dispute.MsgAddFeeToDisputeResponse (*MsgVote)(nil), // 5: layer.dispute.MsgVote (*MsgVoteResponse)(nil), // 6: layer.dispute.MsgVoteResponse - (*MicroReport)(nil), // 7: layer.dispute.MicroReport + (*oracle.MicroReport)(nil), // 7: layer.oracle.MicroReport (DisputeCategory)(0), // 8: layer.dispute.DisputeCategory (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin } var file_layer_dispute_tx_proto_depIdxs = []int32{ - 7, // 0: layer.dispute.MsgProposeDispute.report:type_name -> layer.dispute.MicroReport + 7, // 0: layer.dispute.MsgProposeDispute.report:type_name -> layer.oracle.MicroReport 8, // 1: layer.dispute.MsgProposeDispute.disputeCategory:type_name -> layer.dispute.DisputeCategory 9, // 2: layer.dispute.MsgProposeDispute.fee:type_name -> cosmos.base.v1beta1.Coin 9, // 3: layer.dispute.MsgAddFeeToDispute.amount:type_name -> cosmos.base.v1beta1.Coin diff --git a/api/layer/dispute/vote.pulsar.go b/api/layer/dispute/vote.pulsar.go index 08e3faef8..c306c257f 100644 --- a/api/layer/dispute/vote.pulsar.go +++ b/api/layer/dispute/vote.pulsar.go @@ -987,16 +987,17 @@ var file_layer_dispute_vote_proto_rawDesc = []byte{ 0x4a, 0x4f, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x41, 0x47, 0x41, 0x49, 0x4e, 0x53, 0x54, 0x10, 0x05, 0x12, 0x1e, 0x0a, 0x1a, 0x4e, 0x4f, 0x5f, 0x51, 0x55, 0x4f, 0x52, 0x55, 0x4d, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x49, 0x54, 0x59, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x06, - 0x42, 0x93, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, + 0x42, 0xa1, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x09, 0x56, 0x6f, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/dispute/voter_classes.pulsar.go b/api/layer/dispute/voter_classes.pulsar.go index 13ca8070b..18cd22f94 100644 --- a/api/layer/dispute/voter_classes.pulsar.go +++ b/api/layer/dispute/voter_classes.pulsar.go @@ -726,17 +726,18 @@ var file_layer_dispute_voter_classes_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, - 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x42, 0x9b, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, + 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x42, 0xa9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x11, 0x56, 0x6f, 0x74, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, - 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, + 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, + 0x02, 0x03, 0x4c, 0x44, 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, + 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/mint/genesis.pulsar.go b/api/layer/mint/genesis.pulsar.go index c7f99f76f..23a819053 100644 --- a/api/layer/mint/genesis.pulsar.go +++ b/api/layer/mint/genesis.pulsar.go @@ -651,16 +651,17 @@ var file_layer_mint_genesis_proto_rawDesc = []byte{ 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, - 0x4d, 0x69, 0x6e, 0x74, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x42, 0x84, 0x01, 0x0a, 0x0e, 0x63, + 0x4d, 0x69, 0x6e, 0x74, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x42, 0x92, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6d, 0x69, 0x6e, 0x74, 0x42, 0x0c, 0x47, - 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0xa2, 0x02, 0x03, 0x4c, 0x4d, 0x58, - 0xaa, 0x02, 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0xca, 0x02, 0x0a, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0xe2, 0x02, 0x16, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, 0x6e, - 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, + 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0xa2, 0x02, 0x03, 0x4c, 0x4d, 0x58, 0xaa, 0x02, + 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0xca, 0x02, 0x0a, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0xe2, 0x02, 0x16, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0b, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, 0x6e, 0x74, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/mint/mint.pulsar.go b/api/layer/mint/mint.pulsar.go index ab4d13c2d..2f0f767b9 100644 --- a/api/layer/mint/mint.pulsar.go +++ b/api/layer/mint/mint.pulsar.go @@ -591,15 +591,16 @@ var file_layer_mint_mint_proto_rawDesc = []byte{ 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6f, 0x6e, 0x64, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6f, 0x6e, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, - 0x42, 0x81, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6d, + 0x42, 0x8f, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6d, 0x69, 0x6e, 0x74, 0x42, 0x09, 0x4d, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0xa2, 0x02, 0x03, - 0x4c, 0x4d, 0x58, 0xaa, 0x02, 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, - 0xca, 0x02, 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0xe2, 0x02, 0x16, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, - 0x4d, 0x69, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, + 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0xa2, 0x02, 0x03, 0x4c, 0x4d, + 0x58, 0xaa, 0x02, 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0xca, 0x02, + 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0xe2, 0x02, 0x16, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, + 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/mint/module/module.pulsar.go b/api/layer/mint/module/module.pulsar.go index d0cda20b1..edcfa9764 100644 --- a/api/layer/mint/module/module.pulsar.go +++ b/api/layer/mint/module/module.pulsar.go @@ -496,19 +496,19 @@ var file_layer_mint_module_module_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x29, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x23, 0x0a, 0x21, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x78, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0x42, 0xae, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, + 0x72, 0x2f, 0x78, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0x42, 0xbc, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6d, 0x69, 0x6e, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x22, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x6d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4d, 0x4d, 0xaa, 0x02, 0x11, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, - 0x02, 0x11, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x1d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, - 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, 0x6e, - 0x74, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, + 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x6d, 0x6f, 0x64, + 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4d, 0x4d, 0xaa, 0x02, 0x11, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x11, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, + 0x65, 0xe2, 0x02, 0x1d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x13, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, 0x6e, 0x74, 0x3a, + 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/mint/query.pulsar.go b/api/layer/mint/query.pulsar.go index 1adacba72..3e77495dc 100644 --- a/api/layer/mint/query.pulsar.go +++ b/api/layer/mint/query.pulsar.go @@ -25,16 +25,17 @@ var File_layer_mint_query_proto protoreflect.FileDescriptor var file_layer_mint_query_proto_rawDesc = []byte{ 0x0a, 0x16, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x6d, 0x69, 0x6e, 0x74, 0x32, 0x07, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x82, 0x01, + 0x6d, 0x69, 0x6e, 0x74, 0x32, 0x07, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x90, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6d, 0x69, 0x6e, 0x74, - 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1b, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0xa2, 0x02, 0x03, 0x4c, 0x4d, - 0x58, 0xaa, 0x02, 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0xca, 0x02, - 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0xe2, 0x02, 0x16, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, - 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, + 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6d, 0x69, 0x6e, 0x74, 0xa2, 0x02, 0x03, 0x4c, 0x4d, 0x58, 0xaa, + 0x02, 0x0a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4d, 0x69, 0x6e, 0x74, 0xca, 0x02, 0x0a, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0xe2, 0x02, 0x16, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x4d, 0x69, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0b, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x69, 0x6e, 0x74, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_layer_mint_query_proto_goTypes = []interface{}{} diff --git a/api/layer/oracle/aggregate.pulsar.go b/api/layer/oracle/aggregate.pulsar.go index e8e69cb80..83e58a506 100644 --- a/api/layer/oracle/aggregate.pulsar.go +++ b/api/layer/oracle/aggregate.pulsar.go @@ -1622,17 +1622,18 @@ var file_layer_oracle_aggregate_proto_rawDesc = []byte{ 0x61, 0x6d, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, - 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x42, 0x92, 0x01, 0x0a, + 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x42, 0xa0, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/aggregate_reporter.pulsar.go b/api/layer/oracle/aggregate_reporter.pulsar.go index 402ebfdc5..b342309e7 100644 --- a/api/layer/oracle/aggregate_reporter.pulsar.go +++ b/api/layer/oracle/aggregate_reporter.pulsar.go @@ -546,18 +546,18 @@ var file_layer_oracle_aggregate_reporter_proto_rawDesc = []byte{ 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x9a, 0x01, 0x0a, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x16, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, - 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, - 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, - 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x72, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, + 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, + 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, + 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/commit_report.pulsar.go b/api/layer/oracle/commit_report.pulsar.go index f2ef9695c..5def88863 100644 --- a/api/layer/oracle/commit_report.pulsar.go +++ b/api/layer/oracle/commit_report.pulsar.go @@ -702,17 +702,18 @@ var file_layer_oracle_commit_report_proto_rawDesc = []byte{ 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x6e, - 0x63, 0x79, 0x63, 0x6c, 0x65, 0x42, 0x95, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, + 0x63, 0x79, 0x63, 0x6c, 0x65, 0x42, 0xa3, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, - 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, + 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, + 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/genesis.pulsar.go b/api/layer/oracle/genesis.pulsar.go index 1d57df04f..5987f3ac9 100644 --- a/api/layer/oracle/genesis.pulsar.go +++ b/api/layer/oracle/genesis.pulsar.go @@ -644,16 +644,17 @@ var file_layer_oracle_genesis_proto_rawDesc = []byte{ 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x0a, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, - 0x69, 0x73, 0x74, 0x42, 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x69, 0x73, 0x74, 0x42, 0x9e, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/micro_report.pulsar.go b/api/layer/oracle/micro_report.pulsar.go index 0ba5b3177..0baef9c7a 100644 --- a/api/layer/oracle/micro_report.pulsar.go +++ b/api/layer/oracle/micro_report.pulsar.go @@ -15,15 +15,16 @@ import ( ) var ( - md_MicroReport protoreflect.MessageDescriptor - fd_MicroReport_reporter protoreflect.FieldDescriptor - fd_MicroReport_power protoreflect.FieldDescriptor - fd_MicroReport_queryType protoreflect.FieldDescriptor - fd_MicroReport_queryId protoreflect.FieldDescriptor - fd_MicroReport_aggregateMethod protoreflect.FieldDescriptor - fd_MicroReport_value protoreflect.FieldDescriptor - fd_MicroReport_timestamp protoreflect.FieldDescriptor - fd_MicroReport_cyclelist protoreflect.FieldDescriptor + md_MicroReport protoreflect.MessageDescriptor + fd_MicroReport_reporter protoreflect.FieldDescriptor + fd_MicroReport_power protoreflect.FieldDescriptor + fd_MicroReport_query_type protoreflect.FieldDescriptor + fd_MicroReport_query_id protoreflect.FieldDescriptor + fd_MicroReport_aggregate_method protoreflect.FieldDescriptor + fd_MicroReport_value protoreflect.FieldDescriptor + fd_MicroReport_timestamp protoreflect.FieldDescriptor + fd_MicroReport_cyclelist protoreflect.FieldDescriptor + fd_MicroReport_block_number protoreflect.FieldDescriptor ) func init() { @@ -31,12 +32,13 @@ func init() { md_MicroReport = File_layer_oracle_micro_report_proto.Messages().ByName("MicroReport") fd_MicroReport_reporter = md_MicroReport.Fields().ByName("reporter") fd_MicroReport_power = md_MicroReport.Fields().ByName("power") - fd_MicroReport_queryType = md_MicroReport.Fields().ByName("queryType") - fd_MicroReport_queryId = md_MicroReport.Fields().ByName("queryId") - fd_MicroReport_aggregateMethod = md_MicroReport.Fields().ByName("aggregateMethod") + fd_MicroReport_query_type = md_MicroReport.Fields().ByName("query_type") + fd_MicroReport_query_id = md_MicroReport.Fields().ByName("query_id") + fd_MicroReport_aggregate_method = md_MicroReport.Fields().ByName("aggregate_method") fd_MicroReport_value = md_MicroReport.Fields().ByName("value") fd_MicroReport_timestamp = md_MicroReport.Fields().ByName("timestamp") fd_MicroReport_cyclelist = md_MicroReport.Fields().ByName("cyclelist") + fd_MicroReport_block_number = md_MicroReport.Fields().ByName("block_number") } var _ protoreflect.Message = (*fastReflection_MicroReport)(nil) @@ -118,19 +120,19 @@ func (x *fastReflection_MicroReport) Range(f func(protoreflect.FieldDescriptor, } if x.QueryType != "" { value := protoreflect.ValueOfString(x.QueryType) - if !f(fd_MicroReport_queryType, value) { + if !f(fd_MicroReport_query_type, value) { return } } if x.QueryId != "" { value := protoreflect.ValueOfString(x.QueryId) - if !f(fd_MicroReport_queryId, value) { + if !f(fd_MicroReport_query_id, value) { return } } if x.AggregateMethod != "" { value := protoreflect.ValueOfString(x.AggregateMethod) - if !f(fd_MicroReport_aggregateMethod, value) { + if !f(fd_MicroReport_aggregate_method, value) { return } } @@ -152,6 +154,12 @@ func (x *fastReflection_MicroReport) Range(f func(protoreflect.FieldDescriptor, return } } + if x.BlockNumber != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockNumber) + if !f(fd_MicroReport_block_number, value) { + return + } + } } // Has reports whether a field is populated. @@ -171,11 +179,11 @@ func (x *fastReflection_MicroReport) Has(fd protoreflect.FieldDescriptor) bool { return x.Reporter != "" case "layer.oracle.MicroReport.power": return x.Power != int64(0) - case "layer.oracle.MicroReport.queryType": + case "layer.oracle.MicroReport.query_type": return x.QueryType != "" - case "layer.oracle.MicroReport.queryId": + case "layer.oracle.MicroReport.query_id": return x.QueryId != "" - case "layer.oracle.MicroReport.aggregateMethod": + case "layer.oracle.MicroReport.aggregate_method": return x.AggregateMethod != "" case "layer.oracle.MicroReport.value": return x.Value != "" @@ -183,6 +191,8 @@ func (x *fastReflection_MicroReport) Has(fd protoreflect.FieldDescriptor) bool { return x.Timestamp != nil case "layer.oracle.MicroReport.cyclelist": return x.Cyclelist != false + case "layer.oracle.MicroReport.block_number": + return x.BlockNumber != int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -203,11 +213,11 @@ func (x *fastReflection_MicroReport) Clear(fd protoreflect.FieldDescriptor) { x.Reporter = "" case "layer.oracle.MicroReport.power": x.Power = int64(0) - case "layer.oracle.MicroReport.queryType": + case "layer.oracle.MicroReport.query_type": x.QueryType = "" - case "layer.oracle.MicroReport.queryId": + case "layer.oracle.MicroReport.query_id": x.QueryId = "" - case "layer.oracle.MicroReport.aggregateMethod": + case "layer.oracle.MicroReport.aggregate_method": x.AggregateMethod = "" case "layer.oracle.MicroReport.value": x.Value = "" @@ -215,6 +225,8 @@ func (x *fastReflection_MicroReport) Clear(fd protoreflect.FieldDescriptor) { x.Timestamp = nil case "layer.oracle.MicroReport.cyclelist": x.Cyclelist = false + case "layer.oracle.MicroReport.block_number": + x.BlockNumber = int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -237,13 +249,13 @@ func (x *fastReflection_MicroReport) Get(descriptor protoreflect.FieldDescriptor case "layer.oracle.MicroReport.power": value := x.Power return protoreflect.ValueOfInt64(value) - case "layer.oracle.MicroReport.queryType": + case "layer.oracle.MicroReport.query_type": value := x.QueryType return protoreflect.ValueOfString(value) - case "layer.oracle.MicroReport.queryId": + case "layer.oracle.MicroReport.query_id": value := x.QueryId return protoreflect.ValueOfString(value) - case "layer.oracle.MicroReport.aggregateMethod": + case "layer.oracle.MicroReport.aggregate_method": value := x.AggregateMethod return protoreflect.ValueOfString(value) case "layer.oracle.MicroReport.value": @@ -255,6 +267,9 @@ func (x *fastReflection_MicroReport) Get(descriptor protoreflect.FieldDescriptor case "layer.oracle.MicroReport.cyclelist": value := x.Cyclelist return protoreflect.ValueOfBool(value) + case "layer.oracle.MicroReport.block_number": + value := x.BlockNumber + return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -279,11 +294,11 @@ func (x *fastReflection_MicroReport) Set(fd protoreflect.FieldDescriptor, value x.Reporter = value.Interface().(string) case "layer.oracle.MicroReport.power": x.Power = value.Int() - case "layer.oracle.MicroReport.queryType": + case "layer.oracle.MicroReport.query_type": x.QueryType = value.Interface().(string) - case "layer.oracle.MicroReport.queryId": + case "layer.oracle.MicroReport.query_id": x.QueryId = value.Interface().(string) - case "layer.oracle.MicroReport.aggregateMethod": + case "layer.oracle.MicroReport.aggregate_method": x.AggregateMethod = value.Interface().(string) case "layer.oracle.MicroReport.value": x.Value = value.Interface().(string) @@ -291,6 +306,8 @@ func (x *fastReflection_MicroReport) Set(fd protoreflect.FieldDescriptor, value x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) case "layer.oracle.MicroReport.cyclelist": x.Cyclelist = value.Bool() + case "layer.oracle.MicroReport.block_number": + x.BlockNumber = value.Int() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -320,16 +337,18 @@ func (x *fastReflection_MicroReport) Mutable(fd protoreflect.FieldDescriptor) pr panic(fmt.Errorf("field reporter of message layer.oracle.MicroReport is not mutable")) case "layer.oracle.MicroReport.power": panic(fmt.Errorf("field power of message layer.oracle.MicroReport is not mutable")) - case "layer.oracle.MicroReport.queryType": - panic(fmt.Errorf("field queryType of message layer.oracle.MicroReport is not mutable")) - case "layer.oracle.MicroReport.queryId": - panic(fmt.Errorf("field queryId of message layer.oracle.MicroReport is not mutable")) - case "layer.oracle.MicroReport.aggregateMethod": - panic(fmt.Errorf("field aggregateMethod of message layer.oracle.MicroReport is not mutable")) + case "layer.oracle.MicroReport.query_type": + panic(fmt.Errorf("field query_type of message layer.oracle.MicroReport is not mutable")) + case "layer.oracle.MicroReport.query_id": + panic(fmt.Errorf("field query_id of message layer.oracle.MicroReport is not mutable")) + case "layer.oracle.MicroReport.aggregate_method": + panic(fmt.Errorf("field aggregate_method of message layer.oracle.MicroReport is not mutable")) case "layer.oracle.MicroReport.value": panic(fmt.Errorf("field value of message layer.oracle.MicroReport is not mutable")) case "layer.oracle.MicroReport.cyclelist": panic(fmt.Errorf("field cyclelist of message layer.oracle.MicroReport is not mutable")) + case "layer.oracle.MicroReport.block_number": + panic(fmt.Errorf("field block_number of message layer.oracle.MicroReport is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -347,11 +366,11 @@ func (x *fastReflection_MicroReport) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfString("") case "layer.oracle.MicroReport.power": return protoreflect.ValueOfInt64(int64(0)) - case "layer.oracle.MicroReport.queryType": + case "layer.oracle.MicroReport.query_type": return protoreflect.ValueOfString("") - case "layer.oracle.MicroReport.queryId": + case "layer.oracle.MicroReport.query_id": return protoreflect.ValueOfString("") - case "layer.oracle.MicroReport.aggregateMethod": + case "layer.oracle.MicroReport.aggregate_method": return protoreflect.ValueOfString("") case "layer.oracle.MicroReport.value": return protoreflect.ValueOfString("") @@ -360,6 +379,8 @@ func (x *fastReflection_MicroReport) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfMessage(m.ProtoReflect()) case "layer.oracle.MicroReport.cyclelist": return protoreflect.ValueOfBool(false) + case "layer.oracle.MicroReport.block_number": + return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.MicroReport")) @@ -459,6 +480,9 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { if x.Cyclelist { n += 2 } + if x.BlockNumber != 0 { + n += 1 + runtime.Sov(uint64(x.BlockNumber)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -488,6 +512,11 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.BlockNumber != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockNumber)) + i-- + dAtA[i] = 0x48 + } if x.Cyclelist { i-- if x.Cyclelist { @@ -836,6 +865,25 @@ func (x *fastReflection_MicroReport) ProtoMethods() *protoiface.Methods { } } x.Cyclelist = bool(v != 0) + case 9: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + x.BlockNumber = 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.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -884,19 +932,30 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// MicroReport represents data for a single report type MicroReport struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - QueryType string `protobuf:"bytes,3,opt,name=queryType,proto3" json:"queryType,omitempty"` - QueryId string `protobuf:"bytes,4,opt,name=queryId,proto3" json:"queryId,omitempty"` - AggregateMethod string `protobuf:"bytes,5,opt,name=aggregateMethod,proto3" json:"aggregateMethod,omitempty"` - Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - Timestamp *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Cyclelist bool `protobuf:"varint,8,opt,name=cyclelist,proto3" json:"cyclelist,omitempty"` + // reporter is the address of the reporter + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + // the power of the reporter based on total tokens normalized + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + // string identifier of the data spec + QueryType string `protobuf:"bytes,3,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + // hash of the query data + QueryId string `protobuf:"bytes,4,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + // aggregate method to use for aggregating all the reports for the query id + AggregateMethod string `protobuf:"bytes,5,opt,name=aggregate_method,json=aggregateMethod,proto3" json:"aggregate_method,omitempty"` + // hex string of the response value + Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` + // timestamp of when the report was created + Timestamp *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // indicates if the report's query id is in the cyclelist + Cyclelist bool `protobuf:"varint,8,opt,name=cyclelist,proto3" json:"cyclelist,omitempty"` + // block number of when the report was created + BlockNumber int64 `protobuf:"varint,9,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (x *MicroReport) Reset() { @@ -975,6 +1034,13 @@ func (x *MicroReport) GetCyclelist() bool { return false } +func (x *MicroReport) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber + } + return 0 +} + var File_layer_oracle_micro_report_proto protoreflect.FileDescriptor var file_layer_oracle_micro_report_proto_rawDesc = []byte{ @@ -984,35 +1050,38 @@ var file_layer_oracle_micro_report_proto_rawDesc = []byte{ 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x02, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x02, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, - 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, - 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, - 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, - 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, - 0x73, 0x74, 0x42, 0x94, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x10, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, - 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, - 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, - 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x03, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, + 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x49, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, + 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, 0xa2, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, + 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x10, 0x4d, + 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, + 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, + 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, + 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/params.pulsar.go b/api/layer/oracle/params.pulsar.go index 833430f0f..f2df84e0a 100644 --- a/api/layer/oracle/params.pulsar.go +++ b/api/layer/oracle/params.pulsar.go @@ -499,17 +499,18 @@ var file_layer_oracle_params_proto_rawDesc = []byte{ 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0x8f, 0x01, 0x0a, 0x10, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0x9d, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, - 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, - 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, + 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, + 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, + 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/query.pulsar.go b/api/layer/oracle/query.pulsar.go index 384ddd4fc..9737ee0f6 100644 --- a/api/layer/oracle/query.pulsar.go +++ b/api/layer/oracle/query.pulsar.go @@ -8583,17 +8583,18 @@ var file_layer_oracle_query_proto_rawDesc = []byte{ 0x73, 0x65, 0x22, 0x37, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x12, 0x2f, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x79, 0x63, 0x6c, - 0x65, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x8e, 0x01, 0x0a, 0x10, + 0x65, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x9c, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, - 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, + 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, + 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, + 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/query_meta.pulsar.go b/api/layer/oracle/query_meta.pulsar.go index d73923db3..21d78549f 100644 --- a/api/layer/oracle/query_meta.pulsar.go +++ b/api/layer/oracle/query_meta.pulsar.go @@ -23,7 +23,7 @@ var ( fd_QueryMeta_amount protoreflect.FieldDescriptor fd_QueryMeta_expiration protoreflect.FieldDescriptor fd_QueryMeta_registry_spec_timeframe protoreflect.FieldDescriptor - fd_QueryMeta_hasRevealedReports protoreflect.FieldDescriptor + fd_QueryMeta_has_revealed_reports protoreflect.FieldDescriptor fd_QueryMeta_query_id protoreflect.FieldDescriptor fd_QueryMeta_query_type protoreflect.FieldDescriptor ) @@ -35,7 +35,7 @@ func init() { fd_QueryMeta_amount = md_QueryMeta.Fields().ByName("amount") fd_QueryMeta_expiration = md_QueryMeta.Fields().ByName("expiration") fd_QueryMeta_registry_spec_timeframe = md_QueryMeta.Fields().ByName("registry_spec_timeframe") - fd_QueryMeta_hasRevealedReports = md_QueryMeta.Fields().ByName("hasRevealedReports") + fd_QueryMeta_has_revealed_reports = md_QueryMeta.Fields().ByName("has_revealed_reports") fd_QueryMeta_query_id = md_QueryMeta.Fields().ByName("query_id") fd_QueryMeta_query_type = md_QueryMeta.Fields().ByName("query_type") } @@ -131,7 +131,7 @@ func (x *fastReflection_QueryMeta) Range(f func(protoreflect.FieldDescriptor, pr } if x.HasRevealedReports != false { value := protoreflect.ValueOfBool(x.HasRevealedReports) - if !f(fd_QueryMeta_hasRevealedReports, value) { + if !f(fd_QueryMeta_has_revealed_reports, value) { return } } @@ -170,7 +170,7 @@ func (x *fastReflection_QueryMeta) Has(fd protoreflect.FieldDescriptor) bool { return x.Expiration != nil case "layer.oracle.QueryMeta.registry_spec_timeframe": return x.RegistrySpecTimeframe != nil - case "layer.oracle.QueryMeta.hasRevealedReports": + case "layer.oracle.QueryMeta.has_revealed_reports": return x.HasRevealedReports != false case "layer.oracle.QueryMeta.query_id": return len(x.QueryId) != 0 @@ -200,7 +200,7 @@ func (x *fastReflection_QueryMeta) Clear(fd protoreflect.FieldDescriptor) { x.Expiration = nil case "layer.oracle.QueryMeta.registry_spec_timeframe": x.RegistrySpecTimeframe = nil - case "layer.oracle.QueryMeta.hasRevealedReports": + case "layer.oracle.QueryMeta.has_revealed_reports": x.HasRevealedReports = false case "layer.oracle.QueryMeta.query_id": x.QueryId = nil @@ -234,7 +234,7 @@ func (x *fastReflection_QueryMeta) Get(descriptor protoreflect.FieldDescriptor) case "layer.oracle.QueryMeta.registry_spec_timeframe": value := x.RegistrySpecTimeframe return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "layer.oracle.QueryMeta.hasRevealedReports": + case "layer.oracle.QueryMeta.has_revealed_reports": value := x.HasRevealedReports return protoreflect.ValueOfBool(value) case "layer.oracle.QueryMeta.query_id": @@ -271,7 +271,7 @@ func (x *fastReflection_QueryMeta) Set(fd protoreflect.FieldDescriptor, value pr x.Expiration = value.Message().Interface().(*timestamppb.Timestamp) case "layer.oracle.QueryMeta.registry_spec_timeframe": x.RegistrySpecTimeframe = value.Message().Interface().(*durationpb.Duration) - case "layer.oracle.QueryMeta.hasRevealedReports": + case "layer.oracle.QueryMeta.has_revealed_reports": x.HasRevealedReports = value.Bool() case "layer.oracle.QueryMeta.query_id": x.QueryId = value.Bytes() @@ -311,8 +311,8 @@ func (x *fastReflection_QueryMeta) Mutable(fd protoreflect.FieldDescriptor) prot panic(fmt.Errorf("field id of message layer.oracle.QueryMeta is not mutable")) case "layer.oracle.QueryMeta.amount": panic(fmt.Errorf("field amount of message layer.oracle.QueryMeta is not mutable")) - case "layer.oracle.QueryMeta.hasRevealedReports": - panic(fmt.Errorf("field hasRevealedReports of message layer.oracle.QueryMeta is not mutable")) + case "layer.oracle.QueryMeta.has_revealed_reports": + panic(fmt.Errorf("field has_revealed_reports of message layer.oracle.QueryMeta is not mutable")) case "layer.oracle.QueryMeta.query_id": panic(fmt.Errorf("field query_id of message layer.oracle.QueryMeta is not mutable")) case "layer.oracle.QueryMeta.query_type": @@ -340,7 +340,7 @@ func (x *fastReflection_QueryMeta) NewField(fd protoreflect.FieldDescriptor) pro case "layer.oracle.QueryMeta.registry_spec_timeframe": m := new(durationpb.Duration) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "layer.oracle.QueryMeta.hasRevealedReports": + case "layer.oracle.QueryMeta.has_revealed_reports": return protoreflect.ValueOfBool(false) case "layer.oracle.QueryMeta.query_id": return protoreflect.ValueOfBytes(nil) @@ -840,18 +840,26 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// QueryMeta represents the metadata of a query type QueryMeta struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` - Expiration *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expiration,proto3" json:"expiration,omitempty"` - RegistrySpecTimeframe *durationpb.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3" json:"registry_spec_timeframe,omitempty"` - HasRevealedReports bool `protobuf:"varint,5,opt,name=hasRevealedReports,proto3" json:"hasRevealedReports,omitempty"` - QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` - QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + // unique id of the query that changes after query's lifecycle ends + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // amount of tokens that was tipped + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + // expiration time of the query + Expiration *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expiration,proto3" json:"expiration,omitempty"` + // timeframe of the query according to the data spec + RegistrySpecTimeframe *durationpb.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3" json:"registry_spec_timeframe,omitempty"` + // indicates whether query has revealed reports + HasRevealedReports bool `protobuf:"varint,5,opt,name=has_revealed_reports,json=hasRevealedReports,proto3" json:"has_revealed_reports,omitempty"` + // unique id of the query according to the data spec + QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + // sttring identifier of the data spec + QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` } func (x *QueryMeta) Reset() { @@ -937,7 +945,7 @@ var file_layer_oracle_query_meta_proto_rawDesc = []byte{ 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xf2, 0x02, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, + 0x74, 0x6f, 0x22, 0xf4, 0x02, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, @@ -953,17 +961,18 @@ var file_layer_oracle_query_meta_proto_rawDesc = []byte{ 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x15, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x53, 0x70, 0x65, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, - 0x12, 0x68, 0x61, 0x73, 0x52, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x68, 0x61, 0x73, 0x52, 0x65, - 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x19, 0x0a, - 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x72, - 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x92, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, + 0x53, 0x70, 0x65, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, + 0x14, 0x68, 0x61, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x5f, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x68, 0x61, 0x73, + 0x52, 0x65, 0x76, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, + 0x19, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x79, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0xa0, 0x01, 0x0a, 0x10, 0x63, 0x6f, + 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, + 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, diff --git a/api/layer/oracle/reports.pulsar.go b/api/layer/oracle/reports.pulsar.go index a87eb3200..6222e13d3 100644 --- a/api/layer/oracle/reports.pulsar.go +++ b/api/layer/oracle/reports.pulsar.go @@ -566,16 +566,17 @@ var file_layer_oracle_reports_proto_rawDesc = []byte{ 0x65, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x0c, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x73, 0x42, 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, + 0x70, 0x6f, 0x72, 0x74, 0x73, 0x42, 0x9e, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, - 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, - 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/tips.pulsar.go b/api/layer/oracle/tips.pulsar.go index b3984160b..d5acd26a6 100644 --- a/api/layer/oracle/tips.pulsar.go +++ b/api/layer/oracle/tips.pulsar.go @@ -583,7 +583,7 @@ type Tips struct { // queryData is the query data that was tipped QueryData string `protobuf:"bytes,1,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` - // amount is the amount that was tipped + // the amount that was tipped Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` // totalTips is the total amount of tips for this query data so far TotalTips string `protobuf:"bytes,3,opt,name=total_tips,json=totalTips,proto3" json:"total_tips,omitempty"` @@ -650,16 +650,17 @@ var file_layer_oracle_tips_proto_rawDesc = []byte{ 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x54, 0x69, 0x70, - 0x73, 0x42, 0x8d, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x73, 0x42, 0x9b, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x09, 0x54, 0x69, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, - 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/tx.pulsar.go b/api/layer/oracle/tx.pulsar.go index 749a70dc3..59895627e 100644 --- a/api/layer/oracle/tx.pulsar.go +++ b/api/layer/oracle/tx.pulsar.go @@ -5056,16 +5056,17 @@ var file_layer_oracle_tx_proto_rawDesc = []byte{ 0x43, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x8b, 0x01, 0x0a, 0x10, 0x63, + 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x99, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, - 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, - 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, - 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/oracle/user_tip.pulsar.go b/api/layer/oracle/user_tip.pulsar.go index 33e767837..dc3da7a67 100644 --- a/api/layer/oracle/user_tip.pulsar.go +++ b/api/layer/oracle/user_tip.pulsar.go @@ -574,16 +574,17 @@ var file_layer_oracle_user_tip_proto_rawDesc = []byte{ 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x90, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x9e, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x54, - 0x69, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, - 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, - 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/registry/data_spec.pulsar.go b/api/layer/registry/data_spec.pulsar.go index 61671c58f..4ebe1c80f 100644 --- a/api/layer/registry/data_spec.pulsar.go +++ b/api/layer/registry/data_spec.pulsar.go @@ -1665,18 +1665,19 @@ var file_layer_registry_data_spec_proto_rawDesc = []byte{ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x12, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x42, - 0x75, 0x66, 0x66, 0x65, 0x72, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x42, 0x9d, 0x01, 0x0a, 0x12, + 0x75, 0x66, 0x66, 0x65, 0x72, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x42, 0xab, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x0d, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, + 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/api/layer/registry/genesis.pulsar.go b/api/layer/registry/genesis.pulsar.go index b69dab375..769336970 100644 --- a/api/layer/registry/genesis.pulsar.go +++ b/api/layer/registry/genesis.pulsar.go @@ -605,17 +605,18 @@ var file_layer_registry_genesis_proto_rawDesc = []byte{ 0x73, 0x70, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, - 0x73, 0x70, 0x65, 0x63, 0x42, 0x9c, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x73, 0x70, 0x65, 0x63, 0x42, 0xaa, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x0c, 0x47, 0x65, 0x6e, - 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, - 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, + 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, + 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/registry/params.pulsar.go b/api/layer/registry/params.pulsar.go index 26218fc37..696b8bb35 100644 --- a/api/layer/registry/params.pulsar.go +++ b/api/layer/registry/params.pulsar.go @@ -417,17 +417,18 @@ var file_layer_registry_params_proto_rawDesc = []byte{ 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x04, 0x98, - 0xa0, 0x1f, 0x00, 0x42, 0x9b, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0xa0, 0x1f, 0x00, 0x42, 0xa9, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, - 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, + 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, + 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/registry/query.pulsar.go b/api/layer/registry/query.pulsar.go index 75e1d1286..ba92fe96f 100644 --- a/api/layer/registry/query.pulsar.go +++ b/api/layer/registry/query.pulsar.go @@ -4801,17 +4801,18 @@ var file_layer_registry_query_proto_rawDesc = []byte{ 0x32, 0x12, 0x30, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2f, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2f, 0x7b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x7d, 0x2f, 0x7b, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x7d, 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x75, 0x65, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, 0x02, + 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xe2, + 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/registry/tx.pulsar.go b/api/layer/registry/tx.pulsar.go index 3b00f6de2..e4427ae62 100644 --- a/api/layer/registry/tx.pulsar.go +++ b/api/layer/registry/tx.pulsar.go @@ -2083,17 +2083,18 @@ var file_layer_registry_tx_proto_rawDesc = []byte{ 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x53, 0x70, 0x65, 0x63, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa5, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, - 0x79, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x5c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, + 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xa2, + 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/delegation.pulsar.go b/api/layer/reporter/delegation.pulsar.go index 169d78c7a..e149b0c8b 100644 --- a/api/layer/reporter/delegation.pulsar.go +++ b/api/layer/reporter/delegation.pulsar.go @@ -575,17 +575,18 @@ var file_layer_reporter_delegation_proto_rawDesc = []byte{ 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x9f, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xad, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0f, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, - 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, + 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, + 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/distribution.pulsar.go b/api/layer/reporter/distribution.pulsar.go index f8f257d01..19e18d6b8 100644 --- a/api/layer/reporter/distribution.pulsar.go +++ b/api/layer/reporter/distribution.pulsar.go @@ -3441,18 +3441,19 @@ var file_layer_reporter_distribution_proto_rawDesc = []byte{ 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, 0x08, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xa1, 0x01, 0x0a, + 0x65, 0x63, 0x52, 0x08, 0x66, 0x72, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xaf, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x11, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, - 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, + 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, + 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/genesis.pulsar.go b/api/layer/reporter/genesis.pulsar.go index 743f782e3..9a2118853 100644 --- a/api/layer/reporter/genesis.pulsar.go +++ b/api/layer/reporter/genesis.pulsar.go @@ -514,17 +514,18 @@ var file_layer_reporter_genesis_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0x9c, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, + 0xaa, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, - 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, - 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/module/module.pulsar.go b/api/layer/reporter/module/module.pulsar.go index 7d1811913..081a1ce72 100644 --- a/api/layer/reporter/module/module.pulsar.go +++ b/api/layer/reporter/module/module.pulsar.go @@ -497,20 +497,21 @@ var file_layer_reporter_module_module_proto_rawDesc = []byte{ 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x2d, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x27, 0x0a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x78, 0x2f, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x42, 0xc6, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x72, 0x74, 0x65, 0x72, 0x42, 0xd4, 0x01, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x26, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x4d, 0xaa, - 0x02, 0x15, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x15, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, - 0x02, 0x21, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x17, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, + 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x4d, 0xaa, 0x02, 0x15, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x15, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xe2, 0x02, 0x21, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x17, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/oracle_reporter.pulsar.go b/api/layer/reporter/oracle_reporter.pulsar.go index fbf81f6b6..bf00d661d 100644 --- a/api/layer/reporter/oracle_reporter.pulsar.go +++ b/api/layer/reporter/oracle_reporter.pulsar.go @@ -832,18 +832,19 @@ var file_layer_reporter_oracle_reporter_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x6a, - 0x61, 0x69, 0x6c, 0x65, 0x64, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x42, 0xa3, 0x01, 0x0a, 0x12, 0x63, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x42, 0xb1, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x13, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, - 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, + 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, + 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/params.pulsar.go b/api/layer/reporter/params.pulsar.go index 62094bb9a..3d6606209 100644 --- a/api/layer/reporter/params.pulsar.go +++ b/api/layer/reporter/params.pulsar.go @@ -506,17 +506,18 @@ var file_layer_reporter_params_proto_rawDesc = []byte{ 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x74, 0x65, 0x3a, 0x20, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x78, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x9b, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa9, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, - 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, + 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, + 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/query.pulsar.go b/api/layer/reporter/query.pulsar.go index 827625ef7..11752bea4 100644 --- a/api/layer/reporter/query.pulsar.go +++ b/api/layer/reporter/query.pulsar.go @@ -7694,17 +7694,18 @@ var file_layer_reporter_query_proto_rawDesc = []byte{ 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x7d, 0x42, 0x9a, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, - 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, - 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/token_origin.pulsar.go b/api/layer/reporter/token_origin.pulsar.go index 20ce924d5..a3c7f39e7 100644 --- a/api/layer/reporter/token_origin.pulsar.go +++ b/api/layer/reporter/token_origin.pulsar.go @@ -1727,18 +1727,18 @@ var file_layer_reporter_token_origin_proto_rawDesc = []byte{ 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x42, 0xa0, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x10, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, - 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, + 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/tx.pulsar.go b/api/layer/reporter/tx.pulsar.go index 8f4410126..2d66e4a5a 100644 --- a/api/layer/reporter/tx.pulsar.go +++ b/api/layer/reporter/tx.pulsar.go @@ -3024,15 +3024,15 @@ func (x *_MsgUndelegateReporter_2_list) IsValid() bool { } var ( - md_MsgUndelegateReporter protoreflect.MessageDescriptor - fd_MsgUndelegateReporter_delegator protoreflect.FieldDescriptor - fd_MsgUndelegateReporter_token_origins protoreflect.FieldDescriptor + md_MsgUndelegateReporter protoreflect.MessageDescriptor + fd_MsgUndelegateReporter_delegator_address protoreflect.FieldDescriptor + fd_MsgUndelegateReporter_token_origins protoreflect.FieldDescriptor ) func init() { file_layer_reporter_tx_proto_init() md_MsgUndelegateReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgUndelegateReporter") - fd_MsgUndelegateReporter_delegator = md_MsgUndelegateReporter.Fields().ByName("delegator") + fd_MsgUndelegateReporter_delegator_address = md_MsgUndelegateReporter.Fields().ByName("delegator_address") fd_MsgUndelegateReporter_token_origins = md_MsgUndelegateReporter.Fields().ByName("token_origins") } @@ -3101,9 +3101,9 @@ func (x *fastReflection_MsgUndelegateReporter) Interface() protoreflect.ProtoMes // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgUndelegateReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Delegator != "" { - value := protoreflect.ValueOfString(x.Delegator) - if !f(fd_MsgUndelegateReporter_delegator, value) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_MsgUndelegateReporter_delegator_address, value) { return } } @@ -3128,8 +3128,8 @@ func (x *fastReflection_MsgUndelegateReporter) Range(f func(protoreflect.FieldDe // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgUndelegateReporter) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator": - return x.Delegator != "" + case "layer.reporter.MsgUndelegateReporter.delegator_address": + return x.DelegatorAddress != "" case "layer.reporter.MsgUndelegateReporter.token_origins": return len(x.TokenOrigins) != 0 default: @@ -3148,8 +3148,8 @@ func (x *fastReflection_MsgUndelegateReporter) Has(fd protoreflect.FieldDescript // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgUndelegateReporter) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator": - x.Delegator = "" + case "layer.reporter.MsgUndelegateReporter.delegator_address": + x.DelegatorAddress = "" case "layer.reporter.MsgUndelegateReporter.token_origins": x.TokenOrigins = nil default: @@ -3168,8 +3168,8 @@ func (x *fastReflection_MsgUndelegateReporter) Clear(fd protoreflect.FieldDescri // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgUndelegateReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator": - value := x.Delegator + case "layer.reporter.MsgUndelegateReporter.delegator_address": + value := x.DelegatorAddress return protoreflect.ValueOfString(value) case "layer.reporter.MsgUndelegateReporter.token_origins": if len(x.TokenOrigins) == 0 { @@ -3197,8 +3197,8 @@ func (x *fastReflection_MsgUndelegateReporter) Get(descriptor protoreflect.Field // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgUndelegateReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator": - x.Delegator = value.Interface().(string) + case "layer.reporter.MsgUndelegateReporter.delegator_address": + x.DelegatorAddress = value.Interface().(string) case "layer.reporter.MsgUndelegateReporter.token_origins": lv := value.List() clv := lv.(*_MsgUndelegateReporter_2_list) @@ -3229,8 +3229,8 @@ func (x *fastReflection_MsgUndelegateReporter) Mutable(fd protoreflect.FieldDesc } value := &_MsgUndelegateReporter_2_list{list: &x.TokenOrigins} return protoreflect.ValueOfList(value) - case "layer.reporter.MsgUndelegateReporter.delegator": - panic(fmt.Errorf("field delegator of message layer.reporter.MsgUndelegateReporter is not mutable")) + case "layer.reporter.MsgUndelegateReporter.delegator_address": + panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgUndelegateReporter is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) @@ -3244,7 +3244,7 @@ func (x *fastReflection_MsgUndelegateReporter) Mutable(fd protoreflect.FieldDesc // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgUndelegateReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator": + case "layer.reporter.MsgUndelegateReporter.delegator_address": return protoreflect.ValueOfString("") case "layer.reporter.MsgUndelegateReporter.token_origins": list := []*TokenOrigin{} @@ -3318,7 +3318,7 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method var n int var l int _ = l - l = len(x.Delegator) + l = len(x.DelegatorAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -3373,10 +3373,10 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method dAtA[i] = 0x12 } } - if len(x.Delegator) > 0 { - i -= len(x.Delegator) - copy(dAtA[i:], x.Delegator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Delegator))) + if len(x.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) i-- dAtA[i] = 0xa } @@ -3431,7 +3431,7 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3459,7 +3459,7 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Delegator = string(dAtA[iNdEx:postIndex]) + x.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -7658,7 +7658,7 @@ type MsgUndelegateReporter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, // else the amount field will be the amount to undelegate from the specified token origin. TokenOrigins []*TokenOrigin `protobuf:"bytes,2,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` @@ -7684,9 +7684,9 @@ func (*MsgUndelegateReporter) Descriptor() ([]byte, []int) { return file_layer_reporter_tx_proto_rawDescGZIP(), []int{6} } -func (x *MsgUndelegateReporter) GetDelegator() string { +func (x *MsgUndelegateReporter) GetDelegatorAddress() string { if x != nil { - return x.Delegator + return x.DelegatorAddress } return "" } @@ -8082,143 +8082,145 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x69, 0x67, 0x69, 0x6e, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x1c, - 0x0a, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x0d, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x3a, 0x0e, - 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x1f, - 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x83, 0x01, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x2b, + 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x40, 0x0a, 0x0d, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, + 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x3a, 0x16, 0x82, + 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, 0x01, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x57, 0x69, + 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x0f, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1d, 0x88, + 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x91, 0x01, 0x0a, + 0x25, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x03, 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, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0xc8, 0x01, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, + 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, + 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 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, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x0f, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1e, 0x88, 0xa0, 0x1f, + 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x22, + 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, + 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, 0x35, 0xc8, + 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, + 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x77, 0x0a, 0x11, + 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1d, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x25, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, - 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 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, 0x35, 0xc8, 0xde, 0x1f, 0x00, - 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, - 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xc8, 0x01, 0x0a, 0x1a, 0x4d, 0x73, - 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x10, 0x64, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 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, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1e, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, + 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, + 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x10, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x11, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x16, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x22, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x06, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 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, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x77, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, - 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 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, 0x0f, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, - 0x1d, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, - 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0e, - 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x45, - 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 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, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x16, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, - 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, - 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, - 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x1a, 0x27, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, - 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x10, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x23, 0x2e, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, - 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x6a, 0x0a, 0x12, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x6c, + 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, + 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x64, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x12, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x1a, - 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, - 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x79, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x2a, 0x2e, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, - 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x32, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x55, - 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x97, 0x01, 0x0a, 0x12, 0x63, 0x6f, - 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, - 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x1a, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x12, 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x32, + 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, + 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, + 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, + 0x70, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, + 0x42, 0xa5, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, + 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, + 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 2ad25c389..3baf07c73 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -4067,6 +4067,7 @@ definitions: Msg/WithdrawReporterCommission response type. layer.reporter.MsgWithdrawTipResponse: type: object + description: MsgWithdrawTipResponse defines the Msg/WithdrawTip response type. layer.reporter.Params: type: object properties: diff --git a/proto/buf.gen.pulsar.yaml b/proto/buf.gen.pulsar.yaml index e8fffdb28..bf3ac50e4 100644 --- a/proto/buf.gen.pulsar.yaml +++ b/proto/buf.gen.pulsar.yaml @@ -7,12 +7,13 @@ version: v1 managed: enabled: true go_package_prefix: - default: cosmossdk.io/api + default: github.com/tellor-io/layer/api except: - buf.build/googleapis/googleapis - buf.build/cosmos/gogo-proto - buf.build/cosmos/cosmos-proto override: + buf.build/cosmos/cosmos-sdk: cosmossdk.io/api plugins: - name: go-pulsar out: ./api diff --git a/proto/layer/dispute/dispute.proto b/proto/layer/dispute/dispute.proto index 4559e2fb0..2eba072b5 100644 --- a/proto/layer/dispute/dispute.proto +++ b/proto/layer/dispute/dispute.proto @@ -5,6 +5,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; +import "layer/oracle/micro_report.proto"; option go_package = "github.com/tellor-io/layer/x/dispute/types"; @@ -38,7 +39,7 @@ message Dispute { (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - MicroReport reportEvidence = 12 [(gogoproto.nullable) = false]; + layer.oracle.MicroReport reportEvidence = 12 [(gogoproto.nullable) = false]; repeated PayerInfo feePayers = 13 [(gogoproto.nullable) = false]; string feeTotal = 14 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -48,21 +49,6 @@ message Dispute { repeated uint64 prevDisputeIds = 15; } -// TODO: remove this duplicate -message MicroReport { - string reporter = 1; - int64 power = 2; - string query_type = 3; - string query_id = 4; - string aggregate_method = 5; - string value = 6; - int64 block_number = 7; - google.protobuf.Timestamp timestamp = 8 [ - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; -} - enum DisputeCategory { option (gogoproto.goproto_enum_prefix) = false; @@ -93,6 +79,11 @@ enum DisputeStatus { message PayerInfo { string payerAddress = 1; - cosmos.base.v1beta1.Coin amount = 2 [(gogoproto.nullable) = false]; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; bool fromBond = 3; + int64 block_number = 4; } diff --git a/proto/layer/dispute/dispute_params.proto b/proto/layer/dispute/dispute_params.proto index c3d6066fd..9df3a50bf 100644 --- a/proto/layer/dispute/dispute_params.proto +++ b/proto/layer/dispute/dispute_params.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package layer.dispute; import "layer/dispute/dispute.proto"; +import "layer/oracle/micro_report.proto"; option go_package = "github.com/tellor-io/layer/x/dispute/types"; message DisputeParams { - - MicroReport report = 1; - DisputeCategory category = 2; + layer.oracle.MicroReport report = 1; + DisputeCategory category = 2; } diff --git a/proto/layer/dispute/tx.proto b/proto/layer/dispute/tx.proto index 00c9277cd..3756a557e 100644 --- a/proto/layer/dispute/tx.proto +++ b/proto/layer/dispute/tx.proto @@ -6,6 +6,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "cosmos/msg/v1/msg.proto"; import "gogoproto/gogo.proto"; import "layer/dispute/dispute.proto"; +import "layer/oracle/micro_report.proto"; option go_package = "github.com/tellor-io/layer/x/dispute/types"; @@ -19,7 +20,7 @@ service Msg { message MsgProposeDispute { option (cosmos.msg.v1.signer) = "creator"; string creator = 1; - MicroReport report = 2; + layer.oracle.MicroReport report = 2; DisputeCategory disputeCategory = 3; cosmos.base.v1beta1.Coin fee = 4 [(gogoproto.nullable) = false]; bool payFromBond = 5; diff --git a/proto/layer/oracle/micro_report.proto b/proto/layer/oracle/micro_report.proto index c7655a61e..c6bccffc4 100644 --- a/proto/layer/oracle/micro_report.proto +++ b/proto/layer/oracle/micro_report.proto @@ -6,16 +6,27 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; +// MicroReport represents data for a single report message MicroReport { + // reporter is the address of the reporter string reporter = 1; + // the power of the reporter based on total tokens normalized int64 power = 2; - string queryType = 3; - string queryId = 4; - string aggregateMethod = 5; + // string identifier of the data spec + string query_type = 3; + // hash of the query data + string query_id = 4; + // aggregate method to use for aggregating all the reports for the query id + string aggregate_method = 5; + // hex string of the response value string value = 6; + // timestamp of when the report was created google.protobuf.Timestamp timestamp = 7 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + // indicates if the report's query id is in the cyclelist bool cyclelist = 8; + // block number of when the report was created + int64 block_number = 9; } diff --git a/proto/layer/oracle/query_meta.proto b/proto/layer/oracle/query_meta.proto index b348d3231..084be4c45 100644 --- a/proto/layer/oracle/query_meta.proto +++ b/proto/layer/oracle/query_meta.proto @@ -10,23 +10,31 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/tellor-io/layer/x/oracle/types"; +// QueryMeta represents the metadata of a query message QueryMeta { + // unique id of the query that changes after query's lifecycle ends uint64 id = 1; + // amount of tokens that was tipped string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; + // expiration time of the query google.protobuf.Timestamp expiration = 3 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + // timeframe of the query according to the data spec google.protobuf.Duration registry_spec_timeframe = 4 [ (gogoproto.stdduration) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - bool hasRevealedReports = 5; + // indicates whether query has revealed reports + bool has_revealed_reports = 5; + // unique id of the query according to the data spec bytes query_id = 6; + // sttring identifier of the data spec string query_type = 7; } diff --git a/proto/layer/oracle/tips.proto b/proto/layer/oracle/tips.proto index 1dcde389f..c7c145440 100644 --- a/proto/layer/oracle/tips.proto +++ b/proto/layer/oracle/tips.proto @@ -11,7 +11,7 @@ option go_package = "github.com/tellor-io/layer/x/oracle/types"; message Tips { // queryData is the query data that was tipped string query_data = 1; - // amount is the amount that was tipped + // the amount that was tipped string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", diff --git a/proto/layer/reporter/tx.proto b/proto/layer/reporter/tx.proto index 699c5bbfa..793dd6a75 100644 --- a/proto/layer/reporter/tx.proto +++ b/proto/layer/reporter/tx.proto @@ -97,9 +97,8 @@ message MsgDelegateReporterResponse {} // MsgUndelegateReporter defines the Msg/UndelegateReporter request type. message MsgUndelegateReporter { - option (cosmos.msg.v1.signer) = "delegator"; - string delegator = 1; - + option (cosmos.msg.v1.signer) = "delegator_address"; + string delegator_address = 1; // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, // else the amount field will be the amount to undelegate from the specified token origin. repeated TokenOrigin token_origins = 2; diff --git a/x/dispute/mocks/ReporterKeeper.go b/x/dispute/mocks/ReporterKeeper.go index 644a46eae..5a8a99412 100644 --- a/x/dispute/mocks/ReporterKeeper.go +++ b/x/dispute/mocks/ReporterKeeper.go @@ -6,13 +6,11 @@ import ( context "context" math "cosmossdk.io/math" - disputetypes "github.com/tellor-io/layer/x/dispute/types" + cosmos_sdktypes "github.com/cosmos/cosmos-sdk/types" mock "github.com/stretchr/testify/mock" reportertypes "github.com/tellor-io/layer/x/reporter/types" - - types "github.com/cosmos/cosmos-sdk/types" ) // ReporterKeeper is an autogenerated mock type for the ReporterKeeper type @@ -20,13 +18,13 @@ type ReporterKeeper struct { mock.Mock } -// AllocateRewardsToStake provides a mock function with given fields: ctx, reporterAddr, reward -func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAddr types.AccAddress, reward math.Int) error { - ret := _m.Called(ctx, reporterAddr, reward) +// AddAmountToStake provides a mock function with given fields: ctx, addr, amt +func (_m *ReporterKeeper) AddAmountToStake(ctx context.Context, addr string, amt math.Int) error { + ret := _m.Called(ctx, addr, amt) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { - r0 = rf(ctx, reporterAddr, reward) + if rf, ok := ret.Get(0).(func(context.Context, string, math.Int) error); ok { + r0 = rf(ctx, addr, amt) } else { r0 = ret.Error(0) } @@ -35,11 +33,11 @@ func (_m *ReporterKeeper) AllocateRewardsToStake(ctx context.Context, reporterAd } // EscrowReporterStake provides a mock function with given fields: ctx, reporterAddr, power, height, amt -func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr types.AccAddress, power int64, height int64, amt math.Int) error { +func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr cosmos_sdktypes.AccAddress, power int64, height int64, amt math.Int) error { ret := _m.Called(ctx, reporterAddr, power, height, amt) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, int64, int64, math.Int) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, int64, int64, math.Int) error); ok { r0 = rf(ctx, reporterAddr, power, height, amt) } else { r0 = ret.Error(0) @@ -49,11 +47,11 @@ func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr } // FeefromReporterStake provides a mock function with given fields: ctx, reporterAddr, amt -func (_m *ReporterKeeper) FeefromReporterStake(ctx context.Context, reporterAddr types.AccAddress, amt math.Int) error { +func (_m *ReporterKeeper) FeefromReporterStake(ctx context.Context, reporterAddr cosmos_sdktypes.AccAddress, amt math.Int) error { ret := _m.Called(ctx, reporterAddr, amt) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, math.Int) error); ok { r0 = rf(ctx, reporterAddr, amt) } else { r0 = ret.Error(0) @@ -63,11 +61,11 @@ func (_m *ReporterKeeper) FeefromReporterStake(ctx context.Context, reporterAddr } // JailReporter provides a mock function with given fields: ctx, reporterAddr, jailDuration -func (_m *ReporterKeeper) JailReporter(ctx context.Context, reporterAddr types.AccAddress, jailDuration int64) error { +func (_m *ReporterKeeper) JailReporter(ctx context.Context, reporterAddr cosmos_sdktypes.AccAddress, jailDuration int64) error { ret := _m.Called(ctx, reporterAddr, jailDuration) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, int64) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress, int64) error); ok { r0 = rf(ctx, reporterAddr, jailDuration) } else { r0 = ret.Error(0) @@ -77,15 +75,15 @@ func (_m *ReporterKeeper) JailReporter(ctx context.Context, reporterAddr types.A } // Reporter provides a mock function with given fields: ctx, repAddr -func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddr types.AccAddress) (*reportertypes.OracleReporter, error) { +func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddr cosmos_sdktypes.AccAddress) (*reportertypes.OracleReporter, error) { ret := _m.Called(ctx, repAddr) var r0 *reportertypes.OracleReporter var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) (*reportertypes.OracleReporter, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress) (*reportertypes.OracleReporter, error)); ok { return rf(ctx, repAddr) } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) *reportertypes.OracleReporter); ok { + if rf, ok := ret.Get(0).(func(context.Context, cosmos_sdktypes.AccAddress) *reportertypes.OracleReporter); ok { r0 = rf(ctx, repAddr) } else { if ret.Get(0) != nil { @@ -93,7 +91,7 @@ func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddr types.AccAddress } } - if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, cosmos_sdktypes.AccAddress) error); ok { r1 = rf(ctx, repAddr) } else { r1 = ret.Error(1) @@ -102,13 +100,13 @@ func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddr types.AccAddress return r0, r1 } -// RewardReporterBondToFeePayers provides a mock function with given fields: ctx, recipients, reward -func (_m *ReporterKeeper) RewardReporterBondToFeePayers(ctx context.Context, recipients []disputetypes.PayerInfo, reward math.Int) error { - ret := _m.Called(ctx, recipients, reward) +// ReturnSlashedTokens provides a mock function with given fields: ctx, repAddr, blockHeight, amt +func (_m *ReporterKeeper) ReturnSlashedTokens(ctx context.Context, repAddr string, blockHeight int64, amt math.Int) error { + ret := _m.Called(ctx, repAddr, blockHeight, amt) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []disputetypes.PayerInfo, math.Int) error); ok { - r0 = rf(ctx, recipients, reward) + if rf, ok := ret.Get(0).(func(context.Context, string, int64, math.Int) error); ok { + r0 = rf(ctx, repAddr, blockHeight, amt) } else { r0 = ret.Error(0) } diff --git a/x/dispute/types/dispute.pb.go b/x/dispute/types/dispute.pb.go index 3a557ddd6..d35aa2c13 100644 --- a/x/dispute/types/dispute.pb.go +++ b/x/dispute/types/dispute.pb.go @@ -7,10 +7,11 @@ import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + types "github.com/tellor-io/layer/x/oracle/types" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -116,7 +117,7 @@ type Dispute struct { DisputeRound uint64 `protobuf:"varint,9,opt,name=disputeRound,proto3" json:"disputeRound,omitempty"` SlashAmount cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=slashAmount,proto3,customtype=cosmossdk.io/math.Int" json:"slashAmount"` BurnAmount cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=burnAmount,proto3,customtype=cosmossdk.io/math.Int" json:"burnAmount"` - ReportEvidence MicroReport `protobuf:"bytes,12,opt,name=reportEvidence,proto3" json:"reportEvidence"` + ReportEvidence types.MicroReport `protobuf:"bytes,12,opt,name=reportEvidence,proto3" json:"reportEvidence"` FeePayers []PayerInfo `protobuf:"bytes,13,rep,name=feePayers,proto3" json:"feePayers"` FeeTotal cosmossdk_io_math.Int `protobuf:"bytes,14,opt,name=feeTotal,proto3,customtype=cosmossdk.io/math.Int" json:"feeTotal"` PrevDisputeIds []uint64 `protobuf:"varint,15,rep,packed,name=prevDisputeIds,proto3" json:"prevDisputeIds,omitempty"` @@ -211,11 +212,11 @@ func (m *Dispute) GetDisputeRound() uint64 { return 0 } -func (m *Dispute) GetReportEvidence() MicroReport { +func (m *Dispute) GetReportEvidence() types.MicroReport { if m != nil { return m.ReportEvidence } - return MicroReport{} + return types.MicroReport{} } func (m *Dispute) GetFeePayers() []PayerInfo { @@ -232,118 +233,18 @@ func (m *Dispute) GetPrevDisputeIds() []uint64 { return nil } -// TODO: remove this duplicate -type MicroReport struct { - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - QueryType string `protobuf:"bytes,3,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` - QueryId string `protobuf:"bytes,4,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` - AggregateMethod string `protobuf:"bytes,5,opt,name=aggregate_method,json=aggregateMethod,proto3" json:"aggregate_method,omitempty"` - Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - BlockNumber int64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` - Timestamp time.Time `protobuf:"bytes,8,opt,name=timestamp,proto3,stdtime" json:"timestamp"` -} - -func (m *MicroReport) Reset() { *m = MicroReport{} } -func (m *MicroReport) String() string { return proto.CompactTextString(m) } -func (*MicroReport) ProtoMessage() {} -func (*MicroReport) Descriptor() ([]byte, []int) { - return fileDescriptor_2a5d4b70d69c78b5, []int{1} -} -func (m *MicroReport) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MicroReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MicroReport.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 *MicroReport) XXX_Merge(src proto.Message) { - xxx_messageInfo_MicroReport.Merge(m, src) -} -func (m *MicroReport) XXX_Size() int { - return m.Size() -} -func (m *MicroReport) XXX_DiscardUnknown() { - xxx_messageInfo_MicroReport.DiscardUnknown(m) -} - -var xxx_messageInfo_MicroReport proto.InternalMessageInfo - -func (m *MicroReport) GetReporter() string { - if m != nil { - return m.Reporter - } - return "" -} - -func (m *MicroReport) GetPower() int64 { - if m != nil { - return m.Power - } - return 0 -} - -func (m *MicroReport) GetQueryType() string { - if m != nil { - return m.QueryType - } - return "" -} - -func (m *MicroReport) GetQueryId() string { - if m != nil { - return m.QueryId - } - return "" -} - -func (m *MicroReport) GetAggregateMethod() string { - if m != nil { - return m.AggregateMethod - } - return "" -} - -func (m *MicroReport) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -func (m *MicroReport) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber - } - return 0 -} - -func (m *MicroReport) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - type PayerInfo struct { - PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount"` - FromBond bool `protobuf:"varint,3,opt,name=fromBond,proto3" json:"fromBond,omitempty"` + PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + FromBond bool `protobuf:"varint,3,opt,name=fromBond,proto3" json:"fromBond,omitempty"` + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (m *PayerInfo) Reset() { *m = PayerInfo{} } func (m *PayerInfo) String() string { return proto.CompactTextString(m) } func (*PayerInfo) ProtoMessage() {} func (*PayerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_2a5d4b70d69c78b5, []int{2} + return fileDescriptor_2a5d4b70d69c78b5, []int{1} } func (m *PayerInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -379,95 +280,87 @@ func (m *PayerInfo) GetPayerAddress() string { return "" } -func (m *PayerInfo) GetAmount() types.Coin { +func (m *PayerInfo) GetFromBond() bool { if m != nil { - return m.Amount + return m.FromBond } - return types.Coin{} + return false } -func (m *PayerInfo) GetFromBond() bool { +func (m *PayerInfo) GetBlockNumber() int64 { if m != nil { - return m.FromBond + return m.BlockNumber } - return false + return 0 } func init() { proto.RegisterEnum("layer.dispute.DisputeCategory", DisputeCategory_name, DisputeCategory_value) proto.RegisterEnum("layer.dispute.DisputeStatus", DisputeStatus_name, DisputeStatus_value) proto.RegisterType((*Dispute)(nil), "layer.dispute.Dispute") - proto.RegisterType((*MicroReport)(nil), "layer.dispute.MicroReport") proto.RegisterType((*PayerInfo)(nil), "layer.dispute.PayerInfo") } func init() { proto.RegisterFile("layer/dispute/dispute.proto", fileDescriptor_2a5d4b70d69c78b5) } var fileDescriptor_2a5d4b70d69c78b5 = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x72, 0x22, 0x45, - 0x1c, 0x66, 0x02, 0x9b, 0x30, 0x4d, 0x42, 0xb0, 0x6b, 0x77, 0x9d, 0x60, 0x24, 0x63, 0xaa, 0x56, - 0xd9, 0x68, 0x86, 0x4a, 0x3c, 0x78, 0xf1, 0x02, 0x61, 0x92, 0x1d, 0x4d, 0x80, 0x6a, 0x20, 0x5b, - 0x7a, 0xa1, 0x06, 0xa6, 0x81, 0x71, 0x99, 0xe9, 0xb1, 0xa7, 0x07, 0xcd, 0xdd, 0x83, 0xc5, 0x69, - 0x5f, 0x80, 0xc3, 0x96, 0xaf, 0xe0, 0x1b, 0x78, 0xd9, 0xe3, 0x96, 0x27, 0xcb, 0xc3, 0x6a, 0x25, - 0x55, 0x3e, 0x87, 0x35, 0xdd, 0x1d, 0x08, 0xb0, 0x07, 0xe3, 0x09, 0xbe, 0xaf, 0xbf, 0xaf, 0xfb, - 0xd7, 0xbf, 0x3f, 0x3d, 0xe0, 0x83, 0x91, 0x7d, 0x85, 0x69, 0xc9, 0x71, 0xc3, 0x20, 0x62, 0xf8, - 0xf6, 0xd7, 0x08, 0x28, 0x61, 0x04, 0x6e, 0xf1, 0x45, 0x43, 0x92, 0xf9, 0x42, 0x8f, 0x84, 0x1e, - 0x09, 0x4b, 0x5d, 0x3b, 0xc4, 0xa5, 0xf1, 0x51, 0x17, 0x33, 0xfb, 0xa8, 0xd4, 0x23, 0xae, 0x2f, - 0xe4, 0xf9, 0x1d, 0xb1, 0xde, 0xe1, 0xa8, 0x24, 0x80, 0x5c, 0x7a, 0x38, 0x20, 0x03, 0x22, 0xf8, - 0xf8, 0x9f, 0x64, 0xf7, 0x06, 0x84, 0x0c, 0x46, 0xb8, 0xc4, 0x51, 0x37, 0xea, 0x97, 0x98, 0xeb, - 0xe1, 0x90, 0xd9, 0x5e, 0x20, 0x04, 0xfb, 0xaf, 0x36, 0xc0, 0x46, 0x55, 0x9c, 0x0e, 0x1f, 0x83, - 0xf5, 0xa1, 0x1d, 0x0e, 0x2d, 0x47, 0x53, 0x74, 0xa5, 0xb8, 0x89, 0x24, 0x82, 0xbb, 0x40, 0x95, - 0x01, 0x5a, 0x8e, 0xb6, 0xa6, 0x2b, 0xc5, 0x14, 0x9a, 0x13, 0xf0, 0x19, 0xd8, 0x96, 0xe0, 0xc4, - 0x66, 0x78, 0x40, 0xe8, 0x95, 0x96, 0xd4, 0x95, 0x62, 0xf6, 0xb8, 0x60, 0x2c, 0x5c, 0xce, 0xa8, - 0x2e, 0xaa, 0xd0, 0xb2, 0x0d, 0x7e, 0x0d, 0x80, 0xa4, 0x4e, 0x31, 0xd6, 0x52, 0xba, 0x52, 0x54, - 0x2b, 0x9f, 0xbe, 0x7e, 0xbb, 0x97, 0xf8, 0xf3, 0xed, 0xde, 0x23, 0x71, 0xd9, 0xd0, 0x79, 0x61, - 0xb8, 0xa4, 0xe4, 0xd9, 0x6c, 0x68, 0x58, 0x3e, 0xfb, 0xfd, 0xd7, 0x43, 0x20, 0xb3, 0x60, 0xf9, - 0x0c, 0xdd, 0xb1, 0xc3, 0x0a, 0xd8, 0x92, 0xa8, 0xc9, 0x6c, 0x16, 0x85, 0xda, 0x03, 0x1e, 0xd4, - 0xee, 0xbb, 0x83, 0x12, 0x1a, 0xb4, 0x68, 0x81, 0x0d, 0x90, 0x9b, 0x13, 0x94, 0xb5, 0x5c, 0x0f, - 0x6b, 0xeb, 0xba, 0x52, 0xcc, 0x1c, 0xe7, 0x0d, 0x91, 0x58, 0xe3, 0x36, 0xb1, 0x46, 0xeb, 0x36, - 0xb1, 0x95, 0x74, 0x1c, 0xf2, 0xcb, 0xbf, 0xf6, 0x14, 0xb4, 0xe2, 0x86, 0xe7, 0x20, 0x2b, 0x39, - 0xd3, 0x77, 0xf8, 0x7e, 0x1b, 0xf7, 0xd8, 0x6f, 0xc9, 0x0b, 0x3f, 0x03, 0xef, 0xdd, 0x3d, 0xa1, - 0x32, 0x22, 0xbd, 0x17, 0x5a, 0x5a, 0x57, 0x8a, 0x49, 0xb4, 0xba, 0x00, 0xf7, 0xc1, 0xa6, 0x24, - 0x11, 0x89, 0x7c, 0x47, 0x53, 0x79, 0x25, 0x17, 0x38, 0x78, 0x01, 0x32, 0xe1, 0xc8, 0x0e, 0x87, - 0x65, 0x8f, 0x44, 0x3e, 0xd3, 0xc0, 0xfd, 0x6b, 0x70, 0xd7, 0x1f, 0x57, 0xb4, 0x1b, 0x51, 0x5f, - 0xee, 0x96, 0xf9, 0x1f, 0x15, 0x9d, 0xdb, 0xe1, 0x33, 0x90, 0xa5, 0x38, 0x20, 0x94, 0x99, 0x63, - 0xd7, 0xc1, 0x7e, 0x0f, 0x6b, 0x9b, 0x32, 0x77, 0x8b, 0x25, 0xbd, 0x70, 0x7b, 0x94, 0x20, 0xae, - 0xac, 0xa4, 0xe2, 0xc3, 0xd0, 0x92, 0x0f, 0x7e, 0x09, 0xd4, 0x3e, 0xc6, 0x8d, 0xd8, 0x15, 0x6a, - 0x5b, 0x7a, 0xb2, 0x98, 0x39, 0xd6, 0x96, 0x36, 0xe1, 0x8b, 0x96, 0xdf, 0x27, 0x72, 0x8b, 0xb9, - 0x01, 0x9e, 0x81, 0x74, 0x1f, 0xe3, 0x16, 0x61, 0xf6, 0x48, 0xcb, 0xde, 0xff, 0x4a, 0x33, 0x33, - 0xfc, 0x18, 0x64, 0x03, 0x8a, 0xc7, 0xd5, 0xdb, 0x51, 0x0a, 0xb5, 0x6d, 0x3d, 0x59, 0x4c, 0xa1, - 0x25, 0x76, 0xff, 0xd5, 0x1a, 0xc8, 0xdc, 0xb9, 0x14, 0xcc, 0x83, 0xb4, 0xb8, 0x10, 0xa6, 0x7c, - 0x52, 0x55, 0x34, 0xc3, 0xf0, 0x21, 0x78, 0x10, 0x90, 0x1f, 0x30, 0xe5, 0x73, 0x9a, 0x44, 0x02, - 0xc0, 0x0f, 0x01, 0xf8, 0x3e, 0xc2, 0xf4, 0xaa, 0xc3, 0xae, 0x02, 0xcc, 0xc7, 0x53, 0x45, 0x2a, - 0x67, 0x5a, 0x57, 0x01, 0x86, 0x3b, 0x20, 0x2d, 0x96, 0x5d, 0x47, 0x8c, 0x1d, 0xda, 0xe0, 0xd8, - 0x72, 0xe0, 0x53, 0x90, 0xb3, 0x07, 0x03, 0x8a, 0x07, 0x36, 0xc3, 0x1d, 0x0f, 0xb3, 0x21, 0x71, - 0xf8, 0x24, 0xa9, 0x68, 0x7b, 0xc6, 0x5f, 0x70, 0x3a, 0x3e, 0x7a, 0x6c, 0x8f, 0x22, 0x31, 0x22, - 0x2a, 0x12, 0x00, 0x7e, 0x04, 0x36, 0xbb, 0x71, 0xfb, 0x75, 0xfc, 0xc8, 0xeb, 0x62, 0xca, 0xfb, - 0x3d, 0x89, 0x32, 0x9c, 0xab, 0x71, 0x0a, 0x56, 0x80, 0x3a, 0x7b, 0x96, 0x78, 0xfb, 0xfe, 0xd7, - 0x79, 0x98, 0xdb, 0xf6, 0x7f, 0x52, 0x80, 0x3a, 0xab, 0x59, 0xdc, 0xea, 0x41, 0x0c, 0xca, 0x8e, - 0x43, 0x71, 0x18, 0xca, 0x2c, 0x2d, 0x70, 0xf0, 0x0b, 0xb0, 0x6e, 0x8b, 0xbe, 0x5c, 0xe3, 0x47, - 0xee, 0x18, 0xb2, 0x48, 0xf1, 0xe3, 0x6b, 0xc8, 0xc7, 0xd7, 0x38, 0x21, 0xae, 0x2f, 0x5b, 0x40, - 0xca, 0xe3, 0xf4, 0xf7, 0x29, 0xf1, 0x2a, 0xc4, 0x77, 0x78, 0x2a, 0xd3, 0x68, 0x86, 0x0f, 0x7e, - 0x53, 0xc0, 0xf6, 0xd2, 0x3b, 0x07, 0x8f, 0xc0, 0x6e, 0xd5, 0x6a, 0x36, 0xda, 0x2d, 0xb3, 0x73, - 0x52, 0x6e, 0x99, 0x67, 0x75, 0xf4, 0x4d, 0xa7, 0x5d, 0x6b, 0x36, 0xcc, 0x13, 0xeb, 0xd4, 0x32, - 0xab, 0xb9, 0x44, 0x7e, 0x7b, 0x32, 0xd5, 0x33, 0x6d, 0x3f, 0x0c, 0x70, 0xcf, 0xed, 0xbb, 0x38, - 0xce, 0xba, 0xb6, 0x62, 0x79, 0x5e, 0x46, 0x35, 0xab, 0x76, 0x96, 0x53, 0xf2, 0x99, 0xc9, 0x54, - 0xdf, 0x78, 0x6e, 0x53, 0xdf, 0xf5, 0x07, 0xf0, 0x09, 0x78, 0xbc, 0x22, 0xbd, 0xb0, 0x6a, 0x75, - 0x94, 0x5b, 0xcb, 0xab, 0x93, 0xa9, 0xfe, 0xe0, 0xc2, 0xf5, 0x09, 0x7d, 0xb7, 0xac, 0xfc, 0x55, - 0x1d, 0xe5, 0x92, 0x52, 0x66, 0x7f, 0x47, 0x68, 0x3e, 0xf5, 0xf3, 0x2f, 0x85, 0xc4, 0xc1, 0x3f, - 0x0a, 0xd8, 0x5a, 0x78, 0x18, 0xe1, 0x27, 0x73, 0x7b, 0xb3, 0x55, 0x6e, 0xb5, 0x9b, 0x9d, 0x06, - 0x32, 0x2f, 0xeb, 0x2d, 0x33, 0x97, 0x10, 0xe1, 0x34, 0x28, 0x1e, 0x13, 0x86, 0xe1, 0x13, 0xf0, - 0x68, 0x49, 0x78, 0x59, 0x6f, 0x89, 0xb0, 0xc1, 0x64, 0xaa, 0xaf, 0x5f, 0x12, 0x16, 0x47, 0xfd, - 0x14, 0xbc, 0xbf, 0x24, 0x43, 0x66, 0xb3, 0x7e, 0x7e, 0x69, 0x56, 0x73, 0x6b, 0xf9, 0xcd, 0xc9, - 0x54, 0x4f, 0x23, 0x1c, 0x92, 0xd1, 0x18, 0x3b, 0xf0, 0x10, 0xec, 0x2c, 0x49, 0xdb, 0xb5, 0x99, - 0x38, 0x99, 0xcf, 0x4e, 0xa6, 0x3a, 0x68, 0xfb, 0xf4, 0x56, 0xbe, 0x1a, 0xc0, 0x69, 0xd9, 0x3a, - 0x37, 0xab, 0xb9, 0x94, 0x08, 0xe0, 0xd4, 0x76, 0x47, 0xd8, 0x11, 0x17, 0xad, 0x54, 0x5f, 0x5f, - 0x17, 0x94, 0x37, 0xd7, 0x05, 0xe5, 0xef, 0xeb, 0x82, 0xf2, 0xf2, 0xa6, 0x90, 0x78, 0x73, 0x53, - 0x48, 0xfc, 0x71, 0x53, 0x48, 0x7c, 0x7b, 0x30, 0x70, 0xd9, 0x30, 0xea, 0x1a, 0x3d, 0xe2, 0x95, - 0x18, 0x1e, 0x8d, 0x08, 0x3d, 0x74, 0x49, 0x49, 0x7c, 0xca, 0x7f, 0x9c, 0x7d, 0xcc, 0xe3, 0x71, - 0x0a, 0xbb, 0xeb, 0xbc, 0x49, 0x3f, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x32, 0x1e, 0xd7, 0x49, - 0xea, 0x07, 0x00, 0x00, + // 889 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6e, 0xe2, 0x46, + 0x1c, 0xc6, 0x81, 0x25, 0x30, 0x10, 0x42, 0x47, 0xdd, 0xad, 0xe3, 0x46, 0x8e, 0x1b, 0x69, 0x5b, + 0x36, 0x6d, 0x6c, 0x25, 0xbd, 0xf6, 0x02, 0xc1, 0x49, 0xdd, 0x26, 0x80, 0x06, 0x93, 0x55, 0x7b, + 0x41, 0x06, 0x0f, 0xe0, 0xae, 0xed, 0x41, 0xe3, 0x01, 0x35, 0x6f, 0x50, 0x71, 0xda, 0x17, 0x40, + 0xaa, 0xd4, 0x47, 0x68, 0xdf, 0xa0, 0x97, 0x3d, 0xae, 0x7a, 0xaa, 0x7a, 0xd8, 0x56, 0x89, 0xd4, + 0xe7, 0xa8, 0xec, 0x31, 0x10, 0xcc, 0x5e, 0xe8, 0x09, 0x7e, 0xdf, 0xef, 0xfb, 0xc6, 0xdf, 0xfc, + 0xfe, 0xd8, 0xe0, 0x63, 0xd7, 0xba, 0xc3, 0x54, 0xb3, 0x9d, 0x60, 0x3c, 0x61, 0x78, 0xf1, 0xab, + 0x8e, 0x29, 0x61, 0x04, 0xee, 0x45, 0x49, 0x35, 0x06, 0x25, 0xb9, 0x4f, 0x02, 0x8f, 0x04, 0x5a, + 0xcf, 0x0a, 0xb0, 0x36, 0x3d, 0xeb, 0x61, 0x66, 0x9d, 0x69, 0x7d, 0xe2, 0xf8, 0x9c, 0x2e, 0x1d, + 0xf0, 0x7c, 0x37, 0x8a, 0x34, 0x1e, 0xc4, 0xa9, 0x0f, 0x87, 0x64, 0x48, 0x38, 0x1e, 0xfe, 0x8b, + 0xd1, 0xa3, 0x21, 0x21, 0x43, 0x17, 0x6b, 0x51, 0xd4, 0x9b, 0x0c, 0x34, 0xe6, 0x78, 0x38, 0x60, + 0x96, 0x37, 0x5e, 0x10, 0xb8, 0x3b, 0x42, 0xad, 0xbe, 0x8b, 0x35, 0xcf, 0xe9, 0x53, 0xd2, 0xa5, + 0x78, 0x4c, 0x28, 0xe3, 0x84, 0xe3, 0x9f, 0x77, 0xc1, 0x6e, 0x9d, 0xdb, 0x83, 0xcf, 0x40, 0x76, + 0x64, 0x05, 0x23, 0xc3, 0x16, 0x05, 0x45, 0xa8, 0x14, 0x51, 0x1c, 0xc1, 0x43, 0x90, 0x8f, 0x6f, + 0x60, 0xd8, 0xe2, 0x8e, 0x22, 0x54, 0x32, 0x68, 0x05, 0xc0, 0xaf, 0xc1, 0x7e, 0x1c, 0x5c, 0x58, + 0x0c, 0x0f, 0x09, 0xbd, 0x13, 0xd3, 0x8a, 0x50, 0x29, 0x9d, 0xcb, 0xea, 0xda, 0xed, 0xd5, 0xfa, + 0x3a, 0x0b, 0x25, 0x65, 0xf0, 0x5b, 0x00, 0x62, 0xe8, 0x12, 0x63, 0x31, 0xa3, 0x08, 0x95, 0x7c, + 0xed, 0xf3, 0x37, 0xef, 0x8e, 0x52, 0x7f, 0xbd, 0x3b, 0x7a, 0xca, 0xab, 0x11, 0xd8, 0xaf, 0x54, + 0x87, 0x68, 0x9e, 0xc5, 0x46, 0xaa, 0xe1, 0xb3, 0x3f, 0x7e, 0x3b, 0x05, 0x71, 0x99, 0x0c, 0x9f, + 0xa1, 0x47, 0x72, 0x58, 0x03, 0x7b, 0x71, 0xd4, 0x66, 0x16, 0x9b, 0x04, 0xe2, 0x93, 0xc8, 0xd4, + 0xe1, 0xfb, 0x4d, 0x71, 0x0e, 0x5a, 0x97, 0xc0, 0x16, 0x28, 0xaf, 0x00, 0xca, 0x4c, 0xc7, 0xc3, + 0x62, 0x56, 0x11, 0x2a, 0x85, 0x73, 0x49, 0xe5, 0x95, 0x57, 0x17, 0x95, 0x57, 0xcd, 0x45, 0xe5, + 0x6b, 0xb9, 0xd0, 0xf2, 0xeb, 0xbf, 0x8f, 0x04, 0xb4, 0xa1, 0x86, 0xd7, 0xa0, 0x14, 0x63, 0xba, + 0x6f, 0x47, 0xe7, 0xed, 0x6e, 0x71, 0x5e, 0x42, 0x0b, 0xbf, 0x00, 0x1f, 0x3c, 0x7e, 0x42, 0xcd, + 0x25, 0xfd, 0x57, 0x62, 0x4e, 0x11, 0x2a, 0x69, 0xb4, 0x99, 0x80, 0xc7, 0xa0, 0x18, 0x83, 0x88, + 0x4c, 0x7c, 0x5b, 0xcc, 0x47, 0x9d, 0x5c, 0xc3, 0xe0, 0x0d, 0x28, 0x04, 0xae, 0x15, 0x8c, 0xaa, + 0x1e, 0x99, 0xf8, 0x4c, 0x04, 0xdb, 0xf7, 0xe0, 0xb1, 0x3e, 0xec, 0x68, 0x6f, 0x42, 0xfd, 0xf8, + 0xb4, 0xc2, 0xff, 0xe8, 0xe8, 0x4a, 0x0e, 0xaf, 0x40, 0x89, 0x8f, 0xae, 0x3e, 0x75, 0x6c, 0xec, + 0xf7, 0xb1, 0x58, 0x8c, 0x6a, 0x77, 0x10, 0xb7, 0x94, 0x0f, 0xb9, 0x7a, 0x13, 0x0e, 0x39, 0x8a, + 0x88, 0xb5, 0x4c, 0xf8, 0x2c, 0x94, 0x90, 0xc1, 0xaf, 0x40, 0x7e, 0x80, 0x71, 0x2b, 0x14, 0x05, + 0xe2, 0x9e, 0x92, 0xae, 0x14, 0xce, 0xc5, 0xc4, 0x58, 0x44, 0x49, 0xc3, 0x1f, 0x90, 0xf8, 0x88, + 0x95, 0x00, 0x5e, 0x81, 0xdc, 0x00, 0x63, 0x93, 0x30, 0xcb, 0x15, 0x4b, 0xdb, 0xdf, 0x68, 0x29, + 0x86, 0x9f, 0x82, 0xd2, 0x98, 0xe2, 0x69, 0x7d, 0xb1, 0x49, 0x81, 0xb8, 0xaf, 0xa4, 0x2b, 0x19, + 0x94, 0x40, 0x8f, 0x7f, 0x15, 0x40, 0x7e, 0xe9, 0x27, 0xec, 0xe2, 0x38, 0x0c, 0xaa, 0xb6, 0x4d, + 0x71, 0x10, 0x44, 0xab, 0x9a, 0x47, 0x6b, 0x18, 0xbc, 0x00, 0x59, 0x8b, 0x97, 0x7c, 0x67, 0x7b, + 0x83, 0xb1, 0x14, 0x4a, 0x20, 0x37, 0xa0, 0xc4, 0xab, 0x11, 0xdf, 0x8e, 0x16, 0x3a, 0x87, 0x96, + 0x31, 0xfc, 0x04, 0x14, 0x7b, 0xe1, 0x4c, 0x75, 0xfd, 0x89, 0xd7, 0xc3, 0x34, 0xda, 0xd5, 0x34, + 0x2a, 0x44, 0x58, 0x23, 0x82, 0x4e, 0x7e, 0x17, 0xc0, 0x7e, 0x62, 0xe3, 0xe1, 0x19, 0x38, 0xac, + 0x1b, 0xed, 0x56, 0xc7, 0xd4, 0xbb, 0x17, 0x55, 0x53, 0xbf, 0x6a, 0xa2, 0xef, 0xba, 0x9d, 0x46, + 0xbb, 0xa5, 0x5f, 0x18, 0x97, 0x86, 0x5e, 0x2f, 0xa7, 0xa4, 0xfd, 0xd9, 0x5c, 0x29, 0x74, 0xfc, + 0x60, 0x8c, 0xfb, 0xce, 0xc0, 0xc1, 0x36, 0x7c, 0x01, 0xc4, 0x0d, 0xc9, 0xcb, 0x2a, 0x6a, 0x18, + 0x8d, 0xab, 0xb2, 0x20, 0x15, 0x66, 0x73, 0x65, 0xf7, 0xa5, 0x45, 0x7d, 0xc7, 0x1f, 0xc2, 0xe7, + 0xe0, 0xd9, 0x06, 0xf5, 0xc6, 0x68, 0x34, 0x51, 0x79, 0x47, 0xca, 0xcf, 0xe6, 0xca, 0x93, 0x1b, + 0xc7, 0x27, 0xf4, 0xfd, 0xb4, 0xea, 0x37, 0x4d, 0x54, 0x4e, 0xc7, 0x34, 0xeb, 0x07, 0x42, 0xa5, + 0xcc, 0x4f, 0xbf, 0xc8, 0xa9, 0x93, 0x7f, 0x05, 0xb0, 0xb7, 0xf6, 0x8a, 0x80, 0x9f, 0xad, 0xe4, + 0x6d, 0xb3, 0x6a, 0x76, 0xda, 0xdd, 0x16, 0xd2, 0x6f, 0x9b, 0xa6, 0x5e, 0x4e, 0x71, 0x3b, 0x2d, + 0x8a, 0xa7, 0x84, 0x61, 0xf8, 0x1c, 0x3c, 0x4d, 0x10, 0x6f, 0x9b, 0x26, 0xb7, 0x0d, 0x66, 0x73, + 0x25, 0x7b, 0x4b, 0x58, 0xe8, 0xfa, 0x05, 0xf8, 0x28, 0x41, 0x43, 0x7a, 0xbb, 0x79, 0x7d, 0xab, + 0xd7, 0xcb, 0x3b, 0x52, 0x71, 0x36, 0x57, 0x72, 0x08, 0x07, 0xc4, 0x9d, 0x62, 0x1b, 0x9e, 0x82, + 0x83, 0x04, 0xb5, 0xd3, 0x58, 0x92, 0xd3, 0x52, 0x69, 0x36, 0x57, 0x40, 0xc7, 0xa7, 0x0b, 0xfa, + 0xa6, 0x81, 0xcb, 0xaa, 0x71, 0xad, 0xd7, 0xcb, 0x19, 0x6e, 0xe0, 0xd2, 0x72, 0x5c, 0x6c, 0xf3, + 0x8b, 0xd6, 0xea, 0x6f, 0xee, 0x65, 0xe1, 0xed, 0xbd, 0x2c, 0xfc, 0x73, 0x2f, 0x0b, 0xaf, 0x1f, + 0xe4, 0xd4, 0xdb, 0x07, 0x39, 0xf5, 0xe7, 0x83, 0x9c, 0xfa, 0xfe, 0x64, 0xe8, 0xb0, 0xd1, 0xa4, + 0xa7, 0xf6, 0x89, 0xa7, 0x31, 0xec, 0xba, 0x84, 0x9e, 0x3a, 0x44, 0xe3, 0xdf, 0x95, 0x1f, 0x97, + 0xdf, 0x3d, 0x76, 0x37, 0xc6, 0x41, 0x2f, 0x1b, 0xbd, 0xbe, 0xbe, 0xfc, 0x2f, 0x00, 0x00, 0xff, + 0xff, 0x1d, 0xf1, 0x07, 0x1f, 0x15, 0x07, 0x00, 0x00, } func (m *Dispute) Marshal() (dAtA []byte, err error) { @@ -623,7 +516,7 @@ func (m *Dispute) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MicroReport) Marshal() (dAtA []byte, err error) { +func (m *PayerInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -633,92 +526,21 @@ func (m *MicroReport) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MicroReport) MarshalTo(dAtA []byte) (int, error) { +func (m *PayerInfo) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MicroReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PayerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintDispute(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x42 if m.BlockNumber != 0 { i = encodeVarintDispute(dAtA, i, uint64(m.BlockNumber)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x20 } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintDispute(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x32 - } - if len(m.AggregateMethod) > 0 { - i -= len(m.AggregateMethod) - copy(dAtA[i:], m.AggregateMethod) - i = encodeVarintDispute(dAtA, i, uint64(len(m.AggregateMethod))) - i-- - dAtA[i] = 0x2a - } - if len(m.QueryId) > 0 { - i -= len(m.QueryId) - copy(dAtA[i:], m.QueryId) - i = encodeVarintDispute(dAtA, i, uint64(len(m.QueryId))) - i-- - dAtA[i] = 0x22 - } - if len(m.QueryType) > 0 { - i -= len(m.QueryType) - copy(dAtA[i:], m.QueryType) - i = encodeVarintDispute(dAtA, i, uint64(len(m.QueryType))) - i-- - dAtA[i] = 0x1a - } - if m.Power != 0 { - i = encodeVarintDispute(dAtA, i, uint64(m.Power)) - i-- - dAtA[i] = 0x10 - } - if len(m.Reporter) > 0 { - i -= len(m.Reporter) - copy(dAtA[i:], m.Reporter) - i = encodeVarintDispute(dAtA, i, uint64(len(m.Reporter))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PayerInfo) 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 *PayerInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PayerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l if m.FromBond { i-- if m.FromBond { @@ -730,11 +552,11 @@ func (m *PayerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x18 } { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { return 0, err } - i -= size i = encodeVarintDispute(dAtA, i, uint64(size)) } i-- @@ -815,43 +637,6 @@ func (m *Dispute) Size() (n int) { return n } -func (m *MicroReport) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Reporter) - if l > 0 { - n += 1 + l + sovDispute(uint64(l)) - } - if m.Power != 0 { - n += 1 + sovDispute(uint64(m.Power)) - } - l = len(m.QueryType) - if l > 0 { - n += 1 + l + sovDispute(uint64(l)) - } - l = len(m.QueryId) - if l > 0 { - n += 1 + l + sovDispute(uint64(l)) - } - l = len(m.AggregateMethod) - if l > 0 { - n += 1 + l + sovDispute(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovDispute(uint64(l)) - } - if m.BlockNumber != 0 { - n += 1 + sovDispute(uint64(m.BlockNumber)) - } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) - n += 1 + l + sovDispute(uint64(l)) - return n -} - func (m *PayerInfo) Size() (n int) { if m == nil { return 0 @@ -867,6 +652,9 @@ func (m *PayerInfo) Size() (n int) { if m.FromBond { n += 2 } + if m.BlockNumber != 0 { + n += 1 + sovDispute(uint64(m.BlockNumber)) + } return n } @@ -1400,7 +1188,7 @@ func (m *Dispute) Unmarshal(dAtA []byte) error { } return nil } -func (m *MicroReport) Unmarshal(dAtA []byte) error { +func (m *PayerInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1423,15 +1211,15 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MicroReport: wiretype end group for non-group") + return fmt.Errorf("proto: PayerInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MicroReport: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PayerInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PayerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1459,62 +1247,11 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Reporter = string(dAtA[iNdEx:postIndex]) + m.PayerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) - } - m.Power = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Power |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QueryType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - 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 ErrInvalidLengthDispute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDispute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.QueryType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field QueryId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1542,45 +1279,15 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.QueryId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateMethod", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - 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 ErrInvalidLengthDispute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDispute - } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.AggregateMethod = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FromBond", wireType) } - var stringLen uint64 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowDispute @@ -1590,25 +1297,13 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthDispute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDispute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: + m.FromBond = bool(v != 0) + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) } @@ -1627,174 +1322,6 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { break } } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDispute - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDispute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipDispute(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthDispute - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PayerInfo) 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 ErrIntOverflowDispute - } - 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: PayerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PayerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PayerAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - 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 ErrInvalidLengthDispute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthDispute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PayerAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthDispute - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthDispute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FromBond", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowDispute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.FromBond = bool(v != 0) default: iNdEx = preIndex skippy, err := skipDispute(dAtA[iNdEx:]) diff --git a/x/dispute/types/dispute_params.pb.go b/x/dispute/types/dispute_params.pb.go index 3de2459b1..c4fbac05e 100644 --- a/x/dispute/types/dispute_params.pb.go +++ b/x/dispute/types/dispute_params.pb.go @@ -6,6 +6,7 @@ package types import ( fmt "fmt" proto "github.com/cosmos/gogoproto/proto" + types "github.com/tellor-io/layer/x/oracle/types" io "io" math "math" math_bits "math/bits" @@ -23,8 +24,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type DisputeParams struct { - Report *MicroReport `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` - Category DisputeCategory `protobuf:"varint,2,opt,name=category,proto3,enum=layer.dispute.DisputeCategory" json:"category,omitempty"` + Report *types.MicroReport `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` + Category DisputeCategory `protobuf:"varint,2,opt,name=category,proto3,enum=layer.dispute.DisputeCategory" json:"category,omitempty"` } func (m *DisputeParams) Reset() { *m = DisputeParams{} } @@ -60,7 +61,7 @@ func (m *DisputeParams) XXX_DiscardUnknown() { var xxx_messageInfo_DisputeParams proto.InternalMessageInfo -func (m *DisputeParams) GetReport() *MicroReport { +func (m *DisputeParams) GetReport() *types.MicroReport { if m != nil { return m.Report } @@ -83,20 +84,22 @@ func init() { } var fileDescriptor_2b782315e5e42770 = []byte{ - // 207 bytes of a gzipped FileDescriptorProto + // 230 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0x4f, 0xc9, 0x2c, 0x2e, 0x28, 0x2d, 0x49, 0x85, 0xd1, 0xf1, 0x05, 0x89, 0x45, 0x89, 0xb9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0x60, 0x35, 0x7a, 0x50, 0x39, 0x29, - 0x69, 0xac, 0x5a, 0x20, 0x6a, 0x95, 0xea, 0xb9, 0x78, 0x5d, 0x20, 0x02, 0x01, 0x60, 0x23, 0x84, - 0x8c, 0xb8, 0xd8, 0x8a, 0x52, 0x0b, 0xf2, 0x8b, 0x4a, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, - 0xa4, 0xf4, 0x50, 0x4c, 0xd3, 0xf3, 0xcd, 0x4c, 0x2e, 0xca, 0x0f, 0x02, 0xab, 0x08, 0x82, 0xaa, - 0x14, 0xb2, 0xe2, 0xe2, 0x48, 0x4e, 0x2c, 0x49, 0x4d, 0xcf, 0x2f, 0xaa, 0x94, 0x60, 0x52, 0x60, - 0xd4, 0xe0, 0x33, 0x92, 0x43, 0xd3, 0x05, 0xb5, 0xc3, 0x19, 0xaa, 0x2a, 0x08, 0xae, 0xde, 0xc9, - 0xe5, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, - 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xb4, 0xd2, 0x33, 0x4b, 0x32, - 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x4b, 0x52, 0x73, 0x72, 0xf2, 0x8b, 0x74, 0x33, 0xf3, - 0xf5, 0x21, 0x9e, 0xa9, 0x80, 0x7b, 0xa7, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x1b, - 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xd8, 0xbc, 0x13, 0x1f, 0x01, 0x00, 0x00, + 0x69, 0xac, 0x5a, 0x20, 0x6a, 0xa5, 0xe4, 0x21, 0x92, 0xf9, 0x45, 0x89, 0xc9, 0x39, 0xa9, 0xfa, + 0xb9, 0x99, 0xc9, 0x45, 0xf9, 0xf1, 0x45, 0xa9, 0x05, 0xf9, 0x45, 0x25, 0x10, 0x05, 0x4a, 0x75, + 0x5c, 0xbc, 0x2e, 0x10, 0x1d, 0x01, 0x60, 0x3b, 0x84, 0x0c, 0xb9, 0xd8, 0x20, 0x0a, 0x24, 0x18, + 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x24, 0xf5, 0x20, 0xd6, 0x41, 0x8c, 0xd0, 0xf3, 0x05, 0x19, 0x11, + 0x04, 0x56, 0x10, 0x04, 0x55, 0x28, 0x64, 0xc5, 0xc5, 0x91, 0x9c, 0x58, 0x92, 0x9a, 0x9e, 0x5f, + 0x54, 0x29, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x67, 0x24, 0xa7, 0x87, 0xe2, 0x46, 0x3d, 0xa8, 0x15, + 0xce, 0x50, 0x55, 0x41, 0x70, 0xf5, 0x4e, 0x2e, 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, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x5f, 0x92, + 0x9a, 0x93, 0x93, 0x5f, 0xa4, 0x9b, 0x99, 0xaf, 0x0f, 0xf1, 0x4f, 0x05, 0xdc, 0xbb, 0x25, 0x95, + 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xcf, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x31, 0x01, + 0xdf, 0x13, 0x3f, 0x01, 0x00, 0x00, } func (m *DisputeParams) Marshal() (dAtA []byte, err error) { @@ -231,7 +234,7 @@ func (m *DisputeParams) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Report == nil { - m.Report = &MicroReport{} + m.Report = &types.MicroReport{} } if err := m.Report.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/dispute/types/tx.pb.go b/x/dispute/types/tx.pb.go index 274f2d02a..cd00b4920 100644 --- a/x/dispute/types/tx.pb.go +++ b/x/dispute/types/tx.pb.go @@ -6,11 +6,12 @@ package types import ( context "context" fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + types "github.com/tellor-io/layer/x/oracle/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -59,11 +60,11 @@ func (VoteEnum) EnumDescriptor() ([]byte, []int) { } type MsgProposeDispute struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Report *MicroReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report,omitempty"` - DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"disputeCategory,omitempty"` - Fee types.Coin `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee"` - PayFromBond bool `protobuf:"varint,5,opt,name=payFromBond,proto3" json:"payFromBond,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Report *types.MicroReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report,omitempty"` + DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"disputeCategory,omitempty"` + Fee types1.Coin `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee"` + PayFromBond bool `protobuf:"varint,5,opt,name=payFromBond,proto3" json:"payFromBond,omitempty"` } func (m *MsgProposeDispute) Reset() { *m = MsgProposeDispute{} } @@ -106,7 +107,7 @@ func (m *MsgProposeDispute) GetCreator() string { return "" } -func (m *MsgProposeDispute) GetReport() *MicroReport { +func (m *MsgProposeDispute) GetReport() *types.MicroReport { if m != nil { return m.Report } @@ -120,11 +121,11 @@ func (m *MsgProposeDispute) GetDisputeCategory() DisputeCategory { return Unspecified } -func (m *MsgProposeDispute) GetFee() types.Coin { +func (m *MsgProposeDispute) GetFee() types1.Coin { if m != nil { return m.Fee } - return types.Coin{} + return types1.Coin{} } func (m *MsgProposeDispute) GetPayFromBond() bool { @@ -171,10 +172,10 @@ func (m *MsgProposeDisputeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgProposeDisputeResponse proto.InternalMessageInfo type MsgAddFeeToDispute struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DisputeId uint64 `protobuf:"varint,2,opt,name=disputeId,proto3" json:"disputeId,omitempty"` - Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` - PayFromBond bool `protobuf:"varint,4,opt,name=payFromBond,proto3" json:"payFromBond,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + DisputeId uint64 `protobuf:"varint,2,opt,name=disputeId,proto3" json:"disputeId,omitempty"` + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` + PayFromBond bool `protobuf:"varint,4,opt,name=payFromBond,proto3" json:"payFromBond,omitempty"` } func (m *MsgAddFeeToDispute) Reset() { *m = MsgAddFeeToDispute{} } @@ -224,11 +225,11 @@ func (m *MsgAddFeeToDispute) GetDisputeId() uint64 { return 0 } -func (m *MsgAddFeeToDispute) GetAmount() types.Coin { +func (m *MsgAddFeeToDispute) GetAmount() types1.Coin { if m != nil { return m.Amount } - return types.Coin{} + return types1.Coin{} } func (m *MsgAddFeeToDispute) GetPayFromBond() bool { @@ -383,44 +384,45 @@ func init() { func init() { proto.RegisterFile("layer/dispute/tx.proto", fileDescriptor_3a591d7bef5d6e8a) } var fileDescriptor_3a591d7bef5d6e8a = []byte{ - // 587 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x4f, 0xdb, 0x40, - 0x10, 0x8d, 0x83, 0xf9, 0x1a, 0x28, 0x84, 0x15, 0x02, 0x63, 0x90, 0xeb, 0xe6, 0x94, 0xa6, 0xaa, - 0xad, 0xa4, 0x87, 0x4a, 0x1c, 0xaa, 0x06, 0x02, 0x6d, 0xa4, 0x06, 0x90, 0x49, 0x39, 0x54, 0x95, - 0x90, 0x13, 0x6f, 0x8d, 0x25, 0xec, 0xb1, 0xbc, 0x1b, 0x44, 0x6e, 0x55, 0xaf, 0x95, 0xaa, 0xfe, - 0x14, 0x2e, 0xfd, 0x0f, 0x1c, 0x39, 0xf6, 0x54, 0x55, 0x70, 0xe0, 0x6f, 0x54, 0xb6, 0xd7, 0xa1, - 0x71, 0x2a, 0xa5, 0xa7, 0xdd, 0x7d, 0xf3, 0x66, 0x67, 0xde, 0x9b, 0xd5, 0xc2, 0xda, 0xb9, 0x3d, - 0xa0, 0x91, 0xe9, 0x78, 0x2c, 0xec, 0x73, 0x6a, 0xf2, 0x4b, 0x23, 0x8c, 0x90, 0x23, 0x79, 0x94, - 0xe0, 0x86, 0xc0, 0x55, 0xad, 0x87, 0xcc, 0x47, 0x66, 0x76, 0x6d, 0x46, 0xcd, 0x8b, 0x5a, 0x97, - 0x72, 0xbb, 0x66, 0xf6, 0xd0, 0x0b, 0x52, 0xba, 0xba, 0x2e, 0xe2, 0x3e, 0x73, 0xcd, 0x8b, 0x5a, - 0xbc, 0x88, 0xc0, 0xaa, 0x8b, 0x2e, 0x26, 0x5b, 0x33, 0xde, 0x09, 0x74, 0x73, 0xb4, 0xaa, 0x58, - 0xd3, 0x60, 0xf9, 0x5b, 0x11, 0x56, 0xda, 0xcc, 0x3d, 0x8a, 0x30, 0x44, 0x46, 0x9b, 0x69, 0x8c, - 0x28, 0x30, 0xdb, 0x8b, 0xa8, 0xcd, 0x31, 0x52, 0x24, 0x5d, 0xaa, 0xcc, 0x5b, 0xd9, 0x91, 0xd4, - 0x61, 0x26, 0xa2, 0x21, 0x46, 0x5c, 0x29, 0xea, 0x52, 0x65, 0xa1, 0xae, 0x1a, 0x23, 0xbd, 0x1b, - 0x6d, 0xaf, 0x17, 0xa1, 0x95, 0x30, 0x2c, 0xc1, 0x24, 0x6f, 0x61, 0x59, 0x84, 0x77, 0x6d, 0x4e, - 0x5d, 0x8c, 0x06, 0xca, 0x94, 0x2e, 0x55, 0x96, 0xea, 0x5a, 0x2e, 0xb9, 0x39, 0xca, 0xb2, 0xf2, - 0x69, 0xa4, 0x06, 0x53, 0x9f, 0x28, 0x55, 0xe4, 0xa4, 0xf4, 0x86, 0x91, 0xfa, 0x60, 0xc4, 0x3e, - 0x19, 0xc2, 0x27, 0x63, 0x17, 0xbd, 0x60, 0x47, 0xbe, 0xfe, 0xf5, 0xb8, 0x60, 0xc5, 0x5c, 0xa2, - 0xc3, 0x42, 0x68, 0x0f, 0xf6, 0x23, 0xf4, 0x77, 0x30, 0x70, 0x94, 0x69, 0x5d, 0xaa, 0xcc, 0x59, - 0x7f, 0x43, 0xdb, 0x8b, 0x5f, 0xee, 0xaf, 0xaa, 0x99, 0xc0, 0xf2, 0x26, 0x6c, 0x8c, 0xf9, 0x61, - 0x51, 0x16, 0x62, 0xc0, 0x68, 0xf9, 0x87, 0x04, 0xa4, 0xcd, 0xdc, 0x86, 0xe3, 0xec, 0x53, 0xda, - 0xc1, 0xc9, 0x76, 0x6d, 0xc1, 0xbc, 0xd0, 0xd0, 0x72, 0x12, 0xc7, 0x64, 0xeb, 0x01, 0x20, 0x2f, - 0x61, 0xc6, 0xf6, 0xb1, 0x1f, 0xf0, 0xc4, 0x8f, 0xff, 0x50, 0x24, 0xe8, 0x79, 0x51, 0xf2, 0x24, - 0x51, 0x5b, 0xa0, 0x8e, 0xb7, 0x3d, 0x54, 0x75, 0x06, 0xb3, 0x6d, 0xe6, 0x9e, 0x20, 0xa7, 0x64, - 0x15, 0xa6, 0x2f, 0x90, 0xd3, 0x4c, 0x47, 0x7a, 0x20, 0x4b, 0x50, 0xf4, 0xb2, 0xf6, 0x8b, 0x9e, - 0x43, 0x9e, 0x81, 0x1c, 0x07, 0xc4, 0x14, 0xd7, 0x73, 0x53, 0x8c, 0x2f, 0xda, 0x0b, 0xfa, 0xbe, - 0x95, 0x90, 0xb6, 0x21, 0xee, 0x24, 0xbd, 0xa8, 0xbc, 0x02, 0xcb, 0xa2, 0x52, 0x56, 0xbc, 0xfa, - 0x1a, 0xe6, 0xb2, 0x04, 0x52, 0x82, 0xc5, 0x93, 0xc3, 0xce, 0xde, 0x69, 0xeb, 0xe0, 0xa4, 0xf1, - 0xae, 0xd5, 0x2c, 0x15, 0x86, 0xc8, 0xf1, 0xfb, 0xa3, 0xa3, 0x43, 0xab, 0x53, 0x92, 0x86, 0x48, - 0xe3, 0x4d, 0xa3, 0x75, 0x70, 0xdc, 0x29, 0x15, 0xeb, 0x5f, 0x8b, 0x30, 0xd5, 0x66, 0x2e, 0xf9, - 0x08, 0x4b, 0xb9, 0x67, 0xac, 0xe7, 0x1f, 0x67, 0x7e, 0xb0, 0x6a, 0x65, 0x12, 0x23, 0xeb, 0x93, - 0x9c, 0xc2, 0x72, 0x7e, 0xec, 0x4f, 0xc6, 0x93, 0x73, 0x14, 0xf5, 0xe9, 0x44, 0xca, 0xb0, 0xc0, - 0x2b, 0x90, 0x93, 0x11, 0xac, 0x8d, 0xa7, 0xc4, 0xb8, 0xaa, 0xfd, 0x1b, 0xcf, 0xf2, 0xd5, 0xe9, - 0xcf, 0xf7, 0x57, 0x55, 0x69, 0xa7, 0x79, 0x7d, 0xab, 0x49, 0x37, 0xb7, 0x9a, 0xf4, 0xfb, 0x56, - 0x93, 0xbe, 0xdf, 0x69, 0x85, 0x9b, 0x3b, 0xad, 0xf0, 0xf3, 0x4e, 0x2b, 0x7c, 0xa8, 0xba, 0x1e, - 0x3f, 0xeb, 0x77, 0x8d, 0x1e, 0xfa, 0x26, 0xa7, 0xe7, 0xe7, 0x18, 0x3d, 0xf7, 0xd0, 0x4c, 0x3f, - 0x87, 0xcb, 0x87, 0x4f, 0x69, 0x10, 0x52, 0xd6, 0x9d, 0x49, 0x7e, 0x87, 0x17, 0x7f, 0x02, 0x00, - 0x00, 0xff, 0xff, 0x6d, 0xed, 0x6f, 0x08, 0xb2, 0x04, 0x00, 0x00, + // 604 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x4f, 0xdb, 0x4e, + 0x10, 0x8d, 0x43, 0xf8, 0x37, 0xf0, 0x83, 0xb0, 0x42, 0x10, 0x0c, 0x32, 0xf9, 0xe5, 0x94, 0xa6, + 0xaa, 0xad, 0xd0, 0x43, 0x25, 0x0e, 0x55, 0x03, 0x81, 0x36, 0x52, 0x03, 0xc8, 0xa4, 0x1c, 0xaa, + 0x4a, 0xc8, 0xb1, 0xb7, 0xc6, 0x52, 0xec, 0xb1, 0x76, 0x37, 0x88, 0xdc, 0xaa, 0x5e, 0xab, 0x4a, + 0xfd, 0x28, 0x5c, 0xfa, 0x1d, 0x38, 0x72, 0xec, 0xa9, 0xaa, 0xe0, 0xc0, 0xd7, 0xa8, 0x6c, 0xaf, + 0x43, 0xe3, 0x54, 0x4a, 0x4f, 0xb6, 0xdf, 0xbc, 0xd9, 0x37, 0xef, 0x8d, 0xb5, 0xb0, 0xd6, 0xb3, + 0x06, 0x94, 0x19, 0x8e, 0xc7, 0xc3, 0xbe, 0xa0, 0x86, 0xb8, 0xd2, 0x43, 0x86, 0x02, 0xc9, 0x7f, + 0x31, 0xae, 0x4b, 0x5c, 0xd5, 0x6c, 0xe4, 0x3e, 0x72, 0xa3, 0x6b, 0x71, 0x6a, 0x5c, 0xd6, 0xbb, + 0x54, 0x58, 0x75, 0xc3, 0x46, 0x2f, 0x48, 0xe8, 0xea, 0xba, 0xac, 0xfb, 0xdc, 0x35, 0x2e, 0xeb, + 0xd1, 0x43, 0x16, 0x56, 0x5d, 0x74, 0x31, 0x7e, 0x35, 0xa2, 0x37, 0x89, 0x6e, 0x8e, 0xaa, 0xca, + 0xa7, 0x2c, 0x6e, 0x27, 0x45, 0x64, 0x96, 0xdd, 0xa3, 0x86, 0xef, 0xd9, 0x0c, 0xcf, 0x19, 0x0d, + 0x91, 0x89, 0x84, 0x50, 0xf9, 0x9a, 0x87, 0x95, 0x36, 0x77, 0x4f, 0x18, 0x86, 0xc8, 0x69, 0x33, + 0x69, 0x26, 0x25, 0x98, 0xb5, 0x19, 0xb5, 0x04, 0xb2, 0x92, 0x52, 0x56, 0xaa, 0xf3, 0x66, 0xfa, + 0x49, 0xea, 0x30, 0x93, 0xf4, 0x97, 0xf2, 0x65, 0xa5, 0xba, 0xb0, 0xb3, 0xa1, 0x27, 0xe6, 0x12, + 0x05, 0xbd, 0x1d, 0x29, 0x98, 0x31, 0xc1, 0x94, 0x44, 0xf2, 0x06, 0x96, 0xe5, 0x50, 0xfb, 0x96, + 0xa0, 0x2e, 0xb2, 0x41, 0x69, 0xaa, 0xac, 0x54, 0x97, 0x76, 0x34, 0x7d, 0x24, 0x18, 0xbd, 0x39, + 0xca, 0x32, 0xb3, 0x6d, 0xa4, 0x0e, 0x53, 0x1f, 0x29, 0x2d, 0x15, 0xa4, 0x72, 0x92, 0x93, 0x1e, + 0xe5, 0xa8, 0xcb, 0x1c, 0xf5, 0x7d, 0xf4, 0x82, 0xbd, 0xc2, 0xcd, 0xcf, 0xed, 0x9c, 0x19, 0x71, + 0x49, 0x19, 0x16, 0x42, 0x6b, 0x70, 0xc8, 0xd0, 0xdf, 0xc3, 0xc0, 0x29, 0x4d, 0x97, 0x95, 0xea, + 0x9c, 0xf9, 0x27, 0xb4, 0xbb, 0xf8, 0xf9, 0xe1, 0xba, 0x96, 0xfa, 0xab, 0x6c, 0xc2, 0xc6, 0x58, + 0x1c, 0x26, 0xe5, 0x21, 0x06, 0x9c, 0x56, 0xbe, 0x2b, 0x40, 0xda, 0xdc, 0x6d, 0x38, 0xce, 0x21, + 0xa5, 0x1d, 0x9c, 0x9c, 0xd6, 0x16, 0xcc, 0x4b, 0x0f, 0x2d, 0x27, 0x0e, 0xac, 0x60, 0x3e, 0x02, + 0xe4, 0x05, 0xcc, 0x58, 0x3e, 0xf6, 0x03, 0x11, 0xe7, 0xf1, 0x0f, 0x8e, 0x24, 0x3d, 0x6b, 0xaa, + 0x30, 0xc9, 0xd4, 0x16, 0xa8, 0xe3, 0x63, 0x0f, 0x5d, 0x5d, 0xc0, 0x6c, 0x9b, 0xbb, 0x67, 0x28, + 0x28, 0x59, 0x85, 0xe9, 0x4b, 0x14, 0x34, 0xf5, 0x91, 0x7c, 0x90, 0x25, 0xc8, 0x7b, 0xe9, 0xf8, + 0x79, 0xcf, 0x21, 0x4f, 0xa1, 0x10, 0x15, 0xe4, 0x16, 0xd7, 0x33, 0x5b, 0x8c, 0x0e, 0x3a, 0x08, + 0xfa, 0xbe, 0x19, 0x93, 0x76, 0x21, 0x9a, 0x24, 0x39, 0xa8, 0xb2, 0x02, 0xcb, 0x52, 0x29, 0x15, + 0xaf, 0xbd, 0x82, 0xb9, 0xb4, 0x81, 0x14, 0x61, 0xf1, 0xec, 0xb8, 0x73, 0x70, 0xde, 0x3a, 0x3a, + 0x6b, 0xbc, 0x6d, 0x35, 0x8b, 0xb9, 0x21, 0x72, 0xfa, 0xee, 0xe4, 0xe4, 0xd8, 0xec, 0x14, 0x95, + 0x21, 0xd2, 0x78, 0xdd, 0x68, 0x1d, 0x9d, 0x76, 0x8a, 0xf9, 0x9d, 0x2f, 0x79, 0x98, 0x6a, 0x73, + 0x97, 0x7c, 0x80, 0xa5, 0xcc, 0x5f, 0x5c, 0xce, 0x4c, 0x36, 0xb6, 0x58, 0xb5, 0x3a, 0x89, 0x91, + 0xce, 0x49, 0xce, 0x61, 0x39, 0xbb, 0xf6, 0xff, 0xc7, 0x9b, 0x33, 0x14, 0xf5, 0xc9, 0x44, 0xca, + 0x50, 0xe0, 0x25, 0x14, 0xe2, 0x15, 0xac, 0x8d, 0xb7, 0x44, 0xb8, 0xaa, 0xfd, 0x1d, 0x4f, 0xfb, + 0xd5, 0xe9, 0x4f, 0x0f, 0xd7, 0x35, 0x65, 0xaf, 0x79, 0x73, 0xa7, 0x29, 0xb7, 0x77, 0x9a, 0xf2, + 0xeb, 0x4e, 0x53, 0xbe, 0xdd, 0x6b, 0xb9, 0xdb, 0x7b, 0x2d, 0xf7, 0xe3, 0x5e, 0xcb, 0xbd, 0xaf, + 0xb9, 0x9e, 0xb8, 0xe8, 0x77, 0x75, 0x1b, 0x7d, 0x43, 0xd0, 0x5e, 0x0f, 0xd9, 0x33, 0x0f, 0x8d, + 0xe4, 0x7e, 0xb8, 0x7a, 0xbc, 0xb4, 0x06, 0x21, 0xe5, 0xdd, 0x99, 0xf8, 0x72, 0x78, 0xfe, 0x3b, + 0x00, 0x00, 0xff, 0xff, 0x1e, 0x6b, 0x52, 0xc0, 0xd2, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1006,7 +1008,7 @@ func (m *MsgProposeDispute) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Report == nil { - m.Report = &MicroReport{} + m.Report = &types.MicroReport{} } if err := m.Report.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/oracle/types/micro_report.pb.go b/x/oracle/types/micro_report.pb.go index a77e5a170..015f8a5ae 100644 --- a/x/oracle/types/micro_report.pb.go +++ b/x/oracle/types/micro_report.pb.go @@ -27,15 +27,26 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MicroReport represents data for a single report type MicroReport struct { - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` - QueryType string `protobuf:"bytes,3,opt,name=queryType,proto3" json:"queryType,omitempty"` - QueryId string `protobuf:"bytes,4,opt,name=queryId,proto3" json:"queryId,omitempty"` - AggregateMethod string `protobuf:"bytes,5,opt,name=aggregateMethod,proto3" json:"aggregateMethod,omitempty"` - Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` - Timestamp time.Time `protobuf:"bytes,7,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - Cyclelist bool `protobuf:"varint,8,opt,name=cyclelist,proto3" json:"cyclelist,omitempty"` + // reporter is the address of the reporter + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + // the power of the reporter based on total tokens normalized + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + // string identifier of the data spec + QueryType string `protobuf:"bytes,3,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + // hash of the query data + QueryId string `protobuf:"bytes,4,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + // aggregate method to use for aggregating all the reports for the query id + AggregateMethod string `protobuf:"bytes,5,opt,name=aggregate_method,json=aggregateMethod,proto3" json:"aggregate_method,omitempty"` + // hex string of the response value + Value string `protobuf:"bytes,6,opt,name=value,proto3" json:"value,omitempty"` + // timestamp of when the report was created + Timestamp time.Time `protobuf:"bytes,7,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + // indicates if the report's query id is in the cyclelist + Cyclelist bool `protobuf:"varint,8,opt,name=cyclelist,proto3" json:"cyclelist,omitempty"` + // block number of when the report was created + BlockNumber int64 `protobuf:"varint,9,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (m *MicroReport) Reset() { *m = MicroReport{} } @@ -127,6 +138,13 @@ func (m *MicroReport) GetCyclelist() bool { return false } +func (m *MicroReport) GetBlockNumber() int64 { + if m != nil { + return m.BlockNumber + } + return 0 +} + func init() { proto.RegisterType((*MicroReport)(nil), "layer.oracle.MicroReport") } @@ -134,28 +152,30 @@ func init() { func init() { proto.RegisterFile("layer/oracle/micro_report.proto", fileDescriptor_c39350954f878191) } var fileDescriptor_c39350954f878191 = []byte{ - // 326 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xbf, 0x4e, 0xf3, 0x30, - 0x10, 0xc0, 0xe3, 0xf6, 0x6b, 0x9b, 0xba, 0x9f, 0x84, 0x14, 0x75, 0xb0, 0x22, 0x94, 0x44, 0x4c, - 0x61, 0x20, 0x96, 0xe0, 0x0d, 0xca, 0xc4, 0xd0, 0x25, 0xea, 0xc4, 0x82, 0xd2, 0xf4, 0x70, 0x23, - 0x39, 0xba, 0xe0, 0x3a, 0x40, 0xde, 0xa2, 0x2b, 0x6f, 0xd4, 0xb1, 0x23, 0x13, 0xa0, 0xf6, 0x45, - 0x50, 0x6c, 0xa5, 0x95, 0xd8, 0xfc, 0xbb, 0xfb, 0xf9, 0xfe, 0xe8, 0x68, 0x28, 0xb3, 0x06, 0x14, - 0x47, 0x95, 0xe5, 0x12, 0x78, 0x59, 0xe4, 0x0a, 0x9f, 0x14, 0x54, 0xa8, 0x74, 0x52, 0x29, 0xd4, - 0xe8, 0xfd, 0x37, 0x42, 0x62, 0x05, 0x7f, 0x2a, 0x50, 0xa0, 0x49, 0xf0, 0xf6, 0x65, 0x1d, 0x3f, - 0x14, 0x88, 0x42, 0x02, 0x37, 0xb4, 0xac, 0x9f, 0xb9, 0x2e, 0x4a, 0xd8, 0xe8, 0xac, 0xac, 0xac, - 0x70, 0xf5, 0xd1, 0xa3, 0x93, 0x79, 0x5b, 0x3b, 0x35, 0xa5, 0x3d, 0x9f, 0xba, 0xb6, 0x09, 0x28, - 0x46, 0x22, 0x12, 0x8f, 0xd3, 0x13, 0x7b, 0x53, 0x3a, 0xa8, 0xf0, 0x0d, 0x14, 0xeb, 0x45, 0x24, - 0xee, 0xa7, 0x16, 0xbc, 0x4b, 0x3a, 0x7e, 0xa9, 0x41, 0x35, 0x8b, 0xa6, 0x02, 0xd6, 0x37, 0x5f, - 0xce, 0x01, 0x8f, 0xd1, 0x91, 0x81, 0x87, 0x15, 0xfb, 0x67, 0x72, 0x1d, 0x7a, 0x31, 0xbd, 0xc8, - 0x84, 0x50, 0x20, 0x32, 0x0d, 0x73, 0xd0, 0x6b, 0x5c, 0xb1, 0x81, 0x31, 0xfe, 0x86, 0xdb, 0xbe, - 0xaf, 0x99, 0xac, 0x81, 0x0d, 0x4d, 0xde, 0x82, 0x37, 0xa3, 0xe3, 0xd3, 0x32, 0x6c, 0x14, 0x91, - 0x78, 0x72, 0xeb, 0x27, 0x76, 0xdd, 0xa4, 0x5b, 0x37, 0x59, 0x74, 0xc6, 0xcc, 0xdd, 0x7d, 0x85, - 0xce, 0xf6, 0x3b, 0x24, 0xe9, 0xf9, 0x5b, 0x3b, 0x7b, 0xde, 0xe4, 0x12, 0x64, 0xb1, 0xd1, 0xcc, - 0x8d, 0x48, 0xec, 0xa6, 0xe7, 0xc0, 0xec, 0x7e, 0x77, 0x08, 0xc8, 0xfe, 0x10, 0x90, 0x9f, 0x43, - 0x40, 0xb6, 0xc7, 0xc0, 0xd9, 0x1f, 0x03, 0xe7, 0xf3, 0x18, 0x38, 0x8f, 0xd7, 0xa2, 0xd0, 0xeb, - 0x7a, 0x99, 0xe4, 0x58, 0x72, 0x0d, 0x52, 0xa2, 0xba, 0x29, 0x90, 0xdb, 0x83, 0xbd, 0x77, 0x27, - 0xd3, 0x4d, 0x05, 0x9b, 0xe5, 0xd0, 0xcc, 0x72, 0xf7, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x11, 0x5c, - 0x66, 0xd4, 0xcf, 0x01, 0x00, 0x00, + // 359 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x51, 0xbd, 0x6e, 0xdb, 0x30, + 0x10, 0x16, 0xed, 0xda, 0x96, 0x68, 0x03, 0x2d, 0x08, 0x0f, 0xac, 0xd0, 0x4a, 0x6a, 0x27, 0x79, + 0xa8, 0x04, 0xb4, 0x6f, 0xe0, 0x4e, 0x19, 0x9c, 0x41, 0xf0, 0x94, 0x45, 0x90, 0xe4, 0x0b, 0x2d, + 0x84, 0x0a, 0x15, 0x9a, 0x4a, 0xa2, 0xb7, 0xf0, 0x1b, 0x65, 0xf5, 0xe8, 0x31, 0x53, 0x12, 0xd8, + 0x2f, 0x12, 0x88, 0x84, 0xed, 0x8d, 0xdf, 0xcf, 0xdd, 0xf1, 0xbb, 0xc3, 0x3e, 0xcf, 0x5a, 0x90, + 0xb1, 0x90, 0x59, 0xc1, 0x21, 0xae, 0xca, 0x42, 0x8a, 0x54, 0x42, 0x2d, 0xa4, 0x8a, 0x6a, 0x29, + 0x94, 0x20, 0x13, 0x6d, 0x88, 0x8c, 0xc1, 0x9d, 0x32, 0xc1, 0x84, 0x16, 0xe2, 0xee, 0x65, 0x3c, + 0xae, 0xcf, 0x84, 0x60, 0x1c, 0x62, 0x8d, 0xf2, 0xe6, 0x36, 0x56, 0x65, 0x05, 0x1b, 0x95, 0x55, + 0xb5, 0x31, 0xfc, 0x7e, 0xe9, 0xe1, 0xf1, 0xa2, 0xeb, 0x9d, 0xe8, 0xd6, 0xc4, 0xc5, 0xb6, 0x19, + 0x02, 0x92, 0xa2, 0x00, 0x85, 0x4e, 0x72, 0xc6, 0x64, 0x8a, 0x07, 0xb5, 0x78, 0x02, 0x49, 0x7b, + 0x01, 0x0a, 0xfb, 0x89, 0x01, 0xe4, 0x27, 0xc6, 0x0f, 0x0d, 0xc8, 0x36, 0x55, 0x6d, 0x0d, 0xb4, + 0xaf, 0x6b, 0x1c, 0xcd, 0x2c, 0xdb, 0x1a, 0xc8, 0x77, 0x6c, 0x1b, 0xb9, 0x5c, 0xd1, 0x2f, 0x5a, + 0x1c, 0x69, 0x7c, 0xb5, 0x22, 0x33, 0xfc, 0x2d, 0x63, 0x4c, 0x02, 0xcb, 0x14, 0xa4, 0x15, 0xa8, + 0xb5, 0x58, 0xd1, 0x81, 0xb6, 0x7c, 0x3d, 0xf3, 0x0b, 0x4d, 0x77, 0xa3, 0x1f, 0x33, 0xde, 0x00, + 0x1d, 0x6a, 0xdd, 0x00, 0x32, 0xc7, 0xce, 0x39, 0x0f, 0x1d, 0x05, 0x28, 0x1c, 0xff, 0x75, 0x23, + 0x93, 0x38, 0x3a, 0x25, 0x8e, 0x96, 0x27, 0xc7, 0xdc, 0xde, 0xbd, 0xf9, 0xd6, 0xf6, 0xdd, 0x47, + 0xc9, 0xa5, 0x8c, 0xfc, 0xc0, 0x4e, 0xd1, 0x16, 0x1c, 0x78, 0xb9, 0x51, 0xd4, 0x0e, 0x50, 0x68, + 0x27, 0x17, 0x82, 0xfc, 0xc2, 0x93, 0x9c, 0x8b, 0xe2, 0x2e, 0xbd, 0x6f, 0xaa, 0x1c, 0x24, 0x75, + 0x74, 0xf2, 0xb1, 0xe6, 0xae, 0x35, 0x35, 0xff, 0xbf, 0x3b, 0x78, 0x68, 0x7f, 0xf0, 0xd0, 0xc7, + 0xc1, 0x43, 0xdb, 0xa3, 0x67, 0xed, 0x8f, 0x9e, 0xf5, 0x7a, 0xf4, 0xac, 0x9b, 0x19, 0x2b, 0xd5, + 0xba, 0xc9, 0xa3, 0x42, 0x54, 0xb1, 0x02, 0xce, 0x85, 0xfc, 0x53, 0x8a, 0xd8, 0x9c, 0xf5, 0xf9, + 0x74, 0xd8, 0x6e, 0x6b, 0x9b, 0x7c, 0xa8, 0xbf, 0xfb, 0xef, 0x33, 0x00, 0x00, 0xff, 0xff, 0x0f, + 0x39, 0x4c, 0x75, 0xf5, 0x01, 0x00, 0x00, } func (m *MicroReport) Marshal() (dAtA []byte, err error) { @@ -178,6 +198,11 @@ func (m *MicroReport) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.BlockNumber != 0 { + i = encodeVarintMicroReport(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x48 + } if m.Cyclelist { i-- if m.Cyclelist { @@ -284,6 +309,9 @@ func (m *MicroReport) Size() (n int) { if m.Cyclelist { n += 2 } + if m.BlockNumber != 0 { + n += 1 + sovMicroReport(uint64(m.BlockNumber)) + } return n } @@ -554,6 +582,25 @@ func (m *MicroReport) Unmarshal(dAtA []byte) error { } } m.Cyclelist = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMicroReport + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipMicroReport(dAtA[iNdEx:]) diff --git a/x/oracle/types/query_meta.pb.go b/x/oracle/types/query_meta.pb.go index ee8b75f3f..7cf90268e 100644 --- a/x/oracle/types/query_meta.pb.go +++ b/x/oracle/types/query_meta.pb.go @@ -31,14 +31,22 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryMeta represents the metadata of a query type QueryMeta struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` - Expiration time.Time `protobuf:"bytes,3,opt,name=expiration,proto3,stdtime" json:"expiration"` - RegistrySpecTimeframe time.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3,stdduration" json:"registry_spec_timeframe"` - HasRevealedReports bool `protobuf:"varint,5,opt,name=hasRevealedReports,proto3" json:"hasRevealedReports,omitempty"` - QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` - QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` + // unique id of the query that changes after query's lifecycle ends + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // amount of tokens that was tipped + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + // expiration time of the query + Expiration time.Time `protobuf:"bytes,3,opt,name=expiration,proto3,stdtime" json:"expiration"` + // timeframe of the query according to the data spec + RegistrySpecTimeframe time.Duration `protobuf:"bytes,4,opt,name=registry_spec_timeframe,json=registrySpecTimeframe,proto3,stdduration" json:"registry_spec_timeframe"` + // indicates whether query has revealed reports + HasRevealedReports bool `protobuf:"varint,5,opt,name=has_revealed_reports,json=hasRevealedReports,proto3" json:"has_revealed_reports,omitempty"` + // unique id of the query according to the data spec + QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` + // sttring identifier of the data spec + QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` } func (m *QueryMeta) Reset() { *m = QueryMeta{} } @@ -123,35 +131,35 @@ func init() { func init() { proto.RegisterFile("layer/oracle/query_meta.proto", fileDescriptor_072f14e329c22246) } var fileDescriptor_072f14e329c22246 = []byte{ - // 439 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xc1, 0x6e, 0xd4, 0x30, - 0x10, 0x5d, 0x2f, 0x65, 0xbb, 0x6b, 0x0a, 0x12, 0x11, 0x15, 0xd9, 0x95, 0x9a, 0x44, 0x9c, 0x02, - 0xa8, 0xb6, 0x04, 0x7f, 0xb0, 0xed, 0x65, 0x0f, 0x1c, 0x30, 0x7b, 0xe2, 0xb2, 0x78, 0x93, 0x69, - 0xd6, 0x22, 0x8e, 0x83, 0xed, 0xa0, 0xe6, 0x2f, 0x7a, 0xe4, 0x13, 0x38, 0x72, 0xe0, 0x23, 0x7a, - 0xac, 0x38, 0x21, 0x0e, 0x2d, 0xda, 0x3d, 0x70, 0xe7, 0x0b, 0x50, 0xe2, 0x44, 0x42, 0xd0, 0x8b, - 0xe5, 0x37, 0x6f, 0xe6, 0xf9, 0xcd, 0x78, 0xf0, 0x51, 0xce, 0x6b, 0xd0, 0x54, 0x69, 0x9e, 0xe4, - 0x40, 0x3f, 0x54, 0xa0, 0xeb, 0x95, 0x04, 0xcb, 0x49, 0xa9, 0x95, 0x55, 0xde, 0x41, 0x4b, 0x13, - 0x47, 0xcf, 0x1e, 0x72, 0x29, 0x0a, 0x45, 0xdb, 0xd3, 0x25, 0xcc, 0xa6, 0x89, 0x32, 0x52, 0x99, - 0x55, 0x8b, 0xa8, 0x03, 0x1d, 0xf5, 0x28, 0x53, 0x99, 0x72, 0xf1, 0xe6, 0xd6, 0x45, 0x83, 0x4c, - 0xa9, 0x2c, 0x07, 0xda, 0xa2, 0x75, 0x75, 0x46, 0xd3, 0x4a, 0x73, 0x2b, 0x54, 0xd1, 0xf1, 0xe1, - 0xbf, 0xbc, 0x15, 0x12, 0x8c, 0xe5, 0xb2, 0x74, 0x09, 0x4f, 0x7e, 0x0f, 0xf1, 0xe4, 0x75, 0xe3, - 0xf3, 0x15, 0x58, 0xee, 0x3d, 0xc0, 0x43, 0x91, 0xfa, 0x28, 0x42, 0xf1, 0x1e, 0x1b, 0x8a, 0xd4, - 0x3b, 0xc1, 0x23, 0x2e, 0x55, 0x55, 0x58, 0x7f, 0x18, 0xa1, 0x78, 0x32, 0x7f, 0x7e, 0x79, 0x1d, - 0x0e, 0x7e, 0x5c, 0x87, 0x87, 0xce, 0x9a, 0x49, 0xdf, 0x13, 0xa1, 0xa8, 0xe4, 0x76, 0x43, 0x16, - 0x85, 0xfd, 0xf6, 0xf5, 0x18, 0x77, 0x9e, 0x17, 0x85, 0x65, 0x5d, 0xa9, 0x77, 0x8a, 0x31, 0x9c, - 0x97, 0xc2, 0xf9, 0xf2, 0xef, 0x44, 0x28, 0xbe, 0xf7, 0x62, 0x46, 0x9c, 0x31, 0xd2, 0x1b, 0x23, - 0xcb, 0xde, 0xd8, 0x7c, 0xdc, 0x3c, 0x72, 0x71, 0x13, 0x22, 0xf6, 0x57, 0x9d, 0xf7, 0x0e, 0x3f, - 0xd6, 0x90, 0x09, 0x63, 0x75, 0xbd, 0x32, 0x25, 0x24, 0xab, 0xa6, 0x93, 0x33, 0xcd, 0x25, 0xf8, - 0x7b, 0xad, 0xe4, 0xf4, 0x3f, 0xc9, 0xd3, 0x6e, 0x16, 0xf3, 0xfb, 0x8d, 0xe2, 0xa7, 0x9b, 0x10, - 0x7d, 0xfe, 0xf5, 0xe5, 0x19, 0x62, 0x87, 0xbd, 0xd0, 0x9b, 0x12, 0x92, 0x65, 0x2f, 0xe3, 0x11, - 0xec, 0x6d, 0xb8, 0x61, 0xf0, 0x11, 0x78, 0x0e, 0x29, 0x83, 0x52, 0x69, 0x6b, 0xfc, 0xbb, 0x11, - 0x8a, 0xc7, 0xec, 0x16, 0xc6, 0x9b, 0xe2, 0xb1, 0xfb, 0x61, 0x91, 0xfa, 0xa3, 0x08, 0xc5, 0x07, - 0x6c, 0xbf, 0xc5, 0x8b, 0xd4, 0x3b, 0xc2, 0xd8, 0x51, 0xb6, 0x2e, 0xc1, 0xdf, 0x6f, 0x66, 0xc7, - 0x26, 0x6d, 0x64, 0x59, 0x97, 0x30, 0x3f, 0xb9, 0xdc, 0x06, 0xe8, 0x6a, 0x1b, 0xa0, 0x9f, 0xdb, - 0x00, 0x5d, 0xec, 0x82, 0xc1, 0xd5, 0x2e, 0x18, 0x7c, 0xdf, 0x05, 0x83, 0xb7, 0x4f, 0x33, 0x61, - 0x37, 0xd5, 0x9a, 0x24, 0x4a, 0x52, 0x0b, 0x79, 0xae, 0xf4, 0xb1, 0x50, 0xd4, 0x6d, 0xd5, 0x79, - 0xbf, 0x57, 0x8d, 0xa8, 0x59, 0x8f, 0xda, 0x3e, 0x5f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xed, - 0xe1, 0x4d, 0xcb, 0x74, 0x02, 0x00, 0x00, + // 447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xc1, 0x6e, 0xd3, 0x30, + 0x18, 0xc7, 0xeb, 0x32, 0xba, 0xd6, 0x0c, 0x24, 0xac, 0x4d, 0xa4, 0x95, 0x96, 0x46, 0x9c, 0x02, + 0x68, 0x31, 0x82, 0x37, 0xe8, 0x76, 0xe9, 0x81, 0x03, 0xa6, 0x27, 0x2e, 0xc1, 0x4d, 0xbe, 0xa5, + 0x16, 0x71, 0x1c, 0x6c, 0x07, 0x2d, 0x6f, 0xb1, 0x23, 0x8f, 0xc0, 0x91, 0x03, 0x0f, 0xb1, 0xe3, + 0xc4, 0x09, 0x71, 0xd8, 0x50, 0x7b, 0xe0, 0x05, 0x78, 0x00, 0x94, 0x38, 0x91, 0x10, 0x5c, 0xa2, + 0xfc, 0xbf, 0x9f, 0xfd, 0xcf, 0xff, 0xfb, 0xf2, 0xe1, 0xe3, 0x9c, 0xd7, 0xa0, 0xa9, 0xd2, 0x3c, + 0xc9, 0x81, 0x7e, 0xa8, 0x40, 0xd7, 0xb1, 0x04, 0xcb, 0xa3, 0x52, 0x2b, 0xab, 0xc8, 0x41, 0x8b, + 0x23, 0x87, 0x67, 0x0f, 0xb9, 0x14, 0x85, 0xa2, 0xed, 0xd3, 0x1d, 0x98, 0x4d, 0x13, 0x65, 0xa4, + 0x32, 0x71, 0xab, 0xa8, 0x13, 0x1d, 0x3a, 0xcc, 0x54, 0xa6, 0x5c, 0xbd, 0x79, 0xeb, 0xaa, 0x7e, + 0xa6, 0x54, 0x96, 0x03, 0x6d, 0xd5, 0xba, 0x3a, 0xa7, 0x69, 0xa5, 0xb9, 0x15, 0xaa, 0xe8, 0xf8, + 0xfc, 0x5f, 0x6e, 0x85, 0x04, 0x63, 0xb9, 0x2c, 0xdd, 0x81, 0xc7, 0xbf, 0x87, 0x78, 0xf2, 0xba, + 0xc9, 0xf9, 0x0a, 0x2c, 0x27, 0x0f, 0xf0, 0x50, 0xa4, 0x1e, 0x0a, 0x50, 0xb8, 0xc7, 0x86, 0x22, + 0x25, 0xa7, 0x78, 0xc4, 0xa5, 0xaa, 0x0a, 0xeb, 0x0d, 0x03, 0x14, 0x4e, 0x16, 0xcf, 0xae, 0x6e, + 0xe6, 0x83, 0x1f, 0x37, 0xf3, 0x23, 0x17, 0xcd, 0xa4, 0xef, 0x23, 0xa1, 0xa8, 0xe4, 0x76, 0x13, + 0x2d, 0x0b, 0xfb, 0xed, 0xeb, 0x09, 0xee, 0x32, 0x2f, 0x0b, 0xcb, 0xba, 0xab, 0xe4, 0x0c, 0x63, + 0xb8, 0x28, 0x85, 0xcb, 0xe5, 0xdd, 0x09, 0x50, 0x78, 0xef, 0xc5, 0x2c, 0x72, 0xc1, 0xa2, 0x3e, + 0x58, 0xb4, 0xea, 0x83, 0x2d, 0xc6, 0xcd, 0x47, 0x2e, 0x6f, 0xe7, 0x88, 0xfd, 0x75, 0x8f, 0xbc, + 0xc3, 0x8f, 0x34, 0x64, 0xc2, 0x58, 0x5d, 0xc7, 0xa6, 0x84, 0x24, 0x6e, 0x3a, 0x39, 0xd7, 0x5c, + 0x82, 0xb7, 0xd7, 0x5a, 0x4e, 0xff, 0xb3, 0x3c, 0xeb, 0x66, 0xb1, 0xb8, 0xdf, 0x38, 0x7e, 0xba, + 0x9d, 0xa3, 0xcf, 0xbf, 0xbe, 0x3c, 0x45, 0xec, 0xa8, 0x37, 0x7a, 0x53, 0x42, 0xb2, 0xea, 0x6d, + 0xc8, 0x73, 0x7c, 0xb8, 0xe1, 0x26, 0xd6, 0xf0, 0x11, 0x78, 0x0e, 0x69, 0xac, 0xa1, 0x54, 0xda, + 0x1a, 0xef, 0x6e, 0x80, 0xc2, 0x31, 0x23, 0x1b, 0x6e, 0x58, 0x87, 0x98, 0x23, 0x64, 0x8a, 0xc7, + 0xee, 0x1f, 0x8b, 0xd4, 0x1b, 0x05, 0x28, 0x3c, 0x60, 0xfb, 0xad, 0x5e, 0xa6, 0xe4, 0x18, 0x63, + 0x87, 0x6c, 0x5d, 0x82, 0xb7, 0xdf, 0x4c, 0x8f, 0x4d, 0xda, 0xca, 0xaa, 0x2e, 0x61, 0x71, 0x7a, + 0xb5, 0xf5, 0xd1, 0xf5, 0xd6, 0x47, 0x3f, 0xb7, 0x3e, 0xba, 0xdc, 0xf9, 0x83, 0xeb, 0x9d, 0x3f, + 0xf8, 0xbe, 0xf3, 0x07, 0x6f, 0x9f, 0x64, 0xc2, 0x6e, 0xaa, 0x75, 0x94, 0x28, 0x49, 0x2d, 0xe4, + 0xb9, 0xd2, 0x27, 0x42, 0x51, 0xb7, 0x57, 0x17, 0xfd, 0x66, 0x35, 0xa6, 0x66, 0x3d, 0x6a, 0x3b, + 0x7d, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x76, 0x6b, 0x63, 0x76, 0x02, 0x00, 0x00, } func (m *QueryMeta) Marshal() (dAtA []byte, err error) { diff --git a/x/oracle/types/tips.pb.go b/x/oracle/types/tips.pb.go index 26daa4530..631b78114 100644 --- a/x/oracle/types/tips.pb.go +++ b/x/oracle/types/tips.pb.go @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Tips struct { // queryData is the query data that was tipped QueryData string `protobuf:"bytes,1,opt,name=query_data,json=queryData,proto3" json:"query_data,omitempty"` - // amount is the amount that was tipped + // the amount that was tipped Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` // totalTips is the total amount of tips for this query data so far TotalTips cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=total_tips,json=totalTips,proto3,customtype=cosmossdk.io/math.Int" json:"total_tips"` diff --git a/x/reporter/mocks/StakingKeeper.go b/x/reporter/mocks/StakingKeeper.go index a314f0e9c..89c9d8d40 100644 --- a/x/reporter/mocks/StakingKeeper.go +++ b/x/reporter/mocks/StakingKeeper.go @@ -6,6 +6,7 @@ import ( context "context" math "cosmossdk.io/math" + db "github.com/cosmos/cosmos-db" mock "github.com/stretchr/testify/mock" @@ -245,6 +246,32 @@ func (_m *StakingKeeper) Unbond(ctx context.Context, delAddr types.AccAddress, v return r0, r1 } +// ValidatorsPowerStoreIterator provides a mock function with given fields: ctx +func (_m *StakingKeeper) ValidatorsPowerStoreIterator(ctx context.Context) (db.Iterator, error) { + ret := _m.Called(ctx) + + var r0 db.Iterator + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (db.Iterator, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) db.Iterator); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(db.Iterator) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + type mockConstructorTestingTNewStakingKeeper interface { mock.TestingT Cleanup(func()) diff --git a/x/reporter/types/tx.pb.go b/x/reporter/types/tx.pb.go index 3afd1948e..d04af9991 100644 --- a/x/reporter/types/tx.pb.go +++ b/x/reporter/types/tx.pb.go @@ -325,7 +325,7 @@ var xxx_messageInfo_MsgDelegateReporterResponse proto.InternalMessageInfo // MsgUndelegateReporter defines the Msg/UndelegateReporter request type. type MsgUndelegateReporter struct { - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"` + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, // else the amount field will be the amount to undelegate from the specified token origin. TokenOrigins []*TokenOrigin `protobuf:"bytes,2,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` @@ -364,9 +364,9 @@ func (m *MsgUndelegateReporter) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUndelegateReporter proto.InternalMessageInfo -func (m *MsgUndelegateReporter) GetDelegator() string { +func (m *MsgUndelegateReporter) GetDelegatorAddress() string { if m != nil { - return m.Delegator + return m.DelegatorAddress } return "" } @@ -772,67 +772,68 @@ func init() { func init() { proto.RegisterFile("layer/reporter/tx.proto", fileDescriptor_67b904a7aa978eb1) } var fileDescriptor_67b904a7aa978eb1 = []byte{ - // 960 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x53, 0xe4, 0x44, - 0x14, 0x9e, 0x86, 0x95, 0x72, 0x1e, 0xbb, 0x2c, 0xc4, 0x5d, 0x18, 0x82, 0x64, 0x20, 0xba, 0x8a, - 0x50, 0x93, 0x14, 0x6c, 0xad, 0x55, 0xce, 0x49, 0x87, 0xdd, 0xc3, 0x1e, 0x50, 0x2b, 0x82, 0x5a, - 0x1e, 0xa4, 0x1a, 0xd2, 0x95, 0xe9, 0x65, 0x92, 0x9e, 0x4a, 0x37, 0xb0, 0xdc, 0xac, 0xf5, 0xe0, - 0x8f, 0x83, 0xa5, 0xff, 0xc1, 0x1e, 0x2d, 0x4f, 0x1c, 0xb8, 0x78, 0xf2, 0xca, 0xcd, 0x2d, 0x4e, - 0x96, 0x87, 0xd5, 0x82, 0x2a, 0xf1, 0xcf, 0xb0, 0x92, 0x74, 0x7a, 0x32, 0x99, 0xcc, 0x00, 0xe5, - 0x5a, 0x5e, 0x26, 0xd3, 0xef, 0x7d, 0xef, 0xf5, 0xf7, 0xbe, 0xbc, 0x7e, 0x1d, 0x98, 0x6a, 0xe1, - 0x03, 0x12, 0xda, 0x21, 0x69, 0xb3, 0x50, 0x90, 0xd0, 0x16, 0x8f, 0xad, 0x76, 0xc8, 0x04, 0xd3, - 0xc6, 0x62, 0x87, 0x95, 0x3a, 0xf4, 0x09, 0xec, 0xd3, 0x80, 0xd9, 0xf1, 0x6f, 0x02, 0xd1, 0x8d, - 0x6d, 0xc6, 0x7d, 0xc6, 0xed, 0x2d, 0xcc, 0x89, 0xbd, 0xb7, 0xbc, 0x45, 0x04, 0x5e, 0xb6, 0xb7, - 0x19, 0x0d, 0xa4, 0x7f, 0x4a, 0xfa, 0x7d, 0xee, 0xd9, 0x7b, 0xcb, 0xd1, 0x43, 0x3a, 0x5e, 0x97, - 0x0e, 0x2e, 0xf0, 0x0e, 0x0d, 0x3c, 0x15, 0x2b, 0xd7, 0x12, 0x35, 0x9d, 0xa0, 0x36, 0xe3, 0x95, - 0x9d, 0x2c, 0xa4, 0xeb, 0x96, 0xc7, 0x3c, 0x96, 0xd8, 0xa3, 0x7f, 0xd2, 0x3a, 0x93, 0xab, 0xa5, - 0x8d, 0x43, 0xec, 0xa7, 0x21, 0xf3, 0xf9, 0x42, 0xd9, 0x0e, 0x09, 0x36, 0x59, 0x48, 0xbd, 0x94, - 0xaf, 0xf9, 0x33, 0x82, 0x9b, 0x6b, 0xdc, 0xdb, 0x68, 0xbb, 0x58, 0x90, 0x0f, 0xe3, 0x60, 0xed, - 0x6d, 0x28, 0xe3, 0x5d, 0xd1, 0x64, 0x21, 0x15, 0x07, 0x15, 0x34, 0x87, 0x16, 0xca, 0x8d, 0xca, - 0xc9, 0x51, 0xed, 0x96, 0xa4, 0xf3, 0x9e, 0xeb, 0x86, 0x84, 0xf3, 0x8f, 0x44, 0x48, 0x03, 0xcf, - 0xe9, 0x40, 0xb5, 0x77, 0x60, 0x24, 0xd9, 0xbe, 0x32, 0x34, 0x87, 0x16, 0x46, 0x57, 0x26, 0xad, - 0x6e, 0x3d, 0xad, 0x24, 0x7f, 0xa3, 0x7c, 0xfc, 0xbc, 0x5a, 0xfa, 0xf1, 0xfc, 0x70, 0x11, 0x39, - 0x32, 0xa0, 0x7e, 0xf7, 0xc9, 0xf9, 0xe1, 0x62, 0x27, 0xd5, 0xb7, 0xe7, 0x87, 0x8b, 0x73, 0x09, - 0xf9, 0xc7, 0x1d, 0xfa, 0x39, 0x9e, 0xe6, 0x34, 0x4c, 0xe5, 0x4c, 0x0e, 0xe1, 0x6d, 0x16, 0x70, - 0x62, 0x7e, 0x33, 0x04, 0x13, 0x6b, 0xdc, 0x5b, 0x0d, 0x09, 0x16, 0xc4, 0x91, 0x09, 0x34, 0x1d, - 0x5e, 0x4e, 0x93, 0x25, 0x75, 0x39, 0x6a, 0xad, 0xad, 0xc2, 0x08, 0xf6, 0xd9, 0x6e, 0x20, 0x62, - 0xf2, 0xe5, 0xc6, 0x52, 0x44, 0xf2, 0xf7, 0xe7, 0xd5, 0xdb, 0x49, 0xd5, 0xdc, 0xdd, 0xb1, 0x28, - 0xb3, 0x7d, 0x2c, 0x9a, 0xd6, 0xc3, 0x40, 0x9c, 0x1c, 0xd5, 0x40, 0xca, 0xf1, 0x30, 0x10, 0x8e, - 0x0c, 0xd5, 0xde, 0x85, 0x1b, 0x59, 0x8d, 0x79, 0x65, 0x78, 0x6e, 0x78, 0x61, 0x74, 0x65, 0x26, - 0x2f, 0xc4, 0x7a, 0x04, 0xfa, 0x20, 0xc6, 0x38, 0xd7, 0x45, 0x67, 0xc1, 0xb5, 0x06, 0xc0, 0x36, - 0xf3, 0x7d, 0xca, 0x39, 0x65, 0x41, 0xe5, 0x5a, 0xac, 0xa3, 0x69, 0xc9, 0xad, 0xd2, 0x5e, 0x91, - 0xbd, 0x63, 0xad, 0x2a, 0xa4, 0x93, 0x89, 0xaa, 0xdf, 0x88, 0xc4, 0x54, 0x95, 0x99, 0x33, 0x30, - 0xdd, 0x23, 0x85, 0x12, 0xea, 0x2f, 0x04, 0xaf, 0xac, 0x71, 0xef, 0x3e, 0x69, 0x11, 0x2f, 0x2b, - 0xd5, 0xab, 0x50, 0x76, 0x13, 0x1b, 0x4b, 0xb5, 0xea, 0x18, 0xba, 0x84, 0x1c, 0xea, 0x2b, 0xe4, - 0xf0, 0x0b, 0x14, 0xf2, 0xda, 0x15, 0x85, 0xac, 0x8f, 0xc5, 0x1d, 0xa5, 0x28, 0x9b, 0xb3, 0x30, - 0x53, 0x50, 0xa7, 0xd2, 0xe1, 0x2b, 0x04, 0xb7, 0xa3, 0x66, 0x0a, 0xdc, 0xab, 0x29, 0xd1, 0x43, - 0x74, 0xe8, 0xdf, 0x12, 0xad, 0xc2, 0x6c, 0x21, 0x11, 0x45, 0xf5, 0x4b, 0x14, 0x23, 0x3e, 0xa1, - 0xa2, 0xe9, 0x86, 0x78, 0x3f, 0xf5, 0x77, 0x9a, 0x41, 0x5b, 0x85, 0xf1, 0x74, 0xe3, 0x4d, 0x9c, - 0x9c, 0xd6, 0x0b, 0xcf, 0xf1, 0xcd, 0x34, 0x42, 0x9a, 0xeb, 0xb3, 0x5f, 0x3f, 0xad, 0x96, 0xfe, - 0x7e, 0x5a, 0x2d, 0x45, 0xfc, 0x7a, 0xf2, 0x99, 0x3f, 0x20, 0xb8, 0x33, 0x90, 0x45, 0xca, 0x57, - 0x6b, 0xaa, 0x86, 0x40, 0xb1, 0x36, 0xd3, 0x69, 0x3b, 0x47, 0x33, 0x34, 0xd3, 0xcb, 0x34, 0x68, - 0xdc, 0x8b, 0x7a, 0xe5, 0xa7, 0x3f, 0xaa, 0x0b, 0x1e, 0x15, 0xcd, 0xdd, 0x2d, 0x6b, 0x9b, 0xf9, - 0x72, 0x08, 0xca, 0x47, 0x8d, 0xbb, 0x3b, 0xb6, 0x38, 0x68, 0x13, 0x1e, 0x07, 0x70, 0x39, 0x45, - 0x92, 0xfc, 0xe6, 0x31, 0x02, 0x3d, 0xc3, 0xe9, 0x7e, 0xaa, 0xa9, 0x43, 0xf6, 0x71, 0xe8, 0x6a, - 0x0f, 0x60, 0x42, 0xc9, 0x7c, 0x69, 0x5d, 0xc6, 0x55, 0x88, 0xb4, 0x17, 0xaa, 0x3b, 0x74, 0x55, - 0x75, 0x8d, 0xac, 0xba, 0xbd, 0xb4, 0xcc, 0xef, 0x10, 0x98, 0xfd, 0x4b, 0xf9, 0x1f, 0xb4, 0xdd, - 0x8f, 0x07, 0xea, 0x46, 0xf0, 0x08, 0xd3, 0x96, 0xd3, 0x39, 0xeb, 0xff, 0x7d, 0xa3, 0x25, 0xe3, - 0xab, 0x7b, 0x63, 0x75, 0x16, 0x7e, 0x41, 0x30, 0x96, 0x91, 0x69, 0x9d, 0xb6, 0x5f, 0xd4, 0x5b, - 0x7e, 0x1f, 0x26, 0xf6, 0x70, 0x8b, 0xba, 0x5d, 0x69, 0x92, 0xd7, 0x3c, 0x7f, 0x72, 0x54, 0x9b, - 0x95, 0x69, 0x3e, 0x4e, 0x31, 0xb9, 0x7c, 0x7b, 0x39, 0x7b, 0x7d, 0xb2, 0xcf, 0x8b, 0xae, 0xc0, - 0x64, 0x77, 0x01, 0x69, 0x6d, 0x2b, 0xbf, 0x8e, 0xc0, 0xf0, 0x1a, 0xf7, 0xb4, 0x4f, 0xe1, 0x7a, - 0xd7, 0xf5, 0x5c, 0xcd, 0xcf, 0x96, 0xdc, 0x25, 0xa8, 0xbf, 0x79, 0x01, 0x40, 0x75, 0xcf, 0xe7, - 0x30, 0x96, 0xbb, 0x21, 0xe7, 0x0b, 0x42, 0xbb, 0x21, 0xfa, 0x5b, 0x17, 0x42, 0x54, 0x7e, 0x17, - 0xc6, 0x7b, 0x2e, 0x96, 0xd7, 0x0a, 0xc2, 0xf3, 0x20, 0x7d, 0xe9, 0x12, 0x20, 0xb5, 0xcb, 0x23, - 0xd0, 0x0a, 0xc6, 0xf6, 0x9d, 0x22, 0x11, 0x7a, 0x60, 0x7a, 0xed, 0x52, 0x30, 0xb5, 0xd7, 0x13, - 0x04, 0xfa, 0x80, 0xc1, 0x5b, 0x94, 0xad, 0x3f, 0x5c, 0xbf, 0x77, 0x25, 0xb8, 0x22, 0x71, 0x00, - 0x53, 0xfd, 0x46, 0xdc, 0xe2, 0x80, 0x8c, 0x39, 0xac, 0xbe, 0x72, 0x79, 0x6c, 0xb6, 0x63, 0x72, - 0x23, 0x60, 0xbe, 0x50, 0xc0, 0x2c, 0xa4, 0xb0, 0x63, 0x8a, 0xcf, 0xb3, 0xb6, 0x01, 0xa3, 0xd9, - 0xb3, 0x6c, 0x0c, 0xa0, 0xb8, 0x4e, 0xdb, 0xfa, 0x1b, 0x83, 0xfd, 0x69, 0x5a, 0xfd, 0xa5, 0x2f, - 0xa2, 0x59, 0xd6, 0x78, 0x70, 0x7c, 0x6a, 0xa0, 0x67, 0xa7, 0x06, 0xfa, 0xf3, 0xd4, 0x40, 0xdf, - 0x9f, 0x19, 0xa5, 0x67, 0x67, 0x46, 0xe9, 0xb7, 0x33, 0xa3, 0xf4, 0xd9, 0x52, 0x66, 0x28, 0x0a, - 0xd2, 0x6a, 0xb1, 0xb0, 0x46, 0x99, 0xdd, 0xf3, 0x05, 0x1a, 0x4f, 0xc7, 0xad, 0x91, 0xf8, 0xd3, - 0xf9, 0xee, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0xf1, 0x41, 0x60, 0x48, 0x0c, 0x00, 0x00, + // 973 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x4f, 0x24, 0x45, + 0x14, 0x9e, 0x1a, 0x56, 0xe2, 0x3c, 0x76, 0x59, 0x68, 0x77, 0x61, 0x68, 0xa4, 0x07, 0x5a, 0x57, + 0x11, 0x32, 0xdd, 0x81, 0xcd, 0x9a, 0xc8, 0x49, 0x87, 0xdd, 0xc3, 0x1e, 0x50, 0xd3, 0x82, 0x1a, + 0x0f, 0x92, 0x82, 0xae, 0xf4, 0xd4, 0x32, 0xdd, 0x35, 0xe9, 0x2a, 0x60, 0xb9, 0x99, 0xf5, 0xa2, + 0x1e, 0x8c, 0xfe, 0x01, 0xb3, 0x47, 0xe3, 0x89, 0x03, 0x17, 0x4f, 0x5e, 0xb9, 0xb9, 0xe1, 0x64, + 0x3c, 0xac, 0x06, 0x12, 0xf1, 0x67, 0x98, 0xee, 0xae, 0xae, 0xe9, 0xe9, 0xe9, 0x99, 0x85, 0x04, + 0xb3, 0x17, 0x86, 0xaa, 0xf7, 0xbd, 0x57, 0xdf, 0xfb, 0xfa, 0xab, 0xd7, 0x0d, 0x93, 0x2d, 0x7c, + 0x40, 0x42, 0x3b, 0x24, 0x6d, 0x16, 0x0a, 0x12, 0xda, 0xe2, 0xb1, 0xd5, 0x0e, 0x99, 0x60, 0xda, + 0x68, 0x1c, 0xb0, 0xd2, 0x80, 0x3e, 0x8e, 0x7d, 0x1a, 0x30, 0x3b, 0xfe, 0x9b, 0x40, 0x74, 0x63, + 0x9b, 0x71, 0x9f, 0x71, 0x7b, 0x0b, 0x73, 0x62, 0xef, 0x2d, 0x6d, 0x11, 0x81, 0x97, 0xec, 0x6d, + 0x46, 0x03, 0x19, 0x9f, 0x94, 0x71, 0x9f, 0x7b, 0xf6, 0xde, 0x52, 0xf4, 0x23, 0x03, 0x6f, 0xca, + 0x00, 0x17, 0x78, 0x87, 0x06, 0x9e, 0xca, 0x95, 0x6b, 0x89, 0x9a, 0x4a, 0x50, 0x9b, 0xf1, 0xca, + 0x4e, 0x16, 0x32, 0x74, 0xcb, 0x63, 0x1e, 0x4b, 0xf6, 0xa3, 0xff, 0xe4, 0xee, 0x74, 0xae, 0x97, + 0x36, 0x0e, 0xb1, 0x9f, 0xa6, 0xcc, 0xe5, 0x1b, 0x65, 0x3b, 0x24, 0xd8, 0x64, 0x21, 0xf5, 0x52, + 0xbe, 0xe6, 0xaf, 0x08, 0x6e, 0xae, 0x71, 0x6f, 0xa3, 0xed, 0x62, 0x41, 0x3e, 0x8e, 0x93, 0xb5, + 0x77, 0xa1, 0x82, 0x77, 0x45, 0x93, 0x85, 0x54, 0x1c, 0x54, 0xd1, 0x2c, 0x9a, 0xaf, 0x34, 0xaa, + 0x27, 0x47, 0xf5, 0x5b, 0x92, 0xce, 0x07, 0xae, 0x1b, 0x12, 0xce, 0x3f, 0x11, 0x21, 0x0d, 0x3c, + 0xa7, 0x03, 0xd5, 0xde, 0x83, 0xe1, 0xe4, 0xf8, 0x6a, 0x79, 0x16, 0xcd, 0x8f, 0x2c, 0x4f, 0x58, + 0xdd, 0x7a, 0x5a, 0x49, 0xfd, 0x46, 0xe5, 0xf8, 0x79, 0xad, 0xf4, 0xf3, 0xf9, 0xe1, 0x02, 0x72, + 0x64, 0xc2, 0xca, 0xdd, 0x27, 0xe7, 0x87, 0x0b, 0x9d, 0x52, 0xdf, 0x9d, 0x1f, 0x2e, 0xcc, 0x26, + 0xe4, 0x1f, 0x77, 0xe8, 0xe7, 0x78, 0x9a, 0x53, 0x30, 0x99, 0xdb, 0x72, 0x08, 0x6f, 0xb3, 0x80, + 0x13, 0xf3, 0xdb, 0x32, 0x8c, 0xaf, 0x71, 0x6f, 0x35, 0x24, 0x58, 0x10, 0x47, 0x16, 0xd0, 0x74, + 0x78, 0x35, 0x2d, 0x96, 0xf4, 0xe5, 0xa8, 0xb5, 0xb6, 0x0a, 0xc3, 0xd8, 0x67, 0xbb, 0x81, 0x88, + 0xc9, 0x57, 0x1a, 0x8b, 0x11, 0xc9, 0x3f, 0x9f, 0xd7, 0x6e, 0x27, 0x5d, 0x73, 0x77, 0xc7, 0xa2, + 0xcc, 0xf6, 0xb1, 0x68, 0x5a, 0x0f, 0x03, 0x71, 0x72, 0x54, 0x07, 0x29, 0xc7, 0xc3, 0x40, 0x38, + 0x32, 0x55, 0x7b, 0x1f, 0x6e, 0x64, 0x35, 0xe6, 0xd5, 0xa1, 0xd9, 0xa1, 0xf9, 0x91, 0xe5, 0xe9, + 0xbc, 0x10, 0xeb, 0x11, 0xe8, 0xa3, 0x18, 0xe3, 0x5c, 0x17, 0x9d, 0x05, 0xd7, 0x1a, 0x00, 0xdb, + 0xcc, 0xf7, 0x29, 0xe7, 0x94, 0x05, 0xd5, 0x6b, 0xb1, 0x8e, 0xa6, 0x25, 0x8f, 0x4a, 0xbd, 0x22, + 0xbd, 0x63, 0xad, 0x2a, 0xa4, 0x93, 0xc9, 0x5a, 0xb9, 0x11, 0x89, 0xa9, 0x3a, 0x33, 0xa7, 0x61, + 0xaa, 0x47, 0x0a, 0x25, 0xd4, 0x3f, 0x08, 0x5e, 0x5b, 0xe3, 0xde, 0x7d, 0xd2, 0x22, 0x5e, 0x56, + 0xaa, 0xd7, 0xa1, 0xe2, 0x26, 0x7b, 0x2c, 0xd5, 0xaa, 0xb3, 0xd1, 0x25, 0x64, 0xb9, 0xaf, 0x90, + 0x43, 0x57, 0x28, 0xe4, 0xb5, 0x4b, 0x0a, 0xb9, 0x32, 0x1a, 0x3b, 0x4a, 0x51, 0x36, 0x67, 0x60, + 0xba, 0xa0, 0x4f, 0xa5, 0xc3, 0x4f, 0x08, 0x6e, 0x47, 0x66, 0x0a, 0xdc, 0xbc, 0x12, 0x8b, 0x30, + 0xae, 0xaa, 0x6c, 0xe2, 0xc4, 0xfb, 0x52, 0x91, 0x31, 0x15, 0x90, 0x77, 0xa2, 0x97, 0x77, 0xf9, + 0xb2, 0xbc, 0x27, 0x22, 0xde, 0xbd, 0x27, 0x9a, 0x35, 0x98, 0x29, 0xe4, 0xa7, 0x3a, 0xf8, 0x1a, + 0xc5, 0x88, 0xcf, 0xa8, 0x68, 0xba, 0x21, 0xde, 0x4f, 0xe3, 0x1d, 0x8f, 0x68, 0xab, 0x30, 0x96, + 0x12, 0xe8, 0x6e, 0x64, 0xc0, 0xf5, 0xbe, 0x99, 0x66, 0xc8, 0xed, 0x95, 0x99, 0x6f, 0x9e, 0xd6, + 0x4a, 0xff, 0x3e, 0xad, 0x95, 0x22, 0x9e, 0x3d, 0xf5, 0xcc, 0x1f, 0x11, 0xdc, 0x19, 0xc8, 0x22, + 0xe5, 0xab, 0x35, 0x95, 0x4f, 0x50, 0xac, 0xd1, 0x54, 0xea, 0xf2, 0x68, 0xb4, 0x66, 0x2c, 0x4e, + 0x83, 0xc6, 0xbd, 0xc8, 0x42, 0xbf, 0xfc, 0x55, 0x9b, 0xf7, 0xa8, 0x68, 0xee, 0x6e, 0x59, 0xdb, + 0xcc, 0x97, 0xb3, 0x51, 0xfe, 0xd4, 0xb9, 0xbb, 0x63, 0x8b, 0x83, 0x36, 0xe1, 0x71, 0x02, 0x97, + 0xc3, 0x25, 0xa9, 0x6f, 0x1e, 0x23, 0xd0, 0x33, 0x9c, 0xee, 0xa7, 0xda, 0x3a, 0x64, 0x1f, 0x87, + 0xae, 0xf6, 0xa0, 0xef, 0x03, 0x1e, 0xa0, 0x4b, 0xef, 0xa3, 0x2f, 0x52, 0xb7, 0x7c, 0x59, 0x75, + 0x8d, 0xac, 0xba, 0x05, 0x2e, 0xf8, 0x1e, 0x81, 0xd9, 0xbf, 0x95, 0x97, 0xa0, 0xed, 0x7e, 0x3c, + 0x67, 0x37, 0x82, 0x47, 0x98, 0xb6, 0x9c, 0xce, 0x08, 0xf8, 0xff, 0x8d, 0x96, 0x4c, 0xb5, 0xee, + 0x83, 0xd5, 0x5d, 0xf8, 0x0d, 0xc1, 0x68, 0x46, 0xa6, 0x75, 0xda, 0xbe, 0xaa, 0xa7, 0xfc, 0x21, + 0x8c, 0xef, 0xe1, 0x16, 0x75, 0xbb, 0xca, 0x24, 0x8f, 0x79, 0xee, 0xe4, 0xa8, 0x3e, 0x23, 0xcb, + 0x7c, 0x9a, 0x62, 0x72, 0xf5, 0xf6, 0x72, 0xfb, 0x7d, 0xaf, 0x7b, 0x15, 0x26, 0xba, 0x1b, 0x48, + 0x7b, 0x5b, 0xfe, 0x7d, 0x18, 0x86, 0xd6, 0xb8, 0xa7, 0x7d, 0x0e, 0xd7, 0xbb, 0xde, 0xda, 0xb5, + 0xfc, 0x8c, 0xc9, 0xbd, 0x1b, 0xf5, 0xb7, 0x5f, 0x00, 0x50, 0xee, 0xf9, 0x12, 0x46, 0x73, 0x2f, + 0xce, 0xb9, 0x82, 0xd4, 0x6e, 0x88, 0xfe, 0xce, 0x0b, 0x21, 0xaa, 0xbe, 0x0b, 0x63, 0x3d, 0xef, + 0x9b, 0x37, 0x0a, 0xd2, 0xf3, 0x20, 0x7d, 0xf1, 0x02, 0x20, 0x75, 0xca, 0x23, 0xd0, 0x0a, 0xa6, + 0xf9, 0x9d, 0x22, 0x11, 0x7a, 0x60, 0x7a, 0xfd, 0x42, 0x30, 0x75, 0xd6, 0x13, 0x04, 0xfa, 0x80, + 0xc1, 0x5b, 0x54, 0xad, 0x3f, 0x5c, 0xbf, 0x77, 0x29, 0xb8, 0x22, 0x71, 0x00, 0x93, 0xfd, 0x46, + 0xdc, 0xc2, 0x80, 0x8a, 0x39, 0xac, 0xbe, 0x7c, 0x71, 0x6c, 0xd6, 0x31, 0xb9, 0x11, 0x30, 0x57, + 0x28, 0x60, 0x16, 0x52, 0xe8, 0x98, 0xe2, 0xfb, 0xac, 0x6d, 0xc0, 0x48, 0xf6, 0x2e, 0x1b, 0x03, + 0x28, 0xae, 0xd3, 0xb6, 0xfe, 0xd6, 0xe0, 0x78, 0x5a, 0x56, 0x7f, 0xe5, 0xab, 0x68, 0x96, 0x35, + 0x1e, 0x1c, 0x9f, 0x1a, 0xe8, 0xd9, 0xa9, 0x81, 0xfe, 0x3e, 0x35, 0xd0, 0x0f, 0x67, 0x46, 0xe9, + 0xd9, 0x99, 0x51, 0xfa, 0xe3, 0xcc, 0x28, 0x7d, 0xb1, 0x98, 0x19, 0x8a, 0x82, 0xb4, 0x5a, 0x2c, + 0xac, 0x53, 0x66, 0xf7, 0x7c, 0x98, 0xc6, 0xd3, 0x71, 0x6b, 0x38, 0xfe, 0xa2, 0xbe, 0xfb, 0x5f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xde, 0x80, 0xea, 0x5f, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1459,10 +1460,10 @@ func (m *MsgUndelegateReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if len(m.Delegator) > 0 { - i -= len(m.Delegator) - copy(dAtA[i:], m.Delegator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) i-- dAtA[i] = 0xa } @@ -1855,7 +1856,7 @@ func (m *MsgUndelegateReporter) Size() (n int) { } var l int _ = l - l = len(m.Delegator) + l = len(m.DelegatorAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2655,7 +2656,7 @@ func (m *MsgUndelegateReporter) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2683,7 +2684,7 @@ func (m *MsgUndelegateReporter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Delegator = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { From 941e2a1b068e434f8bac6fac8e0d446c70cf030f Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 02:00:17 -0400 Subject: [PATCH 24/31] fix dispute payout --- daemons/reporter/client/client.go | 3 +- tests/integration/dispute_keeper_test.go | 12 +- x/dispute/client/cli/tx_propose_dispute.go | 3 +- x/dispute/keeper/abci.go | 15 +- x/dispute/keeper/dispute.go | 70 ++-- x/dispute/keeper/dispute_fee.go | 25 +- x/dispute/keeper/execute.go | 37 +- .../keeper/msg_server_add_fee_to_dispute.go | 9 +- .../keeper/msg_server_propose_dispute_test.go | 3 +- x/dispute/types/expected_keepers.go | 4 +- x/dispute/types/message_propose_dispute.go | 3 +- .../keeper/msg_server_submit_value_test.go | 1 + x/oracle/keeper/query_get_reports_test.go | 1 + x/oracle/keeper/submit_value.go | 1 + x/oracle/types/expected_keepers.go | 1 - x/reporter/keeper/distribution.go | 315 ++++++++++++------ .../keeper/msg_server_undelegate_reporter.go | 2 +- x/reporter/keeper/msg_server_withdraw_tip.go | 7 +- x/reporter/simulation/undelegate_reporter.go | 2 +- x/reporter/types/expected_keepers.go | 2 + .../types/message_undelegate_reporter.go | 6 +- .../types/message_undelegate_reporter_test.go | 4 +- 22 files changed, 338 insertions(+), 188 deletions(-) diff --git a/daemons/reporter/client/client.go b/daemons/reporter/client/client.go index d77c94942..5b5a85bb1 100644 --- a/daemons/reporter/client/client.go +++ b/daemons/reporter/client/client.go @@ -43,12 +43,11 @@ type Client struct { } func NewClient(clctx client.Context, logger log.Logger, accountName string) *Client { - c := &Client{ + return &Client{ AccountName: accountName, cosmosCtx: clctx, logger: logger, } - return c } func (c *Client) Start( diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index 886263679..5ce89d3f7 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -29,7 +29,7 @@ func (s *IntegrationTestSuite) TestVotingOnDispute() { s.NoError(err) // assemble report with reporter to dispute - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: repAcc.String(), Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", @@ -107,7 +107,7 @@ func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: repAcc.String(), Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", @@ -159,7 +159,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: repAcc.String(), Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", @@ -253,7 +253,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { reporter, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) s.NoError(err) - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: repAcc.String(), Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", @@ -331,7 +331,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { } _, err = oracleServer.Tip(s.ctx, &msg) s.Nil(err) - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: repAcc.String(), Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", @@ -444,7 +444,7 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { _, err = oracleServer.Tip(s.ctx, &msg) s.Nil(err) - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: repAcc.String(), Power: 100, QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", diff --git a/x/dispute/client/cli/tx_propose_dispute.go b/x/dispute/client/cli/tx_propose_dispute.go index dc685b684..bd589d0f5 100644 --- a/x/dispute/client/cli/tx_propose_dispute.go +++ b/x/dispute/client/cli/tx_propose_dispute.go @@ -13,6 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" "github.com/tellor-io/layer/x/dispute/types" + oracletypes "github.com/tellor-io/layer/x/oracle/types" ) var _ = strconv.Itoa(0) @@ -31,7 +32,7 @@ func CmdProposeDispute() *cobra.Command { Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { fs := cmd.Flags() - argReport := new(types.MicroReport) + argReport := new(oracletypes.MicroReport) err = json.Unmarshal([]byte(args[0]), argReport) if err != nil { return err diff --git a/x/dispute/keeper/abci.go b/x/dispute/keeper/abci.go index 356f11fa0..77fac6407 100644 --- a/x/dispute/keeper/abci.go +++ b/x/dispute/keeper/abci.go @@ -3,7 +3,6 @@ package keeper import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" ) @@ -69,7 +68,7 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { if err := k.RefundDisputeFeeToBond(ctx, fromBond); err != nil { return err } - if err := k.RefundToBond(ctx, dispute.ReportEvidence.Reporter, sdk.NewCoin(layer.BondDenom, dispute.SlashAmount)); err != nil { + if err := k.ReturnSlashedTokens(ctx, dispute); err != nil { return err } vote.Executed = true @@ -85,14 +84,12 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { return err } + // todo: dispute fee? // divide the reporters bond equally amongst the dispute fee payers and add it to the bonded pool - if err := k.reporterKeeper.RewardReporterBondToFeePayers(ctx, dispute.FeePayers, dispute.SlashAmount); err != nil { - return err - } - // send coins to the staking module bonded pool - if err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, dispute.SlashAmount))); err != nil { + if err := k.RewardReporterBondToFeePayers(ctx, dispute.FeePayers, dispute.SlashAmount); err != nil { return err } + vote.Executed = true if err := k.SetVote(ctx, id, vote); err != nil { return err @@ -107,14 +104,14 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { return err } // refund the reporters bond to the reporter plus the remaining disputeFee; goes to bonded pool - if err := k.RefundToBond(ctx, dispute.ReportEvidence.Reporter, sdk.NewCoin(layer.BondDenom, dispute.SlashAmount.Add(disputeFeeMinusBurn))); err != nil { + dispute.SlashAmount = dispute.SlashAmount.Add(disputeFeeMinusBurn) + if err := k.ReturnSlashedTokens(ctx, dispute); err != nil { return err } vote.Executed = true if err := k.SetVote(ctx, id, vote); err != nil { return err } - default: } return nil } diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index 07ccd842c..f14c50b78 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -1,10 +1,11 @@ package keeper import ( + "context" "crypto/sha256" "encoding/binary" - "errors" "fmt" + gomath "math" "math/big" "time" @@ -12,6 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tellor-io/layer/x/dispute/types" + oracletypes "github.com/tellor-io/layer/x/oracle/types" ) // Get dispute by dispute id @@ -30,7 +32,7 @@ func (k Keeper) GetDisputeById(ctx sdk.Context, id uint64) (*types.Dispute, erro } // Get dispute by reporter key -func (k Keeper) GetDisputeByReporter(ctx sdk.Context, r types.MicroReport, c types.DisputeCategory) *types.Dispute { +func (k Keeper) GetDisputeByReporter(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) *types.Dispute { store := k.disputeStore(ctx) key := []byte(k.ReporterKey(ctx, r, c)) bz := store.Get(key) @@ -70,7 +72,7 @@ func (k Keeper) GetOpenDisputeIds(ctx sdk.Context) (types.OpenDisputes, error) { } // Generate hash id -func (k Keeper) HashId(ctx sdk.Context, r types.MicroReport, c types.DisputeCategory) [32]byte { +func (k Keeper) HashId(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) [32]byte { params := types.DisputeParams{ Report: &r, Category: c, @@ -79,7 +81,7 @@ func (k Keeper) HashId(ctx sdk.Context, r types.MicroReport, c types.DisputeCate } // Make a reporter key by combining reporter address and a hash of dispute params -func (k Keeper) ReporterKey(ctx sdk.Context, r types.MicroReport, c types.DisputeCategory) string { +func (k Keeper) ReporterKey(ctx sdk.Context, r oracletypes.MicroReport, c types.DisputeCategory) string { return fmt.Sprintf("%s:%x", r.Reporter, k.HashId(ctx, r, c)) } @@ -124,9 +126,7 @@ func (k Keeper) SetNewDispute(ctx sdk.Context, msg types.MsgProposeDispute) erro if err != nil { return err } - if disputeFee.IsZero() { - return errors.New("error calculating dispute fee") - } + feeList := make([]types.PayerInfo, 0) if msg.Fee.Amount.GT(disputeFee) { @@ -149,8 +149,9 @@ func (k Keeper) SetNewDispute(ctx sdk.Context, msg types.MsgProposeDispute) erro ReportEvidence: *msg.Report, FeePayers: append(feeList, types.PayerInfo{ PayerAddress: msg.Creator, - Amount: msg.Fee, + Amount: msg.Fee.Amount, FromBond: msg.PayFromBond, + BlockNumber: ctx.BlockHeight(), }), FeeTotal: msg.Fee.Amount, PrevDisputeIds: []uint64{disputeId}, @@ -176,25 +177,10 @@ func (k Keeper) SetNewDispute(ctx sdk.Context, msg types.MsgProposeDispute) erro } // Slash and jail reporter -func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report types.MicroReport, category types.DisputeCategory) error { +func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report oracletypes.MicroReport, category types.DisputeCategory) error { reporterAddr := sdk.MustAccAddressFromBech32(report.Reporter) - // k.Slash(ctx, sdk.ValAddress(accAddress), report.Power, k.GetSlashPercentage(category)) - var jailDuration int64 - switch category { - case types.Warning: - // jail for 0 seconds, forces validator to unjail manually - jailDuration = 0 - case types.Minor: - // jail for 10 minutes - jailDuration = 600 - case types.Major: - // TODO: jail duration should be until dispute ends - default: - return types.ErrInvalidDisputeCategory.Wrapf("wrong category selected: %s", category) - } - - slashFactor, err := k.GetSlashPercentage(category) + slashFactor, jailDuration, err := k.GetSlashPercentageAndJailDuration(category) if err != nil { return err } @@ -204,7 +190,15 @@ func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report types.MicroReport, if err != nil { return err } - return k.reporterKeeper.JailReporter(ctx, reporterAddr, jailDuration) + return k.jailReporter(ctx, reporterAddr, jailDuration) +} + +func (k Keeper) jailReporter(ctx context.Context, repAddr sdk.AccAddress, jailDuration int64) error { + // noop for major duration, reporter is removed from store so no need to jail + if jailDuration == gomath.MaxInt64 { + return nil + } + return k.reporterKeeper.JailReporter(ctx, repAddr, jailDuration) } // Store open dispute ids in the store @@ -219,41 +213,41 @@ func (k Keeper) SetOpenDisputeIds(ctx sdk.Context, ids types.OpenDisputes) error } // Get percentage of slash amount based on category -func (k Keeper) GetSlashPercentage(category types.DisputeCategory) (math.LegacyDec, error) { +func (k Keeper) GetSlashPercentageAndJailDuration(category types.DisputeCategory) (math.LegacyDec, int64, error) { switch category { case types.Warning: - return math.LegacyNewDecWithPrec(1, 2), nil // 1% + return math.LegacyNewDecWithPrec(1, 2), 0, nil // 1% case types.Minor: - return math.LegacyNewDecWithPrec(5, 2), nil // 5% + return math.LegacyNewDecWithPrec(5, 2), 600, nil // 5% case types.Major: - return math.LegacyNewDecWithPrec(1, 0), nil // 100% + return math.LegacyNewDecWithPrec(1, 0), gomath.MaxInt64, nil // 100% default: - return math.LegacyDec{}, errors.New("invalid dispute category") + return math.LegacyDec{}, 0, types.ErrInvalidDisputeCategory } } // Get dispute fee -func (k Keeper) GetDisputeFee(ctx sdk.Context, rep string, category types.DisputeCategory) (math.Int, error) { - reporterAddr := sdk.MustAccAddressFromBech32(rep) +func (k Keeper) GetDisputeFee(ctx sdk.Context, repAddr string, category types.DisputeCategory) (math.Int, error) { + reporterAddr := sdk.MustAccAddressFromBech32(repAddr) reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) if err != nil { return math.Int{}, err } stake := reporter.TotalTokens - fee := math.ZeroInt() switch category { case types.Warning: // calculate 1 percent of bond - fee = stake.MulRaw(1).QuoRaw(100) + return stake.MulRaw(1).QuoRaw(100), nil case types.Minor: // calculate 5 percent of bond - fee = stake.MulRaw(5).QuoRaw(100) + return stake.MulRaw(5).QuoRaw(100), nil case types.Major: // calculate 100 percent of bond - fee = stake + return stake, nil + default: + return math.Int{}, types.ErrInvalidDisputeCategory } - return fee, nil } // Update existing dispute when conditions are met diff --git a/x/dispute/keeper/dispute_fee.go b/x/dispute/keeper/dispute_fee.go index 79c281188..cac0f2245 100644 --- a/x/dispute/keeper/dispute_fee.go +++ b/x/dispute/keeper/dispute_fee.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + layertypes "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" ) @@ -24,18 +25,6 @@ func (k Keeper) PayFromBond(ctx sdk.Context, reporterAddr sdk.AccAddress, fee sd return k.reporterKeeper.FeefromReporterStake(ctx, reporterAddr, fee.Amount) } -// Refund coins to bonded pool -func (k Keeper) RefundToBond(ctx sdk.Context, refundTo string, fee sdk.Coin) error { - reporterAddr, err := sdk.AccAddressFromBech32(refundTo) - if err != nil { - return err - } - if err := k.reporterKeeper.AllocateRewardsToStake(ctx, reporterAddr, fee.Amount); err != nil { - return err - } - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(fee)) -} - // Pay dispute fee func (k Keeper) PayDisputeFee(ctx sdk.Context, sender string, fee sdk.Coin, fromBond bool) error { proposer := sdk.MustAccAddressFromBech32(sender) @@ -53,3 +42,15 @@ func (k Keeper) PayDisputeFee(ctx sdk.Context, sender string, fee sdk.Coin, from } return nil } + +// return slashed tokens when reporter either wins dispute or dispute is invalid +func (k Keeper) ReturnSlashedTokens(ctx sdk.Context, dispute *types.Dispute) error { + + err := k.reporterKeeper.ReturnSlashedTokens(ctx, dispute.ReportEvidence.Reporter, dispute.ReportEvidence.BlockNumber, dispute.SlashAmount) + if err != nil { + return err + } + + coins := sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, dispute.SlashAmount)) + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, coins) +} diff --git a/x/dispute/keeper/execute.go b/x/dispute/keeper/execute.go index 79645e7f6..f793b31d0 100644 --- a/x/dispute/keeper/execute.go +++ b/x/dispute/keeper/execute.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" ) @@ -27,10 +28,10 @@ func (k Keeper) RefundDisputeFeeToAccount(ctx sdk.Context, fromAcc []types.Payer // Calculate total amount and prepare outputs for _, recipient := range fromAcc { - burn := recipient.Amount.Amount.MulRaw(1).QuoRaw(20) - recipient.Amount.Amount = recipient.Amount.Amount.Sub(burn) - totalAmount = totalAmount.Add(sdk.NewCoins(recipient.Amount)...) - outputs = append(outputs, banktypes.NewOutput(sdk.MustAccAddressFromBech32(recipient.PayerAddress), sdk.NewCoins(recipient.Amount))) + burn := recipient.Amount.MulRaw(1).QuoRaw(20) + recipient.Amount = recipient.Amount.Sub(burn) + totalAmount = totalAmount.Add(sdk.NewCoins(sdk.NewCoin(layer.BondDenom, recipient.Amount))...) + outputs = append(outputs, banktypes.NewOutput(sdk.MustAccAddressFromBech32(recipient.PayerAddress), sdk.NewCoins(sdk.NewCoin(layer.BondDenom, recipient.Amount)))) } // Prepare input @@ -41,18 +42,36 @@ func (k Keeper) RefundDisputeFeeToAccount(ctx sdk.Context, fromAcc []types.Payer } func (k Keeper) RefundDisputeFeeToBond(ctx sdk.Context, fromBond []types.PayerInfo) error { + // for every reporter refund dispute fee to their bond for _, recipient := range fromBond { - burn := recipient.Amount.Amount.MulRaw(1).QuoRaw(20) - recipient.Amount.Amount = recipient.Amount.Amount.Sub(burn) - if err := k.RefundToBond(ctx, recipient.PayerAddress, recipient.Amount); err != nil { + burn := recipient.Amount.MulRaw(1).QuoRaw(20) + recipient.Amount = recipient.Amount.Sub(burn) + if err := k.reporterKeeper.ReturnSlashedTokens(ctx, recipient.PayerAddress, recipient.BlockNumber, recipient.Amount); err != nil { return err } - // TODO: add fallback to stake in random validator if for some reason the address is not found - // due to undelegating from being a reporter } return nil } +func (k Keeper) RewardReporterBondToFeePayers(ctx sdk.Context, feePayers []types.PayerInfo, reporterBond math.Int) error { + totalFeesPaid := math.ZeroInt() + for _, reporter := range feePayers { + totalFeesPaid = totalFeesPaid.Add(reporter.Amount) + } + for _, reporter := range feePayers { + amt := reporter.Amount.Quo(totalFeesPaid).Mul(reporterBond) + if reporter.FromBond { + if err := k.reporterKeeper.ReturnSlashedTokens(ctx, reporter.PayerAddress, reporter.BlockNumber, amt); err != nil { + return err + } + } else { + if err := k.reporterKeeper.AddAmountToStake(ctx, reporter.PayerAddress, amt); err != nil { + return err + } + } + } + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, reporterBond))) +} func (k Keeper) RewardVoters(ctx sdk.Context, voters []string, totalAmount math.Int) (math.Int, error) { if totalAmount.IsZero() { return totalAmount, nil diff --git a/x/dispute/keeper/msg_server_add_fee_to_dispute.go b/x/dispute/keeper/msg_server_add_fee_to_dispute.go index fcf06b8b2..2d54dab8c 100644 --- a/x/dispute/keeper/msg_server_add_fee_to_dispute.go +++ b/x/dispute/keeper/msg_server_add_fee_to_dispute.go @@ -35,20 +35,19 @@ func (k msgServer) AddFeeToDispute(goCtx context.Context, } dispute.FeePayers = append(dispute.FeePayers, types.PayerInfo{ PayerAddress: msg.Creator, - Amount: msg.Amount, + Amount: msg.Amount.Amount, FromBond: msg.PayFromBond, + BlockNumber: ctx.BlockHeight(), }) dispute.FeeTotal = dispute.FeeTotal.Add(msg.Amount.Amount) if dispute.FeeTotal.Equal(dispute.SlashAmount) { - err := k.Keeper.SlashAndJailReporter(ctx, dispute.ReportEvidence, dispute.DisputeCategory) - if err != nil { + if err := k.Keeper.SlashAndJailReporter(ctx, dispute.ReportEvidence, dispute.DisputeCategory); err != nil { return nil, err } // begin voting immediately dispute.DisputeEndTime = ctx.BlockTime().Add(THREE_DAYS) dispute.DisputeStatus = types.Voting - err = k.Keeper.SetStartVote(ctx, dispute.DisputeId) - if err != nil { + if err := k.Keeper.SetStartVote(ctx, dispute.DisputeId); err != nil { return nil, err } } diff --git a/x/dispute/keeper/msg_server_propose_dispute_test.go b/x/dispute/keeper/msg_server_propose_dispute_test.go index b5a200846..3ba3039cf 100644 --- a/x/dispute/keeper/msg_server_propose_dispute_test.go +++ b/x/dispute/keeper/msg_server_propose_dispute_test.go @@ -10,13 +10,14 @@ import ( "github.com/tellor-io/layer/testutil/sample" layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" + oracletypes "github.com/tellor-io/layer/x/oracle/types" reportertypes "github.com/tellor-io/layer/x/reporter/types" ) func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() sdk.AccAddress { addr := sample.AccAddressBytes() s.ctx = s.ctx.WithBlockTime(time.Now()) - report := types.MicroReport{ + report := oracletypes.MicroReport{ Reporter: addr.String(), QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", diff --git a/x/dispute/types/expected_keepers.go b/x/dispute/types/expected_keepers.go index 2e423ede2..1fd129353 100644 --- a/x/dispute/types/expected_keepers.go +++ b/x/dispute/types/expected_keepers.go @@ -37,11 +37,11 @@ type OracleKeeper interface { } type ReporterKeeper interface { - AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, power, height int64, amt math.Int) error Reporter(ctx context.Context, repAddr sdk.AccAddress) (*reportertypes.OracleReporter, error) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration int64) error TotalReporterPower(ctx context.Context) (math.Int, error) - RewardReporterBondToFeePayers(ctx context.Context, recipients []PayerInfo, reward math.Int) error FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int) error + ReturnSlashedTokens(ctx context.Context, repAddr string, blockHeight int64, amt math.Int) error + AddAmountToStake(ctx context.Context, addr string, amt math.Int) error } diff --git a/x/dispute/types/message_propose_dispute.go b/x/dispute/types/message_propose_dispute.go index e545eab13..fbcc4c1e4 100644 --- a/x/dispute/types/message_propose_dispute.go +++ b/x/dispute/types/message_propose_dispute.go @@ -4,13 +4,14 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + oracletypes "github.com/tellor-io/layer/x/oracle/types" ) const TypeMsgProposeDispute = "propose_dispute" var _ sdk.Msg = &MsgProposeDispute{} -func NewMsgProposeDispute(creator string, report *MicroReport, disputeCategory DisputeCategory, fee sdk.Coin, payFromBond bool) *MsgProposeDispute { +func NewMsgProposeDispute(creator string, report *oracletypes.MicroReport, disputeCategory DisputeCategory, fee sdk.Coin, payFromBond bool) *MsgProposeDispute { return &MsgProposeDispute{ Creator: creator, Report: report, diff --git a/x/oracle/keeper/msg_server_submit_value_test.go b/x/oracle/keeper/msg_server_submit_value_test.go index 86ae8e61d..25d1c9ecd 100644 --- a/x/oracle/keeper/msg_server_submit_value_test.go +++ b/x/oracle/keeper/msg_server_submit_value_test.go @@ -49,6 +49,7 @@ func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, strin Value: value, Timestamp: s.ctx.BlockTime(), Cyclelist: true, + BlockNumber: s.ctx.BlockHeight(), } expectedReport := types.QueryGetReportsbyQidResponse{ Reports: types.Reports{ diff --git a/x/oracle/keeper/query_get_reports_test.go b/x/oracle/keeper/query_get_reports_test.go index 57cad0121..dbeb18f08 100644 --- a/x/oracle/keeper/query_get_reports_test.go +++ b/x/oracle/keeper/query_get_reports_test.go @@ -26,6 +26,7 @@ func (s *KeeperTestSuite) TestGetReportsByQueryId() { Value: value, Timestamp: s.ctx.BlockTime(), Cyclelist: true, + BlockNumber: s.ctx.BlockHeight(), } expectedReports := types.Reports{ MicroReports: []*types.MicroReport{MicroReport}, diff --git a/x/oracle/keeper/submit_value.go b/x/oracle/keeper/submit_value.go index da1d1227e..b7955e470 100644 --- a/x/oracle/keeper/submit_value.go +++ b/x/oracle/keeper/submit_value.go @@ -39,6 +39,7 @@ func (k Keeper) setValue(ctx sdk.Context, reporter sdk.AccAddress, query types.Q AggregateMethod: dataSpec.AggregationMethod, Timestamp: ctx.BlockTime(), Cyclelist: incycle, + BlockNumber: ctx.BlockHeight(), } query.HasRevealedReports = true diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 202e743f8..40adbf443 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -35,7 +35,6 @@ type RegistryKeeper interface { type ReporterKeeper interface { // Methods imported from reporter should be defined here AllocateTokensToReporter(ctx context.Context, reporterAddr sdk.ValAddress, tokens sdk.DecCoins) error - // AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error Reporter(ctx context.Context, repAddress sdk.AccAddress) (*reportertypes.OracleReporter, error) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error } diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 007532c9e..3db655078 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -11,7 +11,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - disputetypes "github.com/tellor-io/layer/x/dispute/types" "github.com/tellor-io/layer/x/reporter/types" ) @@ -749,7 +748,11 @@ func (k Keeper) BeforeReporterDisputed(ctx context.Context, valAddr sdk.ValAddre return k.updateReporterDisputeFraction(ctx, valAddr, fraction) } -func (k Keeper) AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error { +func (k Keeper) GetTokenOriginsAtHeight(ctx context.Context, repAddr sdk.AccAddress, height int64) (types.DelegationsPreUpdate, error) { + return k.TokenOriginSnapshot.Get(ctx, collections.Join(repAddr, height)) +} + +func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error { reporter, err := k.Reporters.Get(ctx, reporterAddr) if err != nil { return err @@ -783,146 +786,272 @@ func (k Keeper) AllocateRewardsToStake(ctx context.Context, reporterAddr sdk.Acc if key.Equals(repAddr) { delegatorShare = delegatorShare.Add(commission) } - rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](key) - iter, err := k.TokenOrigin.Iterate(ctx, rng) + err = k.DelegatorTips.Set(ctx, key, delegatorShare.TruncateInt()) if err != nil { return err } - delegatorSources, err := iter.KeyValues() + } + + return nil +} + +func (k Keeper) returnSlashedTokens(ctx context.Context, repAddr sdk.AccAddress, blockHeight int64, _ math.Int) error { + + snapshot, err := k.GetTokenOriginsAtHeight(ctx, repAddr, blockHeight) + if err != nil { + return err + } + // amt should be equal to sum of snapshot origins + // var totalAmt = math.ZeroInt() + for _, source := range snapshot.TokenOrigins { + // totalAmt = totalAmt.Add(source.Amount) + valAddr, err := sdk.ValAddressFromBech32(source.ValidatorAddress) if err != nil { return err } - bondedShares := math.ZeroInt() - for _, source := range delegatorSources { - srcAmt := source.Value - _share := delegatorShare.Mul(math.LegacyNewDecFromInt(srcAmt)).Quo(math.LegacyNewDecFromInt(del.Amount)) - val, err := k.stakingKeeper.GetValidator(ctx, source.Key.K2()) - if err != nil { + var val stakingtypes.Validator + val, err = k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { return err } - // todo: move coins to escrow instead - newShares, err := k.stakingKeeper.Delegate(ctx, key, _share.TruncateInt(), stakingtypes.Bonded, val, false) // ignore dust??? + vals, err := k.GetBondedValidators(ctx, 1) if err != nil { return err } - source.Value = source.Value.Sub(newShares.TruncateInt()) - if err := k.TokenOrigin.Set(ctx, collections.Join(source.Key.K1(), source.Key.K2()), source.Value); err != nil { - return err + if len(vals) == 0 { + return errors.New("no validators found in staking module to return tokens to") } - bondedShares = bondedShares.Add(newShares.TruncateInt()) + val = vals[0] } - if bondedShares.IsPositive() { - del.Amount = del.Amount.Add(bondedShares) - if err := k.Delegators.Set(ctx, key, del); err != nil { - return err - } + delAddr, err := sdk.AccAddressFromBech32(source.DelegatorAddress) + if err != nil { + return err + } + + _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Unbonded, val, false) + if err != nil { + return err } - } - reporter.TotalTokens = reporter.TotalTokens.Add(reward) - if err := k.Reporters.Set(ctx, reporterAddr, reporter); err != nil { - return err } + // assert totalAmt == amt return nil } -// allocate reward as stake to an address that isn't a reporter, that stakes with a validator -// get all the validators and delegate to them as much as possible -// is there a limit to how much you can delegate to a validator? -func (k Keeper) allocateRewardsToStake(ctx context.Context, val stakingtypes.Validator, addr sdk.AccAddress, reward math.Int) (math.LegacyDec, error) { - newShares, err := k.stakingKeeper.Delegate(ctx, addr, reward, stakingtypes.Bonded, val, false) +func (k Keeper) GetBondedValidators(ctx context.Context, max uint32) ([]stakingtypes.Validator, error) { + validators := make([]stakingtypes.Validator, max) + + iterator, err := k.stakingKeeper.ValidatorsPowerStoreIterator(ctx) if err != nil { - return math.LegacyDec{}, err + return nil, err } - return newShares, nil -} + defer iterator.Close() -func (k Keeper) RewardReporterBondToFeePayers(ctx context.Context, recipients []disputetypes.PayerInfo, reward math.Int) error { - totalAmt := math.ZeroInt() - for _, recipient := range recipients { - totalAmt = totalAmt.Add(recipient.Amount.Amount) - } - unbondedAddrs := make([]disputetypes.PayerInfo, 0) - for _, recipient := range recipients { - amt := recipient.Amount.Amount.Quo(totalAmt).Mul(reward) - addr, err := sdk.AccAddressFromBech32(recipient.PayerAddress) + i := 0 + for ; iterator.Valid() && i < int(max); iterator.Next() { + address := iterator.Value() + validator, err := k.stakingKeeper.GetValidator(ctx, address) if err != nil { - return err + return nil, fmt.Errorf("validator record not found for address: %X", address) } - err = k.AllocateRewardsToStake(ctx, addr, amt) - if err != nil { - if errors.Is(err, collections.ErrNotFound) { - unbondedAddrs = append(unbondedAddrs, recipient) - } else { - return err - } + + if validator.IsBonded() { + validators[i] = validator + i++ } } - if len(unbondedAddrs) == 0 { - return nil - } - // allocate to unbonded addresses - // get list of validators - validators, err := k.stakingKeeper.GetValidators(ctx, uint32(len(unbondedAddrs))) + + return validators[:i], nil // trim +} + +func (k Keeper) ReturnSlashedTokens(ctx context.Context, reporterAddr string, height int64, reward math.Int) error { + repAcc, err := sdk.AccAddressFromBech32(reporterAddr) if err != nil { return err } - // for each validator, delegate as much as possible - for i, val := range validators { - payer := unbondedAddrs[i] - amt := payer.Amount.Amount.Quo(totalAmt).Mul(reward) - addr, err := sdk.AccAddressFromBech32(payer.PayerAddress) - if err != nil { - return err - } - _, err = k.allocateRewardsToStake(ctx, val, addr, amt) - if err != nil { + reporter, err := k.Reporters.Get(ctx, repAcc) + if err != nil { + if !errors.Is(err, collections.ErrNotFound) { return err } + return k.returnSlashedTokens(ctx, repAcc, height, reward) } - return nil -} -func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error { - reporter, err := k.Reporters.Get(ctx, reporterAddr) + snapshot, err := k.GetTokenOriginsAtHeight(ctx, repAcc, height) if err != nil { return err } - // Calculate commission - commission := math.LegacyNewDecFromInt(reward).Mul(reporter.Commission.Rate) - // Calculate net reward - netReward := math.LegacyNewDecFromInt(reward).Sub(commission) - - // Calculate each delegator's share (including the reporter as a self-delegator) - repAddr, err := sdk.AccAddressFromBech32(reporter.Reporter) - if err != nil { - return err - } - delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) - if err != nil { - return err - } - defer delAddrs.Close() - for ; delAddrs.Valid(); delAddrs.Next() { - key, err := delAddrs.PrimaryKey() + for _, source := range snapshot.TokenOrigins { + // attempt to get delegation in reporter module first + valAddr, err := sdk.ValAddressFromBech32(source.ValidatorAddress) if err != nil { return err } - del, err := k.Delegators.Get(ctx, key) + delAddr, err := sdk.AccAddressFromBech32(source.DelegatorAddress) if err != nil { return err } - delegatorShare := netReward.Mul(math.LegacyNewDecFromInt(del.Amount)).Quo(math.LegacyNewDecFromInt(reporter.TotalTokens)) - if key.Equals(repAddr) { - delegatorShare = delegatorShare.Add(commission) + del, err := k.Delegators.Get(ctx, delAddr) + if err != nil { + if !errors.Is(err, collections.ErrNotFound) { + return err + } + // if delegator no longer exists, create a new one and + // delegate tokens to a randomly selected bonded validator + del.Amount = source.Amount + del.Reporter = repAcc.String() + // call hooks :todo + if err := k.Delegators.Set(ctx, delAddr, del); err != nil { + return err + } + vals, err := k.GetBondedValidators(ctx, 1) + if err != nil { + return err + } + // this should never happen since chains need validators to run + if len(vals) == 0 { + return errors.New("no validators found in staking module to return tokens to") + } + newVal, err := sdk.ValAddressFromBech32(vals[0].GetOperator()) + if err != nil { + return err + } + if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr, newVal), source.Amount); err != nil { + return err + } + _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, vals[0], false) + if err != nil { + return err + } + continue } - err = k.DelegatorTips.Set(ctx, key, delegatorShare.TruncateInt()) + // if delegator exists, add tokens to it + del.Amount = del.Amount.Add(source.Amount) + // call hooks :todo + if err := k.Delegators.Set(ctx, delAddr, del); err != nil { + return err + } + // get token origin and see if it still exists + prevAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr, valAddr)) + if err != nil { + if !errors.Is(err, collections.ErrNotFound) { + return err + } + /* + // you can try the same previous validator even though it doesn't exist in tokenorigin store + // or just directly use go for a random bonded validator + // validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + // if err != nil { + // if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { + // return err + // } + // } + // if err != nil || !validator.IsBonded() { + // vals, err := k.GetBondedValidators(ctx, 1) + // if err != nil { + // return err + // } + // validator = vals[0] + // valAddr, err = sdk.ValAddressFromBech32(validator.GetOperator()) + // if err != nil { + // return err + // } + + // } + */ + vals, err := k.GetBondedValidators(ctx, 1) + if err != nil { + return err + } + randoValidator := vals[0] + randoValAddr, err := sdk.ValAddressFromBech32(randoValidator.GetOperator()) + if err != nil { + return err + } + // should probably make sure the random validator is not in tokenOrigin store first + // to avoid overwriting + randoAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr, randoValAddr)) + if err != nil { + if !errors.Is(err, collections.ErrNotFound) { + return err + } + } + if randoAmt.IsNil() { + randoAmt = math.ZeroInt() + } + randoAmt = randoAmt.Add(source.Amount) + // if token origin no longer exists, set it + if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr, valAddr), randoAmt); err != nil { + return err + } + _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, randoValidator, false) + if err != nil { + return err + } + continue + + } + // at this stage the validator exists in tokenorigin store meaning key(delagator, validator) exists + // first we see if stored validator is bonded + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) if err != nil { + if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { + return err + } + } + if err != nil || !validator.IsBonded() { + vals, err := k.GetBondedValidators(ctx, 1) + if err != nil { + return err + } + validator = vals[0] + valAddr, err = sdk.ValAddressFromBech32(validator.GetOperator()) + if err != nil { + return err + } + // double check to make sure the random validator is not in tokenOrigin store first + prevAmt, err = k.TokenOrigin.Get(ctx, collections.Join(delAddr, valAddr)) + if err != nil { + if !errors.Is(err, collections.ErrNotFound) { + return err + } + } + } + if prevAmt.IsNil() { + prevAmt = math.ZeroInt() + } + prevAmt = prevAmt.Add(source.Amount) + if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr, valAddr), prevAmt); err != nil { return err } + _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, validator, false) + if err != nil { + return err + } + continue + } + reporter.TotalTokens = reporter.TotalTokens.Add(reward) + return k.Reporters.Set(ctx, repAcc, reporter) +} +func (k Keeper) AddAmountToStake(ctx context.Context, addr string, amt math.Int) error { + acc, err := sdk.AccAddressFromBech32(addr) + if err != nil { + return err + } + vals, err := k.GetBondedValidators(ctx, 1) + if err != nil { + return err + } + validator := vals[0] + + _, err = k.stakingKeeper.Delegate(ctx, acc, amt, stakingtypes.Bonded, validator, false) + if err != nil { + return err + } return nil } diff --git a/x/reporter/keeper/msg_server_undelegate_reporter.go b/x/reporter/keeper/msg_server_undelegate_reporter.go index fb293cf2b..ca9203b1c 100644 --- a/x/reporter/keeper/msg_server_undelegate_reporter.go +++ b/x/reporter/keeper/msg_server_undelegate_reporter.go @@ -13,7 +13,7 @@ func (k msgServer) UndelegateReporter(goCtx context.Context, msg *types.MsgUndel ctx := sdk.UnwrapSDKContext(goCtx) // fetch delegation - delAddr := sdk.MustAccAddressFromBech32(msg.Delegator) + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) delegation, err := k.Delegators.Get(ctx, delAddr) if err != nil { return nil, err diff --git a/x/reporter/keeper/msg_server_withdraw_tip.go b/x/reporter/keeper/msg_server_withdraw_tip.go index 448cada74..f698dc2c5 100644 --- a/x/reporter/keeper/msg_server_withdraw_tip.go +++ b/x/reporter/keeper/msg_server_withdraw_tip.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "errors" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -26,7 +27,11 @@ func (k msgServer) WithdrawTip(goCtx context.Context, msg *types.MsgWithdrawTip) if err != nil { return nil, err } - _, err = k.Keeper.stakingKeeper.Delegate(ctx, delAddr, shares, stakingtypes.Unbonding, val, false) + + if !val.IsBonded() { + return nil, errors.New("chosen validator must be bonded") + } + _, err = k.Keeper.stakingKeeper.Delegate(ctx, delAddr, shares, val.Status, val, false) if err != nil { return nil, err } diff --git a/x/reporter/simulation/undelegate_reporter.go b/x/reporter/simulation/undelegate_reporter.go index d707c4ff1..e1ef73f2d 100644 --- a/x/reporter/simulation/undelegate_reporter.go +++ b/x/reporter/simulation/undelegate_reporter.go @@ -19,7 +19,7 @@ func SimulateMsgUndelegateReporter( ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgUndelegateReporter{ - Delegator: simAccount.Address.String(), + DelegatorAddress: simAccount.Address.String(), } // TODO: Handling the UndelegateReporter simulation diff --git a/x/reporter/types/expected_keepers.go b/x/reporter/types/expected_keepers.go index b9901aa6c..52dc19e60 100644 --- a/x/reporter/types/expected_keepers.go +++ b/x/reporter/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( "context" + "cosmossdk.io/core/store" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -25,6 +26,7 @@ type StakingKeeper interface { Unbond( ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, shares math.LegacyDec, ) (amount math.Int, err error) + ValidatorsPowerStoreIterator(ctx context.Context) (store.Iterator, error) // Methods imported from account should be defined here } diff --git a/x/reporter/types/message_undelegate_reporter.go b/x/reporter/types/message_undelegate_reporter.go index c9a65d318..c3a550120 100644 --- a/x/reporter/types/message_undelegate_reporter.go +++ b/x/reporter/types/message_undelegate_reporter.go @@ -10,13 +10,13 @@ var _ sdk.Msg = &MsgUndelegateReporter{} func NewMsgUndelegateReporter(delegator string, tokenOrigin []*TokenOrigin) *MsgUndelegateReporter { return &MsgUndelegateReporter{ - Delegator: delegator, - TokenOrigins: tokenOrigin, + DelegatorAddress: delegator, + TokenOrigins: tokenOrigin, } } func (msg *MsgUndelegateReporter) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Delegator) + _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid delegator address (%s)", err) } diff --git a/x/reporter/types/message_undelegate_reporter_test.go b/x/reporter/types/message_undelegate_reporter_test.go index bbc7cd6d3..cabeb0d7c 100644 --- a/x/reporter/types/message_undelegate_reporter_test.go +++ b/x/reporter/types/message_undelegate_reporter_test.go @@ -17,13 +17,13 @@ func TestMsgUndelegateReporter_ValidateBasic(t *testing.T) { { name: "invalid address", msg: MsgUndelegateReporter{ - Delegator: "invalid_address", + DelegatorAddress: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", msg: MsgUndelegateReporter{ - Delegator: sample.AccAddress(), + DelegatorAddress: sample.AccAddress(), }, }, } From 0e5bf61b2dd8da1443f2bbaab8fc23217ce5a91a Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 02:34:50 -0400 Subject: [PATCH 25/31] fix --- api/layer/oracle/aggregate.pulsar.go | 37 +- docs/static/openapi.yml | 1010 ++++++++++++++++++++++++++ x/oracle/keeper/aggregate.go | 1 + x/oracle/types/aggregate.pb.go | 54 +- 4 files changed, 1057 insertions(+), 45 deletions(-) diff --git a/api/layer/oracle/aggregate.pulsar.go b/api/layer/oracle/aggregate.pulsar.go index 16f898caa..e4c497ce2 100644 --- a/api/layer/oracle/aggregate.pulsar.go +++ b/api/layer/oracle/aggregate.pulsar.go @@ -1672,24 +1672,25 @@ var file_layer_oracle_aggregate_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x14, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x61, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, - 0x5b, 0x0a, 0x13, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, - 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x42, 0xa0, 0x01, 0x0a, - 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x42, 0x0e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, - 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, - 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x5b, 0x0a, 0x13, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x12, 0x44, + 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, + 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x73, 0x42, 0xa0, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x42, 0x0e, 0x41, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, + 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, + 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, + 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 3baf07c73..431250b2a 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -4,6 +4,640 @@ info: name: '' description: '' paths: + /tellor-io/layer/dispute/params: + get: + summary: Parameters queries the parameters of the module. + operationId: LayerDisputeParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /layer/oracle/get_reportsby_qid/{queryId}: + get: + summary: Queries a list of GetReportsbyQid items. + operationId: LayerOracleGetReportsbyQid + responses: + '200': + description: A successful response. + schema: + type: object + properties: + reports: + type: object + properties: + microReports: + type: array + items: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: >- + the power of the reporter based on total tokens + normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the + reports for the query id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: >- + indicates if the report's query id is in the + cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: queryId + in: path + required: true + type: string + tags: + - Query + /layer/oracle/get_reportsby_reporter/{reporter}: + get: + operationId: LayerOracleGetReportsbyReporter + responses: + '200': + description: A successful response. + schema: + type: object + properties: + microReports: + type: array + items: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: >- + the power of the reporter based on total tokens + normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the reports + for the query id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: indicates if the report's query id is in the cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: reporter + in: path + required: true + type: string + tags: + - Query + /layer/oracle/get_reportsby_reporter_qid/{reporter}/{queryId}: + get: + operationId: LayerOracleGetReportsbyReporterQid + responses: + '200': + description: A successful response. + schema: + type: object + properties: + reports: + type: object + properties: + microReports: + type: array + items: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: >- + the power of the reporter based on total tokens + normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the + reports for the query id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: >- + indicates if the report's query id is in the + cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: reporter + in: path + required: true + type: string + - name: queryId + in: path + required: true + type: string + tags: + - Query + /layer/oracle/params: + get: + summary: Parameters queries the parameters of the module. + operationId: LayerOracleParams + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + minStakeAmount: + type: string + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /tellor-io/layer/oracle/GetDataBefore/{queryId}/{timestamp}: + get: + summary: Queries a list of GetAggregatedReport items. + operationId: LayerOracleGetDataBefore + responses: + '200': + description: A successful response. + schema: + type: object + properties: + report: + type: object + properties: + queryId: + type: string + aggregateValue: + type: string + aggregateReporter: + type: string + reporterPower: + type: string + format: int64 + standardDeviation: + type: number + format: double + reporters: + type: array + items: + type: object + properties: + reporter: + type: string + power: + type: string + format: int64 + flagged: + type: boolean + nonce: + type: string + format: uint64 + aggregateReportIndex: + type: string + format: int64 + height: + type: string + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: queryId + in: path + required: true + type: string + - name: timestamp + in: path + required: true + type: string + format: int64 + tags: + - Query + /tellor-io/layer/oracle/current_cyclelist_query: + get: + summary: Queries a list of CurrentCyclelistQuery items. + operationId: LayerOracleCurrentCyclelistQuery + responses: + '200': + description: A successful response. + schema: + type: object + properties: + querydata: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /tellor-io/layer/oracle/get_aggregated_report/{queryId}: + get: + summary: Queries a list of GetAggregatedReport items. + operationId: LayerOracleGetAggregatedReport + responses: + '200': + description: A successful response. + schema: + type: object + properties: + report: + type: object + properties: + queryId: + type: string + aggregateValue: + type: string + aggregateReporter: + type: string + reporterPower: + type: string + format: int64 + standardDeviation: + type: number + format: double + reporters: + type: array + items: + type: object + properties: + reporter: + type: string + power: + type: string + format: int64 + flagged: + type: boolean + nonce: + type: string + format: uint64 + aggregateReportIndex: + type: string + format: int64 + height: + type: string + format: int64 + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: queryId + in: path + required: true + type: string + tags: + - Query + /tellor-io/layer/oracle/get_current_tip/{queryData}: + get: + summary: Queries a list of GetCurrentTip items. + operationId: LayerOracleGetCurrentTip + responses: + '200': + description: A successful response. + schema: + type: object + properties: + tips: + type: object + properties: + query_data: + type: string + title: queryData is the query data that was tipped + amount: + type: string + title: the amount that was tipped + total_tips: + type: string + title: >- + totalTips is the total amount of tips for this query data + so far + title: >- + Tips is a struct that contains the query data and the amount + it was tipped + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: queryData + in: path + required: true + type: string + tags: + - Query + /tellor-io/layer/oracle/get_time_based_rewards: + get: + summary: Queries a list of GetTimeBasedRewards items. + operationId: LayerOracleGetTimeBasedRewards + responses: + '200': + description: A successful response. + schema: + type: object + properties: + reward: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query + /tellor-io/layer/oracle/get_user_tip_total/{tipper}/{queryData}: + get: + summary: Queries a list of GetUserTipTotal items. + operationId: LayerOracleGetUserTipTotal + responses: + '200': + description: A successful response. + schema: + type: object + properties: + totalTips: + type: object + properties: + address: + type: string + total: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: tipper + in: path + required: true + type: string + - name: queryData + in: path + required: true + type: string + tags: + - Query /tellor-io/layer/reporter/commission/{reporter_address}: get: summary: ReporterCommission queries accumulated commission for a reporter. @@ -3917,6 +4551,382 @@ definitions: description: |- Version defines the versioning scheme used to negotiate the IBC verison in the connection handshake. + layer.dispute.Params: + type: object + description: Params defines the parameters for the module. + layer.dispute.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: QueryParamsResponse is response type for the Query/Params RPC method. + layer.dispute.DisputeCategory: + type: string + enum: + - DISPUTE_CATEGORY_UNSPECIFIED + - DISPUTE_CATEGORY_WARNING + - DISPUTE_CATEGORY_MINOR + - DISPUTE_CATEGORY_MAJOR + default: DISPUTE_CATEGORY_UNSPECIFIED + description: |2- + - DISPUTE_CATEGORY_UNSPECIFIED: UNSPECIFIED defines an invalid dispute category. + - DISPUTE_CATEGORY_WARNING: WARNING defines a 1 percent slashing. + - DISPUTE_CATEGORY_MINOR: MINOR defines a 5 percent slashing. + - DISPUTE_CATEGORY_MAJOR: MAJOR defines a 100 percent slashing. + layer.dispute.MsgAddFeeToDisputeResponse: + type: object + layer.dispute.MsgProposeDisputeResponse: + type: object + layer.dispute.MsgVoteResponse: + type: object + layer.dispute.VoteEnum: + type: string + enum: + - VOTE_INVALID + - VOTE_SUPPORT + - VOTE_AGAINST + default: VOTE_INVALID + layer.oracle.MicroReport: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: the power of the reporter based on total tokens normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the reports for the query + id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: indicates if the report's query id is in the cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + layer.oracle.Aggregate: + type: object + properties: + queryId: + type: string + aggregateValue: + type: string + aggregateReporter: + type: string + reporterPower: + type: string + format: int64 + standardDeviation: + type: number + format: double + reporters: + type: array + items: + type: object + properties: + reporter: + type: string + power: + type: string + format: int64 + flagged: + type: boolean + nonce: + type: string + format: uint64 + aggregateReportIndex: + type: string + format: int64 + height: + type: string + format: int64 + layer.oracle.AggregateReporter: + type: object + properties: + reporter: + type: string + power: + type: string + format: int64 + layer.oracle.Params: + type: object + properties: + minStakeAmount: + type: string + description: Params defines the parameters for the module. + layer.oracle.QueryCurrentCyclelistQueryResponse: + type: object + properties: + querydata: + type: string + layer.oracle.QueryGetAggregatedReportResponse: + type: object + properties: + report: + type: object + properties: + queryId: + type: string + aggregateValue: + type: string + aggregateReporter: + type: string + reporterPower: + type: string + format: int64 + standardDeviation: + type: number + format: double + reporters: + type: array + items: + type: object + properties: + reporter: + type: string + power: + type: string + format: int64 + flagged: + type: boolean + nonce: + type: string + format: uint64 + aggregateReportIndex: + type: string + format: int64 + height: + type: string + format: int64 + layer.oracle.QueryGetCurrentTipResponse: + type: object + properties: + tips: + type: object + properties: + query_data: + type: string + title: queryData is the query data that was tipped + amount: + type: string + title: the amount that was tipped + total_tips: + type: string + title: totalTips is the total amount of tips for this query data so far + title: >- + Tips is a struct that contains the query data and the amount it was + tipped + layer.oracle.QueryGetReportsbyQidResponse: + type: object + properties: + reports: + type: object + properties: + microReports: + type: array + items: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: the power of the reporter based on total tokens normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the reports for + the query id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: indicates if the report's query id is in the cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + layer.oracle.QueryGetReportsbyReporterResponse: + type: object + properties: + microReports: + type: array + items: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: the power of the reporter based on total tokens normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the reports for the + query id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: indicates if the report's query id is in the cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + layer.oracle.QueryGetTimeBasedRewardsResponse: + type: object + properties: + reward: + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + layer.oracle.QueryGetUserTipTotalResponse: + type: object + properties: + totalTips: + type: object + properties: + address: + type: string + total: + type: string + layer.oracle.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + minStakeAmount: + type: string + description: QueryParamsResponse is response type for the Query/Params RPC method. + layer.oracle.Reports: + type: object + properties: + microReports: + type: array + items: + type: object + properties: + reporter: + type: string + title: reporter is the address of the reporter + power: + type: string + format: int64 + title: the power of the reporter based on total tokens normalized + query_type: + type: string + title: string identifier of the data spec + query_id: + type: string + title: hash of the query data + aggregate_method: + type: string + title: >- + aggregate method to use for aggregating all the reports for the + query id + value: + type: string + title: hex string of the response value + timestamp: + type: string + format: date-time + title: timestamp of when the report was created + cyclelist: + type: boolean + title: indicates if the report's query id is in the cyclelist + block_number: + type: string + format: int64 + title: block number of when the report was created + title: MicroReport represents data for a single report + layer.oracle.Tips: + type: object + properties: + query_data: + type: string + title: queryData is the query data that was tipped + amount: + type: string + title: the amount that was tipped + total_tips: + type: string + title: totalTips is the total amount of tips for this query data so far + title: Tips is a struct that contains the query data and the amount it was tipped + layer.oracle.UserTipTotal: + type: object + properties: + address: + type: string + total: + type: string + layer.oracle.MsgCommitReportResponse: + type: object + layer.oracle.MsgSubmitValueResponse: + type: object + layer.oracle.MsgTipResponse: + type: object + layer.oracle.MsgUpdateCyclelistResponse: + type: object + description: MsgUpdateCycleResponse defines the Msg/UpdateCycle response type. + layer.oracle.MsgUpdateParamsResponse: + type: object layer.registry.ABIComponent: type: object properties: diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index 3ee1b82fd..b3a12ab19 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -4,6 +4,7 @@ import ( "context" "encoding/hex" "errors" + "fmt" "time" "cosmossdk.io/collections" diff --git a/x/oracle/types/aggregate.pb.go b/x/oracle/types/aggregate.pb.go index e0b01b953..655c9b59d 100644 --- a/x/oracle/types/aggregate.pb.go +++ b/x/oracle/types/aggregate.pb.go @@ -196,33 +196,33 @@ func init() { func init() { proto.RegisterFile("layer/oracle/aggregate.proto", fileDescriptor_788ad347f505f8a6) } var fileDescriptor_788ad347f505f8a6 = []byte{ - // 405 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcb, 0x6e, 0xd4, 0x30, - 0x14, 0x8d, 0x3b, 0x7d, 0x4c, 0xcc, 0x43, 0xc2, 0xcc, 0xc2, 0x1a, 0xa1, 0x24, 0xaa, 0x00, 0x05, - 0x09, 0x1c, 0xa9, 0xac, 0x59, 0x4c, 0xe9, 0xa6, 0x3b, 0x64, 0x21, 0x16, 0xb0, 0x40, 0xce, 0xe4, - 0xd6, 0x44, 0xf2, 0xc4, 0xc1, 0x71, 0x4a, 0xe7, 0x2f, 0xfa, 0x59, 0x5d, 0x76, 0xc9, 0x0a, 0xd0, - 0xcc, 0x1f, 0xf0, 0x05, 0x68, 0x9c, 0x3a, 0x4c, 0x67, 0x66, 0xe7, 0x73, 0xcf, 0x39, 0xbe, 0xd7, - 0x3e, 0x17, 0x3f, 0x53, 0x62, 0x0e, 0x26, 0xd3, 0x46, 0x4c, 0x15, 0x64, 0x42, 0x4a, 0x03, 0x52, - 0x58, 0x60, 0xb5, 0xd1, 0x56, 0x93, 0x87, 0x8e, 0x65, 0x1d, 0x3b, 0x1e, 0x49, 0x2d, 0xb5, 0x23, - 0xb2, 0xd5, 0xa9, 0xd3, 0x8c, 0x63, 0xa9, 0xb5, 0x54, 0x90, 0x39, 0x94, 0xb7, 0x17, 0x99, 0x2d, - 0x67, 0xd0, 0x58, 0x31, 0xab, 0xef, 0x04, 0x2f, 0x76, 0xb7, 0xf8, 0x6a, 0xa0, 0xd6, 0xc6, 0x82, - 0xe9, 0x64, 0xc7, 0x7f, 0xf7, 0x70, 0x38, 0xf1, 0x24, 0xa1, 0xf8, 0xe8, 0x7b, 0x0b, 0x66, 0x7e, - 0x5e, 0x50, 0x94, 0xa0, 0x34, 0xe4, 0x1e, 0x92, 0x97, 0xf8, 0x71, 0x7f, 0xc7, 0x27, 0xa1, 0x5a, - 0xa0, 0x7b, 0x4e, 0xb0, 0x51, 0x25, 0xaf, 0xf1, 0x93, 0xbe, 0xc2, 0xef, 0x5a, 0xd1, 0x81, 0x93, - 0x6e, 0x13, 0xe4, 0x39, 0x7e, 0xe4, 0xe7, 0xf9, 0xa0, 0x7f, 0x80, 0xa1, 0xfb, 0x09, 0x4a, 0x07, - 0xfc, 0x7e, 0x71, 0x75, 0x67, 0x63, 0x45, 0x55, 0x08, 0x53, 0x9c, 0xc1, 0x65, 0x29, 0x6c, 0xa9, - 0x2b, 0x7a, 0x90, 0xa0, 0x14, 0xf1, 0x6d, 0x82, 0xbc, 0xc3, 0xa1, 0xb7, 0x37, 0xf4, 0x30, 0x19, - 0xa4, 0x0f, 0x4e, 0x62, 0xb6, 0xfe, 0xa3, 0x6c, 0xb2, 0x39, 0x07, 0xff, 0xef, 0x58, 0x7d, 0xc1, - 0x85, 0x12, 0x52, 0x42, 0x41, 0x8f, 0x12, 0x94, 0x0e, 0xb9, 0x87, 0x64, 0x84, 0x0f, 0x2a, 0x5d, - 0x4d, 0x81, 0x0e, 0x13, 0x94, 0xee, 0xf3, 0x0e, 0x90, 0x13, 0x3c, 0xda, 0x78, 0xd7, 0x79, 0x55, - 0xc0, 0x15, 0x0d, 0xdd, 0x4b, 0x76, 0x72, 0xc7, 0x5f, 0xf0, 0xd3, 0xc9, 0xa5, 0x28, 0x95, 0xc8, - 0x15, 0x7c, 0xf4, 0xb9, 0x35, 0xe4, 0x0c, 0xe3, 0x3e, 0xc5, 0x86, 0x22, 0x37, 0xfa, 0x98, 0x75, - 0x41, 0x33, 0x1f, 0x34, 0xeb, 0x0d, 0xa7, 0xc3, 0x9b, 0x5f, 0x71, 0x70, 0xfd, 0x3b, 0x46, 0x7c, - 0xcd, 0x77, 0xfa, 0xfe, 0x66, 0x11, 0xa1, 0xdb, 0x45, 0x84, 0xfe, 0x2c, 0x22, 0x74, 0xbd, 0x8c, - 0x82, 0xdb, 0x65, 0x14, 0xfc, 0x5c, 0x46, 0xc1, 0xe7, 0x57, 0xb2, 0xb4, 0xdf, 0xda, 0x9c, 0x4d, - 0xf5, 0x2c, 0xb3, 0xa0, 0x94, 0x36, 0x6f, 0x4a, 0x9d, 0x75, 0x7b, 0x72, 0xe5, 0x37, 0xc5, 0xce, - 0x6b, 0x68, 0xf2, 0x43, 0xd7, 0xee, 0xed, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x37, 0x35, 0x51, - 0x8e, 0xa9, 0x02, 0x00, 0x00, + // 416 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcf, 0x6f, 0xd3, 0x30, + 0x14, 0xae, 0xc9, 0xd6, 0x35, 0xe6, 0x87, 0x84, 0xa9, 0x90, 0x55, 0xa1, 0x24, 0x9a, 0x00, 0x05, + 0x09, 0x1c, 0x69, 0x9c, 0x39, 0x74, 0xec, 0xb2, 0x1b, 0xb2, 0x10, 0x07, 0x38, 0x20, 0xa7, 0x79, + 0x73, 0x23, 0xb9, 0x71, 0x70, 0x9c, 0xb1, 0xfe, 0x0b, 0x9c, 0xf6, 0x67, 0xed, 0xb8, 0x23, 0x27, + 0x40, 0xed, 0x3f, 0x82, 0xea, 0xd4, 0x61, 0x74, 0xbb, 0xf9, 0x7b, 0xdf, 0xf7, 0xf9, 0xf9, 0xf9, + 0x7d, 0xf8, 0x99, 0x12, 0x4b, 0x30, 0x99, 0x36, 0x62, 0xa6, 0x20, 0x13, 0x52, 0x1a, 0x90, 0xc2, + 0x02, 0xab, 0x8d, 0xb6, 0x9a, 0x3c, 0x70, 0x2c, 0xeb, 0xd8, 0xc9, 0x58, 0x6a, 0xa9, 0x1d, 0x91, + 0x6d, 0x4e, 0x9d, 0x66, 0x12, 0x4b, 0xad, 0xa5, 0x82, 0xcc, 0xa1, 0xbc, 0x3d, 0xcb, 0x6c, 0xb9, + 0x80, 0xc6, 0x8a, 0x45, 0xbd, 0x15, 0xbc, 0xb8, 0xbb, 0xc5, 0x57, 0x03, 0xb5, 0x36, 0x16, 0x4c, + 0x27, 0x3b, 0xfc, 0x11, 0xe0, 0x70, 0xea, 0x49, 0x42, 0xf1, 0xc1, 0xb7, 0x16, 0xcc, 0xf2, 0xb4, + 0xa0, 0x28, 0x41, 0x69, 0xc8, 0x3d, 0x24, 0x2f, 0xf1, 0xa3, 0xfe, 0x8e, 0x4f, 0x42, 0xb5, 0x40, + 0xef, 0x39, 0xc1, 0x4e, 0x95, 0xbc, 0xc6, 0x8f, 0xfb, 0x0a, 0xdf, 0xb6, 0xa2, 0x81, 0x93, 0xde, + 0x26, 0xc8, 0x73, 0xfc, 0xd0, 0xbf, 0xe7, 0x83, 0xfe, 0x0e, 0x86, 0xee, 0x25, 0x28, 0x0d, 0xf8, + 0xff, 0xc5, 0xcd, 0x9d, 0x8d, 0x15, 0x55, 0x21, 0x4c, 0x71, 0x02, 0xe7, 0xa5, 0xb0, 0xa5, 0xae, + 0xe8, 0x7e, 0x82, 0x52, 0xc4, 0x6f, 0x13, 0xe4, 0x1d, 0x0e, 0xbd, 0xbd, 0xa1, 0xc3, 0x24, 0x48, + 0xef, 0x1f, 0xc5, 0xec, 0xe6, 0x8f, 0xb2, 0xe9, 0xee, 0x3b, 0xf8, 0x3f, 0xc7, 0xe6, 0x0b, 0xce, + 0x94, 0x90, 0x12, 0x0a, 0x7a, 0x90, 0xa0, 0x74, 0xc4, 0x3d, 0x24, 0x63, 0xbc, 0x5f, 0xe9, 0x6a, + 0x06, 0x74, 0x94, 0xa0, 0x74, 0x8f, 0x77, 0x80, 0x1c, 0xe1, 0xf1, 0xce, 0x5c, 0xa7, 0x55, 0x01, + 0x17, 0x34, 0x74, 0x93, 0xdc, 0xc9, 0x91, 0xa7, 0x78, 0x38, 0x87, 0x52, 0xce, 0x2d, 0xc5, 0x4e, + 0xb5, 0x45, 0x87, 0x5f, 0xf0, 0x93, 0xe9, 0xb9, 0x28, 0x95, 0xc8, 0x15, 0x7c, 0xf4, 0xfb, 0x6c, + 0xc8, 0x09, 0xc6, 0xfd, 0x76, 0x1b, 0x8a, 0xdc, 0x48, 0x13, 0xd6, 0x05, 0x80, 0xf9, 0x00, 0xb0, + 0xde, 0x70, 0x3c, 0xba, 0xfa, 0x15, 0x0f, 0x2e, 0x7f, 0xc7, 0x88, 0xdf, 0xf0, 0x1d, 0xbf, 0xbf, + 0x5a, 0x45, 0xe8, 0x7a, 0x15, 0xa1, 0x3f, 0xab, 0x08, 0x5d, 0xae, 0xa3, 0xc1, 0xf5, 0x3a, 0x1a, + 0xfc, 0x5c, 0x47, 0x83, 0xcf, 0xaf, 0x64, 0x69, 0xe7, 0x6d, 0xce, 0x66, 0x7a, 0x91, 0x59, 0x50, + 0x4a, 0x9b, 0x37, 0xa5, 0xce, 0xba, 0xfc, 0x5c, 0xf8, 0x04, 0xd9, 0x65, 0x0d, 0x4d, 0x3e, 0x74, + 0xed, 0xde, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x03, 0x03, 0x31, 0xc1, 0x02, 0x00, 0x00, } func (m *Aggregate) Marshal() (dAtA []byte, err error) { From 309c58e52aa9c4687725e990faf8acc0f82cc87e Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 08:47:26 -0400 Subject: [PATCH 26/31] handle dispute fee for support stat --- proto/layer/dispute/dispute.proto | 60 +++++++++++++++++++++-------- proto/layer/oracle/query_meta.proto | 2 +- x/dispute/keeper/abci.go | 27 ++++++------- x/dispute/keeper/dispute_fee.go | 12 ++++++ x/dispute/keeper/execute.go | 53 +++++++++++-------------- 5 files changed, 92 insertions(+), 62 deletions(-) diff --git a/proto/layer/dispute/dispute.proto b/proto/layer/dispute/dispute.proto index 2eba072b5..cd7c2391f 100644 --- a/proto/layer/dispute/dispute.proto +++ b/proto/layer/dispute/dispute.proto @@ -9,46 +9,63 @@ import "layer/oracle/micro_report.proto"; option go_package = "github.com/tellor-io/layer/x/dispute/types"; +// Dispute defines a dispute. message Dispute { - bytes hashId = 1; - uint64 disputeId = 2; - DisputeCategory disputeCategory = 3; - string disputeFee = 4 [ + // unique dispute hash identifier + bytes hash_id = 1; + // current dispute id + uint64 dispute_id = 2; + // dispute severity level + DisputeCategory dispute_category = 3; + // cost to start dispute + string dispute_fee = 4 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - DisputeStatus disputeStatus = 5; - google.protobuf.Timestamp disputeStartTime = 6 [ + // current dispute status + DisputeStatus dispute_status = 5; + // start time of the dispute that begins after dispute fee is fully paid + google.protobuf.Timestamp dispute_start_time = 6 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; - google.protobuf.Timestamp disputeEndTime = 7 [ + // end time that the dispute stop taking votes and creating new rounds + google.protobuf.Timestamp dispute_end_time = 7 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; - int64 disputeStartBlock = 8; - uint64 disputeRound = 9; - string slashAmount = 10 [ + // height of the block that started the dispute + int64 dispute_start_block = 8; + // current dispute round + uint64 dispute_round = 9; + // reporter's slashed amount + string slash_amount = 10 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - string burnAmount = 11 [ + // burn amount that will be divided in half and paid to voters and the other half burned + string burn_amount = 11 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - layer.oracle.MicroReport reportEvidence = 12 [(gogoproto.nullable) = false]; - repeated PayerInfo feePayers = 13 [(gogoproto.nullable) = false]; - string feeTotal = 14 [ + // single report evidence + layer.oracle.MicroReport report_evidence = 12 [(gogoproto.nullable) = false]; + // fee payers that were involved in paying the dispute fee in order to start the dispute + repeated PayerInfo fee_payers = 13 [(gogoproto.nullable) = false]; + // total fee paid tracked to know if dispute fee is fully paid to start dispute + string fee_total = 14 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - repeated uint64 prevDisputeIds = 15; + // list of dispute ids that preceded before this current round began + repeated uint64 prev_dispute_ids = 15; } +// DisputeCategory defines the severity of a dispute. enum DisputeCategory { option (gogoproto.goproto_enum_prefix) = false; @@ -62,6 +79,7 @@ enum DisputeCategory { DISPUTE_CATEGORY_MAJOR = 3 [(gogoproto.enumvalue_customname) = "Major"]; } +// DisputeStatus defines the status of a dispute. enum DisputeStatus { option (gogoproto.goproto_enum_prefix) = false; @@ -77,13 +95,21 @@ enum DisputeStatus { DISPUTE_STATUS_FAILED = 4 [(gogoproto.enumvalue_customname) = "Failed"]; } +// PayerInfo defines the payer info of a dispute +// fee payer's info that was involved in paying the dispute fee in order to start the dispute message PayerInfo { - string payerAddress = 1; + // fee payer's Account address + string payer_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount paid string amount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; - bool fromBond = 3; + // source of funds either from bond or free floating funds + bool from_bond = 3; + // block number when this specific fee was paid + // keeping track of this in case the bond was used + // in order to reward the reporters' delegators in the future int64 block_number = 4; } diff --git a/proto/layer/oracle/query_meta.proto b/proto/layer/oracle/query_meta.proto index 084be4c45..0d7f2937d 100644 --- a/proto/layer/oracle/query_meta.proto +++ b/proto/layer/oracle/query_meta.proto @@ -35,6 +35,6 @@ message QueryMeta { bool has_revealed_reports = 5; // unique id of the query according to the data spec bytes query_id = 6; - // sttring identifier of the data spec + // string identifier of the data spec string query_type = 7; } diff --git a/x/dispute/keeper/abci.go b/x/dispute/keeper/abci.go index 77fac6407..e01a3e9bb 100644 --- a/x/dispute/keeper/abci.go +++ b/x/dispute/keeper/abci.go @@ -10,8 +10,7 @@ import ( // tally votes func (k Keeper) Tally(ctx sdk.Context, ids []uint64) error { for _, id := range ids { - err := k.TallyVote(ctx, id) - if err != nil { + if err := k.TallyVote(ctx, id); err != nil { return err } } @@ -37,20 +36,23 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { return err } if vote.Executed || dispute.DisputeStatus != types.Resolved { - ctx.Logger().Info("can't execute vote, reason either vote has already executed: %v, or dispute status: %v", vote.Executed, dispute.DisputeStatus) + ctx.Logger().Info("can't execute vote, reason either vote has already executed: %v, or dispute not resolved: %v", vote.Executed, dispute.DisputeStatus) return nil } + // amount of dispute fee to return to fee payers or give to reporter disputeFeeMinusBurn := dispute.SlashAmount.Sub(dispute.BurnAmount) - // the burnAmount %5 of disputeFee, half of which is burned and the other half is distributed to the voters + // the burnAmount starts at %5 of disputeFee, half of which is burned and the other half is distributed to the voters halfBurnAmount := dispute.BurnAmount.QuoRaw(2) voterReward := halfBurnAmount if len(voters) == 0 { + // if no voters, burn the entire burnAmount halfBurnAmount = dispute.BurnAmount + // non voters get nothing voterReward = math.ZeroInt() } switch vote.VoteResult { case types.VoteResult_INVALID, types.VoteResult_NO_QUORUM_MAJORITY_INVALID: - // divide the remaining burnAmount equally among the voters and transfer it to their accounts + // distribute the voterRewardunt equally among the voters and transfer it to their accounts burnRemainder, err := k.RewardVoters(ctx, voters, voterReward) if err != nil { return err @@ -59,15 +61,11 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { return err } - // refund all fees to each dispute fee payer and restore validator bond/power - // burn dispute fee then pay back the remaining dispute fee to the fee payers - fromAcc, fromBond := k.SortPayerInfo(dispute.FeePayers) - if err := k.RefundDisputeFeeToAccount(ctx, fromAcc); err != nil { - return err - } - if err := k.RefundDisputeFeeToBond(ctx, fromBond); err != nil { + // refund the remaining dispute fee to the fee payers according to their payment method + if err := k.RefundDisputeFee(ctx, dispute.FeePayers, disputeFeeMinusBurn); err != nil { return err } + // stake the slashed tokens back into the bonded pool for the reporter if err := k.ReturnSlashedTokens(ctx, dispute); err != nil { return err } @@ -84,7 +82,10 @@ func (k Keeper) ExecuteVote(ctx sdk.Context, id uint64) error { if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, halfBurnAmount.Add(burnRemainder)))); err != nil { return err } - // todo: dispute fee? + // refund the remaining dispute fee to the fee payers according to their payment method + if err := k.RefundDisputeFee(ctx, dispute.FeePayers, disputeFeeMinusBurn); err != nil { + return err + } // divide the reporters bond equally amongst the dispute fee payers and add it to the bonded pool if err := k.RewardReporterBondToFeePayers(ctx, dispute.FeePayers, dispute.SlashAmount); err != nil { return err diff --git a/x/dispute/keeper/dispute_fee.go b/x/dispute/keeper/dispute_fee.go index cac0f2245..fe75d0c67 100644 --- a/x/dispute/keeper/dispute_fee.go +++ b/x/dispute/keeper/dispute_fee.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" layertypes "github.com/tellor-io/layer/types" @@ -54,3 +55,14 @@ func (k Keeper) ReturnSlashedTokens(ctx sdk.Context, dispute *types.Dispute) err coins := sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, dispute.SlashAmount)) return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, coins) } + +func (k Keeper) ReturnFeetoStake(ctx sdk.Context, repAddr string, height int64, remainingAmt math.Int) error { + + err := k.reporterKeeper.ReturnSlashedTokens(ctx, repAddr, height, remainingAmt) + if err != nil { + return err + } + + coins := sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, remainingAmt)) + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, coins) +} diff --git a/x/dispute/keeper/execute.go b/x/dispute/keeper/execute.go index f793b31d0..4815e8a59 100644 --- a/x/dispute/keeper/execute.go +++ b/x/dispute/keeper/execute.go @@ -9,49 +9,40 @@ import ( "github.com/tellor-io/layer/x/dispute/types" ) -func (k Keeper) SortPayerInfo(feePayers []types.PayerInfo) (fromAcc, fromBond []types.PayerInfo) { - for _, payer := range feePayers { - if payer.FromBond { - fromBond = append(fromBond, payer) - } else { - fromAcc = append(fromAcc, payer) - } - } - return fromAcc, fromBond -} - -func (k Keeper) RefundDisputeFeeToAccount(ctx sdk.Context, fromAcc []types.PayerInfo) error { +func (k Keeper) RefundDisputeFee(ctx sdk.Context, feePayers []types.PayerInfo, remainingAmt math.Int) error { var outputs []banktypes.Output moduleAddress := k.accountKeeper.GetModuleAddress(types.ModuleName) - totalAmount := sdk.NewCoins() + initialTotalAmount := math.ZeroInt() - // Calculate total amount and prepare outputs - for _, recipient := range fromAcc { - burn := recipient.Amount.MulRaw(1).QuoRaw(20) - recipient.Amount = recipient.Amount.Sub(burn) - totalAmount = totalAmount.Add(sdk.NewCoins(sdk.NewCoin(layer.BondDenom, recipient.Amount))...) - outputs = append(outputs, banktypes.NewOutput(sdk.MustAccAddressFromBech32(recipient.PayerAddress), sdk.NewCoins(sdk.NewCoin(layer.BondDenom, recipient.Amount)))) + for _, recipient := range feePayers { + initialTotalAmount = initialTotalAmount.Add(recipient.Amount) } + accInputTotal := math.ZeroInt() + // Calculate total amount and prepare outputs + for _, recipient := range feePayers { + amt := math.LegacyNewDecFromInt(recipient.Amount).Quo(math.LegacyNewDecFromInt(initialTotalAmount)) + amt = amt.MulInt(remainingAmt) + + coins := sdk.NewCoins(sdk.NewCoin(layer.BondDenom, amt.TruncateInt())) + if !recipient.FromBond { + accInputTotal = accInputTotal.Add(amt.TruncateInt()) + outputs = append(outputs, banktypes.NewOutput(sdk.MustAccAddressFromBech32(recipient.PayerAddress), coins)) + } else { + if err := k.ReturnFeetoStake(ctx, recipient.PayerAddress, recipient.BlockNumber, amt.TruncateInt()); err != nil { + return err + } + } + + } // Prepare input - inputs := banktypes.NewInput(moduleAddress, totalAmount) + inputs := banktypes.NewInput(moduleAddress, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, accInputTotal))) // Perform the InputOutputCoins operation return k.bankKeeper.InputOutputCoins(ctx, inputs, outputs) } -func (k Keeper) RefundDisputeFeeToBond(ctx sdk.Context, fromBond []types.PayerInfo) error { - // for every reporter refund dispute fee to their bond - for _, recipient := range fromBond { - burn := recipient.Amount.MulRaw(1).QuoRaw(20) - recipient.Amount = recipient.Amount.Sub(burn) - if err := k.reporterKeeper.ReturnSlashedTokens(ctx, recipient.PayerAddress, recipient.BlockNumber, recipient.Amount); err != nil { - return err - } - } - return nil -} func (k Keeper) RewardReporterBondToFeePayers(ctx sdk.Context, feePayers []types.PayerInfo, reporterBond math.Int) error { totalFeesPaid := math.ZeroInt() for _, reporter := range feePayers { From 4ed2354f1035676fa1682bf7b37b69e6801d4ae7 Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 08:51:42 -0400 Subject: [PATCH 27/31] proto gen --- api/layer/dispute/dispute.pulsar.go | 615 +++---- api/layer/oracle/query_meta.pulsar.go | 2 +- docs/static/openapi.yml | 2256 +------------------------ x/dispute/types/dispute.pb.go | 182 +- x/oracle/types/query_meta.pb.go | 2 +- 5 files changed, 450 insertions(+), 2607 deletions(-) diff --git a/api/layer/dispute/dispute.pulsar.go b/api/layer/dispute/dispute.pulsar.go index dbf729f4d..f32f74640 100644 --- a/api/layer/dispute/dispute.pulsar.go +++ b/api/layer/dispute/dispute.pulsar.go @@ -115,42 +115,42 @@ func (x *_Dispute_15_list) IsValid() bool { } var ( - md_Dispute protoreflect.MessageDescriptor - fd_Dispute_hashId protoreflect.FieldDescriptor - fd_Dispute_disputeId protoreflect.FieldDescriptor - fd_Dispute_disputeCategory protoreflect.FieldDescriptor - fd_Dispute_disputeFee protoreflect.FieldDescriptor - fd_Dispute_disputeStatus protoreflect.FieldDescriptor - fd_Dispute_disputeStartTime protoreflect.FieldDescriptor - fd_Dispute_disputeEndTime protoreflect.FieldDescriptor - fd_Dispute_disputeStartBlock protoreflect.FieldDescriptor - fd_Dispute_disputeRound protoreflect.FieldDescriptor - fd_Dispute_slashAmount protoreflect.FieldDescriptor - fd_Dispute_burnAmount protoreflect.FieldDescriptor - fd_Dispute_reportEvidence protoreflect.FieldDescriptor - fd_Dispute_feePayers protoreflect.FieldDescriptor - fd_Dispute_feeTotal protoreflect.FieldDescriptor - fd_Dispute_prevDisputeIds protoreflect.FieldDescriptor + md_Dispute protoreflect.MessageDescriptor + fd_Dispute_hash_id protoreflect.FieldDescriptor + fd_Dispute_dispute_id protoreflect.FieldDescriptor + fd_Dispute_dispute_category protoreflect.FieldDescriptor + fd_Dispute_dispute_fee protoreflect.FieldDescriptor + fd_Dispute_dispute_status protoreflect.FieldDescriptor + fd_Dispute_dispute_start_time protoreflect.FieldDescriptor + fd_Dispute_dispute_end_time protoreflect.FieldDescriptor + fd_Dispute_dispute_start_block protoreflect.FieldDescriptor + fd_Dispute_dispute_round protoreflect.FieldDescriptor + fd_Dispute_slash_amount protoreflect.FieldDescriptor + fd_Dispute_burn_amount protoreflect.FieldDescriptor + fd_Dispute_report_evidence protoreflect.FieldDescriptor + fd_Dispute_fee_payers protoreflect.FieldDescriptor + fd_Dispute_fee_total protoreflect.FieldDescriptor + fd_Dispute_prev_dispute_ids protoreflect.FieldDescriptor ) func init() { file_layer_dispute_dispute_proto_init() md_Dispute = File_layer_dispute_dispute_proto.Messages().ByName("Dispute") - fd_Dispute_hashId = md_Dispute.Fields().ByName("hashId") - fd_Dispute_disputeId = md_Dispute.Fields().ByName("disputeId") - fd_Dispute_disputeCategory = md_Dispute.Fields().ByName("disputeCategory") - fd_Dispute_disputeFee = md_Dispute.Fields().ByName("disputeFee") - fd_Dispute_disputeStatus = md_Dispute.Fields().ByName("disputeStatus") - fd_Dispute_disputeStartTime = md_Dispute.Fields().ByName("disputeStartTime") - fd_Dispute_disputeEndTime = md_Dispute.Fields().ByName("disputeEndTime") - fd_Dispute_disputeStartBlock = md_Dispute.Fields().ByName("disputeStartBlock") - fd_Dispute_disputeRound = md_Dispute.Fields().ByName("disputeRound") - fd_Dispute_slashAmount = md_Dispute.Fields().ByName("slashAmount") - fd_Dispute_burnAmount = md_Dispute.Fields().ByName("burnAmount") - fd_Dispute_reportEvidence = md_Dispute.Fields().ByName("reportEvidence") - fd_Dispute_feePayers = md_Dispute.Fields().ByName("feePayers") - fd_Dispute_feeTotal = md_Dispute.Fields().ByName("feeTotal") - fd_Dispute_prevDisputeIds = md_Dispute.Fields().ByName("prevDisputeIds") + fd_Dispute_hash_id = md_Dispute.Fields().ByName("hash_id") + fd_Dispute_dispute_id = md_Dispute.Fields().ByName("dispute_id") + fd_Dispute_dispute_category = md_Dispute.Fields().ByName("dispute_category") + fd_Dispute_dispute_fee = md_Dispute.Fields().ByName("dispute_fee") + fd_Dispute_dispute_status = md_Dispute.Fields().ByName("dispute_status") + fd_Dispute_dispute_start_time = md_Dispute.Fields().ByName("dispute_start_time") + fd_Dispute_dispute_end_time = md_Dispute.Fields().ByName("dispute_end_time") + fd_Dispute_dispute_start_block = md_Dispute.Fields().ByName("dispute_start_block") + fd_Dispute_dispute_round = md_Dispute.Fields().ByName("dispute_round") + fd_Dispute_slash_amount = md_Dispute.Fields().ByName("slash_amount") + fd_Dispute_burn_amount = md_Dispute.Fields().ByName("burn_amount") + fd_Dispute_report_evidence = md_Dispute.Fields().ByName("report_evidence") + fd_Dispute_fee_payers = md_Dispute.Fields().ByName("fee_payers") + fd_Dispute_fee_total = md_Dispute.Fields().ByName("fee_total") + fd_Dispute_prev_dispute_ids = md_Dispute.Fields().ByName("prev_dispute_ids") } var _ protoreflect.Message = (*fastReflection_Dispute)(nil) @@ -220,91 +220,91 @@ func (x *fastReflection_Dispute) Interface() protoreflect.ProtoMessage { func (x *fastReflection_Dispute) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if len(x.HashId) != 0 { value := protoreflect.ValueOfBytes(x.HashId) - if !f(fd_Dispute_hashId, value) { + if !f(fd_Dispute_hash_id, value) { return } } if x.DisputeId != uint64(0) { value := protoreflect.ValueOfUint64(x.DisputeId) - if !f(fd_Dispute_disputeId, value) { + if !f(fd_Dispute_dispute_id, value) { return } } if x.DisputeCategory != 0 { value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.DisputeCategory)) - if !f(fd_Dispute_disputeCategory, value) { + if !f(fd_Dispute_dispute_category, value) { return } } if x.DisputeFee != "" { value := protoreflect.ValueOfString(x.DisputeFee) - if !f(fd_Dispute_disputeFee, value) { + if !f(fd_Dispute_dispute_fee, value) { return } } if x.DisputeStatus != 0 { value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.DisputeStatus)) - if !f(fd_Dispute_disputeStatus, value) { + if !f(fd_Dispute_dispute_status, value) { return } } if x.DisputeStartTime != nil { value := protoreflect.ValueOfMessage(x.DisputeStartTime.ProtoReflect()) - if !f(fd_Dispute_disputeStartTime, value) { + if !f(fd_Dispute_dispute_start_time, value) { return } } if x.DisputeEndTime != nil { value := protoreflect.ValueOfMessage(x.DisputeEndTime.ProtoReflect()) - if !f(fd_Dispute_disputeEndTime, value) { + if !f(fd_Dispute_dispute_end_time, value) { return } } if x.DisputeStartBlock != int64(0) { value := protoreflect.ValueOfInt64(x.DisputeStartBlock) - if !f(fd_Dispute_disputeStartBlock, value) { + if !f(fd_Dispute_dispute_start_block, value) { return } } if x.DisputeRound != uint64(0) { value := protoreflect.ValueOfUint64(x.DisputeRound) - if !f(fd_Dispute_disputeRound, value) { + if !f(fd_Dispute_dispute_round, value) { return } } if x.SlashAmount != "" { value := protoreflect.ValueOfString(x.SlashAmount) - if !f(fd_Dispute_slashAmount, value) { + if !f(fd_Dispute_slash_amount, value) { return } } if x.BurnAmount != "" { value := protoreflect.ValueOfString(x.BurnAmount) - if !f(fd_Dispute_burnAmount, value) { + if !f(fd_Dispute_burn_amount, value) { return } } if x.ReportEvidence != nil { value := protoreflect.ValueOfMessage(x.ReportEvidence.ProtoReflect()) - if !f(fd_Dispute_reportEvidence, value) { + if !f(fd_Dispute_report_evidence, value) { return } } if len(x.FeePayers) != 0 { value := protoreflect.ValueOfList(&_Dispute_13_list{list: &x.FeePayers}) - if !f(fd_Dispute_feePayers, value) { + if !f(fd_Dispute_fee_payers, value) { return } } if x.FeeTotal != "" { value := protoreflect.ValueOfString(x.FeeTotal) - if !f(fd_Dispute_feeTotal, value) { + if !f(fd_Dispute_fee_total, value) { return } } if len(x.PrevDisputeIds) != 0 { value := protoreflect.ValueOfList(&_Dispute_15_list{list: &x.PrevDisputeIds}) - if !f(fd_Dispute_prevDisputeIds, value) { + if !f(fd_Dispute_prev_dispute_ids, value) { return } } @@ -323,35 +323,35 @@ func (x *fastReflection_Dispute) Range(f func(protoreflect.FieldDescriptor, prot // a repeated field is populated if it is non-empty. func (x *fastReflection_Dispute) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.dispute.Dispute.hashId": + case "layer.dispute.Dispute.hash_id": return len(x.HashId) != 0 - case "layer.dispute.Dispute.disputeId": + case "layer.dispute.Dispute.dispute_id": return x.DisputeId != uint64(0) - case "layer.dispute.Dispute.disputeCategory": + case "layer.dispute.Dispute.dispute_category": return x.DisputeCategory != 0 - case "layer.dispute.Dispute.disputeFee": + case "layer.dispute.Dispute.dispute_fee": return x.DisputeFee != "" - case "layer.dispute.Dispute.disputeStatus": + case "layer.dispute.Dispute.dispute_status": return x.DisputeStatus != 0 - case "layer.dispute.Dispute.disputeStartTime": + case "layer.dispute.Dispute.dispute_start_time": return x.DisputeStartTime != nil - case "layer.dispute.Dispute.disputeEndTime": + case "layer.dispute.Dispute.dispute_end_time": return x.DisputeEndTime != nil - case "layer.dispute.Dispute.disputeStartBlock": + case "layer.dispute.Dispute.dispute_start_block": return x.DisputeStartBlock != int64(0) - case "layer.dispute.Dispute.disputeRound": + case "layer.dispute.Dispute.dispute_round": return x.DisputeRound != uint64(0) - case "layer.dispute.Dispute.slashAmount": + case "layer.dispute.Dispute.slash_amount": return x.SlashAmount != "" - case "layer.dispute.Dispute.burnAmount": + case "layer.dispute.Dispute.burn_amount": return x.BurnAmount != "" - case "layer.dispute.Dispute.reportEvidence": + case "layer.dispute.Dispute.report_evidence": return x.ReportEvidence != nil - case "layer.dispute.Dispute.feePayers": + case "layer.dispute.Dispute.fee_payers": return len(x.FeePayers) != 0 - case "layer.dispute.Dispute.feeTotal": + case "layer.dispute.Dispute.fee_total": return x.FeeTotal != "" - case "layer.dispute.Dispute.prevDisputeIds": + case "layer.dispute.Dispute.prev_dispute_ids": return len(x.PrevDisputeIds) != 0 default: if fd.IsExtension() { @@ -369,35 +369,35 @@ func (x *fastReflection_Dispute) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Dispute) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.dispute.Dispute.hashId": + case "layer.dispute.Dispute.hash_id": x.HashId = nil - case "layer.dispute.Dispute.disputeId": + case "layer.dispute.Dispute.dispute_id": x.DisputeId = uint64(0) - case "layer.dispute.Dispute.disputeCategory": + case "layer.dispute.Dispute.dispute_category": x.DisputeCategory = 0 - case "layer.dispute.Dispute.disputeFee": + case "layer.dispute.Dispute.dispute_fee": x.DisputeFee = "" - case "layer.dispute.Dispute.disputeStatus": + case "layer.dispute.Dispute.dispute_status": x.DisputeStatus = 0 - case "layer.dispute.Dispute.disputeStartTime": + case "layer.dispute.Dispute.dispute_start_time": x.DisputeStartTime = nil - case "layer.dispute.Dispute.disputeEndTime": + case "layer.dispute.Dispute.dispute_end_time": x.DisputeEndTime = nil - case "layer.dispute.Dispute.disputeStartBlock": + case "layer.dispute.Dispute.dispute_start_block": x.DisputeStartBlock = int64(0) - case "layer.dispute.Dispute.disputeRound": + case "layer.dispute.Dispute.dispute_round": x.DisputeRound = uint64(0) - case "layer.dispute.Dispute.slashAmount": + case "layer.dispute.Dispute.slash_amount": x.SlashAmount = "" - case "layer.dispute.Dispute.burnAmount": + case "layer.dispute.Dispute.burn_amount": x.BurnAmount = "" - case "layer.dispute.Dispute.reportEvidence": + case "layer.dispute.Dispute.report_evidence": x.ReportEvidence = nil - case "layer.dispute.Dispute.feePayers": + case "layer.dispute.Dispute.fee_payers": x.FeePayers = nil - case "layer.dispute.Dispute.feeTotal": + case "layer.dispute.Dispute.fee_total": x.FeeTotal = "" - case "layer.dispute.Dispute.prevDisputeIds": + case "layer.dispute.Dispute.prev_dispute_ids": x.PrevDisputeIds = nil default: if fd.IsExtension() { @@ -415,52 +415,52 @@ func (x *fastReflection_Dispute) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Dispute) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.dispute.Dispute.hashId": + case "layer.dispute.Dispute.hash_id": value := x.HashId return protoreflect.ValueOfBytes(value) - case "layer.dispute.Dispute.disputeId": + case "layer.dispute.Dispute.dispute_id": value := x.DisputeId return protoreflect.ValueOfUint64(value) - case "layer.dispute.Dispute.disputeCategory": + case "layer.dispute.Dispute.dispute_category": value := x.DisputeCategory return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - case "layer.dispute.Dispute.disputeFee": + case "layer.dispute.Dispute.dispute_fee": value := x.DisputeFee return protoreflect.ValueOfString(value) - case "layer.dispute.Dispute.disputeStatus": + case "layer.dispute.Dispute.dispute_status": value := x.DisputeStatus return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - case "layer.dispute.Dispute.disputeStartTime": + case "layer.dispute.Dispute.dispute_start_time": value := x.DisputeStartTime return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "layer.dispute.Dispute.disputeEndTime": + case "layer.dispute.Dispute.dispute_end_time": value := x.DisputeEndTime return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "layer.dispute.Dispute.disputeStartBlock": + case "layer.dispute.Dispute.dispute_start_block": value := x.DisputeStartBlock return protoreflect.ValueOfInt64(value) - case "layer.dispute.Dispute.disputeRound": + case "layer.dispute.Dispute.dispute_round": value := x.DisputeRound return protoreflect.ValueOfUint64(value) - case "layer.dispute.Dispute.slashAmount": + case "layer.dispute.Dispute.slash_amount": value := x.SlashAmount return protoreflect.ValueOfString(value) - case "layer.dispute.Dispute.burnAmount": + case "layer.dispute.Dispute.burn_amount": value := x.BurnAmount return protoreflect.ValueOfString(value) - case "layer.dispute.Dispute.reportEvidence": + case "layer.dispute.Dispute.report_evidence": value := x.ReportEvidence return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "layer.dispute.Dispute.feePayers": + case "layer.dispute.Dispute.fee_payers": if len(x.FeePayers) == 0 { return protoreflect.ValueOfList(&_Dispute_13_list{}) } listValue := &_Dispute_13_list{list: &x.FeePayers} return protoreflect.ValueOfList(listValue) - case "layer.dispute.Dispute.feeTotal": + case "layer.dispute.Dispute.fee_total": value := x.FeeTotal return protoreflect.ValueOfString(value) - case "layer.dispute.Dispute.prevDisputeIds": + case "layer.dispute.Dispute.prev_dispute_ids": if len(x.PrevDisputeIds) == 0 { return protoreflect.ValueOfList(&_Dispute_15_list{}) } @@ -486,37 +486,37 @@ func (x *fastReflection_Dispute) Get(descriptor protoreflect.FieldDescriptor) pr // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Dispute) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.dispute.Dispute.hashId": + case "layer.dispute.Dispute.hash_id": x.HashId = value.Bytes() - case "layer.dispute.Dispute.disputeId": + case "layer.dispute.Dispute.dispute_id": x.DisputeId = value.Uint() - case "layer.dispute.Dispute.disputeCategory": + case "layer.dispute.Dispute.dispute_category": x.DisputeCategory = (DisputeCategory)(value.Enum()) - case "layer.dispute.Dispute.disputeFee": + case "layer.dispute.Dispute.dispute_fee": x.DisputeFee = value.Interface().(string) - case "layer.dispute.Dispute.disputeStatus": + case "layer.dispute.Dispute.dispute_status": x.DisputeStatus = (DisputeStatus)(value.Enum()) - case "layer.dispute.Dispute.disputeStartTime": + case "layer.dispute.Dispute.dispute_start_time": x.DisputeStartTime = value.Message().Interface().(*timestamppb.Timestamp) - case "layer.dispute.Dispute.disputeEndTime": + case "layer.dispute.Dispute.dispute_end_time": x.DisputeEndTime = value.Message().Interface().(*timestamppb.Timestamp) - case "layer.dispute.Dispute.disputeStartBlock": + case "layer.dispute.Dispute.dispute_start_block": x.DisputeStartBlock = value.Int() - case "layer.dispute.Dispute.disputeRound": + case "layer.dispute.Dispute.dispute_round": x.DisputeRound = value.Uint() - case "layer.dispute.Dispute.slashAmount": + case "layer.dispute.Dispute.slash_amount": x.SlashAmount = value.Interface().(string) - case "layer.dispute.Dispute.burnAmount": + case "layer.dispute.Dispute.burn_amount": x.BurnAmount = value.Interface().(string) - case "layer.dispute.Dispute.reportEvidence": + case "layer.dispute.Dispute.report_evidence": x.ReportEvidence = value.Message().Interface().(*oracle.MicroReport) - case "layer.dispute.Dispute.feePayers": + case "layer.dispute.Dispute.fee_payers": lv := value.List() clv := lv.(*_Dispute_13_list) x.FeePayers = *clv.list - case "layer.dispute.Dispute.feeTotal": + case "layer.dispute.Dispute.fee_total": x.FeeTotal = value.Interface().(string) - case "layer.dispute.Dispute.prevDisputeIds": + case "layer.dispute.Dispute.prev_dispute_ids": lv := value.List() clv := lv.(*_Dispute_15_list) x.PrevDisputeIds = *clv.list @@ -540,53 +540,53 @@ func (x *fastReflection_Dispute) Set(fd protoreflect.FieldDescriptor, value prot // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Dispute) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.dispute.Dispute.disputeStartTime": + case "layer.dispute.Dispute.dispute_start_time": if x.DisputeStartTime == nil { x.DisputeStartTime = new(timestamppb.Timestamp) } return protoreflect.ValueOfMessage(x.DisputeStartTime.ProtoReflect()) - case "layer.dispute.Dispute.disputeEndTime": + case "layer.dispute.Dispute.dispute_end_time": if x.DisputeEndTime == nil { x.DisputeEndTime = new(timestamppb.Timestamp) } return protoreflect.ValueOfMessage(x.DisputeEndTime.ProtoReflect()) - case "layer.dispute.Dispute.reportEvidence": + case "layer.dispute.Dispute.report_evidence": if x.ReportEvidence == nil { x.ReportEvidence = new(oracle.MicroReport) } return protoreflect.ValueOfMessage(x.ReportEvidence.ProtoReflect()) - case "layer.dispute.Dispute.feePayers": + case "layer.dispute.Dispute.fee_payers": if x.FeePayers == nil { x.FeePayers = []*PayerInfo{} } value := &_Dispute_13_list{list: &x.FeePayers} return protoreflect.ValueOfList(value) - case "layer.dispute.Dispute.prevDisputeIds": + case "layer.dispute.Dispute.prev_dispute_ids": if x.PrevDisputeIds == nil { x.PrevDisputeIds = []uint64{} } value := &_Dispute_15_list{list: &x.PrevDisputeIds} return protoreflect.ValueOfList(value) - case "layer.dispute.Dispute.hashId": - panic(fmt.Errorf("field hashId of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.disputeId": - panic(fmt.Errorf("field disputeId of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.disputeCategory": - panic(fmt.Errorf("field disputeCategory of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.disputeFee": - panic(fmt.Errorf("field disputeFee of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.disputeStatus": - panic(fmt.Errorf("field disputeStatus of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.disputeStartBlock": - panic(fmt.Errorf("field disputeStartBlock of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.disputeRound": - panic(fmt.Errorf("field disputeRound of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.slashAmount": - panic(fmt.Errorf("field slashAmount of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.burnAmount": - panic(fmt.Errorf("field burnAmount of message layer.dispute.Dispute is not mutable")) - case "layer.dispute.Dispute.feeTotal": - panic(fmt.Errorf("field feeTotal of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.hash_id": + panic(fmt.Errorf("field hash_id of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.dispute_id": + panic(fmt.Errorf("field dispute_id of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.dispute_category": + panic(fmt.Errorf("field dispute_category of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.dispute_fee": + panic(fmt.Errorf("field dispute_fee of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.dispute_status": + panic(fmt.Errorf("field dispute_status of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.dispute_start_block": + panic(fmt.Errorf("field dispute_start_block of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.dispute_round": + panic(fmt.Errorf("field dispute_round of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.slash_amount": + panic(fmt.Errorf("field slash_amount of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.burn_amount": + panic(fmt.Errorf("field burn_amount of message layer.dispute.Dispute is not mutable")) + case "layer.dispute.Dispute.fee_total": + panic(fmt.Errorf("field fee_total of message layer.dispute.Dispute is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.dispute.Dispute")) @@ -600,39 +600,39 @@ func (x *fastReflection_Dispute) Mutable(fd protoreflect.FieldDescriptor) protor // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Dispute) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.dispute.Dispute.hashId": + case "layer.dispute.Dispute.hash_id": return protoreflect.ValueOfBytes(nil) - case "layer.dispute.Dispute.disputeId": + case "layer.dispute.Dispute.dispute_id": return protoreflect.ValueOfUint64(uint64(0)) - case "layer.dispute.Dispute.disputeCategory": + case "layer.dispute.Dispute.dispute_category": return protoreflect.ValueOfEnum(0) - case "layer.dispute.Dispute.disputeFee": + case "layer.dispute.Dispute.dispute_fee": return protoreflect.ValueOfString("") - case "layer.dispute.Dispute.disputeStatus": + case "layer.dispute.Dispute.dispute_status": return protoreflect.ValueOfEnum(0) - case "layer.dispute.Dispute.disputeStartTime": + case "layer.dispute.Dispute.dispute_start_time": m := new(timestamppb.Timestamp) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "layer.dispute.Dispute.disputeEndTime": + case "layer.dispute.Dispute.dispute_end_time": m := new(timestamppb.Timestamp) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "layer.dispute.Dispute.disputeStartBlock": + case "layer.dispute.Dispute.dispute_start_block": return protoreflect.ValueOfInt64(int64(0)) - case "layer.dispute.Dispute.disputeRound": + case "layer.dispute.Dispute.dispute_round": return protoreflect.ValueOfUint64(uint64(0)) - case "layer.dispute.Dispute.slashAmount": + case "layer.dispute.Dispute.slash_amount": return protoreflect.ValueOfString("") - case "layer.dispute.Dispute.burnAmount": + case "layer.dispute.Dispute.burn_amount": return protoreflect.ValueOfString("") - case "layer.dispute.Dispute.reportEvidence": + case "layer.dispute.Dispute.report_evidence": m := new(oracle.MicroReport) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "layer.dispute.Dispute.feePayers": + case "layer.dispute.Dispute.fee_payers": list := []*PayerInfo{} return protoreflect.ValueOfList(&_Dispute_13_list{list: &list}) - case "layer.dispute.Dispute.feeTotal": + case "layer.dispute.Dispute.fee_total": return protoreflect.ValueOfString("") - case "layer.dispute.Dispute.prevDisputeIds": + case "layer.dispute.Dispute.prev_dispute_ids": list := []uint64{} return protoreflect.ValueOfList(&_Dispute_15_list{list: &list}) default: @@ -1491,19 +1491,19 @@ func (x *fastReflection_Dispute) ProtoMethods() *protoiface.Methods { } var ( - md_PayerInfo protoreflect.MessageDescriptor - fd_PayerInfo_payerAddress protoreflect.FieldDescriptor - fd_PayerInfo_amount protoreflect.FieldDescriptor - fd_PayerInfo_fromBond protoreflect.FieldDescriptor - fd_PayerInfo_block_number protoreflect.FieldDescriptor + md_PayerInfo protoreflect.MessageDescriptor + fd_PayerInfo_payer_address protoreflect.FieldDescriptor + fd_PayerInfo_amount protoreflect.FieldDescriptor + fd_PayerInfo_from_bond protoreflect.FieldDescriptor + fd_PayerInfo_block_number protoreflect.FieldDescriptor ) func init() { file_layer_dispute_dispute_proto_init() md_PayerInfo = File_layer_dispute_dispute_proto.Messages().ByName("PayerInfo") - fd_PayerInfo_payerAddress = md_PayerInfo.Fields().ByName("payerAddress") + fd_PayerInfo_payer_address = md_PayerInfo.Fields().ByName("payer_address") fd_PayerInfo_amount = md_PayerInfo.Fields().ByName("amount") - fd_PayerInfo_fromBond = md_PayerInfo.Fields().ByName("fromBond") + fd_PayerInfo_from_bond = md_PayerInfo.Fields().ByName("from_bond") fd_PayerInfo_block_number = md_PayerInfo.Fields().ByName("block_number") } @@ -1574,7 +1574,7 @@ func (x *fastReflection_PayerInfo) Interface() protoreflect.ProtoMessage { func (x *fastReflection_PayerInfo) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.PayerAddress != "" { value := protoreflect.ValueOfString(x.PayerAddress) - if !f(fd_PayerInfo_payerAddress, value) { + if !f(fd_PayerInfo_payer_address, value) { return } } @@ -1586,7 +1586,7 @@ func (x *fastReflection_PayerInfo) Range(f func(protoreflect.FieldDescriptor, pr } if x.FromBond != false { value := protoreflect.ValueOfBool(x.FromBond) - if !f(fd_PayerInfo_fromBond, value) { + if !f(fd_PayerInfo_from_bond, value) { return } } @@ -1611,11 +1611,11 @@ func (x *fastReflection_PayerInfo) Range(f func(protoreflect.FieldDescriptor, pr // a repeated field is populated if it is non-empty. func (x *fastReflection_PayerInfo) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.dispute.PayerInfo.payerAddress": + case "layer.dispute.PayerInfo.payer_address": return x.PayerAddress != "" case "layer.dispute.PayerInfo.amount": return x.Amount != "" - case "layer.dispute.PayerInfo.fromBond": + case "layer.dispute.PayerInfo.from_bond": return x.FromBond != false case "layer.dispute.PayerInfo.block_number": return x.BlockNumber != int64(0) @@ -1635,11 +1635,11 @@ func (x *fastReflection_PayerInfo) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_PayerInfo) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.dispute.PayerInfo.payerAddress": + case "layer.dispute.PayerInfo.payer_address": x.PayerAddress = "" case "layer.dispute.PayerInfo.amount": x.Amount = "" - case "layer.dispute.PayerInfo.fromBond": + case "layer.dispute.PayerInfo.from_bond": x.FromBond = false case "layer.dispute.PayerInfo.block_number": x.BlockNumber = int64(0) @@ -1659,13 +1659,13 @@ func (x *fastReflection_PayerInfo) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_PayerInfo) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.dispute.PayerInfo.payerAddress": + case "layer.dispute.PayerInfo.payer_address": value := x.PayerAddress return protoreflect.ValueOfString(value) case "layer.dispute.PayerInfo.amount": value := x.Amount return protoreflect.ValueOfString(value) - case "layer.dispute.PayerInfo.fromBond": + case "layer.dispute.PayerInfo.from_bond": value := x.FromBond return protoreflect.ValueOfBool(value) case "layer.dispute.PayerInfo.block_number": @@ -1691,11 +1691,11 @@ func (x *fastReflection_PayerInfo) Get(descriptor protoreflect.FieldDescriptor) // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_PayerInfo) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.dispute.PayerInfo.payerAddress": + case "layer.dispute.PayerInfo.payer_address": x.PayerAddress = value.Interface().(string) case "layer.dispute.PayerInfo.amount": x.Amount = value.Interface().(string) - case "layer.dispute.PayerInfo.fromBond": + case "layer.dispute.PayerInfo.from_bond": x.FromBond = value.Bool() case "layer.dispute.PayerInfo.block_number": x.BlockNumber = value.Int() @@ -1719,12 +1719,12 @@ func (x *fastReflection_PayerInfo) Set(fd protoreflect.FieldDescriptor, value pr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_PayerInfo) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.dispute.PayerInfo.payerAddress": - panic(fmt.Errorf("field payerAddress of message layer.dispute.PayerInfo is not mutable")) + case "layer.dispute.PayerInfo.payer_address": + panic(fmt.Errorf("field payer_address of message layer.dispute.PayerInfo is not mutable")) case "layer.dispute.PayerInfo.amount": panic(fmt.Errorf("field amount of message layer.dispute.PayerInfo is not mutable")) - case "layer.dispute.PayerInfo.fromBond": - panic(fmt.Errorf("field fromBond of message layer.dispute.PayerInfo is not mutable")) + case "layer.dispute.PayerInfo.from_bond": + panic(fmt.Errorf("field from_bond of message layer.dispute.PayerInfo is not mutable")) case "layer.dispute.PayerInfo.block_number": panic(fmt.Errorf("field block_number of message layer.dispute.PayerInfo is not mutable")) default: @@ -1740,11 +1740,11 @@ func (x *fastReflection_PayerInfo) Mutable(fd protoreflect.FieldDescriptor) prot // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_PayerInfo) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.dispute.PayerInfo.payerAddress": + case "layer.dispute.PayerInfo.payer_address": return protoreflect.ValueOfString("") case "layer.dispute.PayerInfo.amount": return protoreflect.ValueOfString("") - case "layer.dispute.PayerInfo.fromBond": + case "layer.dispute.PayerInfo.from_bond": return protoreflect.ValueOfBool(false) case "layer.dispute.PayerInfo.block_number": return protoreflect.ValueOfInt64(int64(0)) @@ -2089,6 +2089,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// DisputeCategory defines the severity of a dispute. type DisputeCategory int32 const ( @@ -2145,6 +2146,7 @@ func (DisputeCategory) EnumDescriptor() ([]byte, []int) { return file_layer_dispute_dispute_proto_rawDescGZIP(), []int{0} } +// DisputeStatus defines the status of a dispute. type DisputeStatus int32 const ( @@ -2205,26 +2207,42 @@ func (DisputeStatus) EnumDescriptor() ([]byte, []int) { return file_layer_dispute_dispute_proto_rawDescGZIP(), []int{1} } +// Dispute defines a dispute. type Dispute struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - HashId []byte `protobuf:"bytes,1,opt,name=hashId,proto3" json:"hashId,omitempty"` - DisputeId uint64 `protobuf:"varint,2,opt,name=disputeId,proto3" json:"disputeId,omitempty"` - DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"disputeCategory,omitempty"` - DisputeFee string `protobuf:"bytes,4,opt,name=disputeFee,proto3" json:"disputeFee,omitempty"` - DisputeStatus DisputeStatus `protobuf:"varint,5,opt,name=disputeStatus,proto3,enum=layer.dispute.DisputeStatus" json:"disputeStatus,omitempty"` - DisputeStartTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=disputeStartTime,proto3" json:"disputeStartTime,omitempty"` - DisputeEndTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=disputeEndTime,proto3" json:"disputeEndTime,omitempty"` - DisputeStartBlock int64 `protobuf:"varint,8,opt,name=disputeStartBlock,proto3" json:"disputeStartBlock,omitempty"` - DisputeRound uint64 `protobuf:"varint,9,opt,name=disputeRound,proto3" json:"disputeRound,omitempty"` - SlashAmount string `protobuf:"bytes,10,opt,name=slashAmount,proto3" json:"slashAmount,omitempty"` - BurnAmount string `protobuf:"bytes,11,opt,name=burnAmount,proto3" json:"burnAmount,omitempty"` - ReportEvidence *oracle.MicroReport `protobuf:"bytes,12,opt,name=reportEvidence,proto3" json:"reportEvidence,omitempty"` - FeePayers []*PayerInfo `protobuf:"bytes,13,rep,name=feePayers,proto3" json:"feePayers,omitempty"` - FeeTotal string `protobuf:"bytes,14,opt,name=feeTotal,proto3" json:"feeTotal,omitempty"` - PrevDisputeIds []uint64 `protobuf:"varint,15,rep,packed,name=prevDisputeIds,proto3" json:"prevDisputeIds,omitempty"` + // unique dispute hash identifier + HashId []byte `protobuf:"bytes,1,opt,name=hash_id,json=hashId,proto3" json:"hash_id,omitempty"` + // current dispute id + DisputeId uint64 `protobuf:"varint,2,opt,name=dispute_id,json=disputeId,proto3" json:"dispute_id,omitempty"` + // dispute severity level + DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=dispute_category,json=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"dispute_category,omitempty"` + // cost to start dispute + DisputeFee string `protobuf:"bytes,4,opt,name=dispute_fee,json=disputeFee,proto3" json:"dispute_fee,omitempty"` + // current dispute status + DisputeStatus DisputeStatus `protobuf:"varint,5,opt,name=dispute_status,json=disputeStatus,proto3,enum=layer.dispute.DisputeStatus" json:"dispute_status,omitempty"` + // start time of the dispute that begins after dispute fee is fully paid + DisputeStartTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=dispute_start_time,json=disputeStartTime,proto3" json:"dispute_start_time,omitempty"` + // end time that the dispute stop taking votes and creating new rounds + DisputeEndTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=dispute_end_time,json=disputeEndTime,proto3" json:"dispute_end_time,omitempty"` + // height of the block that started the dispute + DisputeStartBlock int64 `protobuf:"varint,8,opt,name=dispute_start_block,json=disputeStartBlock,proto3" json:"dispute_start_block,omitempty"` + // current dispute round + DisputeRound uint64 `protobuf:"varint,9,opt,name=dispute_round,json=disputeRound,proto3" json:"dispute_round,omitempty"` + // reporter's slashed amount + SlashAmount string `protobuf:"bytes,10,opt,name=slash_amount,json=slashAmount,proto3" json:"slash_amount,omitempty"` + // burn amount that will be divided in half and paid to voters and the other half burned + BurnAmount string `protobuf:"bytes,11,opt,name=burn_amount,json=burnAmount,proto3" json:"burn_amount,omitempty"` + // single report evidence + ReportEvidence *oracle.MicroReport `protobuf:"bytes,12,opt,name=report_evidence,json=reportEvidence,proto3" json:"report_evidence,omitempty"` + // fee payers that were involved in paying the dispute fee in order to start the dispute + FeePayers []*PayerInfo `protobuf:"bytes,13,rep,name=fee_payers,json=feePayers,proto3" json:"fee_payers,omitempty"` + // total fee paid tracked to know if dispute fee is fully paid to start dispute + FeeTotal string `protobuf:"bytes,14,opt,name=fee_total,json=feeTotal,proto3" json:"fee_total,omitempty"` + // list of dispute ids that preceded before this current round began + PrevDisputeIds []uint64 `protobuf:"varint,15,rep,packed,name=prev_dispute_ids,json=prevDisputeIds,proto3" json:"prev_dispute_ids,omitempty"` } func (x *Dispute) Reset() { @@ -2352,15 +2370,23 @@ func (x *Dispute) GetPrevDisputeIds() []uint64 { return nil } +// PayerInfo defines the payer info of a dispute +// fee payer's info that was involved in paying the dispute fee in order to start the dispute type PayerInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` - FromBond bool `protobuf:"varint,3,opt,name=fromBond,proto3" json:"fromBond,omitempty"` - BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // fee payer's Account address + PayerAddress string `protobuf:"bytes,1,opt,name=payer_address,json=payerAddress,proto3" json:"payer_address,omitempty"` + // amount paid + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + // source of funds either from bond or free floating funds + FromBond bool `protobuf:"varint,3,opt,name=from_bond,json=fromBond,proto3" json:"from_bond,omitempty"` + // block number when this specific fee was paid + // keeping track of this in case the bond was used + // in order to reward the reporters' delegators in the future + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (x *PayerInfo) Reset() { @@ -2426,114 +2452,117 @@ var file_layer_dispute_dispute_proto_rawDesc = []byte{ 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xa0, 0x07, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, - 0x61, 0x73, 0x68, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, 0x73, - 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, - 0x64, 0x12, 0x48, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, - 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x64, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x0a, 0x64, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, - 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, - 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, - 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x64, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x50, 0x0a, 0x10, - 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4c, - 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x11, - 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x69, - 0x73, 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x4d, - 0x0a, 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, + 0xb3, 0x07, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x68, + 0x61, 0x73, 0x68, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x68, 0x61, + 0x73, 0x68, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, + 0x65, 0x49, 0x64, 0x12, 0x49, 0x0a, 0x10, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x63, + 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x64, + 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4c, + 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, - 0x52, 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4b, 0x0a, - 0x0a, 0x62, 0x75, 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, - 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, - 0x62, 0x75, 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0e, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x04, 0xc8, - 0xde, 0x1f, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x76, 0x69, 0x64, 0x65, - 0x6e, 0x63, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, 0x73, + 0x52, 0x0a, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x46, 0x65, 0x65, 0x12, 0x43, 0x0a, 0x0e, + 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, + 0x70, 0x75, 0x74, 0x65, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x52, 0x0a, 0x12, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, + 0xdf, 0x1f, 0x01, 0x52, 0x10, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4e, 0x0a, 0x10, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, + 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x45, 0x6e, + 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x11, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x64, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x4e, 0x0a, 0x0c, 0x73, 0x6c, + 0x61, 0x73, 0x68, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0b, 0x73, + 0x6c, 0x61, 0x73, 0x68, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x62, 0x75, + 0x72, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0a, 0x62, 0x75, + 0x72, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0f, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x5f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x04, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, + 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x2e, 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x66, 0x65, 0x65, 0x50, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x12, 0x47, 0x0a, 0x08, 0x66, 0x65, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x0e, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, - 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, - 0x52, 0x08, 0x66, 0x65, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x72, - 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, 0x64, 0x73, 0x18, 0x0f, 0x20, 0x03, - 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x49, - 0x64, 0x73, 0x22, 0xb3, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, + 0x73, 0x12, 0x48, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, - 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x6f, - 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x72, 0x6f, - 0x6d, 0x42, 0x6f, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0xc3, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x73, - 0x70, 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x31, 0x0a, 0x1c, - 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, - 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x0f, - 0x8a, 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, - 0x29, 0x0a, 0x18, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, - 0x4f, 0x52, 0x59, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0b, 0x8a, - 0x9d, 0x20, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, - 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, - 0x49, 0x4e, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x09, 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x69, 0x6e, 0x6f, - 0x72, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, - 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x10, 0x03, 0x1a, 0x09, 0x8a, - 0x9d, 0x20, 0x05, 0x4d, 0x61, 0x6a, 0x6f, 0x72, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x2a, 0xe6, - 0x01, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x27, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, - 0x55, 0x53, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x4f, 0x54, 0x45, 0x10, 0x00, 0x1a, 0x0b, 0x8a, 0x9d, - 0x20, 0x07, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, 0x53, - 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x4f, 0x54, 0x49, - 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, - 0x12, 0x29, 0x0a, 0x17, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, - 0x55, 0x53, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x02, 0x1a, 0x0c, 0x8a, - 0x9d, 0x20, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x19, 0x44, - 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, - 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x03, 0x1a, 0x0e, 0x8a, 0x9d, 0x20, 0x0a, - 0x55, 0x6e, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, - 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, - 0x4c, 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, - 0x64, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0xa4, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0c, 0x44, - 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, - 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, - 0x58, 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, - 0x65, 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, - 0x65, 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, - 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x08, 0x66, 0x65, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x10, 0x70, + 0x72, 0x65, 0x76, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, + 0x0f, 0x20, 0x03, 0x28, 0x04, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x76, 0x44, 0x69, 0x73, 0x70, 0x75, + 0x74, 0x65, 0x49, 0x64, 0x73, 0x22, 0xcf, 0x01, 0x0a, 0x09, 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x3d, 0x0a, 0x0d, 0x70, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 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, 0x0c, 0x70, 0x61, 0x79, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, + 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x5f, + 0x62, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, + 0x42, 0x6f, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0xc3, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x70, + 0x75, 0x74, 0x65, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x31, 0x0a, 0x1c, 0x44, + 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x1a, 0x0f, 0x8a, + 0x9d, 0x20, 0x0b, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x29, + 0x0a, 0x18, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, + 0x52, 0x59, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x1a, 0x0b, 0x8a, 0x9d, + 0x20, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, + 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x49, + 0x4e, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x09, 0x8a, 0x9d, 0x20, 0x05, 0x4d, 0x69, 0x6e, 0x6f, 0x72, + 0x12, 0x25, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x54, 0x45, + 0x47, 0x4f, 0x52, 0x59, 0x5f, 0x4d, 0x41, 0x4a, 0x4f, 0x52, 0x10, 0x03, 0x1a, 0x09, 0x8a, 0x9d, + 0x20, 0x05, 0x4d, 0x61, 0x6a, 0x6f, 0x72, 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x2a, 0xe6, 0x01, + 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x27, 0x0a, 0x16, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x50, 0x52, 0x45, 0x56, 0x4f, 0x54, 0x45, 0x10, 0x00, 0x1a, 0x0b, 0x8a, 0x9d, 0x20, + 0x07, 0x50, 0x72, 0x65, 0x76, 0x6f, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, 0x53, 0x50, + 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x56, 0x4f, 0x54, 0x49, 0x4e, + 0x47, 0x10, 0x01, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x56, 0x6f, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x29, 0x0a, 0x17, 0x44, 0x49, 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x02, 0x1a, 0x0c, 0x8a, 0x9d, + 0x20, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x2d, 0x0a, 0x19, 0x44, 0x49, + 0x53, 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x52, + 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x44, 0x10, 0x03, 0x1a, 0x0e, 0x8a, 0x9d, 0x20, 0x0a, 0x55, + 0x6e, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x25, 0x0a, 0x15, 0x44, 0x49, 0x53, + 0x50, 0x55, 0x54, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x46, 0x41, 0x49, 0x4c, + 0x45, 0x44, 0x10, 0x04, 0x1a, 0x0a, 0x8a, 0x9d, 0x20, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x1a, 0x04, 0x88, 0xa3, 0x1e, 0x00, 0x42, 0xa4, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x42, 0x0c, 0x44, 0x69, + 0x73, 0x70, 0x75, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, + 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x44, 0x58, + 0xaa, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0xca, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0xe2, 0x02, 0x19, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x44, 0x69, 0x73, 0x70, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2559,12 +2588,12 @@ var file_layer_dispute_dispute_proto_goTypes = []interface{}{ (*oracle.MicroReport)(nil), // 5: layer.oracle.MicroReport } var file_layer_dispute_dispute_proto_depIdxs = []int32{ - 0, // 0: layer.dispute.Dispute.disputeCategory:type_name -> layer.dispute.DisputeCategory - 1, // 1: layer.dispute.Dispute.disputeStatus:type_name -> layer.dispute.DisputeStatus - 4, // 2: layer.dispute.Dispute.disputeStartTime:type_name -> google.protobuf.Timestamp - 4, // 3: layer.dispute.Dispute.disputeEndTime:type_name -> google.protobuf.Timestamp - 5, // 4: layer.dispute.Dispute.reportEvidence:type_name -> layer.oracle.MicroReport - 3, // 5: layer.dispute.Dispute.feePayers:type_name -> layer.dispute.PayerInfo + 0, // 0: layer.dispute.Dispute.dispute_category:type_name -> layer.dispute.DisputeCategory + 1, // 1: layer.dispute.Dispute.dispute_status:type_name -> layer.dispute.DisputeStatus + 4, // 2: layer.dispute.Dispute.dispute_start_time:type_name -> google.protobuf.Timestamp + 4, // 3: layer.dispute.Dispute.dispute_end_time:type_name -> google.protobuf.Timestamp + 5, // 4: layer.dispute.Dispute.report_evidence:type_name -> layer.oracle.MicroReport + 3, // 5: layer.dispute.Dispute.fee_payers:type_name -> layer.dispute.PayerInfo 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 diff --git a/api/layer/oracle/query_meta.pulsar.go b/api/layer/oracle/query_meta.pulsar.go index 21d78549f..19a33eb5a 100644 --- a/api/layer/oracle/query_meta.pulsar.go +++ b/api/layer/oracle/query_meta.pulsar.go @@ -858,7 +858,7 @@ type QueryMeta struct { HasRevealedReports bool `protobuf:"varint,5,opt,name=has_revealed_reports,json=hasRevealedReports,proto3" json:"has_revealed_reports,omitempty"` // unique id of the query according to the data spec QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` - // sttring identifier of the data spec + // string identifier of the data spec QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` } diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 431250b2a..fe12e5295 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -638,1895 +638,6 @@ paths: type: string tags: - Query - /tellor-io/layer/reporter/commission/{reporter_address}: - get: - summary: ReporterCommission queries accumulated commission for a reporter. - operationId: LayerReporterReporterCommission - responses: - '200': - description: A successful response. - schema: - type: object - properties: - commission: - description: commission defines the commission the reporter received. - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - title: commission is the accumulated commission for the reporter - title: >- - ReporterAccumulatedCommission represents accumulated - commission for a reporter - title: |- - QueryReporterCommissionResponse is the response type for the - Query/ReporterCommission RPC method - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: reporter_address - description: reporter_address defines the reporter address to query for. - in: path - required: true - type: string - tags: - - Query - /tellor-io/layer/reporter/delegation-rewards/{delegator_address}/{reporter_address}: - get: - summary: DelegationRewards queries the total rewards accrued by a delegation. - operationId: LayerReporterDelegationRewards - responses: - '200': - description: A successful response. - schema: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - description: rewards defines the rewards accrued by a delegation. - description: |- - QueryDelegationRewardsResponse is the response type for the - Query/DelegationRewards RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - - name: reporter_address - description: reporter_address defines the reporter address to query for. - in: path - required: true - type: string - tags: - - Query - /tellor-io/layer/reporter/delegator-reporter/{delegator_address}: - get: - summary: DelegatorReporter queries the reporter of a delegator. - operationId: LayerReporterDelegatorReporter - responses: - '200': - description: A successful response. - schema: - type: object - properties: - reporter: - type: string - description: reporter defines the reporter of a delegator. - description: |- - QueryDelegatorReporterResponse is the response type for the - Query/DelegatorReporter RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: delegator_address - description: delegator_address defines the delegator address to query for. - in: path - required: true - type: string - tags: - - Query - /tellor-io/layer/reporter/outstanding-rewards/{reporter_address}: - get: - summary: ReporterOutstandingRewards queries rewards of a reporter address. - operationId: LayerReporterReporterOutstandingRewards - responses: - '200': - description: A successful response. - schema: - type: object - properties: - rewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a - decimal amount. - - - NOTE: The amount field is an Dec which implements the - custom method - - signatures required by gogoproto. - title: rewards is the outstanding rewards for the reporter - description: >- - ReporterOutstandingRewards represents outstanding - (un-withdrawn) rewards - - for a reporter inexpensive to track, allows simple sanity - checks. - description: >- - QueryReporterOutstandingRewardsResponse is the response type for - the - - Query/ReporterOutstandingRewards RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: reporter_address - description: reporter_address defines the reporter address to query for. - in: path - required: true - type: string - tags: - - Query - /tellor-io/layer/reporter/params: - get: - summary: Parameters queries the parameters of the module. - operationId: LayerReporterParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - min_commission_rate: - type: string - title: >- - min_commission_rate, adopted from staking module, is the - minimum commission rate a reporter can their delegators - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /tellor-io/layer/reporter/reporter-stake/{reporter_address}: - get: - summary: ReporterStake queries the total tokens of a reporter. - operationId: LayerReporterReporterStake - responses: - '200': - description: A successful response. - schema: - type: object - properties: - stake: - type: string - description: stake defines the total tokens of a reporter. - description: |- - QueryReporterStakeResponse is the response type for the - Query/ReporterStake RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: reporter_address - description: reporter_address defines the reporter address to query for. - in: path - required: true - type: string - tags: - - Query - /tellor-io/layer/reporter/reporters: - get: - summary: Reporters queries all the staked reporters. - operationId: LayerReporterReporters - responses: - '200': - description: A successful response. - schema: - type: object - properties: - reporters: - type: array - items: - type: object - properties: - reporter: - type: string - title: reporter is the address of the reporter - total_tokens: - type: string - title: tokens is the amount of tokens the reporter has - commission: - title: commission for the reporter - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission - rates to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to - delegators, as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate - which validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily - increase of the validator commission, as a - fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - description: >- - Commission defines commission parameters for a given - validator. - jailed: - type: boolean - title: jailed is a bool whether the reporter is jailed or not - jailed_until: - type: string - format: date-time - title: jailed_until is the time the reporter is jailed until - title: >- - OracleReporter is the struct that holds the data for a - reporter - description: all the reporters. - description: >- - QueryReportersResponse is the response type for the - Query/Reporters RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - tags: - - Query - /tellor-io/layer/reporter/{reporter_address}: - get: - summary: Reporter queries the reporter of a reporter address. - operationId: LayerReporterReporter - responses: - '200': - description: A successful response. - schema: - type: object - properties: - reporter: - type: object - properties: - reporter: - type: string - title: reporter is the address of the reporter - total_tokens: - type: string - title: tokens is the amount of tokens the reporter has - commission: - title: commission for the reporter - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates - to be used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, - as a fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase - of the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - description: >- - Commission defines commission parameters for a given - validator. - jailed: - type: boolean - title: jailed is a bool whether the reporter is jailed or not - jailed_until: - type: string - format: date-time - title: jailed_until is the time the reporter is jailed until - title: >- - OracleReporter is the struct that holds the data for a - reporter - description: >- - QueryReporterResponse is the response type for the Query/Reporter - RPC method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - description: >- - A URL/resource name that uniquely identifies the type of - the serialized - - protocol buffer message. This string must contain at - least - - one "/" character. The last segment of the URL's path - must represent - - the fully qualified name of the type (as in - - `path/google.protobuf.Duration`). The name should be in - a canonical form - - (e.g., leading "." is not accepted). - - - In practice, teams usually precompile into the binary - all types that they - - expect it to use in the context of Any. However, for - URLs which use the - - scheme `http`, `https`, or no scheme, one can optionally - set up a type - - server that maps type URLs to message definitions as - follows: - - - * If no scheme is provided, `https` is assumed. - - * An HTTP GET on the URL must yield a - [google.protobuf.Type][] - value in binary format, or produce an error. - * Applications are allowed to cache lookup results based - on the - URL, or have them precompiled into a binary to avoid any - lookup. Therefore, binary compatibility needs to be preserved - on changes to types. (Use versioned type names to manage - breaking changes.) - - Note: this functionality is not currently available in - the official - - protobuf release, and it is not used for type URLs - beginning with - - type.googleapis.com. As of May 2023, there are no widely - used type server - - implementations and no plans to implement one. - - - Schemes other than `http`, `https` (or the empty scheme) - might be - - used with implementation specific semantics. - additionalProperties: {} - description: >- - `Any` contains an arbitrary serialized protocol buffer - message along with a - - URL that describes the type of the serialized message. - - - Protobuf library provides support to pack/unpack Any values - in the form - - of utility functions or additional generated methods of the - Any type. - - - Example 1: Pack and unpack a message in C++. - - Foo foo = ...; - Any any; - any.PackFrom(foo); - ... - if (any.UnpackTo(&foo)) { - ... - } - - Example 2: Pack and unpack a message in Java. - - Foo foo = ...; - Any any = Any.pack(foo); - ... - if (any.is(Foo.class)) { - foo = any.unpack(Foo.class); - } - // or ... - if (any.isSameTypeAs(Foo.getDefaultInstance())) { - foo = any.unpack(Foo.getDefaultInstance()); - } - - Example 3: Pack and unpack a message in Python. - - foo = Foo(...) - any = Any() - any.Pack(foo) - ... - if any.Is(Foo.DESCRIPTOR): - any.Unpack(foo) - ... - - Example 4: Pack and unpack a message in Go - - foo := &pb.Foo{...} - any, err := anypb.New(foo) - if err != nil { - ... - } - ... - foo := &pb.Foo{} - if err := any.UnmarshalTo(foo); err != nil { - ... - } - - The pack methods provided by protobuf library will by - default use - - 'type.googleapis.com/full.type.name' as the type URL and the - unpack - - methods only use the fully qualified type name after the - last '/' - - in the type URL, for example "foo.bar.com/x/y.z" will yield - type - - name "y.z". - - - JSON - - ==== - - The JSON representation of an `Any` value uses the regular - - representation of the deserialized, embedded message, with - an - - additional field `@type` which contains the type URL. - Example: - - package google.profile; - message Person { - string first_name = 1; - string last_name = 2; - } - - { - "@type": "type.googleapis.com/google.profile.Person", - "firstName": , - "lastName": - } - - If the embedded message type is well-known and has a custom - JSON - - representation, that representation will be embedded adding - a field - - `value` which holds the custom JSON in addition to the - `@type` - - field. Example (for message [google.protobuf.Duration][]): - - { - "@type": "type.googleapis.com/google.protobuf.Duration", - "value": "1.212s" - } - parameters: - - name: reporter_address - description: reporter_address defines the reporter address to query for. - in: path - required: true - type: string - tags: - - Query definitions: cosmos.auth.v1beta1.MsgUpdateParamsResponse: type: object @@ -4569,7 +2680,9 @@ definitions: - DISPUTE_CATEGORY_MINOR - DISPUTE_CATEGORY_MAJOR default: DISPUTE_CATEGORY_UNSPECIFIED - description: |2- + description: |- + DisputeCategory defines the severity of a dispute. + - DISPUTE_CATEGORY_UNSPECIFIED: UNSPECIFIED defines an invalid dispute category. - DISPUTE_CATEGORY_WARNING: WARNING defines a 1 percent slashing. - DISPUTE_CATEGORY_MINOR: MINOR defines a 5 percent slashing. @@ -4623,6 +2736,23 @@ definitions: format: int64 title: block number of when the report was created title: MicroReport represents data for a single report + layer.oracle.MsgCommitReportResponse: + type: object + layer.oracle.MsgSubmitValueResponse: + type: object + layer.oracle.MsgTipResponse: + type: object + layer.oracle.MsgUpdateCyclelistResponse: + type: object + description: MsgUpdateCycleResponse defines the Msg/UpdateCycle response type. + layer.oracle.MsgUpdateParamsResponse: + type: object + layer.oracle.Params: + type: object + properties: + minStakeAmount: + type: string + description: Params defines the parameters for the module. layer.oracle.Aggregate: type: object properties: @@ -4667,12 +2797,6 @@ definitions: power: type: string format: int64 - layer.oracle.Params: - type: object - properties: - minStakeAmount: - type: string - description: Params defines the parameters for the module. layer.oracle.QueryCurrentCyclelistQueryResponse: type: object properties: @@ -4916,17 +3040,6 @@ definitions: type: string total: type: string - layer.oracle.MsgCommitReportResponse: - type: object - layer.oracle.MsgSubmitValueResponse: - type: object - layer.oracle.MsgTipResponse: - type: object - layer.oracle.MsgUpdateCyclelistResponse: - type: object - description: MsgUpdateCycleResponse defines the Msg/UpdateCycle response type. - layer.oracle.MsgUpdateParamsResponse: - type: object layer.registry.ABIComponent: type: object properties: @@ -5101,332 +3214,3 @@ definitions: amount is the amount of tokens to be delegated to a reporter from a delegation in staking title: TokenOrigin is a message to store the origin of a token - cosmos.base.v1beta1.DecCoin: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - layer.reporter.OracleReporter: - type: object - properties: - reporter: - type: string - title: reporter is the address of the reporter - total_tokens: - type: string - title: tokens is the amount of tokens the reporter has - commission: - title: commission for the reporter - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be used - for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which validator - can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - description: Commission defines commission parameters for a given validator. - jailed: - type: boolean - title: jailed is a bool whether the reporter is jailed or not - jailed_until: - type: string - format: date-time - title: jailed_until is the time the reporter is jailed until - title: OracleReporter is the struct that holds the data for a reporter - layer.reporter.QueryDelegationRewardsResponse: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - description: rewards defines the rewards accrued by a delegation. - description: |- - QueryDelegationRewardsResponse is the response type for the - Query/DelegationRewards RPC method. - layer.reporter.QueryDelegatorReporterResponse: - type: object - properties: - reporter: - type: string - description: reporter defines the reporter of a delegator. - description: |- - QueryDelegatorReporterResponse is the response type for the - Query/DelegatorReporter RPC method. - layer.reporter.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - min_commission_rate: - type: string - title: >- - min_commission_rate, adopted from staking module, is the minimum - commission rate a reporter can their delegators - description: QueryParamsResponse is response type for the Query/Params RPC method. - layer.reporter.QueryReporterCommissionResponse: - type: object - properties: - commission: - description: commission defines the commission the reporter received. - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - title: commission is the accumulated commission for the reporter - title: >- - ReporterAccumulatedCommission represents accumulated commission for a - reporter - title: |- - QueryReporterCommissionResponse is the response type for the - Query/ReporterCommission RPC method - layer.reporter.QueryReporterOutstandingRewardsResponse: - type: object - properties: - rewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - DecCoin defines a token with a denomination and a decimal - amount. - - - NOTE: The amount field is an Dec which implements the custom - method - - signatures required by gogoproto. - title: rewards is the outstanding rewards for the reporter - description: >- - ReporterOutstandingRewards represents outstanding (un-withdrawn) - rewards - - for a reporter inexpensive to track, allows simple sanity checks. - description: |- - QueryReporterOutstandingRewardsResponse is the response type for the - Query/ReporterOutstandingRewards RPC method. - layer.reporter.QueryReporterResponse: - type: object - properties: - reporter: - type: object - properties: - reporter: - type: string - title: reporter is the address of the reporter - total_tokens: - type: string - title: tokens is the amount of tokens the reporter has - commission: - title: commission for the reporter - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of the - validator commission, as a fraction. - update_time: - type: string - format: date-time - description: update_time is the last time the commission rate was changed. - description: Commission defines commission parameters for a given validator. - jailed: - type: boolean - title: jailed is a bool whether the reporter is jailed or not - jailed_until: - type: string - format: date-time - title: jailed_until is the time the reporter is jailed until - title: OracleReporter is the struct that holds the data for a reporter - description: >- - QueryReporterResponse is the response type for the Query/Reporter RPC - method. - layer.reporter.QueryReporterStakeResponse: - type: object - properties: - stake: - type: string - description: stake defines the total tokens of a reporter. - description: |- - QueryReporterStakeResponse is the response type for the - Query/ReporterStake RPC method. - layer.reporter.QueryReportersResponse: - type: object - properties: - reporters: - type: array - items: - type: object - properties: - reporter: - type: string - title: reporter is the address of the reporter - total_tokens: - type: string - title: tokens is the amount of tokens the reporter has - commission: - title: commission for the reporter - type: object - properties: - commission_rates: - description: >- - commission_rates defines the initial commission rates to be - used for creating a validator. - type: object - properties: - rate: - type: string - description: >- - rate is the commission rate charged to delegators, as a - fraction. - max_rate: - type: string - description: >- - max_rate defines the maximum commission rate which - validator can ever charge, as a fraction. - max_change_rate: - type: string - description: >- - max_change_rate defines the maximum daily increase of - the validator commission, as a fraction. - update_time: - type: string - format: date-time - description: >- - update_time is the last time the commission rate was - changed. - description: Commission defines commission parameters for a given validator. - jailed: - type: boolean - title: jailed is a bool whether the reporter is jailed or not - jailed_until: - type: string - format: date-time - title: jailed_until is the time the reporter is jailed until - title: OracleReporter is the struct that holds the data for a reporter - description: all the reporters. - description: >- - QueryReportersResponse is the response type for the Query/Reporters RPC - method. - layer.reporter.ReporterAccumulatedCommission: - type: object - properties: - commission: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - title: commission is the accumulated commission for the reporter - title: >- - ReporterAccumulatedCommission represents accumulated commission for a - reporter - layer.reporter.ReporterOutstandingRewards: - type: object - properties: - rewards: - type: array - items: - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - DecCoin defines a token with a denomination and a decimal amount. - - NOTE: The amount field is an Dec which implements the custom method - signatures required by gogoproto. - title: rewards is the outstanding rewards for the reporter - description: |- - ReporterOutstandingRewards represents outstanding (un-withdrawn) rewards - for a reporter inexpensive to track, allows simple sanity checks. diff --git a/x/dispute/types/dispute.pb.go b/x/dispute/types/dispute.pb.go index d35aa2c13..d015e5373 100644 --- a/x/dispute/types/dispute.pb.go +++ b/x/dispute/types/dispute.pb.go @@ -31,6 +31,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// DisputeCategory defines the severity of a dispute. type DisputeCategory int32 const ( @@ -66,6 +67,7 @@ func (DisputeCategory) EnumDescriptor() ([]byte, []int) { return fileDescriptor_2a5d4b70d69c78b5, []int{0} } +// DisputeStatus defines the status of a dispute. type DisputeStatus int32 const ( @@ -105,22 +107,38 @@ func (DisputeStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_2a5d4b70d69c78b5, []int{1} } +// Dispute defines a dispute. type Dispute struct { - HashId []byte `protobuf:"bytes,1,opt,name=hashId,proto3" json:"hashId,omitempty"` - DisputeId uint64 `protobuf:"varint,2,opt,name=disputeId,proto3" json:"disputeId,omitempty"` - DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"disputeCategory,omitempty"` - DisputeFee cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=disputeFee,proto3,customtype=cosmossdk.io/math.Int" json:"disputeFee"` - DisputeStatus DisputeStatus `protobuf:"varint,5,opt,name=disputeStatus,proto3,enum=layer.dispute.DisputeStatus" json:"disputeStatus,omitempty"` - DisputeStartTime time.Time `protobuf:"bytes,6,opt,name=disputeStartTime,proto3,stdtime" json:"disputeStartTime"` - DisputeEndTime time.Time `protobuf:"bytes,7,opt,name=disputeEndTime,proto3,stdtime" json:"disputeEndTime"` - DisputeStartBlock int64 `protobuf:"varint,8,opt,name=disputeStartBlock,proto3" json:"disputeStartBlock,omitempty"` - DisputeRound uint64 `protobuf:"varint,9,opt,name=disputeRound,proto3" json:"disputeRound,omitempty"` - SlashAmount cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=slashAmount,proto3,customtype=cosmossdk.io/math.Int" json:"slashAmount"` - BurnAmount cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=burnAmount,proto3,customtype=cosmossdk.io/math.Int" json:"burnAmount"` - ReportEvidence types.MicroReport `protobuf:"bytes,12,opt,name=reportEvidence,proto3" json:"reportEvidence"` - FeePayers []PayerInfo `protobuf:"bytes,13,rep,name=feePayers,proto3" json:"feePayers"` - FeeTotal cosmossdk_io_math.Int `protobuf:"bytes,14,opt,name=feeTotal,proto3,customtype=cosmossdk.io/math.Int" json:"feeTotal"` - PrevDisputeIds []uint64 `protobuf:"varint,15,rep,packed,name=prevDisputeIds,proto3" json:"prevDisputeIds,omitempty"` + // unique dispute hash identifier + HashId []byte `protobuf:"bytes,1,opt,name=hash_id,json=hashId,proto3" json:"hash_id,omitempty"` + // current dispute id + DisputeId uint64 `protobuf:"varint,2,opt,name=dispute_id,json=disputeId,proto3" json:"dispute_id,omitempty"` + // dispute severity level + DisputeCategory DisputeCategory `protobuf:"varint,3,opt,name=dispute_category,json=disputeCategory,proto3,enum=layer.dispute.DisputeCategory" json:"dispute_category,omitempty"` + // cost to start dispute + DisputeFee cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=dispute_fee,json=disputeFee,proto3,customtype=cosmossdk.io/math.Int" json:"dispute_fee"` + // current dispute status + DisputeStatus DisputeStatus `protobuf:"varint,5,opt,name=dispute_status,json=disputeStatus,proto3,enum=layer.dispute.DisputeStatus" json:"dispute_status,omitempty"` + // start time of the dispute that begins after dispute fee is fully paid + DisputeStartTime time.Time `protobuf:"bytes,6,opt,name=dispute_start_time,json=disputeStartTime,proto3,stdtime" json:"dispute_start_time"` + // end time that the dispute stop taking votes and creating new rounds + DisputeEndTime time.Time `protobuf:"bytes,7,opt,name=dispute_end_time,json=disputeEndTime,proto3,stdtime" json:"dispute_end_time"` + // height of the block that started the dispute + DisputeStartBlock int64 `protobuf:"varint,8,opt,name=dispute_start_block,json=disputeStartBlock,proto3" json:"dispute_start_block,omitempty"` + // current dispute round + DisputeRound uint64 `protobuf:"varint,9,opt,name=dispute_round,json=disputeRound,proto3" json:"dispute_round,omitempty"` + // reporter's slashed amount + SlashAmount cosmossdk_io_math.Int `protobuf:"bytes,10,opt,name=slash_amount,json=slashAmount,proto3,customtype=cosmossdk.io/math.Int" json:"slash_amount"` + // burn amount that will be divided in half and paid to voters and the other half burned + BurnAmount cosmossdk_io_math.Int `protobuf:"bytes,11,opt,name=burn_amount,json=burnAmount,proto3,customtype=cosmossdk.io/math.Int" json:"burn_amount"` + // single report evidence + ReportEvidence types.MicroReport `protobuf:"bytes,12,opt,name=report_evidence,json=reportEvidence,proto3" json:"report_evidence"` + // fee payers that were involved in paying the dispute fee in order to start the dispute + FeePayers []PayerInfo `protobuf:"bytes,13,rep,name=fee_payers,json=feePayers,proto3" json:"fee_payers"` + // total fee paid tracked to know if dispute fee is fully paid to start dispute + FeeTotal cosmossdk_io_math.Int `protobuf:"bytes,14,opt,name=fee_total,json=feeTotal,proto3,customtype=cosmossdk.io/math.Int" json:"fee_total"` + // list of dispute ids that preceded before this current round began + PrevDisputeIds []uint64 `protobuf:"varint,15,rep,packed,name=prev_dispute_ids,json=prevDisputeIds,proto3" json:"prev_dispute_ids,omitempty"` } func (m *Dispute) Reset() { *m = Dispute{} } @@ -233,11 +251,19 @@ func (m *Dispute) GetPrevDisputeIds() []uint64 { return nil } +// PayerInfo defines the payer info of a dispute +// fee payer's info that was involved in paying the dispute fee in order to start the dispute type PayerInfo struct { - PayerAddress string `protobuf:"bytes,1,opt,name=payerAddress,proto3" json:"payerAddress,omitempty"` - Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` - FromBond bool `protobuf:"varint,3,opt,name=fromBond,proto3" json:"fromBond,omitempty"` - BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` + // fee payer's Account address + PayerAddress string `protobuf:"bytes,1,opt,name=payer_address,json=payerAddress,proto3" json:"payer_address,omitempty"` + // amount paid + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + // source of funds either from bond or free floating funds + FromBond bool `protobuf:"varint,3,opt,name=from_bond,json=fromBond,proto3" json:"from_bond,omitempty"` + // block number when this specific fee was paid + // keeping track of this in case the bond was used + // in order to reward the reporters' delegators in the future + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (m *PayerInfo) Reset() { *m = PayerInfo{} } @@ -304,63 +330,67 @@ func init() { func init() { proto.RegisterFile("layer/dispute/dispute.proto", fileDescriptor_2a5d4b70d69c78b5) } var fileDescriptor_2a5d4b70d69c78b5 = []byte{ - // 889 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6e, 0xe2, 0x46, - 0x1c, 0xc6, 0x81, 0x25, 0x30, 0x10, 0x42, 0x47, 0xdd, 0xad, 0xe3, 0x46, 0x8e, 0x1b, 0x69, 0x5b, - 0x36, 0x6d, 0x6c, 0x25, 0xbd, 0xf6, 0x02, 0xc1, 0x49, 0xdd, 0x26, 0x80, 0x06, 0x93, 0x55, 0x7b, - 0x41, 0x06, 0x0f, 0xe0, 0xae, 0xed, 0x41, 0xe3, 0x01, 0x35, 0x6f, 0x50, 0x71, 0xda, 0x17, 0x40, - 0xaa, 0xd4, 0x47, 0x68, 0xdf, 0xa0, 0x97, 0x3d, 0xae, 0x7a, 0xaa, 0x7a, 0xd8, 0x56, 0x89, 0xd4, - 0xe7, 0xa8, 0xec, 0x31, 0x10, 0xcc, 0x5e, 0xe8, 0x09, 0x7e, 0xdf, 0xef, 0xfb, 0xc6, 0xdf, 0xfc, - 0xfe, 0xd8, 0xe0, 0x63, 0xd7, 0xba, 0xc3, 0x54, 0xb3, 0x9d, 0x60, 0x3c, 0x61, 0x78, 0xf1, 0xab, - 0x8e, 0x29, 0x61, 0x04, 0xee, 0x45, 0x49, 0x35, 0x06, 0x25, 0xb9, 0x4f, 0x02, 0x8f, 0x04, 0x5a, - 0xcf, 0x0a, 0xb0, 0x36, 0x3d, 0xeb, 0x61, 0x66, 0x9d, 0x69, 0x7d, 0xe2, 0xf8, 0x9c, 0x2e, 0x1d, - 0xf0, 0x7c, 0x37, 0x8a, 0x34, 0x1e, 0xc4, 0xa9, 0x0f, 0x87, 0x64, 0x48, 0x38, 0x1e, 0xfe, 0x8b, - 0xd1, 0xa3, 0x21, 0x21, 0x43, 0x17, 0x6b, 0x51, 0xd4, 0x9b, 0x0c, 0x34, 0xe6, 0x78, 0x38, 0x60, - 0x96, 0x37, 0x5e, 0x10, 0xb8, 0x3b, 0x42, 0xad, 0xbe, 0x8b, 0x35, 0xcf, 0xe9, 0x53, 0xd2, 0xa5, - 0x78, 0x4c, 0x28, 0xe3, 0x84, 0xe3, 0x9f, 0x77, 0xc1, 0x6e, 0x9d, 0xdb, 0x83, 0xcf, 0x40, 0x76, - 0x64, 0x05, 0x23, 0xc3, 0x16, 0x05, 0x45, 0xa8, 0x14, 0x51, 0x1c, 0xc1, 0x43, 0x90, 0x8f, 0x6f, - 0x60, 0xd8, 0xe2, 0x8e, 0x22, 0x54, 0x32, 0x68, 0x05, 0xc0, 0xaf, 0xc1, 0x7e, 0x1c, 0x5c, 0x58, - 0x0c, 0x0f, 0x09, 0xbd, 0x13, 0xd3, 0x8a, 0x50, 0x29, 0x9d, 0xcb, 0xea, 0xda, 0xed, 0xd5, 0xfa, - 0x3a, 0x0b, 0x25, 0x65, 0xf0, 0x5b, 0x00, 0x62, 0xe8, 0x12, 0x63, 0x31, 0xa3, 0x08, 0x95, 0x7c, - 0xed, 0xf3, 0x37, 0xef, 0x8e, 0x52, 0x7f, 0xbd, 0x3b, 0x7a, 0xca, 0xab, 0x11, 0xd8, 0xaf, 0x54, - 0x87, 0x68, 0x9e, 0xc5, 0x46, 0xaa, 0xe1, 0xb3, 0x3f, 0x7e, 0x3b, 0x05, 0x71, 0x99, 0x0c, 0x9f, - 0xa1, 0x47, 0x72, 0x58, 0x03, 0x7b, 0x71, 0xd4, 0x66, 0x16, 0x9b, 0x04, 0xe2, 0x93, 0xc8, 0xd4, - 0xe1, 0xfb, 0x4d, 0x71, 0x0e, 0x5a, 0x97, 0xc0, 0x16, 0x28, 0xaf, 0x00, 0xca, 0x4c, 0xc7, 0xc3, - 0x62, 0x56, 0x11, 0x2a, 0x85, 0x73, 0x49, 0xe5, 0x95, 0x57, 0x17, 0x95, 0x57, 0xcd, 0x45, 0xe5, - 0x6b, 0xb9, 0xd0, 0xf2, 0xeb, 0xbf, 0x8f, 0x04, 0xb4, 0xa1, 0x86, 0xd7, 0xa0, 0x14, 0x63, 0xba, - 0x6f, 0x47, 0xe7, 0xed, 0x6e, 0x71, 0x5e, 0x42, 0x0b, 0xbf, 0x00, 0x1f, 0x3c, 0x7e, 0x42, 0xcd, - 0x25, 0xfd, 0x57, 0x62, 0x4e, 0x11, 0x2a, 0x69, 0xb4, 0x99, 0x80, 0xc7, 0xa0, 0x18, 0x83, 0x88, - 0x4c, 0x7c, 0x5b, 0xcc, 0x47, 0x9d, 0x5c, 0xc3, 0xe0, 0x0d, 0x28, 0x04, 0xae, 0x15, 0x8c, 0xaa, - 0x1e, 0x99, 0xf8, 0x4c, 0x04, 0xdb, 0xf7, 0xe0, 0xb1, 0x3e, 0xec, 0x68, 0x6f, 0x42, 0xfd, 0xf8, - 0xb4, 0xc2, 0xff, 0xe8, 0xe8, 0x4a, 0x0e, 0xaf, 0x40, 0x89, 0x8f, 0xae, 0x3e, 0x75, 0x6c, 0xec, - 0xf7, 0xb1, 0x58, 0x8c, 0x6a, 0x77, 0x10, 0xb7, 0x94, 0x0f, 0xb9, 0x7a, 0x13, 0x0e, 0x39, 0x8a, - 0x88, 0xb5, 0x4c, 0xf8, 0x2c, 0x94, 0x90, 0xc1, 0xaf, 0x40, 0x7e, 0x80, 0x71, 0x2b, 0x14, 0x05, - 0xe2, 0x9e, 0x92, 0xae, 0x14, 0xce, 0xc5, 0xc4, 0x58, 0x44, 0x49, 0xc3, 0x1f, 0x90, 0xf8, 0x88, - 0x95, 0x00, 0x5e, 0x81, 0xdc, 0x00, 0x63, 0x93, 0x30, 0xcb, 0x15, 0x4b, 0xdb, 0xdf, 0x68, 0x29, - 0x86, 0x9f, 0x82, 0xd2, 0x98, 0xe2, 0x69, 0x7d, 0xb1, 0x49, 0x81, 0xb8, 0xaf, 0xa4, 0x2b, 0x19, - 0x94, 0x40, 0x8f, 0x7f, 0x15, 0x40, 0x7e, 0xe9, 0x27, 0xec, 0xe2, 0x38, 0x0c, 0xaa, 0xb6, 0x4d, - 0x71, 0x10, 0x44, 0xab, 0x9a, 0x47, 0x6b, 0x18, 0xbc, 0x00, 0x59, 0x8b, 0x97, 0x7c, 0x67, 0x7b, - 0x83, 0xb1, 0x14, 0x4a, 0x20, 0x37, 0xa0, 0xc4, 0xab, 0x11, 0xdf, 0x8e, 0x16, 0x3a, 0x87, 0x96, - 0x31, 0xfc, 0x04, 0x14, 0x7b, 0xe1, 0x4c, 0x75, 0xfd, 0x89, 0xd7, 0xc3, 0x34, 0xda, 0xd5, 0x34, - 0x2a, 0x44, 0x58, 0x23, 0x82, 0x4e, 0x7e, 0x17, 0xc0, 0x7e, 0x62, 0xe3, 0xe1, 0x19, 0x38, 0xac, - 0x1b, 0xed, 0x56, 0xc7, 0xd4, 0xbb, 0x17, 0x55, 0x53, 0xbf, 0x6a, 0xa2, 0xef, 0xba, 0x9d, 0x46, - 0xbb, 0xa5, 0x5f, 0x18, 0x97, 0x86, 0x5e, 0x2f, 0xa7, 0xa4, 0xfd, 0xd9, 0x5c, 0x29, 0x74, 0xfc, - 0x60, 0x8c, 0xfb, 0xce, 0xc0, 0xc1, 0x36, 0x7c, 0x01, 0xc4, 0x0d, 0xc9, 0xcb, 0x2a, 0x6a, 0x18, - 0x8d, 0xab, 0xb2, 0x20, 0x15, 0x66, 0x73, 0x65, 0xf7, 0xa5, 0x45, 0x7d, 0xc7, 0x1f, 0xc2, 0xe7, - 0xe0, 0xd9, 0x06, 0xf5, 0xc6, 0x68, 0x34, 0x51, 0x79, 0x47, 0xca, 0xcf, 0xe6, 0xca, 0x93, 0x1b, - 0xc7, 0x27, 0xf4, 0xfd, 0xb4, 0xea, 0x37, 0x4d, 0x54, 0x4e, 0xc7, 0x34, 0xeb, 0x07, 0x42, 0xa5, - 0xcc, 0x4f, 0xbf, 0xc8, 0xa9, 0x93, 0x7f, 0x05, 0xb0, 0xb7, 0xf6, 0x8a, 0x80, 0x9f, 0xad, 0xe4, - 0x6d, 0xb3, 0x6a, 0x76, 0xda, 0xdd, 0x16, 0xd2, 0x6f, 0x9b, 0xa6, 0x5e, 0x4e, 0x71, 0x3b, 0x2d, - 0x8a, 0xa7, 0x84, 0x61, 0xf8, 0x1c, 0x3c, 0x4d, 0x10, 0x6f, 0x9b, 0x26, 0xb7, 0x0d, 0x66, 0x73, - 0x25, 0x7b, 0x4b, 0x58, 0xe8, 0xfa, 0x05, 0xf8, 0x28, 0x41, 0x43, 0x7a, 0xbb, 0x79, 0x7d, 0xab, - 0xd7, 0xcb, 0x3b, 0x52, 0x71, 0x36, 0x57, 0x72, 0x08, 0x07, 0xc4, 0x9d, 0x62, 0x1b, 0x9e, 0x82, - 0x83, 0x04, 0xb5, 0xd3, 0x58, 0x92, 0xd3, 0x52, 0x69, 0x36, 0x57, 0x40, 0xc7, 0xa7, 0x0b, 0xfa, - 0xa6, 0x81, 0xcb, 0xaa, 0x71, 0xad, 0xd7, 0xcb, 0x19, 0x6e, 0xe0, 0xd2, 0x72, 0x5c, 0x6c, 0xf3, - 0x8b, 0xd6, 0xea, 0x6f, 0xee, 0x65, 0xe1, 0xed, 0xbd, 0x2c, 0xfc, 0x73, 0x2f, 0x0b, 0xaf, 0x1f, - 0xe4, 0xd4, 0xdb, 0x07, 0x39, 0xf5, 0xe7, 0x83, 0x9c, 0xfa, 0xfe, 0x64, 0xe8, 0xb0, 0xd1, 0xa4, - 0xa7, 0xf6, 0x89, 0xa7, 0x31, 0xec, 0xba, 0x84, 0x9e, 0x3a, 0x44, 0xe3, 0xdf, 0x95, 0x1f, 0x97, - 0xdf, 0x3d, 0x76, 0x37, 0xc6, 0x41, 0x2f, 0x1b, 0xbd, 0xbe, 0xbe, 0xfc, 0x2f, 0x00, 0x00, 0xff, - 0xff, 0x1d, 0xf1, 0x07, 0x1f, 0x15, 0x07, 0x00, 0x00, + // 959 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0xdb, 0x46, + 0x14, 0x15, 0x2d, 0xc5, 0x96, 0x46, 0x2f, 0x76, 0x9a, 0x34, 0xb4, 0x92, 0xca, 0x6c, 0x8a, 0xa0, + 0x8a, 0x0b, 0x93, 0xb0, 0xbb, 0xce, 0x42, 0x0f, 0x3a, 0x61, 0x61, 0x4b, 0xc2, 0x48, 0x72, 0xd0, + 0x6e, 0x08, 0x4a, 0x1c, 0xc9, 0x6c, 0x28, 0x8e, 0x30, 0x1c, 0x09, 0xf5, 0x1f, 0x14, 0x5a, 0xe5, + 0x07, 0xb4, 0xea, 0x27, 0x34, 0x7f, 0xd0, 0x4d, 0x76, 0x0d, 0xb2, 0x2a, 0xba, 0x48, 0x0b, 0x1b, + 0xe8, 0x77, 0x14, 0x33, 0x43, 0xfa, 0x21, 0x67, 0xe3, 0xae, 0xa4, 0x7b, 0xee, 0xb9, 0x67, 0xce, + 0xcc, 0xbd, 0x33, 0x04, 0x8f, 0x02, 0xf7, 0x0c, 0x53, 0xd3, 0xf3, 0xa3, 0xd9, 0x9c, 0xe1, 0xe4, + 0xd7, 0x98, 0x51, 0xc2, 0x08, 0x2c, 0x8a, 0xa4, 0x11, 0x83, 0x95, 0xea, 0x88, 0x44, 0x53, 0x12, + 0x99, 0x43, 0x37, 0xc2, 0xe6, 0x62, 0x7f, 0x88, 0x99, 0xbb, 0x6f, 0x8e, 0x88, 0x1f, 0x4a, 0x7a, + 0x65, 0x5b, 0xe6, 0x1d, 0x11, 0x99, 0x32, 0x88, 0x53, 0xf7, 0x27, 0x64, 0x42, 0x24, 0xce, 0xff, + 0xc5, 0xe8, 0xce, 0x84, 0x90, 0x49, 0x80, 0x4d, 0x11, 0x0d, 0xe7, 0x63, 0x93, 0xf9, 0x53, 0x1c, + 0x31, 0x77, 0x3a, 0x4b, 0x08, 0xd2, 0x1d, 0xa1, 0xee, 0x28, 0xc0, 0xe6, 0xd4, 0x1f, 0x51, 0xe2, + 0x50, 0x3c, 0x23, 0x94, 0x49, 0xc2, 0x93, 0xdf, 0xb6, 0xc0, 0x56, 0x4b, 0xda, 0x83, 0x0f, 0xc1, + 0xd6, 0xa9, 0x1b, 0x9d, 0x3a, 0xbe, 0xa7, 0x29, 0xba, 0x52, 0x2b, 0xa0, 0x4d, 0x1e, 0xda, 0x1e, + 0xfc, 0x12, 0x80, 0x78, 0x0b, 0x3c, 0xb7, 0xa1, 0x2b, 0xb5, 0x0c, 0xca, 0xc5, 0x88, 0xed, 0x41, + 0x1b, 0xa8, 0x49, 0x7a, 0xe4, 0x32, 0x3c, 0x21, 0xf4, 0x4c, 0x4b, 0xeb, 0x4a, 0xad, 0x74, 0x50, + 0x35, 0x6e, 0x1c, 0x80, 0x11, 0xaf, 0xd4, 0x8c, 0x59, 0xa8, 0xec, 0xdd, 0x04, 0xe0, 0x11, 0xc8, + 0x27, 0x52, 0x63, 0x8c, 0xb5, 0x8c, 0xae, 0xd4, 0x72, 0x8d, 0x6f, 0xdf, 0x7d, 0xdc, 0x49, 0xfd, + 0xf5, 0x71, 0xe7, 0x81, 0x3c, 0x91, 0xc8, 0x7b, 0x6d, 0xf8, 0xc4, 0x9c, 0xba, 0xec, 0xd4, 0xb0, + 0x43, 0xf6, 0xe1, 0xed, 0x1e, 0x88, 0x8f, 0xca, 0x0e, 0x19, 0x4a, 0x9c, 0x1e, 0x62, 0x0c, 0x9b, + 0xa0, 0x94, 0xa8, 0x45, 0xcc, 0x65, 0xf3, 0x48, 0xbb, 0x27, 0x6c, 0x3d, 0xfe, 0xb4, 0xad, 0x9e, + 0xe0, 0xa0, 0xa2, 0x77, 0x3d, 0x84, 0x08, 0xc0, 0x6b, 0x22, 0x94, 0x39, 0xfc, 0x8c, 0xb5, 0x4d, + 0x5d, 0xa9, 0xe5, 0x0f, 0x2a, 0x86, 0x6c, 0x80, 0x91, 0x34, 0xc0, 0xe8, 0x27, 0x0d, 0x68, 0x64, + 0xb9, 0xeb, 0x37, 0x7f, 0xef, 0x28, 0x48, 0xbd, 0x12, 0xa4, 0x8c, 0x13, 0x60, 0xfb, 0xea, 0xc4, + 0x70, 0xe8, 0x49, 0xc5, 0xad, 0x3b, 0x28, 0x26, 0xdb, 0xb2, 0x42, 0x4f, 0xe8, 0x19, 0xe0, 0xf3, + 0x9b, 0x1e, 0x87, 0x01, 0x19, 0xbd, 0xd6, 0xb2, 0xba, 0x52, 0x4b, 0xa3, 0xcf, 0xae, 0x2f, 0xdf, + 0xe0, 0x09, 0xf8, 0x35, 0x48, 0x36, 0xe9, 0x50, 0x32, 0x0f, 0x3d, 0x2d, 0x27, 0x7a, 0x5a, 0x88, + 0x41, 0xc4, 0x31, 0xd8, 0x06, 0x85, 0x28, 0xe0, 0xf3, 0xe0, 0x4e, 0xc9, 0x3c, 0x64, 0x1a, 0xb8, + 0x7b, 0x33, 0xf2, 0x42, 0xa0, 0x2e, 0xea, 0x79, 0x6f, 0x87, 0x73, 0x1a, 0x26, 0x72, 0xf9, 0xff, + 0xd1, 0x5b, 0x5e, 0x1f, 0xab, 0xbd, 0x04, 0x65, 0x39, 0xc8, 0x0e, 0x5e, 0xf8, 0x1e, 0x0e, 0x47, + 0x58, 0x2b, 0x88, 0x13, 0xdc, 0x8e, 0x9b, 0x2b, 0x67, 0xde, 0x38, 0xe6, 0x33, 0x8f, 0x04, 0xb3, + 0x91, 0xe1, 0x8b, 0xa1, 0x92, 0xac, 0xb3, 0xe2, 0x32, 0xf8, 0x1c, 0x80, 0x31, 0xc6, 0xce, 0x8c, + 0x57, 0x45, 0x5a, 0x51, 0x4f, 0xd7, 0xf2, 0x07, 0xda, 0xda, 0x84, 0x74, 0x79, 0x64, 0x87, 0x63, + 0x12, 0x6b, 0xe4, 0xc6, 0x18, 0x0b, 0x2c, 0x82, 0x2f, 0x01, 0x0f, 0x1c, 0x46, 0x98, 0x1b, 0x68, + 0xa5, 0xbb, 0x6f, 0x2a, 0x3b, 0xc6, 0xb8, 0xcf, 0x8b, 0x61, 0x0d, 0xa8, 0x33, 0x8a, 0x17, 0xce, + 0xd5, 0x5d, 0x8b, 0xb4, 0xb2, 0x9e, 0xae, 0x65, 0x50, 0x89, 0xe3, 0xad, 0xe4, 0xc2, 0x45, 0x4f, + 0xfe, 0x50, 0x40, 0xee, 0xd2, 0x12, 0x7c, 0x0e, 0x8a, 0xc2, 0xbc, 0xe3, 0x7a, 0x1e, 0xc5, 0x51, + 0x24, 0x6e, 0x6f, 0xae, 0xa1, 0x7d, 0x78, 0xbb, 0x77, 0x3f, 0x5e, 0xa8, 0x2e, 0x33, 0x3d, 0x46, + 0xfd, 0x70, 0x82, 0x0a, 0x82, 0x1e, 0x63, 0xb0, 0x09, 0x36, 0xe3, 0x96, 0x6c, 0xdc, 0xdd, 0x7d, + 0x5c, 0x0a, 0x1f, 0x81, 0xdc, 0x98, 0x92, 0xa9, 0x33, 0x24, 0xa1, 0x27, 0x2e, 0x7f, 0x16, 0x65, + 0x39, 0xd0, 0x20, 0xa1, 0x07, 0xbf, 0x02, 0x05, 0x31, 0x90, 0x4e, 0x38, 0x9f, 0x0e, 0x31, 0x15, + 0xd7, 0x3a, 0x8d, 0xf2, 0x02, 0x6b, 0x0b, 0x68, 0xf7, 0x77, 0x05, 0x94, 0xd7, 0x5e, 0x07, 0xb8, + 0x0f, 0x1e, 0xb7, 0xec, 0x5e, 0x77, 0xd0, 0xb7, 0x9c, 0x66, 0xbd, 0x6f, 0xbd, 0xe8, 0xa0, 0x1f, + 0x9c, 0x41, 0xbb, 0xd7, 0xb5, 0x9a, 0xf6, 0xa1, 0x6d, 0xb5, 0xd4, 0x54, 0xa5, 0xbc, 0x5c, 0xe9, + 0xf9, 0x41, 0x18, 0xcd, 0xf0, 0xc8, 0x1f, 0xfb, 0xd8, 0x83, 0xcf, 0x80, 0x76, 0xab, 0xe4, 0x55, + 0x1d, 0xb5, 0xed, 0xf6, 0x0b, 0x55, 0xa9, 0xe4, 0x97, 0x2b, 0x7d, 0xeb, 0x95, 0x4b, 0x43, 0x3f, + 0x9c, 0xc0, 0xa7, 0xe0, 0x8b, 0x5b, 0xd4, 0x63, 0xbb, 0xdd, 0x41, 0xea, 0x46, 0x25, 0xb7, 0x5c, + 0xe9, 0xf7, 0x8e, 0xfd, 0x90, 0xd0, 0x4f, 0xd3, 0xea, 0xdf, 0x77, 0x90, 0x9a, 0x8e, 0x69, 0xee, + 0x4f, 0x84, 0x56, 0x32, 0xbf, 0xfc, 0x5a, 0x4d, 0xed, 0xfe, 0xab, 0x80, 0xe2, 0x8d, 0xc7, 0x04, + 0x7e, 0x73, 0x55, 0xde, 0xeb, 0xd7, 0xfb, 0x83, 0x9e, 0xd3, 0x45, 0xd6, 0x49, 0xa7, 0x6f, 0xa9, + 0x29, 0x69, 0xa7, 0x4b, 0xf1, 0x82, 0x30, 0x0c, 0x9f, 0x82, 0x07, 0x6b, 0xc4, 0x93, 0x4e, 0x5f, + 0xda, 0x06, 0xcb, 0x95, 0xbe, 0x79, 0x42, 0x18, 0x77, 0xfd, 0x0c, 0x3c, 0x5c, 0xa3, 0x21, 0xab, + 0xd7, 0x39, 0x3a, 0xb1, 0x5a, 0xea, 0x46, 0xa5, 0xb0, 0x5c, 0xe9, 0x59, 0x84, 0x23, 0x12, 0x2c, + 0xb0, 0x07, 0xf7, 0xc0, 0xf6, 0x1a, 0x75, 0xd0, 0xbe, 0x24, 0xa7, 0x2b, 0xa5, 0xe5, 0x4a, 0x07, + 0x83, 0x90, 0x26, 0xf4, 0xdb, 0x06, 0x0e, 0xeb, 0xf6, 0x91, 0xd5, 0x52, 0x33, 0xd2, 0xc0, 0xa1, + 0xeb, 0x07, 0xd8, 0x93, 0x1b, 0x6d, 0xb4, 0xde, 0x9d, 0x57, 0x95, 0xf7, 0xe7, 0x55, 0xe5, 0x9f, + 0xf3, 0xaa, 0xf2, 0xe6, 0xa2, 0x9a, 0x7a, 0x7f, 0x51, 0x4d, 0xfd, 0x79, 0x51, 0x4d, 0xfd, 0xb8, + 0x3b, 0xf1, 0xd9, 0xe9, 0x7c, 0x68, 0x8c, 0xc8, 0xd4, 0x64, 0x38, 0x08, 0x08, 0xdd, 0xf3, 0x89, + 0x29, 0x3f, 0x43, 0x3f, 0x5f, 0x7e, 0x26, 0xd9, 0xd9, 0x0c, 0x47, 0xc3, 0x4d, 0xf1, 0xc8, 0x7d, + 0xf7, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x97, 0xa9, 0x87, 0xa4, 0x44, 0x07, 0x00, 0x00, } func (m *Dispute) Marshal() (dAtA []byte, err error) { diff --git a/x/oracle/types/query_meta.pb.go b/x/oracle/types/query_meta.pb.go index 7cf90268e..67484cfb2 100644 --- a/x/oracle/types/query_meta.pb.go +++ b/x/oracle/types/query_meta.pb.go @@ -45,7 +45,7 @@ type QueryMeta struct { HasRevealedReports bool `protobuf:"varint,5,opt,name=has_revealed_reports,json=hasRevealedReports,proto3" json:"has_revealed_reports,omitempty"` // unique id of the query according to the data spec QueryId []byte `protobuf:"bytes,6,opt,name=query_id,json=queryId,proto3" json:"query_id,omitempty"` - // sttring identifier of the data spec + // string identifier of the data spec QueryType string `protobuf:"bytes,7,opt,name=query_type,json=queryType,proto3" json:"query_type,omitempty"` } From f218dbeac1153e321b8989aa1011a8797ca9ba9d Mon Sep 17 00:00:00 2001 From: danflo27 Date: Thu, 21 Mar 2024 09:21:09 -0400 Subject: [PATCH 28/31] edit integration tests for tipping queries not in cycle list --- tests/integration/oracle_keeper_test.go | 44 +++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index 87bd25886..02f0ad649 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -21,6 +21,7 @@ import ( "github.com/tellor-io/layer/x/oracle/keeper" "github.com/tellor-io/layer/x/oracle/types" oracleutils "github.com/tellor-io/layer/x/oracle/utils" + reporterkeeper "github.com/tellor-io/layer/x/reporter/keeper" reportertypes "github.com/tellor-io/layer/x/reporter/types" ) @@ -555,6 +556,7 @@ func (s *IntegrationTestSuite) TestCommitQueryMixed() { // test tipping a query id not in cycle list and observe the reporters' delegators stake increase in staking module func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { + require := s.Require() s.ctx = s.ctx.WithBlockTime(time.Now()) msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) @@ -603,13 +605,31 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 3)) // bypassing offset that expires time to commit/reveal err = s.oraclekeeper.SetAggregatedReport(s.ctx) s.Nil(err) - // delegation shares should increase after reporting + + // check that tip is in escrow + escrowAcct := s.accountKeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + require.NotNil(escrowAcct) + escrowBalance := s.bankKeeper.GetBalance(s.ctx, escrowAcct, s.denom) + require.NotNil(escrowBalance) + twoPercent := sdk.NewCoin(s.denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + require.Equal(tipAmount.Sub(twoPercent.Amount), escrowBalance.Amount) + + // withdraw tip + // create reporterMsgServer + reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + _, err = reporterMsgServer.WithdrawTip(s.ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: repAcc.String(), ValidatorAddress: valAddr.String()}) + require.NoError(err) + + // delegation shares should increase after reporting and escrow balance should go nback to 0 delAfter, err := s.stakingKeeper.Delegation(s.ctx, repAcc.Bytes(), valAddr) s.Nil(err) s.True(delAfter.GetShares().Equal(delBefore.GetShares().Add(math.LegacyNewDec(980))), "delegation shares plus the tip added") // 1000 - 2% tip + escrowBalance = s.bankKeeper.GetBalance(s.ctx, escrowAcct, s.denom) + s.True(escrowBalance.IsZero()) } func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { + require := s.Require() msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) accs := s.CreateAccountsWithTokens(3, 100*1e6) @@ -666,11 +686,31 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 3)) // bypassing offset that expires time to commit/reveal err = s.oraclekeeper.SetAggregatedReport(s.ctx) s.Nil(err) - // delegation shares should increase after reporting + + // check tip escrow account + escrowAcct := s.accountKeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + require.NotNil(escrowAcct) + escrowBalance := s.bankKeeper.GetBalance(s.ctx, escrowAcct, s.denom) + require.NotNil(escrowBalance) + twoPercent := sdk.NewCoin(s.denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + require.Equal(tipAmount.Sub(twoPercent.Amount), escrowBalance.Amount) + + // withdraw self delegation from tip escrow + reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + _, err = reporterMsgServer.WithdrawTip(s.ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: delegator1.String(), ValidatorAddress: valAddr.String()}) + require.NoError(err) + + // delegation shares should increase after reporting and withdrawing del1After, err := s.stakingKeeper.Delegation(s.ctx, delegator1.Bytes(), valAddr) s.Nil(err) // 980 = 1000 - 2% tip, 980 / 2 = 490 for each delegator but with 50 percent commission for the reporter would be 490 + (490 / 2) = 735 s.True(del1After.GetShares().Equal(del1Before.GetShares().Add(math.LegacyNewDec(735))), "delegation 1 (self delegation) shares should be half the tip plus 50 percent commission") + + // withdraw del2 delegation from tip escrow + _, err = reporterMsgServer.WithdrawTip(s.ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: delegator2.String(), ValidatorAddress: valAddr.String()}) + require.NoError(err) + + // 980 - 735 = 245 del2After, err := s.stakingKeeper.Delegation(s.ctx, delegator2.Bytes(), valAddr) s.Nil(err) s.True(del2After.GetShares().Equal(del2Before.GetShares().Add(math.LegacyNewDec(245))), "delegation 2 shares should be half the tip minus 50 percent reporter commission") From b0ac76f40db6511f7ee50b6759c6a5683581c8e3 Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 09:33:12 -0400 Subject: [PATCH 29/31] add constant --- types/global.go | 3 +++ x/dispute/keeper/dispute.go | 3 ++- x/dispute/keeper/tally.go | 5 +++-- x/oracle/keeper/msg_server_submit_value.go | 3 ++- x/reporter/keeper/withdraw.go | 3 ++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/types/global.go b/types/global.go index e9ee69115..813e48fbb 100644 --- a/types/global.go +++ b/types/global.go @@ -2,6 +2,7 @@ package types import ( "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) var ( @@ -10,4 +11,6 @@ var ( OneTrb = math.NewInt(1_000_000) // ten percent of 1TRB TenPercent = math.NewInt(10_000) + + PowerReduction = sdk.DefaultPowerReduction ) diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index f14c50b78..1a2c91fea 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -12,6 +12,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + layertypes "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" oracletypes "github.com/tellor-io/layer/x/oracle/types" ) @@ -184,7 +185,7 @@ func (k Keeper) SlashAndJailReporter(ctx sdk.Context, report oracletypes.MicroRe if err != nil { return err } - amount := sdk.TokensFromConsensusPower(report.Power, sdk.DefaultPowerReduction) + amount := math.NewInt(report.Power).Mul(layertypes.PowerReduction) slashAmount := math.LegacyNewDecFromInt(amount).Mul(slashFactor) err = k.reporterKeeper.EscrowReporterStake(ctx, reporterAddr, report.Power, report.BlockNumber, slashAmount.TruncateInt()) if err != nil { diff --git a/x/dispute/keeper/tally.go b/x/dispute/keeper/tally.go index 80ffd8a19..4fe1926c8 100644 --- a/x/dispute/keeper/tally.go +++ b/x/dispute/keeper/tally.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" layer "github.com/tellor-io/layer/types" + layertypes "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" reptypes "github.com/tellor-io/layer/x/reporter/types" ) @@ -250,7 +251,7 @@ func (k Keeper) GetReporterPower(ctx sdk.Context, voter string) (math.Int, error } return math.Int{}, err } - return reporter.TotalTokens.Quo(sdk.DefaultPowerReduction), nil + return reporter.TotalTokens.Quo(layertypes.PowerReduction), nil } func (k Keeper) GetAccountBalance(ctx sdk.Context, voter string) (math.Int, error) { @@ -356,7 +357,7 @@ func (k Keeper) CalculateVoterShare(ctx sdk.Context, voters []string, totalToken // Calculate and allocate tokens based on each person's share of the total power tokenDistribution := make(map[string]math.Int) - scalingFactor := math.NewInt(1_000_000) //TODO: use sdk.DefaultPowerReduction + scalingFactor := layertypes.PowerReduction totalShare := math.ZeroInt() for voter, power := range powers { share := power.Mul(scalingFactor).Quo(totalPower) diff --git a/x/oracle/keeper/msg_server_submit_value.go b/x/oracle/keeper/msg_server_submit_value.go index 692e2852f..53d5b501a 100644 --- a/x/oracle/keeper/msg_server_submit_value.go +++ b/x/oracle/keeper/msg_server_submit_value.go @@ -15,6 +15,7 @@ import ( oracleutils "github.com/tellor-io/layer/x/oracle/utils" sdk "github.com/cosmos/cosmos-sdk/types" + layertypes "github.com/tellor-io/layer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -43,7 +44,7 @@ func (k msgServer) SubmitValue(goCtx context.Context, msg *types.MsgSubmitValue) return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required %s", reporter.TotalTokens, params.MinStakeAmount) } - votingPower := reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64() + votingPower := reporter.TotalTokens.Quo(layertypes.PowerReduction).Int64() // decode query data hex string to bytes msg.QueryData = utils.Remove0xPrefix(msg.QueryData) qDataBytes, err := hex.DecodeString(msg.QueryData) diff --git a/x/reporter/keeper/withdraw.go b/x/reporter/keeper/withdraw.go index d2abac76c..8a501812b 100644 --- a/x/reporter/keeper/withdraw.go +++ b/x/reporter/keeper/withdraw.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" layer "github.com/tellor-io/layer/types" + layertypes "github.com/tellor-io/layer/types" disputetypes "github.com/tellor-io/layer/x/dispute/types" "github.com/tellor-io/layer/x/reporter/types" ) @@ -206,7 +207,7 @@ func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAdd return err } - totalTokens := sdk.DefaultPowerReduction.MulRaw(power) + totalTokens := layertypes.PowerReduction.MulRaw(power) for _, del := range firstValue.TokenOrigins { delegatorShare := math.LegacyNewDecFromInt(del.Amount).Quo(math.LegacyNewDecFromInt(totalTokens)).Mul(math.LegacyNewDecFromInt(amt)) delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) From 2beea2267f4aae9bb86a1a0ddb40d251efdaca75 Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 09:34:29 -0400 Subject: [PATCH 30/31] fix test --- tests/integration/dispute_keeper_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index 5ce89d3f7..93e7307b3 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -1,10 +1,13 @@ package integration_test import ( + "bytes" "time" + "cosmossdk.io/collections" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/tellor-io/layer/x/dispute/keeper" "github.com/tellor-io/layer/x/dispute/types" oracleKeeper "github.com/tellor-io/layer/x/oracle/keeper" @@ -408,12 +411,20 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { addrs := []sdk.AccAddress{repAcc, disputer, delegators[1], delegators[2]} votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, v.Voters, twoPercentBurn) for i := range votersBalanceBefore { - votersBalanceBefore[i].Amount = votersBalanceBefore[i].Amount.Add(votersReward[addrs[i].String()]) - s.Equal(votersBalanceBefore[i], (votersBalanceAfter[i])) + // voterBal := votersBalanceBefore[i].Amount.Add(votersReward[addrs[i].String()]) + voterBal := votersBalanceBefore[i].AddAmount(votersReward[addrs[i].String()]) + if bytes.Equal(disputer, addrs[i]) { + // disputer gets the dispute fee they paid minus the 5% burn for a one rounder dispute + voterBal = voterBal.AddAmount(disputeFee.Sub(fivePercentBurn)) + } + s.Equal(voterBal, votersBalanceAfter[i]) } disputerDelgation, err := s.stakingKeeper.GetDelegatorBonded(s.ctx, disputer) s.NoError(err) s.True(disputerDelgation.Equal(math.NewInt(1_000_000))) + + // get module account balance + s.bankKeeper.Balances.Get(s.ctx, collections.Join(authtypes.NewModuleAddress(types.ModuleName), s.denom)) } func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { From 1cfa51bea5e67d68900ca9b31c43aa09b432300b Mon Sep 17 00:00:00 2001 From: akrem Date: Thu, 21 Mar 2024 13:07:04 -0400 Subject: [PATCH 31/31] clean up --- tests/integration/keeper_test.go | 11 ++++++----- types/global.go | 5 +++-- x/dispute/keeper/dispute.go | 4 +--- x/dispute/keeper/msg_server_propose_dispute.go | 4 ++-- x/reporter/keeper/distribution.go | 15 ++++++++++++++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index 956619b6b..0ee8feffb 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -223,16 +223,17 @@ func (s *IntegrationTestSuite) SetupTest() { s.app = app } -func (s *IntegrationTestSuite) mintTokens(addr sdk.AccAddress, amount sdk.Coin) { +func (s *IntegrationTestSuite) mintTokens(addr sdk.AccAddress, amount math.Int) { ctx := s.ctx // s.accountKeeper.SetAccount(ctx, authtypes.NewBaseAccountWithAddress(addr)) - s.NoError(s.bankKeeper.MintCoins(ctx, authtypes.Minter, sdk.NewCoins(amount))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.Minter, addr, sdk.NewCoins(amount))) + coins := sdk.NewCoins(sdk.NewCoin(s.denom, amount)) + s.NoError(s.bankKeeper.MintCoins(ctx, authtypes.Minter, coins)) + s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.Minter, addr, coins)) } func (s *IntegrationTestSuite) newKeysWithTokens() sdk.AccAddress { Addr := sample.AccAddressBytes() - s.mintTokens(Addr, sdk.NewCoin(s.denom, math.NewInt(1_000_000))) + s.mintTokens(Addr, math.NewInt(1_000_000)) return Addr } @@ -350,7 +351,7 @@ func (s *IntegrationTestSuite) CreateAccountsWithTokens(numofAccs int, amountOfT accs := make([]sdk.AccAddress, numofAccs) for i, pk := range privKeys { accs[i] = sdk.AccAddress(pk.PubKey().Address()) - s.mintTokens(accs[i], sdk.NewCoin(s.denom, math.NewInt(amountOfTokens))) + s.mintTokens(accs[i], math.NewInt(amountOfTokens)) } return accs } diff --git a/types/global.go b/types/global.go index 813e48fbb..3906d40be 100644 --- a/types/global.go +++ b/types/global.go @@ -9,8 +9,9 @@ var ( BondDenom = "loya" OneTrb = math.NewInt(1_000_000) - // ten percent of 1TRB - TenPercent = math.NewInt(10_000) + // one percent of 1TRB + // min stake is 1TRB so min dispute fee would be 1% of 1TRB + OnePercent = math.NewInt(1_000) PowerReduction = sdk.DefaultPowerReduction ) diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index 1a2c91fea..5bb960536 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -307,9 +307,7 @@ func (k Keeper) AddDisputeRound(ctx sdk.Context, dispute types.Dispute, msg type if err != nil { return err } - // How does second round of dispute fee work? - // If fee is not paid then doubling the burnAmount means reducing the fee total? - // Reducing the fee total means that feeTotal - burnAmount could be zero and the fee payers don't get anything from the feePaid or who gets what is not clear + return nil } diff --git a/x/dispute/keeper/msg_server_propose_dispute.go b/x/dispute/keeper/msg_server_propose_dispute.go index 6b9dc8fe8..4e9afbce9 100644 --- a/x/dispute/keeper/msg_server_propose_dispute.go +++ b/x/dispute/keeper/msg_server_propose_dispute.go @@ -15,8 +15,8 @@ func (k msgServer) ProposeDispute(goCtx context.Context, msg *types.MsgProposeDi return nil, types.ErrInvalidFeeDenom.Wrapf("wrong fee denom: %s, expected: %s", msg.Fee.Denom, layer.BondDenom) } - if msg.Fee.Amount.LT(layer.TenPercent) { - return nil, types.ErrMinimumTRBrequired.Wrapf("fee %s dosen't meet minimum fee required", msg.Fee.Amount) + if msg.Fee.Amount.LT(layer.OnePercent) { + return nil, types.ErrMinimumTRBrequired.Wrapf("fee %s doesn't meet minimum fee required", msg.Fee.Amount) } dispute := k.GetDisputeByReporter(ctx, *msg.Report, msg.DisputeCategory) diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 3db655078..053e77dc9 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -904,9 +904,15 @@ func (k Keeper) ReturnSlashedTokens(ctx context.Context, reporterAddr string, he del.Amount = source.Amount del.Reporter = repAcc.String() // call hooks :todo + if err := k.BeforeDelegationCreated(ctx, reporter); err != nil { + return err + } if err := k.Delegators.Set(ctx, delAddr, del); err != nil { return err } + if err := k.AfterDelegationModified(ctx, delAddr, repAcc.Bytes(), del.Amount); err != nil { + return err + } vals, err := k.GetBondedValidators(ctx, 1) if err != nil { return err @@ -929,11 +935,18 @@ func (k Keeper) ReturnSlashedTokens(ctx context.Context, reporterAddr string, he continue } // if delegator exists, add tokens to it - del.Amount = del.Amount.Add(source.Amount) // call hooks :todo + if err := k.BeforeDelegationModified(ctx, delAddr, del, reporter); err != nil { + return err + } + del.Amount = del.Amount.Add(source.Amount) + if err := k.Delegators.Set(ctx, delAddr, del); err != nil { return err } + if err := k.AfterDelegationModified(ctx, delAddr, repAcc.Bytes(), del.Amount); err != nil { + return err + } // get token origin and see if it still exists prevAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr, valAddr)) if err != nil {