From dc5f3da60eb3e7955d8490fead38f4a989a59d5f Mon Sep 17 00:00:00 2001 From: hacheigriega Date: Fri, 29 Nov 2024 16:56:45 -0500 Subject: [PATCH] chore(pubkey): add proving schemes state and add endblock logic for checking status --- proto/sedachain/pubkey/v1/genesis.proto | 8 + proto/sedachain/pubkey/v1/query.proto | 25 +- x/batching/types/expected_keepers.go | 1 - x/pubkey/client/cli/query.go | 27 ++ x/pubkey/keeper/endblock.go | 63 +++ x/pubkey/keeper/genesis.go | 40 +- x/pubkey/keeper/grpc_query.go | 11 + x/pubkey/keeper/keeper.go | 93 +++- .../keeper/testutil/expected_keepers_mock.go | 69 ++- x/pubkey/module.go | 8 +- x/pubkey/types/expected_keepers.go | 12 +- x/pubkey/types/genesis.go | 16 +- x/pubkey/types/genesis.pb.go | 306 ++++++++++++- x/pubkey/types/keys.go | 5 +- x/pubkey/types/query.pb.go | 405 ++++++++++++++++-- x/pubkey/types/query.pb.gw.go | 65 +++ 16 files changed, 1048 insertions(+), 106 deletions(-) create mode 100644 x/pubkey/keeper/endblock.go diff --git a/proto/sedachain/pubkey/v1/genesis.proto b/proto/sedachain/pubkey/v1/genesis.proto index 19224ad1..5c4d93d1 100644 --- a/proto/sedachain/pubkey/v1/genesis.proto +++ b/proto/sedachain/pubkey/v1/genesis.proto @@ -11,6 +11,8 @@ option go_package = "github.com/sedaprotocol/seda-chain/x/pubkey/types"; message GenesisState { repeated ValidatorPubKeys validator_pub_keys = 1 [ (gogoproto.nullable) = false ]; + repeated ProvingScheme proving_schemes = 2 + [ (gogoproto.nullable) = false ]; } // ValidatorPubKeys defines a validator's list of registered public keys @@ -20,3 +22,9 @@ message ValidatorPubKeys { [ (cosmos_proto.scalar) = "cosmos.ValidatorAddressString" ]; repeated IndexedPubKey indexed_pub_keys = 2 [ (gogoproto.nullable) = false ]; } + +// ProvingScheme defines the status of a proving scheme. +message ProvingScheme { + uint32 index = 1; + bool is_enabled = 2; +} diff --git a/proto/sedachain/pubkey/v1/query.proto b/proto/sedachain/pubkey/v1/query.proto index 84f822b4..90fd571e 100644 --- a/proto/sedachain/pubkey/v1/query.proto +++ b/proto/sedachain/pubkey/v1/query.proto @@ -16,17 +16,34 @@ service Query { option (google.api.http).get = "/seda-chain/pubkey/validator_keys/{validator_addr}"; } + + // ProvingSchemes returns the statuses of the SEDA proving schemes. + rpc ProvingSchemes(QueryProvingSchemesRequest) + returns (QueryProvingSchemesResponse) { + option (google.api.http).get = + "/seda-chain/pubkey/proving_schemes"; +} } -// QueryValidatorKeysRequest is request type for the Query/ValidatorKeys RPC -// method. +// QueryValidatorKeysRequest is request type for the Query/ValidatorKeys +// RPC method. message QueryValidatorKeysRequest { string validator_addr = 1 [ (cosmos_proto.scalar) = "cosmos.ValidatorAddressString" ]; } -// QueryValidatorKeysResponse is response type for the Query/ValidatorKeys RPC -// method. +// QueryValidatorKeysResponse is response type for the Query/ValidatorKeys +// RPC method. message QueryValidatorKeysResponse { ValidatorPubKeys validator_pub_keys = 1 [ (gogoproto.nullable) = false ]; } + +// QueryProvingSchemesRequest is request type for the Query/ProvingSchemes +// RPC method. +message QueryProvingSchemesRequest {} + +// QueryProvingSchemesResponse is response type for the Query/ProvingSchemes +// RPC method. +message QueryProvingSchemesResponse { + repeated ProvingScheme proving_schemes = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/x/batching/types/expected_keepers.go b/x/batching/types/expected_keepers.go index cba8c2ff..0b8f462e 100644 --- a/x/batching/types/expected_keepers.go +++ b/x/batching/types/expected_keepers.go @@ -6,7 +6,6 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/pubkey/client/cli/query.go b/x/pubkey/client/cli/query.go index a4f7da95..e404e6c2 100644 --- a/x/pubkey/client/cli/query.go +++ b/x/pubkey/client/cli/query.go @@ -22,6 +22,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand( GetCmdValidatorKeys(), + GetProvingSchemes(), ) return cmd } @@ -54,3 +55,29 @@ func GetCmdValidatorKeys() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +// GetProvingSchemes returns the command for querying statuses of the +// SEDA proving schemes. +func GetProvingSchemes() *cobra.Command { + cmd := &cobra.Command{ + Use: "proving-schemes", + Short: "Query statuses of the SEDA proving schemes", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.ProvingSchemes(cmd.Context(), &types.QueryProvingSchemesRequest{}) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/pubkey/keeper/endblock.go b/x/pubkey/keeper/endblock.go new file mode 100644 index 00000000..9f2bf307 --- /dev/null +++ b/x/pubkey/keeper/endblock.go @@ -0,0 +1,63 @@ +package keeper + +import ( + "errors" + + "cosmossdk.io/collections" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/sedaprotocol/seda-chain/app/utils" +) + +func (k Keeper) EndBlock(ctx sdk.Context) (err error) { + // Use defer to prevent returning an error, which would cause + // the chain to halt. + defer func() { + // Handle a panic. + if r := recover(); r != nil { + k.Logger(ctx).Error("recovered from panic in pubkey end block", "err", r) + } + // Handle an error. + if err != nil { + k.Logger(ctx).Error("error in pubkey end block", "err", err) + } + err = nil + }() + + totalPower, err := k.stakingKeeper.GetLastTotalPower(ctx) + if err != nil { + return err + } + + // If the sum of the voting power has reached (2/3 + 1), enable + // secp256k1 proving scheme. + var powerSum uint64 + err = k.stakingKeeper.IterateLastValidatorPowers(ctx, func(valAddr sdk.ValAddress, power int64) (stop bool) { + _, err := k.GetValidatorKeyAtIndex(ctx, valAddr, utils.SEDAKeyIndexSecp256k1) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return false + } else { + panic(err) + } + } else { + powerSum += uint64(power) + } + return false + }) + if err != nil { + return err + } + + if requiredPower := ((totalPower.Int64() * 4) / 5) + 1; powerSum >= uint64(requiredPower) { + err = k.EnableProvingScheme(ctx, utils.SEDAKeyIndexSecp256k1) + if err != nil { + return err + } + // TODO: Jail validators (active and inactive) without required + // public keys. + } + + return +} diff --git a/x/pubkey/keeper/genesis.go b/x/pubkey/keeper/genesis.go index a14058c9..aeec9478 100644 --- a/x/pubkey/keeper/genesis.go +++ b/x/pubkey/keeper/genesis.go @@ -1,8 +1,6 @@ package keeper import ( - "bytes" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sedaprotocol/seda-chain/app/utils" @@ -23,41 +21,25 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { } } } + for _, scheme := range data.ProvingSchemes { + err := k.SetProvingScheme(ctx, utils.SEDAKeyIndex(scheme.Index), scheme.IsEnabled) + if err != nil { + panic(err) + } + } } // ExportGenesis extracts all data from store to genesis state. func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState { var gs types.GenesisState - - itr, err := k.pubKeys.Iterate(ctx, nil) + var err error + gs.ValidatorPubKeys, err = k.GetAllValidatorPubKeys(ctx) if err != nil { panic(err) } - defer itr.Close() - - var currentVal []byte - for ; itr.Valid(); itr.Next() { - kv, err := itr.KeyValue() - if err != nil { - panic(err) - } - - // Skip if the validator has already been processed. - if bytes.Equal(kv.Key.K1(), currentVal) { - continue - } - currentVal = kv.Key.K1() - - valAddr, err := k.validatorAddressCodec.BytesToString(kv.Key.K1()) - if err != nil { - panic(err) - } - res, err := k.GetValidatorKeys(ctx, valAddr) - if err != nil { - panic(err) - } - - gs.ValidatorPubKeys = append(gs.ValidatorPubKeys, res) + gs.ProvingSchemes, err = k.GetAllProvingSchemes(ctx) + if err != nil { + panic(err) } return gs } diff --git a/x/pubkey/keeper/grpc_query.go b/x/pubkey/keeper/grpc_query.go index a1aba3bc..270b427d 100644 --- a/x/pubkey/keeper/grpc_query.go +++ b/x/pubkey/keeper/grpc_query.go @@ -3,6 +3,7 @@ package keeper import ( "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sedaprotocol/seda-chain/x/pubkey/types" ) @@ -19,3 +20,13 @@ func (q Querier) ValidatorKeys(ctx context.Context, req *types.QueryValidatorKey } return &types.QueryValidatorKeysResponse{ValidatorPubKeys: result}, nil } + +func (q Querier) ProvingSchemes(ctx context.Context, req *types.QueryProvingSchemesRequest) (*types.QueryProvingSchemesResponse, error) { + schemes, err := q.GetAllProvingSchemes(sdk.UnwrapSDKContext(ctx)) + if err != nil { + return nil, err + } + return &types.QueryProvingSchemesResponse{ + ProvingSchemes: schemes, + }, nil +} diff --git a/x/pubkey/keeper/keeper.go b/x/pubkey/keeper/keeper.go index 7752a470..dcbdcd1d 100644 --- a/x/pubkey/keeper/keeper.go +++ b/x/pubkey/keeper/keeper.go @@ -1,11 +1,14 @@ package keeper import ( + "bytes" "context" + "fmt" "cosmossdk.io/collections" "cosmossdk.io/core/address" storetypes "cosmossdk.io/core/store" + "cosmossdk.io/log" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -18,8 +21,9 @@ type Keeper struct { stakingKeeper types.StakingKeeper validatorAddressCodec address.Codec - Schema collections.Schema - pubKeys collections.Map[collections.Pair[[]byte, uint32], []byte] + Schema collections.Schema + pubKeys collections.Map[collections.Pair[[]byte, uint32], []byte] + provingSchemes collections.Map[uint32, bool] } func NewKeeper(storeService storetypes.KVStoreService, sk types.StakingKeeper, validatorAddressCodec address.Codec) *Keeper { @@ -32,6 +36,7 @@ func NewKeeper(storeService storetypes.KVStoreService, sk types.StakingKeeper, v stakingKeeper: sk, validatorAddressCodec: validatorAddressCodec, pubKeys: collections.NewMap(sb, types.PubKeysPrefix, "pubkeys", collections.PairKeyCodec(collections.BytesKey, collections.Uint32Key), collections.BytesValue), + provingSchemes: collections.NewMap(sb, types.ProvingSchemesPrefix, "proving_schemes", collections.Uint32Key, collections.BoolValue), } schema, err := sb.Build() @@ -58,6 +63,7 @@ func (k Keeper) GetValidatorKeyAtIndex(ctx context.Context, validatorAddr sdk.Va return pubKey, nil } +// GetValidatorKeys returns all public keys of a given validator. func (k Keeper) GetValidatorKeys(ctx context.Context, validatorAddr string) (result types.ValidatorPubKeys, err error) { valAddr, err := k.validatorAddressCodec.StringToBytes(validatorAddr) if err != nil { @@ -88,3 +94,86 @@ func (k Keeper) GetValidatorKeys(ctx context.Context, validatorAddr string) (res } return result, nil } + +// GetAllValidatorPubKeys returns all validator public keys in the store. +func (k Keeper) GetAllValidatorPubKeys(ctx context.Context) ([]types.ValidatorPubKeys, error) { + var valPubKeys []types.ValidatorPubKeys + + itr, err := k.pubKeys.Iterate(ctx, nil) + if err != nil { + return nil, err + } + defer itr.Close() + + var currentVal []byte + for ; itr.Valid(); itr.Next() { + kv, err := itr.KeyValue() + if err != nil { + return nil, err + } + + // Skip if the validator has already been processed. + if bytes.Equal(kv.Key.K1(), currentVal) { + continue + } + currentVal = kv.Key.K1() + + valAddr, err := k.validatorAddressCodec.BytesToString(kv.Key.K1()) + if err != nil { + return nil, err + } + res, err := k.GetValidatorKeys(ctx, valAddr) + if err != nil { + return nil, err + } + + valPubKeys = append(valPubKeys, res) + } + return valPubKeys, err +} + +func (k Keeper) SetProvingScheme(ctx context.Context, index utils.SEDAKeyIndex, isEnabled bool) error { + err := k.provingSchemes.Set(ctx, uint32(index), isEnabled) + if err != nil { + return err + } + return nil +} + +func (k Keeper) EnableProvingScheme(ctx context.Context, index utils.SEDAKeyIndex) error { + err := k.provingSchemes.Set(ctx, uint32(index), true) + if err != nil { + return err + } + return nil +} + +func (k Keeper) GetAllProvingSchemes(ctx sdk.Context) ([]types.ProvingScheme, error) { + itr, err := k.provingSchemes.Iterate(ctx, nil) + if err != nil { + return nil, err + } + defer itr.Close() + + var schemes []types.ProvingScheme + for ; itr.Valid(); itr.Next() { + kv, err := itr.KeyValue() + if err != nil { + return nil, err + } + + isEnabled, err := k.provingSchemes.Get(ctx, kv.Key) + if err != nil { + return nil, err + } + schemes = append(schemes, types.ProvingScheme{ + Index: kv.Key, + IsEnabled: isEnabled, + }) + } + return schemes, nil +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/pubkey/keeper/testutil/expected_keepers_mock.go b/x/pubkey/keeper/testutil/expected_keepers_mock.go index fb06adc4..acc8644b 100644 --- a/x/pubkey/keeper/testutil/expected_keepers_mock.go +++ b/x/pubkey/keeper/testutil/expected_keepers_mock.go @@ -13,8 +13,10 @@ import ( context "context" reflect "reflect" - types "github.com/cosmos/cosmos-sdk/types" - types0 "github.com/cosmos/cosmos-sdk/x/staking/types" + math "cosmossdk.io/math" + types "github.com/cometbft/cometbft/abci/types" + types0 "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/x/staking/types" gomock "go.uber.org/mock/gomock" ) @@ -41,11 +43,41 @@ func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { return m.recorder } +// GetBondedValidatorsByPower mocks base method. +func (m *MockStakingKeeper) GetBondedValidatorsByPower(ctx context.Context) ([]types1.Validator, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBondedValidatorsByPower", ctx) + ret0, _ := ret[0].([]types1.Validator) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBondedValidatorsByPower indicates an expected call of GetBondedValidatorsByPower. +func (mr *MockStakingKeeperMockRecorder) GetBondedValidatorsByPower(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBondedValidatorsByPower", reflect.TypeOf((*MockStakingKeeper)(nil).GetBondedValidatorsByPower), ctx) +} + +// GetLastTotalPower mocks base method. +func (m *MockStakingKeeper) GetLastTotalPower(ctx context.Context) (math.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLastTotalPower", ctx) + ret0, _ := ret[0].(math.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetLastTotalPower indicates an expected call of GetLastTotalPower. +func (mr *MockStakingKeeperMockRecorder) GetLastTotalPower(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastTotalPower", reflect.TypeOf((*MockStakingKeeper)(nil).GetLastTotalPower), ctx) +} + // GetValidator mocks base method. -func (m *MockStakingKeeper) GetValidator(ctx context.Context, addr types.ValAddress) (types0.Validator, error) { +func (m *MockStakingKeeper) GetValidator(ctx context.Context, addr types0.ValAddress) (types1.Validator, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidator", ctx, addr) - ret0, _ := ret[0].(types0.Validator) + ret0, _ := ret[0].(types1.Validator) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -55,3 +87,32 @@ func (mr *MockStakingKeeperMockRecorder) GetValidator(ctx, addr any) *gomock.Cal mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidator), ctx, addr) } + +// GetValidatorUpdates mocks base method. +func (m *MockStakingKeeper) GetValidatorUpdates(ctx context.Context) ([]types.ValidatorUpdate, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetValidatorUpdates", ctx) + ret0, _ := ret[0].([]types.ValidatorUpdate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetValidatorUpdates indicates an expected call of GetValidatorUpdates. +func (mr *MockStakingKeeperMockRecorder) GetValidatorUpdates(ctx any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorUpdates", reflect.TypeOf((*MockStakingKeeper)(nil).GetValidatorUpdates), ctx) +} + +// IterateLastValidatorPowers mocks base method. +func (m *MockStakingKeeper) IterateLastValidatorPowers(ctx context.Context, handler func(types0.ValAddress, int64) bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IterateLastValidatorPowers", ctx, handler) + ret0, _ := ret[0].(error) + return ret0 +} + +// IterateLastValidatorPowers indicates an expected call of IterateLastValidatorPowers. +func (mr *MockStakingKeeperMockRecorder) IterateLastValidatorPowers(ctx, handler any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateLastValidatorPowers", reflect.TypeOf((*MockStakingKeeper)(nil).IterateLastValidatorPowers), ctx, handler) +} diff --git a/x/pubkey/module.go b/x/pubkey/module.go index bd988453..9a52ac5d 100644 --- a/x/pubkey/module.go +++ b/x/pubkey/module.go @@ -66,7 +66,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesisState()) } -// ValidateGenesis performs genesis state validation for the wasm-storage module. +// ValidateGenesis performs genesis state validation for the pubkey module. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { @@ -139,7 +139,7 @@ func (am AppModule) BeginBlock(_ context.Context) error { return nil } -// EndBlock returns the end block logic for the wasm-storage module. -func (am AppModule) EndBlock(_ context.Context) error { - return nil +// EndBlock returns the end block logic for the pubkey module. +func (am AppModule) EndBlock(ctx context.Context) error { + return am.keeper.EndBlock(sdk.UnwrapSDKContext(ctx)) } diff --git a/x/pubkey/types/expected_keepers.go b/x/pubkey/types/expected_keepers.go index f65f1293..d69ed836 100644 --- a/x/pubkey/types/expected_keepers.go +++ b/x/pubkey/types/expected_keepers.go @@ -3,10 +3,18 @@ package types import ( "context" + abci "github.com/cometbft/cometbft/abci/types" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) type StakingKeeper interface { - GetValidator(ctx context.Context, addr sdk.ValAddress) (validator types.Validator, err error) + GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) + GetBondedValidatorsByPower(ctx context.Context) ([]stakingtypes.Validator, error) + GetValidatorUpdates(ctx context.Context) ([]abci.ValidatorUpdate, error) + IterateLastValidatorPowers(ctx context.Context, handler func(operator sdk.ValAddress, power int64) (stop bool)) error + GetLastTotalPower(ctx context.Context) (math.Int, error) } diff --git a/x/pubkey/types/genesis.go b/x/pubkey/types/genesis.go index 16990410..287bbe3e 100644 --- a/x/pubkey/types/genesis.go +++ b/x/pubkey/types/genesis.go @@ -4,15 +4,15 @@ import ( fmt "fmt" ) -func NewGenesisState(valPubKeys []ValidatorPubKeys) GenesisState { - return GenesisState{ - ValidatorPubKeys: valPubKeys, - } -} - func DefaultGenesisState() *GenesisState { - state := NewGenesisState(nil) - return &state + return &GenesisState{ + ProvingSchemes: []ProvingScheme{ + { + Index: 0, // TODO resolve import cycle for uint32(utils.SEDAKeyIndexSecp256k1), + IsEnabled: false, + }, + }, + } } func ValidateGenesis(data GenesisState) error { diff --git a/x/pubkey/types/genesis.pb.go b/x/pubkey/types/genesis.pb.go index 4e354956..14204f6f 100644 --- a/x/pubkey/types/genesis.pb.go +++ b/x/pubkey/types/genesis.pb.go @@ -27,6 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines pubkey module's genesis state. type GenesisState struct { ValidatorPubKeys []ValidatorPubKeys `protobuf:"bytes,1,rep,name=validator_pub_keys,json=validatorPubKeys,proto3" json:"validator_pub_keys"` + ProvingSchemes []ProvingScheme `protobuf:"bytes,2,rep,name=proving_schemes,json=provingSchemes,proto3" json:"proving_schemes"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,6 +70,13 @@ func (m *GenesisState) GetValidatorPubKeys() []ValidatorPubKeys { return nil } +func (m *GenesisState) GetProvingSchemes() []ProvingScheme { + if m != nil { + return m.ProvingSchemes + } + return nil +} + // ValidatorPubKeys defines a validator's list of registered public keys // primarily used in the x/pubkey genesis state. type ValidatorPubKeys struct { @@ -123,36 +131,94 @@ func (m *ValidatorPubKeys) GetIndexedPubKeys() []IndexedPubKey { return nil } +// ProvingScheme defines the status of a proving scheme. +type ProvingScheme struct { + Index uint32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + IsEnabled bool `protobuf:"varint,2,opt,name=is_enabled,json=isEnabled,proto3" json:"is_enabled,omitempty"` +} + +func (m *ProvingScheme) Reset() { *m = ProvingScheme{} } +func (m *ProvingScheme) String() string { return proto.CompactTextString(m) } +func (*ProvingScheme) ProtoMessage() {} +func (*ProvingScheme) Descriptor() ([]byte, []int) { + return fileDescriptor_a68b70401eeae88a, []int{2} +} +func (m *ProvingScheme) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProvingScheme) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProvingScheme.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 *ProvingScheme) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProvingScheme.Merge(m, src) +} +func (m *ProvingScheme) XXX_Size() int { + return m.Size() +} +func (m *ProvingScheme) XXX_DiscardUnknown() { + xxx_messageInfo_ProvingScheme.DiscardUnknown(m) +} + +var xxx_messageInfo_ProvingScheme proto.InternalMessageInfo + +func (m *ProvingScheme) GetIndex() uint32 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *ProvingScheme) GetIsEnabled() bool { + if m != nil { + return m.IsEnabled + } + return false +} + func init() { proto.RegisterType((*GenesisState)(nil), "sedachain.pubkey.v1.GenesisState") proto.RegisterType((*ValidatorPubKeys)(nil), "sedachain.pubkey.v1.ValidatorPubKeys") + proto.RegisterType((*ProvingScheme)(nil), "sedachain.pubkey.v1.ProvingScheme") } func init() { proto.RegisterFile("sedachain/pubkey/v1/genesis.proto", fileDescriptor_a68b70401eeae88a) } var fileDescriptor_a68b70401eeae88a = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x4e, 0x4d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x28, 0x4d, 0xca, 0x4e, 0xad, 0xd4, 0x2f, 0x33, 0xd4, - 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, - 0x2b, 0xd1, 0x83, 0x28, 0xd1, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, - 0x83, 0x58, 0x10, 0xa5, 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x10, 0x09, 0x08, - 0x07, 0x2a, 0xa5, 0x80, 0xcd, 0x22, 0xa8, 0x79, 0x60, 0x15, 0x4a, 0x99, 0x5c, 0x3c, 0xee, 0x10, - 0x8b, 0x83, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x22, 0xb9, 0x84, 0xca, 0x12, 0x73, 0x32, 0x53, 0x12, - 0x4b, 0xf2, 0x8b, 0xe2, 0x0b, 0x4a, 0x93, 0xe2, 0xb3, 0x53, 0x2b, 0x8b, 0x25, 0x18, 0x15, 0x98, - 0x35, 0xb8, 0x8d, 0x54, 0xf5, 0xb0, 0x38, 0x4a, 0x2f, 0x0c, 0xa6, 0x3c, 0xa0, 0x34, 0xc9, 0x3b, - 0xb5, 0xb2, 0xd8, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0x81, 0x32, 0x34, 0x71, 0xa5, 0x0d, - 0x8c, 0x5c, 0x02, 0xe8, 0x8a, 0x85, 0x3c, 0xb8, 0xf8, 0x10, 0xf6, 0x25, 0xa6, 0xa4, 0x14, 0x49, - 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0x29, 0x5e, 0xda, 0xa2, 0x2b, 0x0b, 0xf5, 0x0b, 0x5c, 0x93, - 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x6f, 0x19, - 0xb2, 0xb8, 0x50, 0x10, 0x97, 0x40, 0x66, 0x5e, 0x4a, 0x6a, 0x45, 0x6a, 0x0a, 0xc2, 0xdd, 0x4c, - 0x60, 0x77, 0x2b, 0x61, 0x75, 0xb7, 0x27, 0x44, 0x31, 0xc4, 0x21, 0x50, 0x47, 0xf3, 0x65, 0x22, - 0x0b, 0x16, 0x3b, 0x79, 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, 0x61, - 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, 0x74, 0x70, 0x68, 0x26, - 0xe7, 0xe7, 0x80, 0x39, 0xba, 0x90, 0x20, 0xaf, 0x80, 0x05, 0x7a, 0x49, 0x65, 0x41, 0x6a, 0x71, - 0x12, 0x1b, 0x58, 0x8d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x95, 0x37, 0xd4, 0xb9, 0xfe, 0x01, - 0x00, 0x00, + // 397 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xcf, 0xae, 0xd2, 0x40, + 0x14, 0xc6, 0x3b, 0xf8, 0x27, 0x32, 0x0a, 0x92, 0x91, 0x45, 0x25, 0xa1, 0x96, 0x26, 0x26, 0x6c, + 0x68, 0x83, 0x3e, 0x81, 0x44, 0xa3, 0x86, 0x0d, 0x96, 0xc4, 0x44, 0x37, 0x4d, 0xdb, 0x99, 0x94, + 0x09, 0xd0, 0x69, 0x7a, 0xda, 0x86, 0xbe, 0x85, 0x8f, 0xe2, 0xc2, 0xa5, 0x0f, 0xc0, 0x92, 0xb8, + 0x72, 0x75, 0x73, 0x03, 0x2f, 0x72, 0xc3, 0x4c, 0xf9, 0x73, 0x09, 0xb9, 0xbb, 0x9e, 0xef, 0xfc, + 0xfa, 0x9d, 0x6f, 0x66, 0x0e, 0xee, 0x01, 0xa3, 0x7e, 0x38, 0xf3, 0x79, 0xec, 0x24, 0x79, 0x30, + 0x67, 0xa5, 0x53, 0x0c, 0x9d, 0x88, 0xc5, 0x0c, 0x38, 0xd8, 0x49, 0x2a, 0x32, 0x41, 0x5e, 0x1d, + 0x11, 0x5b, 0x21, 0x76, 0x31, 0xec, 0xb4, 0x23, 0x11, 0x09, 0xd9, 0x77, 0xf6, 0x5f, 0x0a, 0xed, + 0xbc, 0x0e, 0x05, 0x2c, 0x05, 0x78, 0xaa, 0xa1, 0x8a, 0xaa, 0x65, 0x5e, 0x1b, 0x54, 0xf9, 0x49, + 0xc2, 0xfa, 0x8b, 0xf0, 0x8b, 0xcf, 0x6a, 0xf2, 0x34, 0xf3, 0x33, 0x46, 0x7e, 0x60, 0x52, 0xf8, + 0x0b, 0x4e, 0xfd, 0x4c, 0xa4, 0x5e, 0x92, 0x07, 0xde, 0x9c, 0x95, 0xa0, 0x23, 0xf3, 0x51, 0xff, + 0xf9, 0xbb, 0xb7, 0xf6, 0x95, 0x54, 0xf6, 0xf7, 0x03, 0x3e, 0xc9, 0x83, 0x31, 0x2b, 0x61, 0xf4, + 0x78, 0x7d, 0xf3, 0x46, 0x73, 0x5b, 0xc5, 0x85, 0x4e, 0xbe, 0xe1, 0x97, 0x49, 0x2a, 0x0a, 0x1e, + 0x47, 0x1e, 0x84, 0x33, 0xb6, 0x64, 0xa0, 0xd7, 0xa4, 0xaf, 0x75, 0xd5, 0x77, 0xa2, 0xd8, 0xa9, + 0x44, 0x2b, 0xd3, 0x66, 0x72, 0x2e, 0x82, 0xf5, 0x1b, 0xe1, 0xd6, 0xe5, 0x7c, 0xf2, 0x05, 0x37, + 0x4f, 0x47, 0xf0, 0x29, 0x4d, 0x75, 0x64, 0xa2, 0x7e, 0x7d, 0xd4, 0xfb, 0xf7, 0x67, 0xd0, 0xad, + 0xee, 0xe7, 0xf8, 0xd3, 0x07, 0x4a, 0x53, 0x06, 0x30, 0xcd, 0x52, 0x1e, 0x47, 0x6e, 0xa3, 0x38, + 0xd7, 0x89, 0x8b, 0x5b, 0x3c, 0xa6, 0x6c, 0xc5, 0xe8, 0xe9, 0x2a, 0x1e, 0x8a, 0xfc, 0x55, 0xc1, + 0x2a, 0xc8, 0x21, 0x32, 0x3f, 0x17, 0xc1, 0xfa, 0x88, 0x1b, 0xf7, 0x4e, 0x46, 0xda, 0xf8, 0x89, + 0x44, 0x64, 0xca, 0x86, 0xab, 0x0a, 0xd2, 0xc5, 0x98, 0x83, 0xc7, 0x62, 0x3f, 0x58, 0x30, 0xaa, + 0xd7, 0x4c, 0xd4, 0x7f, 0xe6, 0xd6, 0x39, 0x7c, 0x52, 0xc2, 0x68, 0xbc, 0xde, 0x1a, 0x68, 0xb3, + 0x35, 0xd0, 0xed, 0xd6, 0x40, 0xbf, 0x76, 0x86, 0xb6, 0xd9, 0x19, 0xda, 0xff, 0x9d, 0xa1, 0xfd, + 0x1c, 0x46, 0x3c, 0x9b, 0xe5, 0x81, 0x1d, 0x8a, 0xa5, 0xb3, 0xcf, 0x28, 0xdf, 0x39, 0x14, 0x0b, + 0x59, 0x0c, 0xd4, 0x32, 0xac, 0x0e, 0xeb, 0x90, 0x95, 0x09, 0x83, 0xe0, 0xa9, 0x64, 0xde, 0xdf, + 0x05, 0x00, 0x00, 0xff, 0xff, 0x36, 0x7b, 0x80, 0x95, 0x98, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -175,6 +241,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ProvingSchemes) > 0 { + for iNdEx := len(m.ProvingSchemes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProvingSchemes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } if len(m.ValidatorPubKeys) > 0 { for iNdEx := len(m.ValidatorPubKeys) - 1; iNdEx >= 0; iNdEx-- { { @@ -236,6 +316,44 @@ func (m *ValidatorPubKeys) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ProvingScheme) 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 *ProvingScheme) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProvingScheme) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsEnabled { + i-- + if m.IsEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Index != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -259,6 +377,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.ProvingSchemes) > 0 { + for _, e := range m.ProvingSchemes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -281,6 +405,21 @@ func (m *ValidatorPubKeys) Size() (n int) { return n } +func (m *ProvingScheme) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovGenesis(uint64(m.Index)) + } + if m.IsEnabled { + n += 2 + } + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -350,6 +489,40 @@ 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 ProvingSchemes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProvingSchemes = append(m.ProvingSchemes, ProvingScheme{}) + if err := m.ProvingSchemes[len(m.ProvingSchemes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -487,6 +660,95 @@ func (m *ValidatorPubKeys) Unmarshal(dAtA []byte) error { } return nil } +func (m *ProvingScheme) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProvingScheme: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProvingScheme: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/pubkey/types/keys.go b/x/pubkey/types/keys.go index bf1c278a..60bb27cf 100644 --- a/x/pubkey/types/keys.go +++ b/x/pubkey/types/keys.go @@ -7,4 +7,7 @@ const ( StoreKey ) -var PubKeysPrefix = collections.NewPrefix(0) +var ( + PubKeysPrefix = collections.NewPrefix(0) + ProvingSchemesPrefix = collections.NewPrefix(1) +) diff --git a/x/pubkey/types/query.pb.go b/x/pubkey/types/query.pb.go index 9fb1dfc3..1addf290 100644 --- a/x/pubkey/types/query.pb.go +++ b/x/pubkey/types/query.pb.go @@ -30,8 +30,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryValidatorKeysRequest is request type for the Query/ValidatorKeys RPC -// method. +// QueryValidatorKeysRequest is request type for the Query/ValidatorKeys +// RPC method. type QueryValidatorKeysRequest struct { ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` } @@ -76,8 +76,8 @@ func (m *QueryValidatorKeysRequest) GetValidatorAddr() string { return "" } -// QueryValidatorKeysResponse is response type for the Query/ValidatorKeys RPC -// method. +// QueryValidatorKeysResponse is response type for the Query/ValidatorKeys +// RPC method. type QueryValidatorKeysResponse struct { ValidatorPubKeys ValidatorPubKeys `protobuf:"bytes,1,opt,name=validator_pub_keys,json=validatorPubKeys,proto3" json:"validator_pub_keys"` } @@ -122,39 +122,130 @@ func (m *QueryValidatorKeysResponse) GetValidatorPubKeys() ValidatorPubKeys { return ValidatorPubKeys{} } +// QueryProvingSchemesRequest is request type for the Query/ProvingSchemes +// RPC method. +type QueryProvingSchemesRequest struct { +} + +func (m *QueryProvingSchemesRequest) Reset() { *m = QueryProvingSchemesRequest{} } +func (m *QueryProvingSchemesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProvingSchemesRequest) ProtoMessage() {} +func (*QueryProvingSchemesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ab5fa3182b3fb474, []int{2} +} +func (m *QueryProvingSchemesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProvingSchemesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProvingSchemesRequest.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 *QueryProvingSchemesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProvingSchemesRequest.Merge(m, src) +} +func (m *QueryProvingSchemesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProvingSchemesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProvingSchemesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProvingSchemesRequest proto.InternalMessageInfo + +// QueryProvingSchemesResponse is response type for the Query/ProvingSchemes +// RPC method. +type QueryProvingSchemesResponse struct { + ProvingSchemes []ProvingScheme `protobuf:"bytes,1,rep,name=proving_schemes,json=provingSchemes,proto3" json:"proving_schemes"` +} + +func (m *QueryProvingSchemesResponse) Reset() { *m = QueryProvingSchemesResponse{} } +func (m *QueryProvingSchemesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProvingSchemesResponse) ProtoMessage() {} +func (*QueryProvingSchemesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ab5fa3182b3fb474, []int{3} +} +func (m *QueryProvingSchemesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProvingSchemesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProvingSchemesResponse.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 *QueryProvingSchemesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProvingSchemesResponse.Merge(m, src) +} +func (m *QueryProvingSchemesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProvingSchemesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProvingSchemesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProvingSchemesResponse proto.InternalMessageInfo + +func (m *QueryProvingSchemesResponse) GetProvingSchemes() []ProvingScheme { + if m != nil { + return m.ProvingSchemes + } + return nil +} + func init() { proto.RegisterType((*QueryValidatorKeysRequest)(nil), "sedachain.pubkey.v1.QueryValidatorKeysRequest") proto.RegisterType((*QueryValidatorKeysResponse)(nil), "sedachain.pubkey.v1.QueryValidatorKeysResponse") + proto.RegisterType((*QueryProvingSchemesRequest)(nil), "sedachain.pubkey.v1.QueryProvingSchemesRequest") + proto.RegisterType((*QueryProvingSchemesResponse)(nil), "sedachain.pubkey.v1.QueryProvingSchemesResponse") } func init() { proto.RegisterFile("sedachain/pubkey/v1/query.proto", fileDescriptor_ab5fa3182b3fb474) } var fileDescriptor_ab5fa3182b3fb474 = []byte{ - // 375 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2f, 0x4e, 0x4d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x2f, 0x28, 0x4d, 0xca, 0x4e, 0xad, 0xd4, 0x2f, 0x33, 0xd4, - 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0x2b, 0xd0, - 0x83, 0x28, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, - 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0x68, 0x91, - 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x33, 0xf5, 0x41, 0x2c, 0xa8, 0xa8, 0x64, 0x72, 0x7e, 0x71, - 0x6e, 0x7e, 0x71, 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x4a, 0x29, 0x62, 0x73, 0x44, 0x7a, 0x6a, 0x5e, - 0x6a, 0x71, 0x26, 0x54, 0x89, 0x52, 0x2a, 0x97, 0x64, 0x20, 0xc8, 0x55, 0x61, 0x89, 0x39, 0x99, - 0x29, 0x89, 0x25, 0xf9, 0x45, 0xde, 0xa9, 0x95, 0xc5, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, - 0x42, 0x1e, 0x5c, 0x7c, 0x65, 0x30, 0xf1, 0xf8, 0xc4, 0x94, 0x94, 0x22, 0x09, 0x46, 0x05, 0x46, - 0x0d, 0x4e, 0x27, 0xc5, 0x4b, 0x5b, 0x74, 0x65, 0xa1, 0x36, 0xc1, 0x35, 0x3a, 0xa6, 0xa4, 0x14, - 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0xf1, 0x96, 0x21, 0x8b, 0x2b, 0x95, - 0x73, 0x49, 0x61, 0xb3, 0xa6, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x28, 0x92, 0x4b, 0x08, 0x61, - 0x4f, 0x41, 0x69, 0x52, 0x7c, 0x76, 0x6a, 0x65, 0x31, 0xd8, 0x2e, 0x6e, 0x23, 0x55, 0x3d, 0x2c, - 0x01, 0x85, 0xb0, 0x35, 0xa0, 0x34, 0x09, 0x64, 0x94, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, - 0x02, 0x65, 0x68, 0xe2, 0x46, 0xdb, 0x18, 0xb9, 0x58, 0xc1, 0x36, 0x0b, 0xad, 0x61, 0xe4, 0xe2, - 0x45, 0xb1, 0x5e, 0x48, 0x0f, 0xab, 0xd1, 0x38, 0x83, 0x43, 0x4a, 0x9f, 0x68, 0xf5, 0x10, 0x7f, - 0x29, 0x59, 0x35, 0x5d, 0x7e, 0x32, 0x99, 0xc9, 0x44, 0xc8, 0x48, 0x1f, 0xa4, 0x51, 0x17, 0x35, - 0x26, 0xe0, 0x1e, 0x06, 0x79, 0x56, 0xbf, 0x1a, 0x35, 0xa0, 0x6b, 0x9d, 0xbc, 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, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, - 0x39, 0x3f, 0x17, 0x6c, 0x2e, 0x38, 0x22, 0x93, 0xf3, 0x73, 0x90, 0x2d, 0xa9, 0x80, 0x59, 0x53, - 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x56, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x4a, - 0x35, 0xb0, 0x7e, 0x96, 0x02, 0x00, 0x00, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcb, 0x6e, 0xd4, 0x30, + 0x14, 0x9d, 0x94, 0x87, 0x84, 0xab, 0x0e, 0xc8, 0xb0, 0x68, 0x43, 0x49, 0xdb, 0x08, 0xa4, 0x0a, + 0xa9, 0x31, 0x33, 0xb0, 0x62, 0xc7, 0xac, 0x90, 0xba, 0x69, 0xa7, 0x12, 0x12, 0x6c, 0xa2, 0x3c, + 0xae, 0x3c, 0x56, 0x67, 0x6c, 0x37, 0x76, 0x02, 0x11, 0x62, 0xc3, 0x17, 0x20, 0xf1, 0x01, 0xfc, + 0x00, 0x4b, 0x3e, 0xa2, 0xcb, 0x0a, 0x36, 0x5d, 0x21, 0x34, 0xc3, 0x87, 0xa0, 0x24, 0x9e, 0x69, + 0x53, 0x99, 0x6a, 0x76, 0xf6, 0xbd, 0xe7, 0x9e, 0x73, 0x7c, 0xae, 0xd1, 0x96, 0x82, 0x34, 0x4a, + 0x46, 0x11, 0xe3, 0x44, 0xe6, 0xf1, 0x31, 0x94, 0xa4, 0xe8, 0x91, 0x93, 0x1c, 0xb2, 0x32, 0x90, + 0x99, 0xd0, 0x02, 0xdf, 0x5f, 0x00, 0x82, 0x06, 0x10, 0x14, 0x3d, 0x77, 0x93, 0x0a, 0x41, 0xc7, + 0x40, 0x22, 0xc9, 0x48, 0xc4, 0xb9, 0xd0, 0x91, 0x66, 0x82, 0xab, 0x66, 0xc4, 0x7d, 0x40, 0x05, + 0x15, 0xf5, 0x91, 0x54, 0x27, 0x53, 0xdd, 0x48, 0x84, 0x9a, 0x08, 0x15, 0x36, 0x8d, 0xe6, 0x62, + 0x5a, 0x3b, 0x36, 0x13, 0x14, 0x38, 0x28, 0x66, 0x20, 0x3e, 0xa0, 0x8d, 0xc3, 0xca, 0xd5, 0x9b, + 0x68, 0xcc, 0xd2, 0x48, 0x8b, 0x6c, 0x1f, 0x4a, 0x35, 0x84, 0x93, 0x1c, 0x94, 0xc6, 0xaf, 0x51, + 0xb7, 0x98, 0xd7, 0xc3, 0x28, 0x4d, 0xb3, 0x75, 0x67, 0xdb, 0xd9, 0xbd, 0x33, 0xd8, 0xf9, 0xf9, + 0x63, 0xef, 0x91, 0x51, 0x5a, 0x0c, 0xbe, 0x4a, 0xd3, 0x0c, 0x94, 0x3a, 0xd2, 0x19, 0xe3, 0x74, + 0xb8, 0x56, 0x5c, 0xae, 0xfb, 0xef, 0x91, 0x6b, 0x93, 0x51, 0x52, 0x70, 0x05, 0xf8, 0x2d, 0xc2, + 0x17, 0x3a, 0x32, 0x8f, 0xc3, 0x63, 0x28, 0x55, 0xad, 0xb5, 0xda, 0x7f, 0x12, 0x58, 0x82, 0xba, + 0x50, 0x3d, 0xc8, 0xe3, 0x8a, 0x6a, 0x70, 0xf3, 0xf4, 0xf7, 0x56, 0x67, 0x78, 0xaf, 0xb8, 0x52, + 0xf7, 0x37, 0x8d, 0xf0, 0x41, 0x26, 0x0a, 0xc6, 0xe9, 0x51, 0x32, 0x82, 0x09, 0xcc, 0x1f, 0xe8, + 0x4b, 0xf4, 0xd0, 0xda, 0x35, 0xbe, 0x0e, 0xd1, 0x5d, 0xd9, 0x74, 0x42, 0xd5, 0xb4, 0xd6, 0x9d, + 0xed, 0x1b, 0xbb, 0xab, 0x7d, 0xdf, 0x6a, 0xaa, 0xc5, 0x62, 0x1c, 0x75, 0x65, 0x8b, 0xba, 0x7f, + 0xbe, 0x82, 0x6e, 0xd5, 0x92, 0xf8, 0xbb, 0x83, 0xd6, 0x5a, 0x71, 0xe0, 0xc0, 0xca, 0xfa, 0xdf, + 0xf5, 0xb8, 0x64, 0x69, 0x7c, 0xf3, 0x1e, 0xff, 0xe5, 0xe7, 0x5f, 0x7f, 0xbf, 0xae, 0xbc, 0xc0, + 0x7d, 0x52, 0x0d, 0xee, 0xb5, 0x7f, 0xc6, 0x62, 0x01, 0x55, 0xf8, 0xe4, 0x63, 0x7b, 0xf1, 0x9f, + 0xf0, 0x37, 0x07, 0x75, 0xdb, 0x31, 0xe1, 0x6b, 0xf4, 0xad, 0x71, 0xbb, 0xcf, 0x96, 0x1f, 0x30, + 0x8e, 0x9f, 0xd6, 0x8e, 0x1f, 0x63, 0xdf, 0xe2, 0xf8, 0xca, 0x6a, 0x06, 0xfb, 0xa7, 0x53, 0xcf, + 0x39, 0x9b, 0x7a, 0xce, 0x9f, 0xa9, 0xe7, 0x7c, 0x99, 0x79, 0x9d, 0xb3, 0x99, 0xd7, 0x39, 0x9f, + 0x79, 0x9d, 0x77, 0x3d, 0xca, 0xf4, 0x28, 0x8f, 0x83, 0x44, 0x4c, 0x6a, 0x9e, 0xfa, 0xeb, 0x27, + 0x62, 0x7c, 0x99, 0xf4, 0xc3, 0x9c, 0x56, 0x97, 0x12, 0x54, 0x7c, 0xbb, 0xc6, 0x3c, 0xff, 0x17, + 0x00, 0x00, 0xff, 0xff, 0x62, 0x3d, 0x2a, 0x11, 0xc8, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -171,6 +262,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // ValidatorKeys returns a given validator's registered keys. ValidatorKeys(ctx context.Context, in *QueryValidatorKeysRequest, opts ...grpc.CallOption) (*QueryValidatorKeysResponse, error) + // ProvingSchemes returns the statuses of the SEDA proving schemes. + ProvingSchemes(ctx context.Context, in *QueryProvingSchemesRequest, opts ...grpc.CallOption) (*QueryProvingSchemesResponse, error) } type queryClient struct { @@ -190,10 +283,21 @@ func (c *queryClient) ValidatorKeys(ctx context.Context, in *QueryValidatorKeysR return out, nil } +func (c *queryClient) ProvingSchemes(ctx context.Context, in *QueryProvingSchemesRequest, opts ...grpc.CallOption) (*QueryProvingSchemesResponse, error) { + out := new(QueryProvingSchemesResponse) + err := c.cc.Invoke(ctx, "/sedachain.pubkey.v1.Query/ProvingSchemes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ValidatorKeys returns a given validator's registered keys. ValidatorKeys(context.Context, *QueryValidatorKeysRequest) (*QueryValidatorKeysResponse, error) + // ProvingSchemes returns the statuses of the SEDA proving schemes. + ProvingSchemes(context.Context, *QueryProvingSchemesRequest) (*QueryProvingSchemesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -203,6 +307,9 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) ValidatorKeys(ctx context.Context, req *QueryValidatorKeysRequest) (*QueryValidatorKeysResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ValidatorKeys not implemented") } +func (*UnimplementedQueryServer) ProvingSchemes(ctx context.Context, req *QueryProvingSchemesRequest) (*QueryProvingSchemesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProvingSchemes not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -226,6 +333,24 @@ func _Query_ValidatorKeys_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Query_ProvingSchemes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProvingSchemesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ProvingSchemes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/sedachain.pubkey.v1.Query/ProvingSchemes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ProvingSchemes(ctx, req.(*QueryProvingSchemesRequest)) + } + return interceptor(ctx, in, info, handler) +} + var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "sedachain.pubkey.v1.Query", @@ -235,6 +360,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ValidatorKeys", Handler: _Query_ValidatorKeys_Handler, }, + { + MethodName: "ProvingSchemes", + Handler: _Query_ProvingSchemes_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sedachain/pubkey/v1/query.proto", @@ -303,6 +432,66 @@ func (m *QueryValidatorKeysResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryProvingSchemesRequest) 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 *QueryProvingSchemesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProvingSchemesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryProvingSchemesResponse) 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 *QueryProvingSchemesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProvingSchemesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProvingSchemes) > 0 { + for iNdEx := len(m.ProvingSchemes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProvingSchemes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -338,6 +527,30 @@ func (m *QueryValidatorKeysResponse) Size() (n int) { return n } +func (m *QueryProvingSchemesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryProvingSchemesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ProvingSchemes) > 0 { + for _, e := range m.ProvingSchemes { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -509,6 +722,140 @@ func (m *QueryValidatorKeysResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryProvingSchemesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProvingSchemesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProvingSchemesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProvingSchemesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProvingSchemesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProvingSchemesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProvingSchemes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProvingSchemes = append(m.ProvingSchemes, ProvingScheme{}) + if err := m.ProvingSchemes[len(m.ProvingSchemes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/pubkey/types/query.pb.gw.go b/x/pubkey/types/query.pb.gw.go index b1834c49..e04995c0 100644 --- a/x/pubkey/types/query.pb.gw.go +++ b/x/pubkey/types/query.pb.gw.go @@ -87,6 +87,24 @@ func local_request_Query_ValidatorKeys_0(ctx context.Context, marshaler runtime. } +func request_Query_ProvingSchemes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProvingSchemesRequest + var metadata runtime.ServerMetadata + + msg, err := client.ProvingSchemes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ProvingSchemes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProvingSchemesRequest + var metadata runtime.ServerMetadata + + msg, err := server.ProvingSchemes(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -116,6 +134,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ProvingSchemes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ProvingSchemes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ProvingSchemes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -177,13 +218,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ProvingSchemes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ProvingSchemes_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ProvingSchemes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_ValidatorKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"seda-chain", "pubkey", "validator_keys", "validator_addr"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ProvingSchemes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"seda-chain", "pubkey", "proving_schemes"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_ValidatorKeys_0 = runtime.ForwardResponseMessage + + forward_Query_ProvingSchemes_0 = runtime.ForwardResponseMessage )