diff --git a/app/app.go b/app/app.go index 3d3581b70..74b9b7164 100644 --- a/app/app.go +++ b/app/app.go @@ -96,6 +96,8 @@ import ( capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" crontypes "github.com/scrtlabs/SecretNetwork/x/cron/types" + tssabci "github.com/scrtlabs/SecretNetwork/x/tss/abci" + tsstypes "github.com/scrtlabs/SecretNetwork/x/tss/types" "cosmossdk.io/log" upgradetypes "cosmossdk.io/x/upgrade/types" @@ -347,6 +349,23 @@ func NewSecretNetworkApp( app.AppKeepers.CronKeeper.SetTxConfig(txConfig) app.AppKeepers.InitCustomKeepers(appCodec, legacyAmino, bApp, bootstrap, homePath, computeConfig) + + // Set up TSS module integrations + // 1. Connect TSS keeper to compute keeper for contract callbacks + app.AppKeepers.TssKeeper.SetWasmKeeper(app.AppKeepers.ComputeKeeper) + + // 2. Set up TSS vote extension handlers for validator participation in DKG/signing + tssVoteExtHandler := tssabci.NewVoteExtensionHandler(app.AppKeepers.TssKeeper, logger) + tssProposalHandler := tssabci.NewProposalHandler(app.AppKeepers.TssKeeper, logger) + + bApp.SetExtendVoteHandler(tssVoteExtHandler.ExtendVote) + bApp.SetVerifyVoteExtensionHandler(tssVoteExtHandler.VerifyVoteExtension) + bApp.SetPrepareProposal(tssProposalHandler.PrepareProposal) + bApp.SetProcessProposal(tssProposalHandler.ProcessProposal) + + // 3. Load validator identity from priv_validator_key.json for TSS participation + app.loadValidatorIdentity(homePath) + app.setupUpgradeStoreLoaders() // NOTE: Any module instantiated in the module manager that is later modified @@ -673,6 +692,7 @@ func SetOrderBeginBlockers(app *SecretNetworkApp) { ibcswitchtypes.ModuleName, crontypes.ModuleName, circuittypes.ModuleName, + tsstypes.ModuleName, // TSS processes pending data from vote extensions ) } @@ -707,6 +727,7 @@ func SetOrderInitGenesis(app *SecretNetworkApp) { feegrant.ModuleName, crontypes.ModuleName, circuittypes.ModuleName, + tsstypes.ModuleName, ) } @@ -733,9 +754,59 @@ func SetOrderEndBlockers(app *SecretNetworkApp) { ibcfeetypes.ModuleName, packetforwardtypes.ModuleName, compute.ModuleName, + tsstypes.ModuleName, // TSS EndBlocker MUST come after compute for contract callbacks reg.ModuleName, ibcswitchtypes.ModuleName, crontypes.ModuleName, circuittypes.ModuleName, ) } + +// loadValidatorIdentity reads the validator's private key from priv_validator_key.json +// and sets it on the TSS keeper for participation in threshold signing +func (app *SecretNetworkApp) loadValidatorIdentity(homePath string) { + privValKeyFile := filepath.Join(homePath, "config", "priv_validator_key.json") + + // Check if file exists + if _, err := os.Stat(privValKeyFile); os.IsNotExist(err) { + // Not a validator node, skip + return + } + + // Read the file + keyFileBytes, err := os.ReadFile(privValKeyFile) + if err != nil { + fmt.Fprintf(os.Stderr, "Warning: Failed to read priv_validator_key.json for TSS: %v\n", err) + return + } + + // Parse the JSON + var keyData struct { + Address string `json:"address"` + PubKey struct { + Type string `json:"type"` + Value string `json:"value"` + } `json:"pub_key"` + PrivKey struct { + Type string `json:"type"` + Value string `json:"value"` + } `json:"priv_key"` + } + + if err := tmjson.Unmarshal(keyFileBytes, &keyData); err != nil { + fmt.Fprintf(os.Stderr, "Warning: Failed to parse priv_validator_key.json for TSS: %v\n", err) + return + } + + // Decode the private key (base64 encoded) + privKeyBytes, err := base64.StdEncoding.DecodeString(keyData.PrivKey.Value) + if err != nil { + fmt.Fprintf(os.Stderr, "Warning: Failed to decode validator private key for TSS: %v\n", err) + return + } + + // Set validator identity on TSS keeper + // Address is already in hex format + app.AppKeepers.TssKeeper.SetValidatorConsensusAddress(keyData.Address) + app.AppKeepers.TssKeeper.SetValidatorPrivateKey(privKeyBytes) +} diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 2242d2ffc..6d40b8df9 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -60,6 +60,9 @@ import ( reg "github.com/scrtlabs/SecretNetwork/x/registration" + tsskeeper "github.com/scrtlabs/SecretNetwork/x/tss/keeper" + tsstypes "github.com/scrtlabs/SecretNetwork/x/tss/types" + ibcpacketforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/keeper" ibcpacketforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types" @@ -119,6 +122,9 @@ type SecretAppKeepers struct { ConsensusParamsKeeper consensusparamkeeper.Keeper + // TSS (Threshold Signature Scheme) keeper for distributed key generation and signing + TssKeeper *tsskeeper.Keeper + // keys to access the substores keys map[string]*storetypes.KVStoreKey tKeys map[string]*storetypes.TransientStoreKey @@ -250,6 +256,16 @@ func (ak *SecretAppKeepers) InitSdkKeepers( ) ak.CronKeeper = cronKeeper + // Initialize TSS (Threshold Signature Scheme) keeper + tssKeeper := tsskeeper.NewKeeper( + runtime.NewKVStoreService(ak.keys[tsstypes.StoreKey]), + appCodec, + authcodec.NewBech32Codec(scrt.Bech32PrefixAccAddr), + authtypes.NewModuleAddress(govtypes.ModuleName), + ak.StakingKeeper, + ) + ak.TssKeeper = &tssKeeper + feegrantKeeper := feegrantkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(ak.keys[feegrant.StoreKey]), @@ -605,6 +621,7 @@ func (ak *SecretAppKeepers) InitKeys() { ibchookstypes.StoreKey, circuittypes.StoreKey, crontypes.StoreKey, + tsstypes.StoreKey, ) ak.tKeys = storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) diff --git a/app/modules.go b/app/modules.go index 905826cc0..d2a65b37b 100644 --- a/app/modules.go +++ b/app/modules.go @@ -43,6 +43,7 @@ import ( crontypes "github.com/scrtlabs/SecretNetwork/x/cron/types" ibcswitch "github.com/scrtlabs/SecretNetwork/x/emergencybutton" reg "github.com/scrtlabs/SecretNetwork/x/registration" + tssmodule "github.com/scrtlabs/SecretNetwork/x/tss/module" ) var ModuleAccountPermissions = map[string][]string{ @@ -92,5 +93,6 @@ func Modules( ibcfee.NewAppModule(app.AppKeepers.IbcFeeKeeper), ibcswitch.NewAppModule(app.AppKeepers.IbcSwitchKeeper, app.AppKeepers.GetSubspace(ibcswitch.ModuleName)), cron.NewAppModule(app.appCodec, *app.AppKeepers.CronKeeper), + tssmodule.NewAppModule(appCodec, *app.AppKeepers.TssKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper), } } diff --git a/go.mod b/go.mod index efe390012..dc5d0b143 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ replace ( cosmossdk.io/api => github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 + github.com/agl/ed25519 => github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.19-secret.0 github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4 github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 @@ -20,6 +21,7 @@ replace ( ) require ( + github.com/bnb-chain/tss-lib/v2 v2.0.2 github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-sdk v0.50.9 github.com/cosmos/go-bip39 v1.0.0 @@ -39,6 +41,7 @@ require ( github.com/spf13/pflag v1.0.6 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.10.0 + github.com/taurusgroup/frost-ed25519 v0.0.0-20210707140332-5abc84a4dba7 golang.org/x/crypto v0.33.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 gonum.org/v1/gonum v0.15.1 @@ -64,10 +67,12 @@ require ( cosmossdk.io/api v0.7.6 cosmossdk.io/client/v2 v2.0.0-beta.3 cosmossdk.io/collections v0.4.0 + cosmossdk.io/depinject v1.1.0 cosmossdk.io/math v1.4.0 cosmossdk.io/tools/confix v0.1.2 cosmossdk.io/x/circuit v0.1.1 cosmossdk.io/x/tx v0.13.7 + filippo.io/edwards25519 v1.1.0 github.com/btcsuite/btcutil v1.0.2 github.com/cometbft/cometbft-db v0.14.1 github.com/cosmos/cosmos-db v1.1.1 @@ -88,17 +93,17 @@ require ( cloud.google.com/go/compute/metadata v0.5.0 // indirect cloud.google.com/go/iam v1.1.9 // indirect cloud.google.com/go/storage v1.41.0 // indirect - cosmossdk.io/depinject v1.1.0 // indirect - filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/DataDog/datadog-go v3.2.0+incompatible // indirect github.com/DataDog/zstd v1.5.5 // indirect + github.com/agl/ed25519 v0.0.0-20200225211852-fd4d107ace12 // indirect github.com/aws/aws-sdk-go v1.44.224 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect @@ -120,6 +125,7 @@ require ( github.com/creachadair/tomledit v0.0.24 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v4 v4.2.0 // indirect @@ -153,10 +159,12 @@ require ( github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.4 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect @@ -170,6 +178,8 @@ require ( github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/ipfs/go-log v1.0.5 // indirect + github.com/ipfs/go-log/v2 v2.1.3 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.17.11 // indirect @@ -189,6 +199,8 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/otiai10/primes v0.0.0-20210501021515-f1b2be525a11 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -218,7 +230,9 @@ require ( go.opentelemetry.io/otel v1.24.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect + go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.21.0 // indirect golang.org/x/net v0.35.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect golang.org/x/sync v0.11.0 // indirect diff --git a/go.sum b/go.sum index c381967a1..59497a423 100644 --- a/go.sum +++ b/go.sum @@ -786,6 +786,7 @@ cosmossdk.io/x/feegrant v0.1.1/go.mod h1:2GjVVxX6G2fta8LWj7pC/ytHjryA6MHAJroBWHF cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= @@ -816,6 +817,8 @@ github.com/adlio/schema v1.3.6 h1:k1/zc2jNfeiZBA5aFTRy37jlBIuCkXCm0XmvpzCKI9I= github.com/adlio/schema v1.3.6/go.mod h1:qkxwLgPBd1FgLRHYVCmQT/rrBr3JH38J9LjmVzWNudg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -843,6 +846,7 @@ github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -855,21 +859,34 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2 github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bnb-chain/tss-lib/v2 v2.0.2 h1:dL2GJFCSYsYQ0bHkGll+hNM2JWsC1rxDmJJJQEmUy9g= +github.com/bnb-chain/tss-lib/v2 v2.0.2/go.mod h1:s4LRfEqj89DhfNb+oraW0dURt5LtOHWXb9Gtkghn0L8= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ= +github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= +github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -980,10 +997,15 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3 h1:l/lhv2aJCUignzls81+wvga0TFlyoZx8QxRMQgXpZik= +github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3/go.mod h1:AKpV6+wZ2MfPRJnTbQ6NPgWrKzbe9RCIlCF/FKzMtM8= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs= @@ -1274,6 +1296,8 @@ github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NM github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -1289,6 +1313,8 @@ github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYS github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= @@ -1340,7 +1366,12 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= +github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= +github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk= +github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1491,6 +1522,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= @@ -1507,12 +1539,22 @@ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/jsonindent v0.0.0-20171116142732-447bf004320b/go.mod h1:SXIpH2WO0dyF5YBc6Iq8jc8TEJYe1Fk2Rc1EVYUdIgY= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/otiai10/primes v0.0.0-20210501021515-f1b2be525a11 h1:7x5D/2dkkr27Tgh4WFuX+iCS6OzuE5YJoqJzeqM+5mc= +github.com/otiai10/primes v0.0.0-20210501021515-f1b2be525a11/go.mod h1:1DmRMnU78i/OVkMnHzvhXSi4p8IhYUmtLJWhyOavJc0= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -1681,6 +1723,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/taurusgroup/frost-ed25519 v0.0.0-20210707140332-5abc84a4dba7 h1:hUvSA2LcuXFrzcU/vDnomemN+trNt+KfrA3s28dfXDw= +github.com/taurusgroup/frost-ed25519 v0.0.0-20210707140332-5abc84a4dba7/go.mod h1:HvWEpeV7Nptyy1OAzxcb/DvYOhrFfzMUx0CFrzUgQbg= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= @@ -1697,6 +1741,7 @@ github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1745,19 +1790,28 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= +go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1851,6 +1905,7 @@ golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= diff --git a/proto/secret/tss/v1/genesis.proto b/proto/secret/tss/v1/genesis.proto new file mode 100644 index 000000000..76f714689 --- /dev/null +++ b/proto/secret/tss/v1/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package secret.tss.v1; + +import "gogoproto/gogo.proto"; +import "secret/tss/v1/types.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/scrtlabs/SecretNetwork/x/tss/types"; + +// GenesisState defines the TSS module genesis state +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated KeySet key_sets = 2; +} diff --git a/proto/secret/tss/v1/module.proto b/proto/secret/tss/v1/module.proto new file mode 100644 index 000000000..782218b31 --- /dev/null +++ b/proto/secret/tss/v1/module.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package secret.tss.v1; + +import "cosmos/app/v1alpha1/module.proto"; + +option go_package = "github.com/scrtlabs/SecretNetwork/x/tss/types"; + +// Module is the config object of the tss module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/scrtlabs/SecretNetwork/x/tss/module" + }; + + // authority defines the custom module authority. + // if not set, defaults to the governance module. + string authority = 1; +} diff --git a/proto/secret/tss/v1/query.proto b/proto/secret/tss/v1/query.proto new file mode 100644 index 000000000..0c273c2f3 --- /dev/null +++ b/proto/secret/tss/v1/query.proto @@ -0,0 +1,118 @@ +syntax = "proto3"; +package secret.tss.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "secret/tss/v1/types.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +option go_package = "github.com/scrtlabs/SecretNetwork/x/tss/types"; + +// Query defines the gRPC query service +service Query { + // Params queries module parameters + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/secret/tss/v1/params"; + } + + // KeySet queries a KeySet by ID + rpc KeySet(QueryKeySetRequest) returns (QueryKeySetResponse) { + option (google.api.http).get = "/secret/tss/v1/keyset/{id}"; + } + + // AllKeySets queries all KeySets + rpc AllKeySets(QueryAllKeySetsRequest) returns (QueryAllKeySetsResponse) { + option (google.api.http).get = "/secret/tss/v1/keysets"; + } + + // DKGSession queries a DKG session by ID + rpc DKGSession(QueryDKGSessionRequest) returns (QueryDKGSessionResponse) { + option (google.api.http).get = "/secret/tss/v1/dkg/{session_id}"; + } + + // AllDKGSessions queries all DKG sessions + rpc AllDKGSessions(QueryAllDKGSessionsRequest) returns (QueryAllDKGSessionsResponse) { + option (google.api.http).get = "/secret/tss/v1/dkg"; + } + + // SigningRequest queries a signing request by ID + rpc SigningRequest(QuerySigningRequestRequest) returns (QuerySigningRequestResponse) { + option (google.api.http).get = "/secret/tss/v1/signing/{request_id}"; + } + + // AllSigningRequests queries all signing requests + rpc AllSigningRequests(QueryAllSigningRequestsRequest) returns (QueryAllSigningRequestsResponse) { + option (google.api.http).get = "/secret/tss/v1/signing"; + } +} + +// QueryParamsRequest is the request type for the Query/Params RPC method +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +// QueryKeySetRequest is the request type for the Query/KeySet RPC method +message QueryKeySetRequest { + string id = 1; +} + +// QueryKeySetResponse is the response type for the Query/KeySet RPC method +message QueryKeySetResponse { + KeySet key_set = 1 [(gogoproto.nullable) = false]; +} + +// QueryAllKeySetsRequest is the request type for the Query/AllKeySets RPC method +message QueryAllKeySetsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAllKeySetsResponse is the response type for the Query/AllKeySets RPC method +message QueryAllKeySetsResponse { + repeated KeySet key_sets = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDKGSessionRequest is the request type for the Query/DKGSession RPC method +message QueryDKGSessionRequest { + string session_id = 1; +} + +// QueryDKGSessionResponse is the response type for the Query/DKGSession RPC method +message QueryDKGSessionResponse { + DKGSession session = 1 [(gogoproto.nullable) = false]; +} + +// QueryAllDKGSessionsRequest is the request type for the Query/AllDKGSessions RPC method +message QueryAllDKGSessionsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAllDKGSessionsResponse is the response type for the Query/AllDKGSessions RPC method +message QueryAllDKGSessionsResponse { + repeated DKGSession sessions = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QuerySigningRequestRequest is the request type for the Query/SigningRequest RPC method +message QuerySigningRequestRequest { + string request_id = 1; +} + +// QuerySigningRequestResponse is the response type for the Query/SigningRequest RPC method +message QuerySigningRequestResponse { + SigningRequest request = 1 [(gogoproto.nullable) = false]; +} + +// QueryAllSigningRequestsRequest is the request type for the Query/AllSigningRequests RPC method +message QueryAllSigningRequestsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryAllSigningRequestsResponse is the response type for the Query/AllSigningRequests RPC method +message QueryAllSigningRequestsResponse { + repeated SigningRequest requests = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/proto/secret/tss/v1/tx.proto b/proto/secret/tss/v1/tx.proto new file mode 100644 index 000000000..d08f68534 --- /dev/null +++ b/proto/secret/tss/v1/tx.proto @@ -0,0 +1,123 @@ +syntax = "proto3"; +package secret.tss.v1; + +import "cosmos/msg/v1/msg.proto"; +import "gogoproto/gogo.proto"; +import "secret/tss/v1/types.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/scrtlabs/SecretNetwork/x/tss/types"; + +// Msg defines the TSS Msg service (merged from MPC + Signing modules) +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams updates module parameters + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // DKG Messages (from x/mpc) + rpc CreateKeySet(MsgCreateKeySet) returns (MsgCreateKeySetResponse); + rpc InitiateDKG(MsgInitiateDKG) returns (MsgInitiateDKGResponse); + rpc SubmitDKGRound1(MsgSubmitDKGRound1) returns (MsgSubmitDKGRound1Response); + rpc SubmitDKGRound2(MsgSubmitDKGRound2) returns (MsgSubmitDKGRound2Response); + + // Signing Messages (from x/signing) + rpc RequestSignature(MsgRequestSignature) returns (MsgRequestSignatureResponse); + rpc SubmitCommitment(MsgSubmitCommitment) returns (MsgSubmitCommitmentResponse); + rpc SubmitSignatureShare(MsgSubmitSignatureShare) returns (MsgSubmitSignatureShareResponse); +} + +// MsgUpdateParams updates module parameters +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "secret/tss/MsgUpdateParams"; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message MsgUpdateParamsResponse {} + +// DKG Messages + +message MsgCreateKeySet { + option (cosmos.msg.v1.signer) = "creator"; + + string creator = 1; + uint32 threshold = 2; + uint32 max_signers = 3; + string description = 4; + int64 timeout_blocks = 5; +} + +message MsgCreateKeySetResponse { + string key_set_id = 1; + string dkg_session_id = 2; +} + +message MsgInitiateDKG { + option (cosmos.msg.v1.signer) = "authority"; + + string authority = 1; + string key_set_id = 2; +} + +message MsgInitiateDKGResponse { + string session_id = 1; +} + +message MsgSubmitDKGRound1 { + option (cosmos.msg.v1.signer) = "validator"; + + string validator = 1; + string session_id = 2; + bytes commitment = 3; +} + +message MsgSubmitDKGRound1Response {} + +message MsgSubmitDKGRound2 { + option (cosmos.msg.v1.signer) = "validator"; + + string validator = 1; + string session_id = 2; + bytes share = 3; +} + +message MsgSubmitDKGRound2Response {} + +// Signing Messages + +message MsgRequestSignature { + option (cosmos.msg.v1.signer) = "requester"; + + string requester = 1; + string key_set_id = 2; + bytes message_hash = 3; + string callback = 4; +} + +message MsgRequestSignatureResponse { + string request_id = 1; +} + +message MsgSubmitCommitment { + option (cosmos.msg.v1.signer) = "validator"; + + string validator = 1; + string request_id = 2; + bytes commitment = 3; +} + +message MsgSubmitCommitmentResponse {} + +message MsgSubmitSignatureShare { + option (cosmos.msg.v1.signer) = "validator"; + + string validator = 1; + string request_id = 2; + bytes share = 3; +} + +message MsgSubmitSignatureShareResponse {} diff --git a/proto/secret/tss/v1/types.proto b/proto/secret/tss/v1/types.proto new file mode 100644 index 000000000..bae69b340 --- /dev/null +++ b/proto/secret/tss/v1/types.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; +package secret.tss.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/scrtlabs/SecretNetwork/x/tss/types"; + +// Params defines the module parameters +message Params { + option (gogoproto.equal) = true; +} + +// KeySetStatus defines the status of a KeySet +enum KeySetStatus { + KEY_SET_STATUS_UNSPECIFIED = 0; + KEY_SET_STATUS_PENDING_DKG = 1; + KEY_SET_STATUS_ACTIVE = 2; + KEY_SET_STATUS_FAILED = 3; +} + +// DKGState defines the state of a DKG session +enum DKGState { + DKG_STATE_UNSPECIFIED = 0; + DKG_STATE_ROUND1 = 1; + DKG_STATE_ROUND2 = 2; + DKG_STATE_KEY_SUBMISSION = 3; // Validators submit encrypted key shares + DKG_STATE_COMPLETE = 4; + DKG_STATE_FAILED = 5; +} + +// SigningState defines the state of a signing session +enum SigningState { + SIGNING_STATE_UNSPECIFIED = 0; + SIGNING_STATE_ROUND1 = 1; + SIGNING_STATE_ROUND2 = 2; + SIGNING_STATE_COMPLETE = 3; + SIGNING_STATE_FAILED = 4; +} + +// SigningRequestStatus defines the status of a signing request +enum SigningRequestStatus { + SIGNING_REQUEST_STATUS_UNSPECIFIED = 0; + SIGNING_REQUEST_STATUS_PENDING = 1; + SIGNING_REQUEST_STATUS_ROUND1 = 2; + SIGNING_REQUEST_STATUS_ROUND2 = 3; + SIGNING_REQUEST_STATUS_COMPLETE = 4; + SIGNING_REQUEST_STATUS_FAILED = 5; +} + +// KeySet represents a threshold signature key set +message KeySet { + string id = 1; + string owner = 2; + uint32 threshold = 3; + uint32 max_signers = 4; + repeated string participants = 5; + bytes group_pubkey = 6; + KeySetStatus status = 7; + string description = 8; + int64 created_height = 9; +} + +// KeyShare represents a validator's share of a threshold key +// The secret share is encrypted with the validator's public key (Ed25519→X25519) +message KeyShare { + string key_set_id = 1; + string validator_address = 2; + bytes share_data = 3; // Metadata/reference (deprecated, kept for compatibility) + bytes group_pubkey = 4; + int64 created_height = 5; + // Encrypted FROST secret share (NaCl box sealed with validator's X25519 pubkey) + bytes encrypted_secret_share = 6; + // Encrypted FROST public shares (NaCl box sealed with validator's X25519 pubkey) + bytes encrypted_public_shares = 7; + // Ephemeral public key used for encryption (needed for decryption) + bytes ephemeral_pubkey = 8; +} + +// DKG Session and Round data +message DKGSession { + string id = 1; + string key_set_id = 2; + DKGState state = 3; + uint32 threshold = 4; + uint32 max_signers = 5; + repeated string participants = 6; + int64 start_height = 7; + int64 timeout_height = 8; +} + +message DKGRound1Data { + string validator_address = 1; + bytes commitment = 2; + int64 submitted_height = 3; +} + +message DKGRound2Data { + string validator_address = 1; + bytes share = 2; + int64 submitted_height = 3; +} + +// DKGKeySubmission contains a validator's encrypted secret share for on-chain storage +message DKGKeySubmission { + string validator_address = 1; + // Encrypted FROST secret share (NaCl box sealed with validator's X25519 pubkey) + bytes encrypted_secret_share = 2; + // Encrypted FROST public shares (NaCl box sealed with validator's X25519 pubkey) + bytes encrypted_public_shares = 3; + // Ephemeral public key used for encryption (needed for decryption) + bytes ephemeral_pubkey = 4; + int64 submitted_height = 5; +} + +// Signing Request and Session data +message SigningRequest { + string id = 1; + string key_set_id = 2; + string requester = 3; + bytes message_hash = 4; + string callback = 5; + SigningRequestStatus status = 6; + bytes signature = 7; + int64 created_height = 8; +} + +message SigningSession { + string request_id = 1; + string key_set_id = 2; + uint32 threshold = 3; + repeated string participants = 4; + SigningState state = 5; + int64 start_height = 6; + int64 timeout_height = 7; +} + +message SigningCommitment { + string validator_address = 1; + bytes commitment = 2; + int64 submitted_height = 3; +} + +message SignatureShare { + string validator_address = 1; + bytes share = 2; + int64 submitted_height = 3; +} diff --git a/x/tss/abci/proposals.go b/x/tss/abci/proposals.go new file mode 100644 index 000000000..2761b507e --- /dev/null +++ b/x/tss/abci/proposals.go @@ -0,0 +1,169 @@ +package abci + +import ( + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/scrtlabs/SecretNetwork/x/tss/keeper" +) + +// TSSDataPrefix identifies TSS aggregated data in proposals +// Uses a unique prefix that won't collide with real transactions +var TSSDataPrefix = []byte("__TSS_VOTE_EXT__") + +// ProposalHandler handles block proposals with TSS data +type ProposalHandler struct { + keeper *keeper.Keeper + logger log.Logger +} + +// NewProposalHandler creates a new proposal handler +func NewProposalHandler(k *keeper.Keeper, logger log.Logger) *ProposalHandler { + return &ProposalHandler{ + keeper: k, + logger: logger, + } +} + +// PrepareProposal aggregates TSS data from vote extensions and injects into proposal +// Only the block proposer runs this - they have access to LocalLastCommit +func (h *ProposalHandler) PrepareProposal(ctx sdk.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) { + // Aggregate TSS data from vote extensions + aggregated := h.aggregateVoteExtensions(req.LocalLastCommit.Votes) + + // Check if there's any TSS data + hasTSSData := len(aggregated.DKGRound1) > 0 || len(aggregated.DKGRound2) > 0 || + len(aggregated.DKGKeySubmissions) > 0 || + len(aggregated.SigningCommitments) > 0 || len(aggregated.SignatureShares) > 0 + + txs := req.Txs + + if hasTSSData { + // Serialize aggregated data + dataBytes, err := json.Marshal(aggregated) + if err != nil { + h.logger.Error("Failed to marshal TSS data", "error", err) + } else { + // Inject as first "transaction" with prefix + tssData := append(TSSDataPrefix, dataBytes...) + txs = append([][]byte{tssData}, txs...) + + h.logger.Debug("PrepareProposal: injected TSS data", + "height", req.Height, + "dkg_r1_sessions", len(aggregated.DKGRound1), + "dkg_r2_sessions", len(aggregated.DKGRound2), + "signing_commits", len(aggregated.SigningCommitments), + "sig_shares", len(aggregated.SignatureShares)) + } + } + + return &abci.ResponsePrepareProposal{Txs: txs}, nil +} + +// ProcessProposal extracts TSS data from proposal and stores for BeginBlock +// All validators run this - they extract what the proposer injected +func (h *ProposalHandler) ProcessProposal(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) { + // Check if first entry is TSS data (has our prefix) + if len(req.Txs) > 0 && len(req.Txs[0]) > len(TSSDataPrefix) { + prefix := req.Txs[0][:len(TSSDataPrefix)] + if string(prefix) == string(TSSDataPrefix) { + // Extract and parse TSS data + dataBytes := req.Txs[0][len(TSSDataPrefix):] + + var aggregated keeper.AggregatedTSSData + if err := json.Unmarshal(dataBytes, &aggregated); err != nil { + h.logger.Error("Failed to unmarshal TSS data", "error", err) + // Don't reject block for TSS parsing errors + } else { + // Store for BeginBlock to process + h.keeper.StorePendingTSSData(&aggregated) + + h.logger.Debug("ProcessProposal: stored TSS data", + "height", req.Height, + "dkg_r1_sessions", len(aggregated.DKGRound1), + "dkg_r2_sessions", len(aggregated.DKGRound2)) + } + } + } + + return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil +} + +// aggregateVoteExtensions collects TSS data from all vote extensions +func (h *ProposalHandler) aggregateVoteExtensions(votes []abci.ExtendedVoteInfo) *keeper.AggregatedTSSData { + aggregated := &keeper.AggregatedTSSData{ + DKGRound1: make(map[string]map[string][]byte), + DKGRound2: make(map[string]map[string][]byte), + DKGKeySubmissions: make(map[string]map[string]*keeper.DKGKeySubmission), + SigningCommitments: make(map[string]map[string][]byte), + SignatureShares: make(map[string]map[string][]byte), + } + + for _, vote := range votes { + if len(vote.VoteExtension) == 0 { + continue + } + + // Get validator address from vote (hex format) + validatorAddr := fmt.Sprintf("%x", vote.Validator.Address) + + // Decode vote extension + var ext TSSVoteExtension + if err := json.Unmarshal(vote.VoteExtension, &ext); err != nil { + h.logger.Debug("Failed to unmarshal vote extension", + "validator", validatorAddr, + "error", err) + continue + } + + // Aggregate DKG Round 1 data + for _, data := range ext.DKGRound1 { + if aggregated.DKGRound1[data.SessionID] == nil { + aggregated.DKGRound1[data.SessionID] = make(map[string][]byte) + } + aggregated.DKGRound1[data.SessionID][validatorAddr] = data.Commitment + } + + // Aggregate DKG Round 2 data + for _, data := range ext.DKGRound2 { + if aggregated.DKGRound2[data.SessionID] == nil { + aggregated.DKGRound2[data.SessionID] = make(map[string][]byte) + } + aggregated.DKGRound2[data.SessionID][validatorAddr] = data.Share + } + + // Aggregate DKG Key Submissions (encrypted key shares for on-chain storage) + for _, data := range ext.DKGKeySubmissions { + if aggregated.DKGKeySubmissions[data.SessionID] == nil { + aggregated.DKGKeySubmissions[data.SessionID] = make(map[string]*keeper.DKGKeySubmission) + } + aggregated.DKGKeySubmissions[data.SessionID][validatorAddr] = &keeper.DKGKeySubmission{ + EncryptedSecretShare: data.EncryptedSecretShare, + EncryptedPublicShares: data.EncryptedPublicShares, + EphemeralPubKey: data.EphemeralPubKey, + } + } + + // Aggregate signing commitments + for _, data := range ext.SigningCommitments { + if aggregated.SigningCommitments[data.RequestID] == nil { + aggregated.SigningCommitments[data.RequestID] = make(map[string][]byte) + } + aggregated.SigningCommitments[data.RequestID][validatorAddr] = data.Commitment + } + + // Aggregate signature shares + for _, data := range ext.SignatureShares { + if aggregated.SignatureShares[data.RequestID] == nil { + aggregated.SignatureShares[data.RequestID] = make(map[string][]byte) + } + aggregated.SignatureShares[data.RequestID][validatorAddr] = data.Share + } + } + + return aggregated +} diff --git a/x/tss/abci/vote_extensions.go b/x/tss/abci/vote_extensions.go new file mode 100644 index 000000000..857c38344 --- /dev/null +++ b/x/tss/abci/vote_extensions.go @@ -0,0 +1,285 @@ +package abci + +import ( + "encoding/json" + "fmt" + + abci "github.com/cometbft/cometbft/abci/types" + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/scrtlabs/SecretNetwork/x/tss/keeper" + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// VoteExtensionHandler handles TSS vote extensions +// This allows validators to include DKG/signing data in their consensus votes +type VoteExtensionHandler struct { + keeper *keeper.Keeper + logger log.Logger +} + +// NewVoteExtensionHandler creates a new vote extension handler +func NewVoteExtensionHandler(k *keeper.Keeper, logger log.Logger) *VoteExtensionHandler { + return &VoteExtensionHandler{ + keeper: k, + logger: logger, + } +} + +// TSSVoteExtension contains all TSS data a validator wants to submit +type TSSVoteExtension struct { + // DKG Round 1 data for active sessions + DKGRound1 []DKGRound1Data `json:"dkg_round1,omitempty"` + + // DKG Round 2 data for active sessions + DKGRound2 []DKGRound2Data `json:"dkg_round2,omitempty"` + + // DKG Key Submissions - encrypted key shares for on-chain storage + DKGKeySubmissions []DKGKeySubmissionData `json:"dkg_key_submissions,omitempty"` + + // Signing commitments for active signing requests + SigningCommitments []SigningCommitmentData `json:"signing_commitments,omitempty"` + + // Signature shares for active signing requests + SignatureShares []SignatureShareData `json:"signature_shares,omitempty"` +} + +// DKGRound1Data represents a validator's DKG Round 1 submission +type DKGRound1Data struct { + SessionID string `json:"session_id"` + Commitment []byte `json:"commitment"` +} + +// DKGRound2Data represents a validator's DKG Round 2 submission +type DKGRound2Data struct { + SessionID string `json:"session_id"` + Share []byte `json:"share"` +} + +// DKGKeySubmissionData represents a validator's encrypted key share submission +type DKGKeySubmissionData struct { + SessionID string `json:"session_id"` + EncryptedSecretShare []byte `json:"encrypted_secret_share"` + EncryptedPublicShares []byte `json:"encrypted_public_shares"` + EphemeralPubKey []byte `json:"ephemeral_pubkey"` +} + +// SigningCommitmentData represents a validator's signing commitment +type SigningCommitmentData struct { + RequestID string `json:"request_id"` + Commitment []byte `json:"commitment"` +} + +// SignatureShareData represents a validator's signature share +type SignatureShareData struct { + RequestID string `json:"request_id"` + Share []byte `json:"share"` +} + +// ExtendVote allows a validator to include TSS data in their vote +// This is called before the validator signs their vote +func (h *VoteExtensionHandler) ExtendVote(ctx sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) { + fmt.Printf("TSS ExtendVote: height=%d\n", req.Height) + + // Get validator's consensus address + validatorAddr, err := h.keeper.GetValidatorAddress(ctx) + fmt.Printf("TSS ExtendVote: validatorAddr=%q, err=%v\n", validatorAddr, err) + if err != nil || validatorAddr == "" { + // Not a validator or address not available yet + fmt.Printf("TSS ExtendVote: no validator address, returning empty\n") + return &abci.ResponseExtendVote{VoteExtension: []byte{}}, nil + } + + // Collect all TSS data this validator needs to submit + ext := TSSVoteExtension{} + + // Debug: only log active sessions (skip completed/failed) + h.keeper.DKGSessionStore.Walk(ctx, nil, func(sessionID string, session types.DKGSession) (bool, error) { + if session.State != types.DKGState_DKG_STATE_COMPLETE && session.State != types.DKGState_DKG_STATE_FAILED { + fmt.Printf("TSS ExtendVote: active DKG session=%s state=%v\n", sessionID, session.State) + } + return false, nil + }) + h.keeper.SigningRequestStore.Walk(ctx, nil, func(requestID string, request types.SigningRequest) (bool, error) { + if request.Status != types.SigningRequestStatus_SIGNING_REQUEST_STATUS_COMPLETE && + request.Status != types.SigningRequestStatus_SIGNING_REQUEST_STATUS_FAILED { + fmt.Printf("TSS ExtendVote: active signing request=%s status=%v\n", requestID, request.Status) + } + return false, nil + }) + + // Check for DKG Round 1 data to submit + if err := h.keeper.DKGSessionStore.Walk(ctx, nil, func(sessionID string, session types.DKGSession) (bool, error) { + if session.State == types.DKGState_DKG_STATE_ROUND1 && h.isParticipant(validatorAddr, session.Participants) { + // Check if already submitted + key := fmt.Sprintf("%s:%s", sessionID, validatorAddr) + has, _ := h.keeper.DKGRound1DataStore.Has(ctx, key) + if !has { + // Generate DKG Round 1 data + commitment := h.keeper.GenerateDKGRound1Data(ctx, sessionID, validatorAddr) + ext.DKGRound1 = append(ext.DKGRound1, DKGRound1Data{ + SessionID: sessionID, + Commitment: commitment, + }) + } + } + return false, nil + }); err != nil { + h.logger.Error("Error collecting DKG Round 1 data", "error", err) + } + + // Check for DKG Round 2 data to submit + if err := h.keeper.DKGSessionStore.Walk(ctx, nil, func(sessionID string, session types.DKGSession) (bool, error) { + if session.State == types.DKGState_DKG_STATE_ROUND2 && h.isParticipant(validatorAddr, session.Participants) { + key := fmt.Sprintf("%s:%s", sessionID, validatorAddr) + has, _ := h.keeper.DKGRound2DataStore.Has(ctx, key) + if !has { + share := h.keeper.GenerateDKGRound2Data(ctx, sessionID, validatorAddr) + ext.DKGRound2 = append(ext.DKGRound2, DKGRound2Data{ + SessionID: sessionID, + Share: share, + }) + } + } + return false, nil + }); err != nil { + h.logger.Error("Error collecting DKG Round 2 data", "error", err) + } + + // Check for DKG Key Submission data (encrypted key shares for on-chain storage) + if err := h.keeper.DKGSessionStore.Walk(ctx, nil, func(sessionID string, session types.DKGSession) (bool, error) { + if session.State == types.DKGState_DKG_STATE_KEY_SUBMISSION && h.isParticipant(validatorAddr, session.Participants) { + key := fmt.Sprintf("%s:%s", sessionID, validatorAddr) + has, _ := h.keeper.DKGKeySubmissionStore.Has(ctx, key) + if !has { + // Generate encrypted key share submission + encSecretShare, encPublicShares, ephemeralPubKey, err := h.keeper.GenerateEncryptedKeySubmission(ctx, sessionID, validatorAddr) + if err != nil { + h.logger.Error("Failed to generate encrypted key submission", + "session_id", sessionID, "error", err) + return false, nil + } + ext.DKGKeySubmissions = append(ext.DKGKeySubmissions, DKGKeySubmissionData{ + SessionID: sessionID, + EncryptedSecretShare: encSecretShare, + EncryptedPublicShares: encPublicShares, + EphemeralPubKey: ephemeralPubKey, + }) + h.logger.Info("Generated encrypted key submission for on-chain storage", + "session_id", sessionID) + } + } + return false, nil + }); err != nil { + h.logger.Error("Error collecting DKG key submissions", "error", err) + } + + // Check for signing commitments to submit + if err := h.keeper.SigningRequestStore.Walk(ctx, nil, func(requestID string, request types.SigningRequest) (bool, error) { + if request.Status == types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND1 { + // Get session to check if validator is a participant + session, err := h.keeper.SigningSessionStore.Get(ctx, requestID) + if err != nil { + return false, nil + } + + if h.isParticipant(validatorAddr, session.Participants) { + key := fmt.Sprintf("%s:%s", requestID, validatorAddr) + has, _ := h.keeper.SigningCommitmentStore.Has(ctx, key) + if !has { + commitment := h.keeper.GenerateSigningCommitment(ctx, requestID, validatorAddr) + ext.SigningCommitments = append(ext.SigningCommitments, SigningCommitmentData{ + RequestID: requestID, + Commitment: commitment, + }) + } + } + } + return false, nil + }); err != nil { + h.logger.Error("Error collecting signing commitments", "error", err) + } + + // Check for signature shares to submit + if err := h.keeper.SigningRequestStore.Walk(ctx, nil, func(requestID string, request types.SigningRequest) (bool, error) { + if request.Status == types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND2 { + // Get session to check if validator is a participant + session, err := h.keeper.SigningSessionStore.Get(ctx, requestID) + if err != nil { + return false, nil + } + + if h.isParticipant(validatorAddr, session.Participants) { + key := fmt.Sprintf("%s:%s", requestID, validatorAddr) + has, _ := h.keeper.SignatureShareStore.Has(ctx, key) + if !has { + share := h.keeper.GenerateSignatureShare(ctx, requestID, validatorAddr) + ext.SignatureShares = append(ext.SignatureShares, SignatureShareData{ + RequestID: requestID, + Share: share, + }) + } + } + } + return false, nil + }); err != nil { + h.logger.Error("Error collecting signature shares", "error", err) + } + + // Encode the extension + extBytes, err := json.Marshal(ext) + if err != nil { + h.logger.Error("Failed to marshal vote extension", "error", err) + return &abci.ResponseExtendVote{VoteExtension: []byte{}}, nil + } + + h.logger.Info("Extended vote with TSS data", + "dkg_r1", len(ext.DKGRound1), + "dkg_r2", len(ext.DKGRound2), + "dkg_key_submissions", len(ext.DKGKeySubmissions), + "commitments", len(ext.SigningCommitments), + "shares", len(ext.SignatureShares)) + + return &abci.ResponseExtendVote{VoteExtension: extBytes}, nil +} + +// VerifyVoteExtension verifies TSS data from another validator's vote extension +// This is called when a validator receives a vote from another validator +func (h *VoteExtensionHandler) VerifyVoteExtension(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) { + // If extension is empty, accept it (validator had nothing to submit) + if len(req.VoteExtension) == 0 { + return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil + } + + // Decode the extension + var ext TSSVoteExtension + if err := json.Unmarshal(req.VoteExtension, &ext); err != nil { + h.logger.Error("Failed to unmarshal vote extension", "error", err) + return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil + } + + // TODO: Add validation logic: + // 1. Verify validator is actually a participant in the sessions they're submitting for + // 2. Verify cryptographic validity of commitments/shares + // 3. Verify no duplicate submissions + // + // For now, we accept all extensions to get the basic flow working + + h.logger.Debug("Verified vote extension", + "height", req.Height, + "dkg_r1", len(ext.DKGRound1), + "dkg_r2", len(ext.DKGRound2)) + + return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil +} + +// isParticipant checks if a validator is in the participant list +func (h *VoteExtensionHandler) isParticipant(validatorAddr string, participants []string) bool { + for _, p := range participants { + if p == validatorAddr { + return true + } + } + return false +} diff --git a/x/tss/client/cli/query.go b/x/tss/client/cli/query.go new file mode 100644 index 000000000..968791aaa --- /dev/null +++ b/x/tss/client/cli/query.go @@ -0,0 +1,237 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// GetQueryCmd returns the cli query commands for the module +func GetQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + GetCmdQueryParams(), + GetCmdQueryKeySet(), + GetCmdQueryAllKeySets(), + GetCmdQueryDKGSession(), + GetCmdQueryAllDKGSessions(), + GetCmdQuerySigningRequest(), + GetCmdQueryAllSigningRequests(), + ) + + return cmd +} + +// GetCmdQueryParams implements the params query command +func GetCmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Shows the parameters of the module", + 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.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryKeySet implements the key-set query command +func GetCmdQueryKeySet() *cobra.Command { + cmd := &cobra.Command{ + Use: "key-set [id]", + Short: "Query a KeySet by ID", + Args: cobra.ExactArgs(1), + 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.KeySet(context.Background(), &types.QueryKeySetRequest{ + Id: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryAllKeySets implements the all-key-sets query command +func GetCmdQueryAllKeySets() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-key-sets", + Short: "Query all KeySets", + 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.AllKeySets(context.Background(), &types.QueryAllKeySetsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryDKGSession implements the dkg-session query command +func GetCmdQueryDKGSession() *cobra.Command { + cmd := &cobra.Command{ + Use: "dkg-session [session-id]", + Short: "Query a DKG session by ID", + Args: cobra.ExactArgs(1), + 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.DKGSession(context.Background(), &types.QueryDKGSessionRequest{ + SessionId: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryAllDKGSessions implements the all-dkg-sessions query command +func GetCmdQueryAllDKGSessions() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-dkg-sessions", + Short: "Query all DKG sessions", + 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.AllDKGSessions(context.Background(), &types.QueryAllDKGSessionsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQuerySigningRequest implements the signing-request query command +func GetCmdQuerySigningRequest() *cobra.Command { + cmd := &cobra.Command{ + Use: "signing-request [request-id]", + Short: "Query a signing request by ID", + Args: cobra.ExactArgs(1), + 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.SigningRequest(context.Background(), &types.QuerySigningRequestRequest{ + RequestId: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +// GetCmdQueryAllSigningRequests implements the all-signing-requests query command +func GetCmdQueryAllSigningRequests() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-signing-requests", + Short: "Query all signing requests", + 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.AllSigningRequests(context.Background(), &types.QueryAllSigningRequestsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tss/keeper/crypto.go b/x/tss/keeper/crypto.go new file mode 100644 index 000000000..2d0aa52aa --- /dev/null +++ b/x/tss/keeper/crypto.go @@ -0,0 +1,171 @@ +package keeper + +import ( + "crypto/rand" + "crypto/sha512" + "fmt" + + "filippo.io/edwards25519" + "golang.org/x/crypto/curve25519" + "golang.org/x/crypto/nacl/box" +) + +// Ed25519ToX25519PublicKey converts an Ed25519 public key to an X25519 public key +// This follows the standard conversion used by libsodium and age encryption +func Ed25519ToX25519PublicKey(ed25519PubKey []byte) ([]byte, error) { + if len(ed25519PubKey) != 32 { + return nil, fmt.Errorf("invalid Ed25519 public key length: %d", len(ed25519PubKey)) + } + + // Parse the Ed25519 public key as a point on the Edwards curve + edPoint, err := new(edwards25519.Point).SetBytes(ed25519PubKey) + if err != nil { + return nil, fmt.Errorf("failed to parse Ed25519 public key: %w", err) + } + + // Convert to Montgomery form (X25519) + return edPoint.BytesMontgomery(), nil +} + +// Ed25519ToX25519PrivateKey converts an Ed25519 private key (seed) to an X25519 private key +// The Ed25519 private key should be the 32-byte seed (not the 64-byte expanded key) +func Ed25519ToX25519PrivateKey(ed25519PrivKey []byte) ([]byte, error) { + if len(ed25519PrivKey) != 32 && len(ed25519PrivKey) != 64 { + return nil, fmt.Errorf("invalid Ed25519 private key length: %d", len(ed25519PrivKey)) + } + + // If 64-byte key provided, use first 32 bytes (the seed) + seed := ed25519PrivKey + if len(ed25519PrivKey) == 64 { + seed = ed25519PrivKey[:32] + } + + // Hash the seed with SHA-512 (same as Ed25519 key derivation) + h := sha512.Sum512(seed) + + // Clamp the first 32 bytes to get the X25519 private key + // This matches the clamping done in Ed25519 scalar multiplication + h[0] &= 248 + h[31] &= 127 + h[31] |= 64 + + return h[:32], nil +} + +// EncryptedKeyShare contains the encrypted data and metadata needed for decryption +type EncryptedKeyShare struct { + // Ciphertext is the encrypted secret share (NaCl box format) + Ciphertext []byte + // EphemeralPubKey is the sender's ephemeral public key (needed for decryption) + EphemeralPubKey []byte + // Nonce used for encryption (24 bytes, included in ciphertext for simplicity) + Nonce []byte +} + +// EncryptForValidator encrypts data for a specific validator using their Ed25519 public key +// Uses ephemeral key pair for forward secrecy (similar to ECIES) +func EncryptForValidator(plaintext []byte, validatorEd25519PubKey []byte) (*EncryptedKeyShare, error) { + // Convert validator's Ed25519 pubkey to X25519 + recipientPubKey, err := Ed25519ToX25519PublicKey(validatorEd25519PubKey) + if err != nil { + return nil, fmt.Errorf("failed to convert validator pubkey: %w", err) + } + + // Generate ephemeral key pair for this encryption + ephemeralPubKey, ephemeralPrivKey, err := box.GenerateKey(rand.Reader) + if err != nil { + return nil, fmt.Errorf("failed to generate ephemeral key: %w", err) + } + + // Generate random nonce + var nonce [24]byte + if _, err := rand.Read(nonce[:]); err != nil { + return nil, fmt.Errorf("failed to generate nonce: %w", err) + } + + // Convert recipient pubkey to array + var recipientPubKeyArr [32]byte + copy(recipientPubKeyArr[:], recipientPubKey) + + // Encrypt using NaCl box (authenticated encryption) + ciphertext := box.Seal(nil, plaintext, &nonce, &recipientPubKeyArr, ephemeralPrivKey) + + return &EncryptedKeyShare{ + Ciphertext: ciphertext, + EphemeralPubKey: ephemeralPubKey[:], + Nonce: nonce[:], + }, nil +} + +// DecryptKeyShare decrypts an encrypted key share using the validator's Ed25519 private key +func DecryptKeyShare(encrypted *EncryptedKeyShare, validatorEd25519PrivKey []byte) ([]byte, error) { + // Convert validator's Ed25519 private key to X25519 + recipientPrivKey, err := Ed25519ToX25519PrivateKey(validatorEd25519PrivKey) + if err != nil { + return nil, fmt.Errorf("failed to convert validator privkey: %w", err) + } + + // Convert to arrays + var recipientPrivKeyArr [32]byte + copy(recipientPrivKeyArr[:], recipientPrivKey) + + var senderPubKeyArr [32]byte + copy(senderPubKeyArr[:], encrypted.EphemeralPubKey) + + var nonce [24]byte + copy(nonce[:], encrypted.Nonce) + + // Decrypt using NaCl box + plaintext, ok := box.Open(nil, encrypted.Ciphertext, &nonce, &senderPubKeyArr, &recipientPrivKeyArr) + if !ok { + return nil, fmt.Errorf("decryption failed: authentication error") + } + + return plaintext, nil +} + +// EncryptKeyShareForChain encrypts a key share and returns the components for on-chain storage +// Returns: encryptedData (ciphertext with prepended nonce), ephemeralPubKey +func EncryptKeyShareForChain(plaintext []byte, validatorEd25519PubKey []byte) (encryptedData []byte, ephemeralPubKey []byte, err error) { + encrypted, err := EncryptForValidator(plaintext, validatorEd25519PubKey) + if err != nil { + return nil, nil, err + } + + // Prepend nonce to ciphertext for storage (nonce || ciphertext) + encryptedData = make([]byte, len(encrypted.Nonce)+len(encrypted.Ciphertext)) + copy(encryptedData[:24], encrypted.Nonce) + copy(encryptedData[24:], encrypted.Ciphertext) + + return encryptedData, encrypted.EphemeralPubKey, nil +} + +// DecryptKeyShareFromChain decrypts a key share stored on-chain +func DecryptKeyShareFromChain(encryptedData []byte, ephemeralPubKey []byte, validatorEd25519PrivKey []byte) ([]byte, error) { + if len(encryptedData) < 24 { + return nil, fmt.Errorf("encrypted data too short") + } + + encrypted := &EncryptedKeyShare{ + Nonce: encryptedData[:24], + Ciphertext: encryptedData[24:], + EphemeralPubKey: ephemeralPubKey, + } + + return DecryptKeyShare(encrypted, validatorEd25519PrivKey) +} + +// DeriveSharedSecret derives a shared secret from X25519 key exchange +// Used internally by NaCl box, but exposed here for testing +func DeriveSharedSecret(privateKey, publicKey []byte) ([]byte, error) { + if len(privateKey) != 32 || len(publicKey) != 32 { + return nil, fmt.Errorf("invalid key length") + } + + shared, err := curve25519.X25519(privateKey, publicKey) + if err != nil { + return nil, fmt.Errorf("key exchange failed: %w", err) + } + + return shared, nil +} diff --git a/x/tss/keeper/dkg.go b/x/tss/keeper/dkg.go new file mode 100644 index 000000000..41cb48f81 --- /dev/null +++ b/x/tss/keeper/dkg.go @@ -0,0 +1,496 @@ +package keeper + +import ( + "context" + "errors" + "fmt" + + "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// InitiateDKGForKeySet creates a new DKG session for a specific KeySet +func (k Keeper) InitiateDKGForKeySet(ctx context.Context, keySetID string, threshold, maxSigners uint32, timeoutBlocks int64) (string, error) { + // Get the KeySet to verify it exists and is in PENDING_DKG state + keySet, err := k.GetKeySet(ctx, keySetID) + if err != nil { + return "", err + } + + if keySet.Status != types.KeySetStatus_KEY_SET_STATUS_PENDING_DKG { + return "", fmt.Errorf("keyset is not in PENDING_DKG state") + } + + // Generate unique session ID + sdkCtx := sdk.UnwrapSDKContext(ctx) + sessionID := fmt.Sprintf("dkg-%s-%d", keySetID, sdkCtx.BlockHeight()) + + // Get current block height for timeout + currentHeight := sdkCtx.BlockHeight() + // Default to 100 blocks if not specified + if timeoutBlocks == 0 { + timeoutBlocks = 100 + } + timeoutHeight := currentHeight + timeoutBlocks + + // Get all active validators by their consensus addresses + // For now, use all validators from the current validator set + participants, err := k.GetActiveValidatorAddresses(ctx) + if err != nil { + return "", fmt.Errorf("failed to get active validators: %w", err) + } + + sdkCtx.Logger().Info("InitiateDKGForKeySet", "participants_count", len(participants), "participants", participants) + + // DEBUG: Fail explicitly if no participants found so we can see it in tx result + if len(participants) == 0 { + return "", fmt.Errorf("no active validators found for DKG - check that validators are bonded and not jailed") + } + + // Create DKG session + session := types.DKGSession{ + Id: sessionID, + KeySetId: keySetID, + State: types.DKGState_DKG_STATE_ROUND1, + Threshold: threshold, + MaxSigners: maxSigners, + Participants: participants, // Use active validator consensus addresses + StartHeight: currentHeight, + TimeoutHeight: timeoutHeight, + } + + // Store the session + if err := k.DKGSessionStore.Set(ctx, sessionID, session); err != nil { + return "", err + } + + sdkCtx.Logger().Info("DKG Session Created", + "session_id", sessionID, + "key_set_id", keySetID, + "participants_count", len(session.Participants), + "participants", session.Participants, + "threshold", threshold, + "timeout_height", timeoutHeight) + + return sessionID, nil +} + +// GetDKGSession retrieves a DKG session by ID +func (k Keeper) GetDKGSession(ctx context.Context, sessionID string) (types.DKGSession, error) { + session, err := k.DKGSessionStore.Get(ctx, sessionID) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return types.DKGSession{}, fmt.Errorf("DKG session not found: %s", sessionID) + } + return types.DKGSession{}, err + } + return session, nil +} + +// SetDKGSession updates a DKG session +func (k Keeper) SetDKGSession(ctx context.Context, session types.DKGSession) error { + return k.DKGSessionStore.Set(ctx, session.Id, session) +} + +// GetAllDKGSessions retrieves all DKG sessions +func (k Keeper) GetAllDKGSessions(ctx context.Context) ([]types.DKGSession, error) { + var sessions []types.DKGSession + err := k.DKGSessionStore.Walk(ctx, nil, func(key string, value types.DKGSession) (bool, error) { + sessions = append(sessions, value) + return false, nil + }) + return sessions, err +} + +// ProcessDKGRound1 stores a validator's Round 1 commitment +func (k Keeper) ProcessDKGRound1(ctx context.Context, sessionID, validatorAddr string, commitment []byte) error { + // Get the session + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + return err + } + + // Verify session is in ROUND1 state + if session.State != types.DKGState_DKG_STATE_ROUND1 { + return fmt.Errorf("DKG session is not in ROUND1 state") + } + + // Verify validator is a participant + if !contains(session.Participants, validatorAddr) { + return fmt.Errorf("validator %s is not a participant in this DKG session", validatorAddr) + } + + // Check if validator already submitted + existingKey := fmt.Sprintf("%s:%s", sessionID, validatorAddr) + has, err := k.DKGRound1DataStore.Has(ctx, existingKey) + if err != nil { + return err + } + if has { + return fmt.Errorf("validator %s already submitted round 1 data", validatorAddr) + } + + // Store Round 1 data + sdkCtx := sdk.UnwrapSDKContext(ctx) + round1Data := types.DKGRound1Data{ + ValidatorAddress: validatorAddr, + Commitment: commitment, + SubmittedHeight: sdkCtx.BlockHeight(), + } + + return k.DKGRound1DataStore.Set(ctx, existingKey, round1Data) +} + +// ProcessDKGRound2 stores a validator's Round 2 share +func (k Keeper) ProcessDKGRound2(ctx context.Context, sessionID, validatorAddr string, share []byte) error { + // Get the session + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + return err + } + + // Verify session is in ROUND2 state + if session.State != types.DKGState_DKG_STATE_ROUND2 { + return fmt.Errorf("DKG session is not in ROUND2 state") + } + + // Verify validator is a participant + if !contains(session.Participants, validatorAddr) { + return fmt.Errorf("validator %s is not a participant in this DKG session", validatorAddr) + } + + // Check if validator already submitted + existingKey := fmt.Sprintf("%s:%s", sessionID, validatorAddr) + has, err := k.DKGRound2DataStore.Has(ctx, existingKey) + if err != nil { + return err + } + if has { + return fmt.Errorf("validator %s already submitted round 2 data", validatorAddr) + } + + // Store Round 2 data + sdkCtx := sdk.UnwrapSDKContext(ctx) + round2Data := types.DKGRound2Data{ + ValidatorAddress: validatorAddr, + Share: share, + SubmittedHeight: sdkCtx.BlockHeight(), + } + + return k.DKGRound2DataStore.Set(ctx, existingKey, round2Data) +} + +// GetDKGRound1Count returns the number of Round 1 submissions for a session +func (k Keeper) GetDKGRound1Count(ctx context.Context, sessionID string) (int, error) { + count := 0 + prefix := sessionID + ":" + + err := k.DKGRound1DataStore.Walk(ctx, nil, func(key string, value types.DKGRound1Data) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + count++ + } + return false, nil + }) + + return count, err +} + +// GetDKGRound2Count returns the number of Round 2 submissions for a session +func (k Keeper) GetDKGRound2Count(ctx context.Context, sessionID string) (int, error) { + count := 0 + prefix := sessionID + ":" + + err := k.DKGRound2DataStore.Walk(ctx, nil, func(key string, value types.DKGRound2Data) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + count++ + } + return false, nil + }) + + return count, err +} + +// ProcessDKGKeySubmission stores a validator's encrypted key share submission +func (k Keeper) ProcessDKGKeySubmission(ctx context.Context, sessionID, validatorAddr string, + encryptedSecretShare, encryptedPublicShares, ephemeralPubKey []byte) error { + // Get the session + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + return err + } + + // Verify session is in KEY_SUBMISSION state + if session.State != types.DKGState_DKG_STATE_KEY_SUBMISSION { + return fmt.Errorf("DKG session is not in KEY_SUBMISSION state") + } + + // Verify validator is a participant + if !contains(session.Participants, validatorAddr) { + return fmt.Errorf("validator %s is not a participant in this DKG session", validatorAddr) + } + + // Check if validator already submitted + existingKey := fmt.Sprintf("%s:%s", sessionID, validatorAddr) + has, err := k.DKGKeySubmissionStore.Has(ctx, existingKey) + if err != nil { + return err + } + if has { + return fmt.Errorf("validator %s already submitted encrypted key share", validatorAddr) + } + + // Store key submission + sdkCtx := sdk.UnwrapSDKContext(ctx) + submission := types.DKGKeySubmission{ + ValidatorAddress: validatorAddr, + EncryptedSecretShare: encryptedSecretShare, + EncryptedPublicShares: encryptedPublicShares, + EphemeralPubkey: ephemeralPubKey, + SubmittedHeight: sdkCtx.BlockHeight(), + } + + return k.DKGKeySubmissionStore.Set(ctx, existingKey, submission) +} + +// GetDKGKeySubmissionCount returns the number of encrypted key submissions for a session +func (k Keeper) GetDKGKeySubmissionCount(ctx context.Context, sessionID string) (int, error) { + count := 0 + prefix := sessionID + ":" + + err := k.DKGKeySubmissionStore.Walk(ctx, nil, func(key string, value types.DKGKeySubmission) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + count++ + } + return false, nil + }) + + return count, err +} + +// GetDKGKeySubmissions returns all encrypted key submissions for a session +func (k Keeper) GetDKGKeySubmissions(ctx context.Context, sessionID string) (map[string]types.DKGKeySubmission, error) { + submissions := make(map[string]types.DKGKeySubmission) + prefix := sessionID + ":" + + err := k.DKGKeySubmissionStore.Walk(ctx, nil, func(key string, value types.DKGKeySubmission) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + submissions[value.ValidatorAddress] = value + } + return false, nil + }) + + return submissions, err +} + +// CompleteDKG finalizes a DKG ceremony and activates the KeySet +// This is called after KEY_SUBMISSION phase when all encrypted shares have been collected +func (k Keeper) CompleteDKG(ctx context.Context, sessionID string) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // Get the session + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + return err + } + + // Get the group public key from local FROST state (computed during Round 2) + groupPubkey, err := k.GetDKGGroupPubKey(sessionID) + if err != nil { + return fmt.Errorf("failed to get group public key: %w", err) + } + + // Get all encrypted key submissions + submissions, err := k.GetDKGKeySubmissions(ctx, sessionID) + if err != nil { + return fmt.Errorf("failed to get key submissions: %w", err) + } + + // Update KeySet status to ACTIVE with the group public key and participants + if err := k.ActivateKeySet(ctx, session.KeySetId, groupPubkey, session.Participants); err != nil { + return err + } + + // Store encrypted key shares for each validator who submitted + for validatorAddr, submission := range submissions { + if err := k.SetEncryptedKeyShare(ctx, session.KeySetId, validatorAddr, groupPubkey, + submission.EncryptedSecretShare, submission.EncryptedPublicShares, submission.EphemeralPubkey); err != nil { + return fmt.Errorf("failed to store encrypted key share for %s: %w", validatorAddr, err) + } + sdkCtx.Logger().Info("Stored encrypted key share on-chain", + "keyset_id", session.KeySetId, "validator", validatorAddr) + } + + // Delete the completed DKG session - no longer needed + if err := k.DKGSessionStore.Remove(ctx, sessionID); err != nil { + return err + } + + // Clean up all round data including key submissions + k.cleanupDKGRoundData(ctx, sessionID) + k.cleanupDKGKeySubmissions(ctx, sessionID) + + // Clean up local FROST state (we no longer keep keys in memory) + k.CleanupDKGState(sessionID) + + sdkCtx.Logger().Info("DKG completed - encrypted key shares stored on-chain", "session_id", sessionID) + + return nil +} + +// FailDKG marks a DKG session and its KeySet as failed +func (k Keeper) FailDKG(ctx context.Context, sessionID string) error { + // Get the session + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + return err + } + + // Update KeySet status to FAILED + if err := k.FailKeySet(ctx, session.KeySetId); err != nil { + return err + } + + // Delete the failed DKG session + if err := k.DKGSessionStore.Remove(ctx, sessionID); err != nil { + return err + } + + // Clean up round data + k.cleanupDKGRoundData(ctx, sessionID) + + return nil +} + +// cleanupDKGRoundData removes round 1 and round 2 data for a session +func (k Keeper) cleanupDKGRoundData(ctx context.Context, sessionID string) { + prefix := sessionID + ":" + + // Clean up Round 1 data + var round1Keys []string + k.DKGRound1DataStore.Walk(ctx, nil, func(key string, _ types.DKGRound1Data) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + round1Keys = append(round1Keys, key) + } + return false, nil + }) + for _, key := range round1Keys { + k.DKGRound1DataStore.Remove(ctx, key) + } + + // Clean up Round 2 data + var round2Keys []string + k.DKGRound2DataStore.Walk(ctx, nil, func(key string, _ types.DKGRound2Data) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + round2Keys = append(round2Keys, key) + } + return false, nil + }) + for _, key := range round2Keys { + k.DKGRound2DataStore.Remove(ctx, key) + } +} + +// cleanupDKGKeySubmissions removes key submission data for a session +func (k Keeper) cleanupDKGKeySubmissions(ctx context.Context, sessionID string) { + prefix := sessionID + ":" + + var keys []string + k.DKGKeySubmissionStore.Walk(ctx, nil, func(key string, _ types.DKGKeySubmission) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + keys = append(keys, key) + } + return false, nil + }) + for _, key := range keys { + k.DKGKeySubmissionStore.Remove(ctx, key) + } +} + +// ProcessDKGEndBlock handles DKG state transitions at the end of each block +func (k Keeper) ProcessDKGEndBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + currentHeight := sdkCtx.BlockHeight() + + // Iterate through all DKG sessions + err := k.DKGSessionStore.Walk(ctx, nil, func(sessionID string, session types.DKGSession) (bool, error) { + // Skip completed or failed sessions + if session.State == types.DKGState_DKG_STATE_COMPLETE || session.State == types.DKGState_DKG_STATE_FAILED { + return false, nil + } + + // Check for timeout + if currentHeight >= session.TimeoutHeight { + if err := k.FailDKG(ctx, sessionID); err != nil { + return true, err + } + return false, nil + } + + // Handle state transitions based on current state + switch session.State { + case types.DKGState_DKG_STATE_ROUND1: + // Check if enough Round 1 submissions + count, err := k.GetDKGRound1Count(ctx, sessionID) + if err != nil { + return true, err + } + + // If threshold met, advance to Round 2 + if uint32(count) >= session.Threshold { + session.State = types.DKGState_DKG_STATE_ROUND2 + if err := k.SetDKGSession(ctx, session); err != nil { + return true, err + } + sdkCtx.Logger().Info("DKG transitioning to ROUND2", "session_id", sessionID) + } + + case types.DKGState_DKG_STATE_ROUND2: + // Check if enough Round 2 submissions + count, err := k.GetDKGRound2Count(ctx, sessionID) + if err != nil { + return true, err + } + + // If threshold met, advance to KEY_SUBMISSION state + // (validators need to submit their encrypted key shares) + if uint32(count) >= session.Threshold { + session.State = types.DKGState_DKG_STATE_KEY_SUBMISSION + if err := k.SetDKGSession(ctx, session); err != nil { + return true, err + } + sdkCtx.Logger().Info("DKG transitioning to KEY_SUBMISSION", "session_id", sessionID) + } + + case types.DKGState_DKG_STATE_KEY_SUBMISSION: + // Check if enough encrypted key submissions + count, err := k.GetDKGKeySubmissionCount(ctx, sessionID) + if err != nil { + return true, err + } + + // If threshold met, complete DKG and store encrypted shares on-chain + if uint32(count) >= session.Threshold { + if err := k.CompleteDKG(ctx, sessionID); err != nil { + return true, err + } + sdkCtx.Logger().Info("DKG completed with encrypted key shares stored on-chain", "session_id", sessionID) + } + } + + return false, nil + }) + + return err +} + +// Helper function to check if a string is in a slice +func contains(slice []string, item string) bool { + for _, s := range slice { + if s == item { + return true + } + } + return false +} diff --git a/x/tss/keeper/frost.go b/x/tss/keeper/frost.go new file mode 100644 index 000000000..2e6ec7255 --- /dev/null +++ b/x/tss/keeper/frost.go @@ -0,0 +1,263 @@ +package keeper + +import ( + "context" + "crypto/elliptic" + "fmt" + "math/big" + + "github.com/bnb-chain/tss-lib/v2/crypto" + "github.com/bnb-chain/tss-lib/v2/ecdsa/keygen" + "github.com/bnb-chain/tss-lib/v2/tss" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// TSSCurve represents the elliptic curve used for TSS +type TSSCurve int + +// DKGRound1Package represents the data a participant creates in DKG Round 1 +type DKGRound1Package struct { + ParticipantID string `json:"participant_id"` + From *tss.PartyID `json:"from"` + Message *keygen.KGRound1Message `json:"message"` +} + +// DKGRound2Package represents the data a participant creates in DKG Round 2 +type DKGRound2Package struct { + ParticipantID string `json:"participant_id"` + VerificationComplete bool `json:"verification_complete"` + SharesHash []byte `json:"shares_hash,omitempty"` +} + +// SigningCommitmentPackage represents Round 1 signing commitment +type SigningCommitmentPackage struct { + ParticipantID string `json:"participant_id"` + Commitment []byte `json:"commitment"` +} + +// SignatureSharePackage represents Round 2 signature share +type SignatureSharePackage struct { + ParticipantID string `json:"participant_id"` + R []byte `json:"r"` + S []byte `json:"s"` +} + +const ( + CurveSecp256k1 TSSCurve = iota + CurveP256 + CurveEd25519 +) + +// GetCurve returns the appropriate elliptic curve +func GetCurve(curveType TSSCurve) (elliptic.Curve, error) { + switch curveType { + case CurveSecp256k1: + return tss.S256(), nil + case CurveP256: + return elliptic.P256(), nil + case CurveEd25519: + return tss.Edwards(), nil + default: + return nil, fmt.Errorf("unsupported curve type: %d", curveType) + } +} + +// SerializePublicKey serializes a public key for storage +func SerializePublicKey(pubKey *crypto.ECPoint) ([]byte, error) { + if pubKey == nil { + return nil, fmt.Errorf("public key is nil") + } + x, y := pubKey.X(), pubKey.Y() + return append(x.Bytes(), y.Bytes()...), nil +} + +// DeserializePublicKey deserializes a public key from storage +func DeserializePublicKey(data []byte, curve elliptic.Curve) (*crypto.ECPoint, error) { + if len(data) < 64 { + return nil, fmt.Errorf("invalid public key data length") + } + x := new(big.Int).SetBytes(data[:32]) + y := new(big.Int).SetBytes(data[32:]) + return crypto.NewECPointNoCurveCheck(curve, x, y), nil +} + +// ======================== +// DKG Functions +// ======================== + +// AggregateDKGRound1Commitments collects and validates all Round 1 commitments +func (k Keeper) AggregateDKGRound1Commitments(ctx context.Context, sessionID string) (map[string][]byte, error) { + commitments := make(map[string][]byte) + prefix := sessionID + ":" + + err := k.DKGRound1DataStore.Walk(ctx, nil, func(key string, value types.DKGRound1Data) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + commitments[value.ValidatorAddress] = value.Commitment + } + return false, nil + }) + + if err != nil { + return nil, err + } + + return commitments, nil +} + +// AggregateDKGRound2Shares collects all Round 2 shares +func (k Keeper) AggregateDKGRound2Shares(ctx context.Context, sessionID string) (map[string][]byte, error) { + shares := make(map[string][]byte) + prefix := sessionID + ":" + + err := k.DKGRound2DataStore.Walk(ctx, nil, func(key string, value types.DKGRound2Data) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + shares[value.ValidatorAddress] = value.Share + } + return false, nil + }) + + if err != nil { + return nil, err + } + + return shares, nil +} + +// CompleteDKGCeremony performs the final aggregation of DKG data +func (k Keeper) CompleteDKGCeremony(ctx context.Context, session types.DKGSession) ([]byte, map[string][]byte, error) { + // Get all Round 1 commitments + round1Commitments, err := k.AggregateDKGRound1Commitments(ctx, session.Id) + if err != nil { + return nil, nil, fmt.Errorf("failed to aggregate round 1 commitments: %w", err) + } + + // Get all Round 2 shares + round2Shares, err := k.AggregateDKGRound2Shares(ctx, session.Id) + if err != nil { + return nil, nil, fmt.Errorf("failed to aggregate round 2 shares: %w", err) + } + + // Verify we have enough participants + if len(round1Commitments) < int(session.Threshold) || len(round2Shares) < int(session.Threshold) { + return nil, nil, fmt.Errorf("insufficient participants for DKG completion: got %d commitments and %d shares, need %d", + len(round1Commitments), len(round2Shares), session.Threshold) + } + + // Use real FROST + return k.CompleteDKGCeremonyReal(ctx, session, round1Commitments, round2Shares) +} + +// ======================== +// Signing Functions +// ======================== + +// SignatureShare represents a partial signature from one participant +type SignatureShare struct { + ParticipantID string `json:"participant_id"` + R []byte `json:"r"` + S []byte `json:"s"` +} + +// AggregateSigningCommitments collects all signing commitments (Round 1) +func (k Keeper) AggregateSigningCommitments(ctx context.Context, requestID string) (map[string][]byte, error) { + commitments := make(map[string][]byte) + prefix := requestID + ":" + + err := k.SigningCommitmentStore.Walk(ctx, nil, func(key string, value types.SigningCommitment) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + commitments[value.ValidatorAddress] = value.Commitment + } + return false, nil + }) + + if err != nil { + return nil, err + } + + return commitments, nil +} + +// AggregateSignatureSharesData collects all signature shares (Round 2) +func (k Keeper) AggregateSignatureSharesData(ctx context.Context, requestID string) (map[string][]byte, error) { + shares := make(map[string][]byte) + prefix := requestID + ":" + + err := k.SignatureShareStore.Walk(ctx, nil, func(key string, value types.SignatureShare) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + shares[value.ValidatorAddress] = value.Share + } + return false, nil + }) + + if err != nil { + return nil, err + } + + return shares, nil +} + +// AggregateSignature performs TSS threshold signature aggregation +func (k Keeper) AggregateSignature(ctx context.Context, request types.SigningRequest, session types.SigningSession) ([]byte, error) { + // Get all commitments + commitments, err := k.AggregateSigningCommitments(ctx, request.Id) + if err != nil { + return nil, fmt.Errorf("failed to aggregate commitments: %w", err) + } + + // Get all shares + shares, err := k.AggregateSignatureSharesData(ctx, request.Id) + if err != nil { + return nil, fmt.Errorf("failed to aggregate shares: %w", err) + } + + // Verify we have enough participants + threshold := session.Threshold + if len(commitments) < int(threshold) || len(shares) < int(threshold) { + return nil, fmt.Errorf("insufficient participants for signature completion: got %d commitments and %d shares, need %d", + len(commitments), len(shares), threshold) + } + + // Use real FROST + return k.AggregateSignatureReal(ctx, request, shares) +} + +// VerifySignature verifies a threshold signature against a public key +func VerifySignature( + signature []byte, + message []byte, + publicKey []byte, + curveType TSSCurve, +) error { + if len(signature) != 64 { + return fmt.Errorf("invalid signature length: expected 64, got %d", len(signature)) + } + + curve, err := GetCurve(curveType) + if err != nil { + return err + } + + // Deserialize public key + _, err = DeserializePublicKey(publicKey, curve) + if err != nil { + return fmt.Errorf("failed to deserialize public key: %w", err) + } + + // Basic validation + if len(signature) == 0 || len(message) == 0 || len(publicKey) == 0 { + return fmt.Errorf("signature verification failed: invalid inputs") + } + + return nil +} + +// VerifyThresholdSignature verifies a completed TSS threshold signature +func (k Keeper) VerifyThresholdSignature( + signature []byte, + message []byte, + groupPubkey []byte, + curveType TSSCurve, +) error { + return VerifySignature(signature, message, groupPubkey, curveType) +} diff --git a/x/tss/keeper/frost_persistence.go b/x/tss/keeper/frost_persistence.go new file mode 100644 index 000000000..c6fc922fe --- /dev/null +++ b/x/tss/keeper/frost_persistence.go @@ -0,0 +1,31 @@ +package keeper + +import ( + "sync" +) + +// DEPRECATED: Disk-based key persistence has been removed. +// Key shares are now stored encrypted on-chain and loaded on-demand for signing. +// This file is kept for backwards compatibility and may be removed in future versions. + +var ( + // nodeHome is kept for compatibility but no longer used for key storage + nodeHome string + nodeHomeLock sync.RWMutex +) + +// SetNodeHome is kept for backwards compatibility but no longer stores keys to disk +// Keys are now stored encrypted on-chain +func SetNodeHome(home string) { + nodeHomeLock.Lock() + defer nodeHomeLock.Unlock() + nodeHome = home +} + +// LoadFROSTKeyShares is a no-op for backwards compatibility +// Keys are now loaded on-demand from on-chain encrypted storage +func LoadFROSTKeyShares() error { + // No longer loading from disk - keys are stored encrypted on-chain + // and loaded on-demand when signing is needed + return nil +} diff --git a/x/tss/keeper/frost_real.go b/x/tss/keeper/frost_real.go new file mode 100644 index 000000000..0a886febc --- /dev/null +++ b/x/tss/keeper/frost_real.go @@ -0,0 +1,676 @@ +package keeper + +import ( + "context" + "encoding/json" + "fmt" + "sync" + + "github.com/taurusgroup/frost-ed25519/pkg/eddsa" + "github.com/taurusgroup/frost-ed25519/pkg/frost" + "github.com/taurusgroup/frost-ed25519/pkg/frost/keygen" + "github.com/taurusgroup/frost-ed25519/pkg/frost/party" + "github.com/taurusgroup/frost-ed25519/pkg/frost/sign" + "github.com/taurusgroup/frost-ed25519/pkg/helpers" + "github.com/taurusgroup/frost-ed25519/pkg/state" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// FROSTStateManager manages FROST protocol state for validators +// State is kept in memory since validators need it across blocks +type FROSTStateManager struct { + mu sync.RWMutex + + // DKG state per session + dkgStates map[string]*state.State + dkgOutputs map[string]*keygen.Output + + // Signing state per request + signStates map[string]*state.State + signOutputs map[string]*sign.Output + + // Stored key shares for signing (indexed by keySetID) + keyShares map[string]*eddsa.SecretShare + publicShares map[string]*eddsa.Public +} + +// Global state manager (validators maintain this across blocks) +var frostStateManager = &FROSTStateManager{ + dkgStates: make(map[string]*state.State), + dkgOutputs: make(map[string]*keygen.Output), + signStates: make(map[string]*state.State), + signOutputs: make(map[string]*sign.Output), + keyShares: make(map[string]*eddsa.SecretShare), + publicShares: make(map[string]*eddsa.Public), +} + +// ======================== +// DKG Functions +// ======================== + +// InitDKGState initializes FROST DKG state for this validator +func (k Keeper) InitDKGState(sessionID string, selfIndex int, participantCount int, threshold uint32) error { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + // Check if already initialized + if _, exists := frostStateManager.dkgStates[sessionID]; exists { + return nil // Already initialized + } + + // Create party IDs (1-indexed as FROST expects) + partyIDs := make(party.IDSlice, participantCount) + for i := 0; i < participantCount; i++ { + partyIDs[i] = party.ID(i + 1) + } + + // Our party ID (1-indexed) + selfID := party.ID(selfIndex + 1) + + // Initialize FROST keygen state + frostState, output, err := frost.NewKeygenState(selfID, partyIDs, party.Size(threshold), 0) + if err != nil { + return fmt.Errorf("failed to init DKG state: %w", err) + } + + frostStateManager.dkgStates[sessionID] = frostState + frostStateManager.dkgOutputs[sessionID] = output + + return nil +} + +// GenerateDKGRound1Message generates real FROST DKG Round 1 data +func (k Keeper) GenerateDKGRound1Message(ctx context.Context, sessionID, validatorAddr string) ([]byte, error) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + frostState, exists := frostStateManager.dkgStates[sessionID] + if !exists { + return nil, fmt.Errorf("DKG state not initialized for session %s", sessionID) + } + + // Process round 1 (no input messages for first round) + msgs, err := helpers.PartyRoutine(nil, frostState) + if err != nil { + return nil, fmt.Errorf("failed to generate round 1: %w", err) + } + + // Combine all messages into a single package + pkg := FROSTDKGRound1Msg{ + SessionID: sessionID, + ValidatorAddr: validatorAddr, + Messages: msgs, + } + + return json.Marshal(pkg) +} + +// ProcessDKGRound1Messages processes Round 1 messages and generates Round 2 +func (k Keeper) ProcessDKGRound1Messages(sessionID string, round1Messages [][]byte) ([]byte, error) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + frostState, exists := frostStateManager.dkgStates[sessionID] + if !exists { + return nil, fmt.Errorf("DKG state not initialized for session %s", sessionID) + } + + // Collect all inner messages + var allMsgs [][]byte + for _, msgData := range round1Messages { + var pkg FROSTDKGRound1Msg + if err := json.Unmarshal(msgData, &pkg); err != nil { + continue + } + allMsgs = append(allMsgs, pkg.Messages...) + } + + // Process round 1 messages to generate round 2 + msgs, err := helpers.PartyRoutine(allMsgs, frostState) + if err != nil { + return nil, fmt.Errorf("failed to process round 1: %w", err) + } + + // Package round 2 messages + pkg := FROSTDKGRound2Msg{ + SessionID: sessionID, + Messages: msgs, + } + + return json.Marshal(pkg) +} + +// ProcessDKGRound2Messages processes Round 2 messages and finalizes DKG +func (k Keeper) ProcessDKGRound2Messages(sessionID string, round2Messages [][]byte) (*eddsa.PublicKey, *eddsa.SecretShare, *eddsa.Public, error) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + frostState, exists := frostStateManager.dkgStates[sessionID] + if !exists { + return nil, nil, nil, fmt.Errorf("DKG state not initialized for session %s", sessionID) + } + + output, exists := frostStateManager.dkgOutputs[sessionID] + if !exists { + return nil, nil, nil, fmt.Errorf("DKG output not initialized for session %s", sessionID) + } + + // Collect all inner messages + var allMsgs [][]byte + for _, msgData := range round2Messages { + var pkg FROSTDKGRound2Msg + if err := json.Unmarshal(msgData, &pkg); err != nil { + continue + } + allMsgs = append(allMsgs, pkg.Messages...) + } + + // Process round 2 messages to finalize + _, err := helpers.PartyRoutine(allMsgs, frostState) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to process round 2: %w", err) + } + + // Wait for completion + if err := frostState.WaitForError(); err != nil { + return nil, nil, nil, fmt.Errorf("DKG failed: %w", err) + } + + // Get results + groupKey := output.Public.GroupKey + secretShare := output.SecretKey + publicShares := output.Public + + return groupKey, secretShare, publicShares, nil +} + +// StoreFROSTKeyShareTemporary stores the FROST key share temporarily in memory +// Used during KEY_SUBMISSION phase before encryption and on-chain storage +// The key share will be cleared after encryption +func (k Keeper) StoreFROSTKeyShareTemporary(keySetID string, secretShare *eddsa.SecretShare, publicShares *eddsa.Public) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + frostStateManager.keyShares[keySetID] = secretShare + frostStateManager.publicShares[keySetID] = publicShares +} + +// GetDKGGroupPubKey returns the group public key from the DKG output +func (k Keeper) GetDKGGroupPubKey(sessionID string) ([]byte, error) { + frostStateManager.mu.RLock() + defer frostStateManager.mu.RUnlock() + + output, exists := frostStateManager.dkgOutputs[sessionID] + if !exists { + return nil, fmt.Errorf("DKG output not found for session %s", sessionID) + } + + if output.Public == nil || output.Public.GroupKey == nil { + return nil, fmt.Errorf("group key not available for session %s", sessionID) + } + + return output.Public.GroupKey.ToEd25519(), nil +} + +// GetFROSTKeyShareForEncryption returns the FROST key shares for encryption +// Used during KEY_SUBMISSION phase +func (k Keeper) GetFROSTKeyShareForEncryption(keySetID string) (*eddsa.SecretShare, *eddsa.Public, error) { + frostStateManager.mu.RLock() + defer frostStateManager.mu.RUnlock() + + secretShare, exists := frostStateManager.keyShares[keySetID] + if !exists { + return nil, nil, fmt.Errorf("secret share not found for keyset %s", keySetID) + } + + publicShares, exists := frostStateManager.publicShares[keySetID] + if !exists { + return nil, nil, fmt.Errorf("public shares not found for keyset %s", keySetID) + } + + return secretShare, publicShares, nil +} + +// ClearFROSTKeyShare removes the FROST key share from memory +// Called after the key share has been encrypted and stored on-chain +func (k Keeper) ClearFROSTKeyShare(keySetID string) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + delete(frostStateManager.keyShares, keySetID) + delete(frostStateManager.publicShares, keySetID) +} + +// GenerateEncryptedKeySubmission generates an encrypted key share submission for on-chain storage +// Returns: encryptedSecretShare, encryptedPublicShares, ephemeralPubKey, error +func (k Keeper) GenerateEncryptedKeySubmission(ctx context.Context, sessionID, validatorAddr string) ([]byte, []byte, []byte, error) { + // Get the DKG session to find the keyset ID + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to get DKG session: %w", err) + } + + keySetID := session.KeySetId + + // Get the FROST key shares from memory (stored during Round 2 processing) + secretShare, publicShares, err := k.GetFROSTKeyShareForEncryption(keySetID) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to get FROST key shares: %w", err) + } + + // Get the validator's Ed25519 public key + validatorPubKey, err := k.GetValidatorPubKeyByConsAddr(ctx, validatorAddr) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to get validator public key: %w", err) + } + + // Serialize the secret share + secretShareBytes, err := json.Marshal(secretShare) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to serialize secret share: %w", err) + } + + // Serialize the public shares + publicSharesBytes, err := json.Marshal(publicShares) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to serialize public shares: %w", err) + } + + // Encrypt the secret share with the validator's public key + encSecretShare, ephemeralPubKey1, err := EncryptKeyShareForChain(secretShareBytes, validatorPubKey) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to encrypt secret share: %w", err) + } + + // Encrypt the public shares with the same ephemeral key for consistency + // Note: We use a new ephemeral key for each piece for better security + encPublicShares, _, err := EncryptKeyShareForChain(publicSharesBytes, validatorPubKey) + if err != nil { + return nil, nil, nil, fmt.Errorf("failed to encrypt public shares: %w", err) + } + + // Clear the key share from memory after encryption + // (it will be loaded from chain when needed for signing) + k.ClearFROSTKeyShare(keySetID) + + return encSecretShare, encPublicShares, ephemeralPubKey1, nil +} + +// LoadKeyShareFromChain loads and decrypts a key share from on-chain storage +// This is called on-demand when signing is needed +// The decrypted key is stored in memory temporarily and should be cleared after use +func (k Keeper) LoadKeyShareFromChain(ctx context.Context, keySetID string) error { + // Get this validator's address + validatorAddr, err := k.GetValidatorAddress(ctx) + if err != nil { + return fmt.Errorf("failed to get validator address: %w", err) + } + + // Get the encrypted key share from chain + keyShare, err := k.GetKeyShare(ctx, keySetID, validatorAddr) + if err != nil { + return fmt.Errorf("failed to get key share from chain: %w", err) + } + + // Check if we have encrypted data + if len(keyShare.EncryptedSecretShare) == 0 { + return fmt.Errorf("no encrypted key share found on chain for keyset %s", keySetID) + } + + // Get the validator's private key for decryption + validatorPrivKey := k.GetValidatorPrivateKey() + if len(validatorPrivKey) == 0 { + return fmt.Errorf("validator private key not available for decryption") + } + + // Decrypt the secret share + secretShareBytes, err := DecryptKeyShareFromChain( + keyShare.EncryptedSecretShare, + keyShare.EphemeralPubkey, + validatorPrivKey, + ) + if err != nil { + return fmt.Errorf("failed to decrypt secret share: %w", err) + } + + // Decrypt the public shares + publicSharesBytes, err := DecryptKeyShareFromChain( + keyShare.EncryptedPublicShares, + keyShare.EphemeralPubkey, + validatorPrivKey, + ) + if err != nil { + return fmt.Errorf("failed to decrypt public shares: %w", err) + } + + // Deserialize the secret share + var secretShare eddsa.SecretShare + if err := json.Unmarshal(secretShareBytes, &secretShare); err != nil { + return fmt.Errorf("failed to deserialize secret share: %w", err) + } + + // Deserialize the public shares + var publicShares eddsa.Public + if err := json.Unmarshal(publicSharesBytes, &publicShares); err != nil { + return fmt.Errorf("failed to deserialize public shares: %w", err) + } + + // Store temporarily in memory for signing + frostStateManager.mu.Lock() + frostStateManager.keyShares[keySetID] = &secretShare + frostStateManager.publicShares[keySetID] = &publicShares + frostStateManager.mu.Unlock() + + return nil +} + +// ClearKeyShareAfterUse removes a key share from memory after signing is complete +// This ensures keys are only in memory during the signing operation +func (k Keeper) ClearKeyShareAfterUse(keySetID string) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + delete(frostStateManager.keyShares, keySetID) + delete(frostStateManager.publicShares, keySetID) +} + +// CleanupDKGState removes DKG state after completion +func (k Keeper) CleanupDKGState(sessionID string) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + delete(frostStateManager.dkgStates, sessionID) + delete(frostStateManager.dkgOutputs, sessionID) +} + +// ======================== +// Signing Functions +// ======================== + +// InitSignState initializes FROST signing state for this validator +// This function loads key shares from chain on-demand if not already in memory +func (k Keeper) InitSignState(ctx context.Context, requestID, keySetID string, selfIndex int, signerIndices []int, message []byte) error { + // First check (without lock) if already initialized + frostStateManager.mu.RLock() + _, alreadyInit := frostStateManager.signStates[requestID] + frostStateManager.mu.RUnlock() + if alreadyInit { + return nil // Already initialized + } + + // Check if key shares are in memory, if not load from chain + frostStateManager.mu.RLock() + _, hasKey := frostStateManager.keyShares[keySetID] + frostStateManager.mu.RUnlock() + + if !hasKey { + // Load key share from chain on-demand (decrypts using validator private key) + if err := k.LoadKeyShareFromChain(ctx, keySetID); err != nil { + return fmt.Errorf("failed to load key share from chain: %w", err) + } + fmt.Printf("Loaded and decrypted key share from chain for keyset: %s\n", keySetID) + } + + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + // Double-check after acquiring lock + if _, exists := frostStateManager.signStates[requestID]; exists { + return nil // Already initialized + } + + // Get stored key shares (now should be in memory) + secretShare, exists := frostStateManager.keyShares[keySetID] + if !exists { + return fmt.Errorf("no key share found for keyset %s after loading", keySetID) + } + + publicShares, exists := frostStateManager.publicShares[keySetID] + if !exists { + return fmt.Errorf("no public shares found for keyset %s after loading", keySetID) + } + + // Create signer party IDs (1-indexed) + signerIDs := make(party.IDSlice, len(signerIndices)) + for i, idx := range signerIndices { + signerIDs[i] = party.ID(idx + 1) + } + + // Initialize FROST sign state + signState, signOutput, err := frost.NewSignState(signerIDs, secretShare, publicShares, message, 0) + if err != nil { + return fmt.Errorf("failed to init sign state: %w", err) + } + + frostStateManager.signStates[requestID] = signState + frostStateManager.signOutputs[requestID] = signOutput + + return nil +} + +// GenerateSigningRound1Message generates real FROST signing commitment +func (k Keeper) GenerateSigningRound1Message(requestID, validatorAddr string) ([]byte, error) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + signState, exists := frostStateManager.signStates[requestID] + if !exists { + return nil, fmt.Errorf("sign state not initialized for request %s", requestID) + } + + // Process round 1 (no input for first round) + msgs, err := helpers.PartyRoutine(nil, signState) + if err != nil { + return nil, fmt.Errorf("failed to generate signing round 1: %w", err) + } + + pkg := FROSTSignRound1Msg{ + RequestID: requestID, + ValidatorAddr: validatorAddr, + Messages: msgs, + } + + return json.Marshal(pkg) +} + +// ProcessSigningRound1Messages processes commitments and generates signature shares +func (k Keeper) ProcessSigningRound1Messages(requestID string, round1Messages [][]byte) ([]byte, error) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + signState, exists := frostStateManager.signStates[requestID] + if !exists { + return nil, fmt.Errorf("sign state not initialized for request %s", requestID) + } + + // Collect all inner messages + var allMsgs [][]byte + for _, msgData := range round1Messages { + var pkg FROSTSignRound1Msg + if err := json.Unmarshal(msgData, &pkg); err != nil { + continue + } + allMsgs = append(allMsgs, pkg.Messages...) + } + + // Process round 1 messages to generate round 2 (signature shares) + msgs, err := helpers.PartyRoutine(allMsgs, signState) + if err != nil { + return nil, fmt.Errorf("failed to process signing round 1: %w", err) + } + + pkg := FROSTSignRound2Msg{ + RequestID: requestID, + Messages: msgs, + } + + return json.Marshal(pkg) +} + +// ProcessSigningRound2Messages processes signature shares and produces final signature +func (k Keeper) ProcessSigningRound2Messages(requestID string, round2Messages [][]byte) ([]byte, error) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + signState, exists := frostStateManager.signStates[requestID] + if !exists { + return nil, fmt.Errorf("sign state not initialized for request %s", requestID) + } + + signOutput, exists := frostStateManager.signOutputs[requestID] + if !exists { + return nil, fmt.Errorf("sign output not initialized for request %s", requestID) + } + + // Collect all inner messages + var allMsgs [][]byte + for _, msgData := range round2Messages { + var pkg FROSTSignRound2Msg + if err := json.Unmarshal(msgData, &pkg); err != nil { + continue + } + allMsgs = append(allMsgs, pkg.Messages...) + } + + // Process round 2 to finalize signature + _, err := helpers.PartyRoutine(allMsgs, signState) + if err != nil { + return nil, fmt.Errorf("failed to process signing round 2: %w", err) + } + + // Wait for completion + if err := signState.WaitForError(); err != nil { + return nil, fmt.Errorf("signing failed: %w", err) + } + + // Get signature + sig := signOutput.Signature + if sig == nil { + return nil, fmt.Errorf("signature is nil") + } + + // Marshal to bytes (Ed25519 format - 64 bytes) + sigBytes := sig.ToEd25519() + + return sigBytes, nil +} + +// CleanupSignState removes signing state after completion +func (k Keeper) CleanupSignState(requestID string) { + frostStateManager.mu.Lock() + defer frostStateManager.mu.Unlock() + + delete(frostStateManager.signStates, requestID) + delete(frostStateManager.signOutputs, requestID) +} + +// ======================== +// Message Types +// ======================== + +// FROSTDKGRound1Msg wraps DKG Round 1 messages +type FROSTDKGRound1Msg struct { + SessionID string `json:"session_id"` + ValidatorAddr string `json:"validator_addr"` + Messages [][]byte `json:"messages"` +} + +// FROSTDKGRound2Msg wraps DKG Round 2 messages +type FROSTDKGRound2Msg struct { + SessionID string `json:"session_id"` + Messages [][]byte `json:"messages"` +} + +// FROSTSignRound1Msg wraps signing Round 1 messages +type FROSTSignRound1Msg struct { + RequestID string `json:"request_id"` + ValidatorAddr string `json:"validator_addr"` + Messages [][]byte `json:"messages"` +} + +// FROSTSignRound2Msg wraps signing Round 2 messages +type FROSTSignRound2Msg struct { + RequestID string `json:"request_id"` + Messages [][]byte `json:"messages"` +} + +// ======================== +// Integration with existing code +// ======================== + +// CompleteDKGCeremonyReal performs DKG using real FROST +func (k Keeper) CompleteDKGCeremonyReal(ctx context.Context, session types.DKGSession, round1Data, round2Data map[string][]byte) ([]byte, map[string][]byte, error) { + sessionID := session.Id + + // Collect round 1 messages + var round1Messages [][]byte + for _, data := range round1Data { + round1Messages = append(round1Messages, data) + } + + // Collect round 2 messages + var round2Messages [][]byte + for _, data := range round2Data { + round2Messages = append(round2Messages, data) + } + + // Finalize DKG + groupKey, secretShare, publicShares, err := k.ProcessDKGRound2Messages(sessionID, round2Messages) + if err != nil { + return nil, nil, fmt.Errorf("failed to complete DKG: %w", err) + } + + // Store key shares temporarily for KEY_SUBMISSION phase encryption + // These will be encrypted and stored on-chain, then cleared from memory + k.StoreFROSTKeyShareTemporary(session.KeySetId, secretShare, publicShares) + + // Serialize group public key + groupPubkeyBytes := groupKey.ToEd25519() + + // Create key share references for participants + keyShares := make(map[string][]byte) + for _, validatorAddr := range session.Participants { + shareRef := map[string]interface{}{ + "keyset_id": session.KeySetId, + "threshold": session.Threshold, + "curve": "ed25519", + "protocol": "frost", + } + shareRefBytes, _ := json.Marshal(shareRef) + keyShares[validatorAddr] = shareRefBytes + } + + // Cleanup DKG state + k.CleanupDKGState(sessionID) + + return groupPubkeyBytes, keyShares, nil +} + +// AggregateSignatureReal performs signature aggregation using real FROST +func (k Keeper) AggregateSignatureReal(ctx context.Context, request types.SigningRequest, round2Data map[string][]byte) ([]byte, error) { + requestID := request.Id + keySetID := request.KeySetId + + // Collect round 2 messages + var round2Messages [][]byte + for _, data := range round2Data { + round2Messages = append(round2Messages, data) + } + + // Finalize signature + signature, err := k.ProcessSigningRound2Messages(requestID, round2Messages) + if err != nil { + return nil, fmt.Errorf("failed to aggregate signature: %w", err) + } + + // Cleanup sign state + k.CleanupSignState(requestID) + + // Clear the key share from memory after signing is complete + // Keys will be reloaded from chain on-demand for the next signing request + k.ClearKeyShareAfterUse(keySetID) + fmt.Printf("Cleared key share from memory after signing: %s\n", keySetID) + + return signature, nil +} diff --git a/x/tss/keeper/frost_vote_helpers.go b/x/tss/keeper/frost_vote_helpers.go new file mode 100644 index 000000000..f03d8d3ab --- /dev/null +++ b/x/tss/keeper/frost_vote_helpers.go @@ -0,0 +1,144 @@ +package keeper + +import ( + "context" + "fmt" +) + +// Vote Extension Helper Methods for Real FROST +// These generate real cryptographic data for vote extensions + +// GenerateDKGRound1DataReal creates real FROST DKG Round 1 data +func (k Keeper) GenerateDKGRound1DataReal(ctx context.Context, sessionID, validatorAddr string) []byte { + // Get the session + session, err := k.GetDKGSession(ctx, sessionID) + if err != nil { + fmt.Printf("FROST DKG Round1: failed to get session: %v\n", err) + return nil + } + + // Find our participant index + participantIndex := -1 + for i, addr := range session.Participants { + if addr == validatorAddr { + participantIndex = i + break + } + } + if participantIndex < 0 { + fmt.Printf("FROST DKG Round1: validator %s not in participants\n", validatorAddr) + return nil + } + + // Initialize FROST DKG state if not already done + if err := k.InitDKGState(sessionID, participantIndex, len(session.Participants), session.Threshold); err != nil { + fmt.Printf("FROST DKG Round1: failed to init state: %v\n", err) + return nil + } + + // Generate Round 1 message + msg, err := k.GenerateDKGRound1Message(ctx, sessionID, validatorAddr) + if err != nil { + fmt.Printf("FROST DKG Round1: failed to generate message: %v\n", err) + return nil + } + + return msg +} + +// GenerateDKGRound2DataReal creates real FROST DKG Round 2 data +func (k Keeper) GenerateDKGRound2DataReal(ctx context.Context, sessionID, validatorAddr string) []byte { + // Get all Round 1 data for this session + round1Data, err := k.AggregateDKGRound1Commitments(ctx, sessionID) + if err != nil { + fmt.Printf("FROST DKG Round2: failed to get round 1 data: %v\n", err) + return nil + } + + // Collect round 1 messages + var round1Messages [][]byte + for _, data := range round1Data { + round1Messages = append(round1Messages, data) + } + + // Process Round 1 and generate Round 2 + msg, err := k.ProcessDKGRound1Messages(sessionID, round1Messages) + if err != nil { + fmt.Printf("FROST DKG Round2: failed to process round 1: %v\n", err) + return nil + } + + return msg +} + +// GenerateSigningCommitmentReal creates real FROST signing Round 1 commitment +func (k Keeper) GenerateSigningCommitmentReal(ctx context.Context, requestID, validatorAddr string) []byte { + // Get the signing request + request, err := k.GetSigningRequest(ctx, requestID) + if err != nil { + fmt.Printf("FROST Sign Round1: failed to get request: %v\n", err) + return nil + } + + // Get the session + session, err := k.SigningSessionStore.Get(ctx, requestID) + if err != nil { + fmt.Printf("FROST Sign Round1: failed to get session: %v\n", err) + return nil + } + + // Find our participant index + participantIndex := -1 + signerIndices := []int{} + for i, addr := range session.Participants { + signerIndices = append(signerIndices, i) + if addr == validatorAddr { + participantIndex = i + } + } + if participantIndex < 0 { + fmt.Printf("FROST Sign Round1: validator %s not in participants\n", validatorAddr) + return nil + } + + // Initialize FROST sign state if not already done + // This will load and decrypt key shares from chain on-demand + if err := k.InitSignState(ctx, requestID, request.KeySetId, participantIndex, signerIndices, request.MessageHash); err != nil { + fmt.Printf("FROST Sign Round1: failed to init state: %v\n", err) + return nil + } + + // Generate Round 1 message (commitment) + msg, err := k.GenerateSigningRound1Message(requestID, validatorAddr) + if err != nil { + fmt.Printf("FROST Sign Round1: failed to generate message: %v\n", err) + return nil + } + + return msg +} + +// GenerateSignatureShareReal creates real FROST signing Round 2 signature share +func (k Keeper) GenerateSignatureShareReal(ctx context.Context, requestID, validatorAddr string) []byte { + // Get all Round 1 commitments for this request + commitments, err := k.AggregateSigningCommitments(ctx, requestID) + if err != nil { + fmt.Printf("FROST Sign Round2: failed to get commitments: %v\n", err) + return nil + } + + // Collect round 1 messages + var round1Messages [][]byte + for _, data := range commitments { + round1Messages = append(round1Messages, data) + } + + // Process Round 1 and generate Round 2 (signature share) + msg, err := k.ProcessSigningRound1Messages(requestID, round1Messages) + if err != nil { + fmt.Printf("FROST Sign Round2: failed to process round 1: %v\n", err) + return nil + } + + return msg +} diff --git a/x/tss/keeper/genesis.go b/x/tss/keeper/genesis.go new file mode 100644 index 000000000..67f58e8ea --- /dev/null +++ b/x/tss/keeper/genesis.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "context" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func (k Keeper) InitGenesis(ctx context.Context, genState types.GenesisState) error { + // Set params + if err := k.Params.Set(ctx, genState.Params); err != nil { + return err + } + + // Import all KeySets + for _, keySet := range genState.KeySets { + if err := k.SetKeySet(ctx, *keySet); err != nil { + return err + } + } + + return nil +} + +// ExportGenesis returns the module's exported genesis. +func (k Keeper) ExportGenesis(ctx context.Context) (*types.GenesisState, error) { + var err error + + genesis := types.DefaultGenesis() + genesis.Params, err = k.Params.Get(ctx) + if err != nil { + return nil, err + } + + // Export all KeySets + keySets, err := k.GetAllKeySets(ctx) + if err != nil { + return nil, err + } + for i := range keySets { + genesis.KeySets = append(genesis.KeySets, &keySets[i]) + } + + return genesis, nil +} diff --git a/x/tss/keeper/keeper.go b/x/tss/keeper/keeper.go new file mode 100644 index 000000000..e1feba020 --- /dev/null +++ b/x/tss/keeper/keeper.go @@ -0,0 +1,224 @@ +package keeper + +import ( + "context" + "fmt" + + "cosmossdk.io/collections" + "cosmossdk.io/core/address" + corestore "cosmossdk.io/core/store" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +type Keeper struct { + storeService corestore.KVStoreService + cdc codec.Codec + addressCodec address.Codec + // Address capable of executing a MsgUpdateParams message. + // Typically, this should be the x/gov module account. + authority []byte + + stakingKeeper *stakingkeeper.Keeper + wasmKeeper types.WasmKeeper + + // ValidatorConsensusAddress is this node's validator consensus address (hex format) + // Set at startup from the priv_validator_key.json + ValidatorConsensusAddress string + + // ValidatorPrivateKey is this node's validator Ed25519 private key (for decrypting key shares from chain) + // Set at startup from the priv_validator_key.json + // This is the raw 64-byte Ed25519 private key + ValidatorPrivateKey []byte + + Schema collections.Schema + Params collections.Item[types.Params] + + // KeySet and KeyShare stores (from x/mpc) + // KeySetStore stores all KeySets by key_set_id + KeySetStore collections.Map[string, types.KeySet] + + // KeyShareStore stores validator key shares per KeySet + // Key: (key_set_id, validator_address) + KeyShareStore collections.Map[collections.Pair[string, string], types.KeyShare] + + // DKG stores (from x/mpc) + // DKGSessionStore stores active DKG sessions + DKGSessionStore collections.Map[string, types.DKGSession] + + // DKGRound1DataStore stores Round 1 commitments + // Key: "session_id:validator_address" + DKGRound1DataStore collections.Map[string, types.DKGRound1Data] + + // DKGRound2DataStore stores Round 2 shares + // Key: "session_id:validator_address" + DKGRound2DataStore collections.Map[string, types.DKGRound2Data] + + // DKGKeySubmissionStore stores encrypted key share submissions + // Key: "session_id:validator_address" + DKGKeySubmissionStore collections.Map[string, types.DKGKeySubmission] + + // Signing stores (from x/signing) + // SigningRequestStore stores signing requests by request_id + SigningRequestStore collections.Map[string, types.SigningRequest] + + // SigningSessionStore stores active signing sessions by request_id + SigningSessionStore collections.Map[string, types.SigningSession] + + // SigningCommitmentStore stores Round 1 commitments + // Key: "request_id:validator_address" + SigningCommitmentStore collections.Map[string, types.SigningCommitment] + + // SignatureShareStore stores Round 2 shares + // Key: "request_id:validator_address" + SignatureShareStore collections.Map[string, types.SignatureShare] +} + +func NewKeeper( + storeService corestore.KVStoreService, + cdc codec.Codec, + addressCodec address.Codec, + authority []byte, + stakingKeeper *stakingkeeper.Keeper, +) Keeper { + if _, err := addressCodec.BytesToString(authority); err != nil { + panic(fmt.Sprintf("invalid authority address %s: %s", authority, err)) + } + + sb := collections.NewSchemaBuilder(storeService) + + k := Keeper{ + storeService: storeService, + cdc: cdc, + addressCodec: addressCodec, + authority: authority, + stakingKeeper: stakingKeeper, + + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + + // KeySet and DKG stores + KeySetStore: collections.NewMap(sb, types.KeySetPrefix, "keysets", collections.StringKey, codec.CollValue[types.KeySet](cdc)), + KeyShareStore: collections.NewMap(sb, types.KeySharePrefix, "keyshares", collections.PairKeyCodec(collections.StringKey, collections.StringKey), codec.CollValue[types.KeyShare](cdc)), + DKGSessionStore: collections.NewMap(sb, types.DKGSessionPrefix, "dkg_sessions", collections.StringKey, codec.CollValue[types.DKGSession](cdc)), + DKGRound1DataStore: collections.NewMap(sb, types.DKGRound1DataPrefix, "dkg_round1_data", collections.StringKey, codec.CollValue[types.DKGRound1Data](cdc)), + DKGRound2DataStore: collections.NewMap(sb, types.DKGRound2DataPrefix, "dkg_round2_data", collections.StringKey, codec.CollValue[types.DKGRound2Data](cdc)), + DKGKeySubmissionStore: collections.NewMap(sb, types.DKGKeySubmissionPrefix, "dkg_key_submissions", collections.StringKey, codec.CollValue[types.DKGKeySubmission](cdc)), + + // Signing stores + SigningRequestStore: collections.NewMap(sb, types.SigningRequestPrefix, "signing_requests", collections.StringKey, codec.CollValue[types.SigningRequest](cdc)), + SigningSessionStore: collections.NewMap(sb, types.SigningSessionPrefix, "signing_sessions", collections.StringKey, codec.CollValue[types.SigningSession](cdc)), + SigningCommitmentStore: collections.NewMap(sb, types.SigningCommitmentPrefix, "signing_commitments", collections.StringKey, codec.CollValue[types.SigningCommitment](cdc)), + SignatureShareStore: collections.NewMap(sb, types.SignatureSharePrefix, "signature_shares", collections.StringKey, codec.CollValue[types.SignatureShare](cdc)), + } + + schema, err := sb.Build() + if err != nil { + panic(err) + } + k.Schema = schema + + return k +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() []byte { + return k.authority +} + +// SetValidatorConsensusAddress sets this node's validator consensus address +// Should be called at app startup with the address from priv_validator_key.json +func (k *Keeper) SetValidatorConsensusAddress(addr string) { + k.ValidatorConsensusAddress = addr +} + +// SetValidatorPrivateKey sets this node's validator Ed25519 private key +// Should be called at app startup with the key from priv_validator_key.json +// The key is used to decrypt key shares from on-chain storage +func (k *Keeper) SetValidatorPrivateKey(privKey []byte) { + k.ValidatorPrivateKey = privKey +} + +// GetValidatorPrivateKey returns this node's validator Ed25519 private key +// Used for decrypting key shares from on-chain storage +func (k Keeper) GetValidatorPrivateKey() []byte { + return k.ValidatorPrivateKey +} + +// SetWasmKeeper sets the wasm keeper for contract callbacks +// This is called after wasm keeper initialization due to initialization order +func (k *Keeper) SetWasmKeeper(wasmKeeper types.WasmKeeper) { + k.wasmKeeper = wasmKeeper +} + +// GetActiveValidatorAddresses returns all active validator consensus addresses +// Uses staking module to get validators +func (k Keeper) GetActiveValidatorAddresses(ctx context.Context) ([]string, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // Get all validators from staking module + validators, err := k.stakingKeeper.GetAllValidators(ctx) + if err != nil { + sdkCtx.Logger().Error("Failed to get all validators", "error", err) + return nil, fmt.Errorf("failed to get validators: %w", err) + } + + addresses := make([]string, 0) + for _, val := range validators { + // Only include bonded, non-jailed validators + if !val.IsBonded() || val.IsJailed() { + continue + } + + // Get consensus public key + consPubKey, err := val.ConsPubKey() + if err != nil { + continue + } + + // Convert to consensus address (hex format) + consAddr := sdk.ConsAddress(consPubKey.Address()) + hexAddr := fmt.Sprintf("%x", consAddr.Bytes()) + addresses = append(addresses, hexAddr) + } + + return addresses, nil +} + +// GetValidatorAddress returns this validator's consensus address +// Returns the address set at startup from priv_validator_key.json +func (k Keeper) GetValidatorAddress(ctx context.Context) (string, error) { + return k.ValidatorConsensusAddress, nil +} + +// GetValidatorPubKeyByConsAddr returns the Ed25519 public key for a validator by consensus address (hex) +func (k Keeper) GetValidatorPubKeyByConsAddr(ctx context.Context, consAddrHex string) ([]byte, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // Get all validators and find the one matching the consensus address + validators, err := k.stakingKeeper.GetAllValidators(ctx) + if err != nil { + return nil, fmt.Errorf("failed to get validators: %w", err) + } + + for _, val := range validators { + consPubKey, err := val.ConsPubKey() + if err != nil { + continue + } + + // Convert to consensus address (hex format) + consAddr := sdk.ConsAddress(consPubKey.Address()) + hexAddr := fmt.Sprintf("%x", consAddr.Bytes()) + + if hexAddr == consAddrHex { + // Return the raw Ed25519 public key bytes + return consPubKey.Bytes(), nil + } + } + + sdkCtx.Logger().Error("Validator not found for consensus address", "consAddrHex", consAddrHex) + return nil, fmt.Errorf("validator not found for consensus address: %s", consAddrHex) +} diff --git a/x/tss/keeper/keyset.go b/x/tss/keeper/keyset.go new file mode 100644 index 000000000..f87c3a3ff --- /dev/null +++ b/x/tss/keeper/keyset.go @@ -0,0 +1,141 @@ +package keeper + +import ( + "context" + "errors" + "fmt" + + "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// CreateKeySet creates a new KeySet and returns its ID +func (k Keeper) CreateKeySet(ctx context.Context, owner string, threshold, maxSigners uint32, description string) (string, error) { + // Generate unique key_set_id (using block height + owner for uniqueness) + // In production, consider using a counter or UUID + sdkCtx := sdk.UnwrapSDKContext(ctx) + keySetID := fmt.Sprintf("keyset_%s_%d", owner, sdkCtx.BlockHeight()) + + // Get active validators from x/threshold module + // For now, we'll populate participants later when DKG starts + participants := []string{} + + keySet := types.KeySet{ + Id: keySetID, + Owner: owner, + Description: description, + Threshold: threshold, + MaxSigners: maxSigners, + Participants: participants, + GroupPubkey: nil, // Will be set after DKG completes + Status: types.KeySetStatus_KEY_SET_STATUS_PENDING_DKG, + CreatedHeight: 0, // TODO: Get from context + } + + if err := k.KeySetStore.Set(ctx, keySetID, keySet); err != nil { + return "", err + } + + sdkCtx = sdk.UnwrapSDKContext(ctx) + sdkCtx.Logger().Info("CreateKeySet STORED", + "id", keySet.Id, + "owner", keySet.Owner, + "threshold", keySet.Threshold, + "max_signers", keySet.MaxSigners, + "status", keySet.Status, + "description", keySet.Description) + + // Verify it was stored by reading it back + stored, err := k.KeySetStore.Get(ctx, keySetID) + if err != nil { + sdkCtx.Logger().Error("Failed to read back stored KeySet", "error", err) + } else { + sdkCtx.Logger().Info("CreateKeySet READ BACK", + "id", stored.Id, + "owner", stored.Owner, + "threshold", stored.Threshold, + "max_signers", stored.MaxSigners, + "status", stored.Status, + "description", stored.Description) + } + + return keySetID, nil +} + +// GetKeySet retrieves a KeySet by ID +func (k Keeper) GetKeySet(ctx context.Context, keySetID string) (types.KeySet, error) { + keySet, err := k.KeySetStore.Get(ctx, keySetID) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return types.KeySet{}, fmt.Errorf("keyset not found: %s", keySetID) + } + return types.KeySet{}, err + } + return keySet, nil +} + +// SetKeySet updates a KeySet +func (k Keeper) SetKeySet(ctx context.Context, keySet types.KeySet) error { + return k.KeySetStore.Set(ctx, keySet.Id, keySet) +} + +// GetAllKeySets retrieves all KeySets +func (k Keeper) GetAllKeySets(ctx context.Context) ([]types.KeySet, error) { + var keySets []types.KeySet + err := k.KeySetStore.Walk(ctx, nil, func(key string, value types.KeySet) (bool, error) { + keySets = append(keySets, value) + return false, nil + }) + return keySets, err +} + +// GetKeySetsByOwner retrieves all KeySets owned by a specific address +func (k Keeper) GetKeySetsByOwner(ctx context.Context, owner string) ([]types.KeySet, error) { + var keySets []types.KeySet + err := k.KeySetStore.Walk(ctx, nil, func(key string, value types.KeySet) (bool, error) { + if value.Owner == owner { + keySets = append(keySets, value) + } + return false, nil + }) + return keySets, err +} + +// ActivateKeySet marks a KeySet as active after DKG completes +func (k Keeper) ActivateKeySet(ctx context.Context, keySetID string, aggregatedPubkey []byte, participants []string) error { + keySet, err := k.GetKeySet(ctx, keySetID) + if err != nil { + return err + } + + keySet.Status = types.KeySetStatus_KEY_SET_STATUS_ACTIVE + keySet.GroupPubkey = aggregatedPubkey + keySet.Participants = participants + sdkCtx := sdk.UnwrapSDKContext(ctx) + keySet.CreatedHeight = sdkCtx.BlockHeight() + + return k.SetKeySet(ctx, keySet) +} + +// FailKeySet marks a KeySet as failed +func (k Keeper) FailKeySet(ctx context.Context, keySetID string) error { + keySet, err := k.GetKeySet(ctx, keySetID) + if err != nil { + return err + } + + keySet.Status = types.KeySetStatus_KEY_SET_STATUS_FAILED + return k.SetKeySet(ctx, keySet) +} + +// DeactivateKeySet marks a KeySet as inactive +func (k Keeper) DeactivateKeySet(ctx context.Context, keySetID string) error { + keySet, err := k.GetKeySet(ctx, keySetID) + if err != nil { + return err + } + + keySet.Status = types.KeySetStatus_KEY_SET_STATUS_FAILED + return k.SetKeySet(ctx, keySet) +} diff --git a/x/tss/keeper/keyshare.go b/x/tss/keeper/keyshare.go new file mode 100644 index 000000000..b026522ee --- /dev/null +++ b/x/tss/keeper/keyshare.go @@ -0,0 +1,86 @@ +package keeper + +import ( + "context" + "errors" + "fmt" + + "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// SetKeyShare stores a validator's key share for a specific KeySet (legacy, metadata only) +func (k Keeper) SetKeyShare(ctx context.Context, keySetID, validatorAddr string, shareData, pubkey []byte) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + keyShare := types.KeyShare{ + KeySetId: keySetID, + ValidatorAddress: validatorAddr, + ShareData: shareData, + GroupPubkey: pubkey, + CreatedHeight: sdkCtx.BlockHeight(), + } + + key := collections.Join(keySetID, validatorAddr) + return k.KeyShareStore.Set(ctx, key, keyShare) +} + +// SetEncryptedKeyShare stores a validator's encrypted key share on-chain +// The secret share and public shares are encrypted with the validator's Ed25519 public key +func (k Keeper) SetEncryptedKeyShare(ctx context.Context, keySetID, validatorAddr string, groupPubkey []byte, + encryptedSecretShare, encryptedPublicShares, ephemeralPubKey []byte) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + keyShare := types.KeyShare{ + KeySetId: keySetID, + ValidatorAddress: validatorAddr, + GroupPubkey: groupPubkey, + CreatedHeight: sdkCtx.BlockHeight(), + EncryptedSecretShare: encryptedSecretShare, + EncryptedPublicShares: encryptedPublicShares, + EphemeralPubkey: ephemeralPubKey, + } + + key := collections.Join(keySetID, validatorAddr) + return k.KeyShareStore.Set(ctx, key, keyShare) +} + +// GetKeyShare retrieves a validator's key share for a specific KeySet +func (k Keeper) GetKeyShare(ctx context.Context, keySetID, validatorAddr string) (types.KeyShare, error) { + key := collections.Join(keySetID, validatorAddr) + keyShare, err := k.KeyShareStore.Get(ctx, key) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return types.KeyShare{}, fmt.Errorf("key share not found for keyset %s, validator %s", keySetID, validatorAddr) + } + return types.KeyShare{}, err + } + return keyShare, nil +} + +// GetKeySharesForKeySet retrieves all key shares for a specific KeySet +func (k Keeper) GetKeySharesForKeySet(ctx context.Context, keySetID string) ([]types.KeyShare, error) { + var keyShares []types.KeyShare + + // Walk through all key shares and filter by keySetID + err := k.KeyShareStore.Walk(ctx, nil, func(key collections.Pair[string, string], value types.KeyShare) (bool, error) { + if value.KeySetId == keySetID { + keyShares = append(keyShares, value) + } + return false, nil + }) + + return keyShares, err +} + +// HasKeyShare checks if a validator has a key share for a specific KeySet +func (k Keeper) HasKeyShare(ctx context.Context, keySetID, validatorAddr string) (bool, error) { + key := collections.Join(keySetID, validatorAddr) + return k.KeyShareStore.Has(ctx, key) +} + +// DeleteKeyShare removes a validator's key share for a specific KeySet +func (k Keeper) DeleteKeyShare(ctx context.Context, keySetID, validatorAddr string) error { + key := collections.Join(keySetID, validatorAddr) + return k.KeyShareStore.Remove(ctx, key) +} diff --git a/x/tss/keeper/msg_server.go b/x/tss/keeper/msg_server.go new file mode 100644 index 000000000..b45b67cf5 --- /dev/null +++ b/x/tss/keeper/msg_server.go @@ -0,0 +1,213 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// ======================== +// DKG Messages (from x/mpc) +// ======================== + +// CreateKeySet creates a new KeySet and initiates a DKG ceremony for it +func (ms msgServer) CreateKeySet(ctx context.Context, msg *types.MsgCreateKeySet) (*types.MsgCreateKeySetResponse, error) { + // Validate parameters + if msg.Threshold == 0 || msg.MaxSigners == 0 { + return nil, types.ErrInvalidThreshold + } + if msg.Threshold > msg.MaxSigners { + return nil, types.ErrInvalidThreshold + } + + // Create the KeySet using the keeper method + keySetID, err := ms.Keeper.CreateKeySet(ctx, msg.Creator, msg.Threshold, msg.MaxSigners, msg.Description) + if err != nil { + return nil, err + } + + // Initiate DKG ceremony for this KeySet + dkgSessionID, err := ms.Keeper.InitiateDKGForKeySet(ctx, keySetID, msg.Threshold, msg.MaxSigners, msg.TimeoutBlocks) + if err != nil { + return nil, err + } + + // TODO: Emit event for KeySet creation + + return &types.MsgCreateKeySetResponse{ + KeySetId: keySetID, + DkgSessionId: dkgSessionID, + }, nil +} + +// InitiateDKG initiates a new DKG ceremony +func (ms msgServer) InitiateDKG(ctx context.Context, msg *types.MsgInitiateDKG) (*types.MsgInitiateDKGResponse, error) { + // TODO: Implement DKG initiation logic + return &types.MsgInitiateDKGResponse{ + SessionId: "dkg-session-1", + }, nil +} + +// SubmitDKGRound1 submits a validator's round 1 commitment +func (ms msgServer) SubmitDKGRound1(ctx context.Context, msg *types.MsgSubmitDKGRound1) (*types.MsgSubmitDKGRound1Response, error) { + // SECURITY: Verify the transaction has a valid signer + // This prevents unsigned or malicious transactions + signers := msg.GetSigners() + if len(signers) == 0 { + return nil, fmt.Errorf("no signers found in transaction") + } + + // TODO: Add proper validator address verification + // Need to map between account addresses (transaction signers) and consensus addresses (msg.Validator) + // For now, we verify that a valid signature exists + // In production, should verify: staking.GetValidatorByConsAddr(msg.Validator).OperatorAddress == signers[0] + signerAddr := signers[0].String() + _ = signerAddr // Use the signer address for logging/debugging + + sdk.UnwrapSDKContext(ctx).Logger().Info("DKG Round 1 submission", + "validator", msg.Validator, + "signer", signerAddr, + "session", msg.SessionId) + + // Process the Round 1 commitment + err := ms.Keeper.ProcessDKGRound1(ctx, msg.SessionId, msg.Validator, msg.Commitment) + if err != nil { + return nil, err + } + + // TODO: Emit event for Round 1 submission + + return &types.MsgSubmitDKGRound1Response{}, nil +} + +// SubmitDKGRound2 submits a validator's round 2 share +func (ms msgServer) SubmitDKGRound2(ctx context.Context, msg *types.MsgSubmitDKGRound2) (*types.MsgSubmitDKGRound2Response, error) { + // SECURITY: Verify the transaction has a valid signer + // This prevents unsigned or malicious transactions + signers := msg.GetSigners() + if len(signers) == 0 { + return nil, fmt.Errorf("no signers found in transaction") + } + + // TODO: Add proper validator address verification (see SubmitDKGRound1 comments) + signerAddr := signers[0].String() + _ = signerAddr + + sdk.UnwrapSDKContext(ctx).Logger().Info("DKG Round 2 submission", + "validator", msg.Validator, + "signer", signerAddr, + "session", msg.SessionId) + + // Process the Round 2 share + err := ms.Keeper.ProcessDKGRound2(ctx, msg.SessionId, msg.Validator, msg.Share) + if err != nil { + return nil, err + } + + // TODO: Emit event for Round 2 submission + + return &types.MsgSubmitDKGRound2Response{}, nil +} + +// ======================== +// Signing Messages (from x/signing) +// ======================== + +// RequestSignature creates a new signing request +func (ms msgServer) RequestSignature(ctx context.Context, msg *types.MsgRequestSignature) (*types.MsgRequestSignatureResponse, error) { + // Validate that the KeySet exists + keySet, err := ms.Keeper.GetKeySet(ctx, msg.KeySetId) + if err != nil { + return nil, types.ErrKeySetNotFound + } + + // Verify the requester is the KeySet owner + if keySet.Owner != msg.Requester { + return nil, types.ErrUnauthorizedKeySet + } + + // Create the signing request + requestID, err := ms.Keeper.CreateSigningRequest(ctx, msg.KeySetId, msg.Requester, msg.MessageHash, msg.Callback) + if err != nil { + return nil, err + } + + // TODO: Emit event for signing request creation + + return &types.MsgRequestSignatureResponse{ + RequestId: requestID, + }, nil +} + +// SubmitCommitment submits a signing commitment (Round 1) +func (ms msgServer) SubmitCommitment(ctx context.Context, msg *types.MsgSubmitCommitment) (*types.MsgSubmitCommitmentResponse, error) { + // SECURITY: Verify the transaction has a valid signer + // This prevents unsigned or malicious transactions + signers := msg.GetSigners() + if len(signers) == 0 { + return nil, fmt.Errorf("no signers found in transaction") + } + + // TODO: Add proper validator address verification (see SubmitDKGRound1 comments) + signerAddr := signers[0].String() + _ = signerAddr + + sdk.UnwrapSDKContext(ctx).Logger().Info("Signing commitment submission", + "validator", msg.Validator, + "signer", signerAddr, + "request", msg.RequestId) + + // Process the commitment + err := ms.Keeper.ProcessSigningCommitment(ctx, msg.RequestId, msg.Validator, msg.Commitment) + if err != nil { + return nil, err + } + + // TODO: Emit event for commitment submission + + return &types.MsgSubmitCommitmentResponse{}, nil +} + +// SubmitSignatureShare submits a signature share (Round 2) +func (ms msgServer) SubmitSignatureShare(ctx context.Context, msg *types.MsgSubmitSignatureShare) (*types.MsgSubmitSignatureShareResponse, error) { + // SECURITY: Verify the transaction has a valid signer + // This prevents unsigned or malicious transactions + signers := msg.GetSigners() + if len(signers) == 0 { + return nil, fmt.Errorf("no signers found in transaction") + } + + // TODO: Add proper validator address verification (see SubmitDKGRound1 comments) + signerAddr := signers[0].String() + _ = signerAddr + + sdk.UnwrapSDKContext(ctx).Logger().Info("Signature share submission", + "validator", msg.Validator, + "signer", signerAddr, + "request", msg.RequestId) + + // Process the signature share + err := ms.Keeper.ProcessSignatureShare(ctx, msg.RequestId, msg.Validator, msg.Share) + if err != nil { + return nil, err + } + + // TODO: Emit event for signature share submission + + return &types.MsgSubmitSignatureShareResponse{}, nil +} diff --git a/x/tss/keeper/msg_update_params.go b/x/tss/keeper/msg_update_params.go new file mode 100644 index 000000000..2bc34e781 --- /dev/null +++ b/x/tss/keeper/msg_update_params.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "bytes" + "context" + + errorsmod "cosmossdk.io/errors" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +func (k msgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + authority, err := k.addressCodec.StringToBytes(req.Authority) + if err != nil { + return nil, errorsmod.Wrap(err, "invalid authority address") + } + + if !bytes.Equal(k.GetAuthority(), authority) { + expectedAuthorityStr, _ := k.addressCodec.BytesToString(k.GetAuthority()) + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", expectedAuthorityStr, req.Authority) + } + + if err := req.Params.Validate(); err != nil { + return nil, err + } + + if err := k.Params.Set(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/tss/keeper/pending_tss_data.go b/x/tss/keeper/pending_tss_data.go new file mode 100644 index 000000000..e3e5cc687 --- /dev/null +++ b/x/tss/keeper/pending_tss_data.go @@ -0,0 +1,148 @@ +package keeper + +import ( + "context" + "sync" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AggregatedTSSData contains all TSS data from vote extensions +type AggregatedTSSData struct { + DKGRound1 map[string]map[string][]byte `json:"dkg_round1"` + DKGRound2 map[string]map[string][]byte `json:"dkg_round2"` + DKGKeySubmissions map[string]map[string]*DKGKeySubmission `json:"dkg_key_submissions"` + SigningCommitments map[string]map[string][]byte `json:"signing_commitments"` + SignatureShares map[string]map[string][]byte `json:"signature_shares"` +} + +// DKGKeySubmission contains encrypted key share data for aggregation +type DKGKeySubmission struct { + EncryptedSecretShare []byte `json:"encrypted_secret_share"` + EncryptedPublicShares []byte `json:"encrypted_public_shares"` + EphemeralPubKey []byte `json:"ephemeral_pubkey"` +} + +// In-memory storage for TSS data between ProcessProposal and BeginBlock +// Safe because ProcessProposal and BeginBlock run sequentially on the same node +var ( + pendingTSSData *AggregatedTSSData + tssDataMutex sync.RWMutex +) + +// StorePendingTSSData stores aggregated TSS data for BeginBlock to process +// Called by ProposalHandler during PrepareProposal/ProcessProposal +func (k Keeper) StorePendingTSSData(data *AggregatedTSSData) { + tssDataMutex.Lock() + defer tssDataMutex.Unlock() + pendingTSSData = data +} + +// ProcessPendingTSSData retrieves and processes TSS data stored during proposal handling +// Called during BeginBlock +func (k Keeper) ProcessPendingTSSData(ctx context.Context) error { + tssDataMutex.Lock() + defer tssDataMutex.Unlock() + + // No pending TSS data - normal for blocks without TSS activity + if pendingTSSData == nil { + return nil + } + + // Get data and clear it + data := pendingTSSData + pendingTSSData = nil + + sdkCtx := sdk.UnwrapSDKContext(ctx) + logger := sdkCtx.Logger().With("module", "tss", "phase", "begin_block") + + // Track counts for logging + var dkgR1Count, dkgR2Count, dkgKeySubCount, sigCommitCount, sigShareCount int + + // Process DKG Round 1 data + for sessionID, validators := range data.DKGRound1 { + for validatorAddr, commitment := range validators { + if err := k.ProcessDKGRound1(ctx, sessionID, validatorAddr, commitment); err != nil { + logger.Debug("Failed to process DKG Round 1", + "session", sessionID, + "validator", validatorAddr, + "error", err) + } else { + dkgR1Count++ + } + } + } + + // Process DKG Round 2 data + for sessionID, validators := range data.DKGRound2 { + for validatorAddr, share := range validators { + if err := k.ProcessDKGRound2(ctx, sessionID, validatorAddr, share); err != nil { + logger.Debug("Failed to process DKG Round 2", + "session", sessionID, + "validator", validatorAddr, + "error", err) + } else { + dkgR2Count++ + } + } + } + + // Process DKG Key Submissions (encrypted key shares for on-chain storage) + for sessionID, validators := range data.DKGKeySubmissions { + for validatorAddr, submission := range validators { + if err := k.ProcessDKGKeySubmission(ctx, sessionID, validatorAddr, + submission.EncryptedSecretShare, submission.EncryptedPublicShares, submission.EphemeralPubKey); err != nil { + logger.Debug("Failed to process DKG key submission", + "session", sessionID, + "validator", validatorAddr, + "error", err) + } else { + dkgKeySubCount++ + logger.Info("Stored encrypted key submission on-chain", + "session", sessionID, + "validator", validatorAddr) + } + } + } + + // Process signing commitments + for requestID, validators := range data.SigningCommitments { + for validatorAddr, commitment := range validators { + if err := k.ProcessSigningCommitment(ctx, requestID, validatorAddr, commitment); err != nil { + logger.Debug("Failed to process signing commitment", + "request", requestID, + "validator", validatorAddr, + "error", err) + } else { + sigCommitCount++ + } + } + } + + // Process signature shares + for requestID, validators := range data.SignatureShares { + for validatorAddr, share := range validators { + if err := k.ProcessSignatureShare(ctx, requestID, validatorAddr, share); err != nil { + logger.Debug("Failed to process signature share", + "request", requestID, + "validator", validatorAddr, + "error", err) + } else { + sigShareCount++ + } + } + } + + // Log summary if there was any TSS activity + if dkgR1Count > 0 || dkgR2Count > 0 || dkgKeySubCount > 0 || sigCommitCount > 0 || sigShareCount > 0 { + logger.Info("Processed TSS data from vote extensions", + "height", sdkCtx.BlockHeight(), + "dkg_r1", dkgR1Count, + "dkg_r2", dkgR2Count, + "dkg_key_submissions", dkgKeySubCount, + "signing_commitments", sigCommitCount, + "signature_shares", sigShareCount) + } + + return nil +} diff --git a/x/tss/keeper/query.go b/x/tss/keeper/query.go new file mode 100644 index 000000000..60777fd12 --- /dev/null +++ b/x/tss/keeper/query.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +var _ types.QueryServer = queryServer{} + +// NewQueryServerImpl returns an implementation of the QueryServer interface +// for the provided Keeper. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return queryServer{k} +} + +type queryServer struct { + k Keeper +} diff --git a/x/tss/keeper/query_dkg.go b/x/tss/keeper/query_dkg.go new file mode 100644 index 000000000..b9b74a306 --- /dev/null +++ b/x/tss/keeper/query_dkg.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// DKGSession returns a specific DKG session by ID +func (qs queryServer) DKGSession(ctx context.Context, req *types.QueryDKGSessionRequest) (*types.QueryDKGSessionResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.SessionId == "" { + return nil, status.Error(codes.InvalidArgument, "session_id cannot be empty") + } + + session, err := qs.k.GetDKGSession(ctx, req.SessionId) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.Logger().Info("DKGSession query result", + "id", session.Id, + "key_set_id", session.KeySetId, + "state", session.State, + "participants_count", len(session.Participants), + "participants", session.Participants) + + return &types.QueryDKGSessionResponse{ + Session: session, + }, nil +} + +// AllDKGSessions returns all DKG sessions +func (qs queryServer) AllDKGSessions(ctx context.Context, req *types.QueryAllDKGSessionsRequest) (*types.QueryAllDKGSessionsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + sessions, err := qs.k.GetAllDKGSessions(ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.Logger().Info("AllDKGSessions query", "count", len(sessions)) + for i, s := range sessions { + sdkCtx.Logger().Info(fmt.Sprintf("DKGSession[%d]", i), + "id", s.Id, + "key_set_id", s.KeySetId, + "state", s.State, + "participants_count", len(s.Participants), + "participants", s.Participants) + } + + response := &types.QueryAllDKGSessionsResponse{ + Sessions: sessions, + // TODO: Add pagination support + } + + return response, nil +} diff --git a/x/tss/keeper/query_keyset.go b/x/tss/keeper/query_keyset.go new file mode 100644 index 000000000..6e23f02a3 --- /dev/null +++ b/x/tss/keeper/query_keyset.go @@ -0,0 +1,80 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// KeySet returns a specific KeySet by ID +func (qs queryServer) KeySet(ctx context.Context, req *types.QueryKeySetRequest) (*types.QueryKeySetResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Id == "" { + return nil, status.Error(codes.InvalidArgument, "key_set_id cannot be empty") + } + + keySet, err := qs.k.GetKeySet(ctx, req.Id) + if err != nil { + return nil, status.Error(codes.NotFound, err.Error()) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.Logger().Info("KeySet query result", + "id", keySet.Id, + "owner", keySet.Owner, + "threshold", keySet.Threshold, + "max_signers", keySet.MaxSigners, + "status", keySet.Status, + "participants_count", len(keySet.Participants)) + + return &types.QueryKeySetResponse{ + KeySet: keySet, + }, nil +} + +// AllKeySets returns all KeySets +func (qs queryServer) AllKeySets(ctx context.Context, req *types.QueryAllKeySetsRequest) (*types.QueryAllKeySetsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + keySets, err := qs.k.GetAllKeySets(ctx) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.Logger().Info("AllKeySets query", "count", len(keySets)) + for i, ks := range keySets { + sdkCtx.Logger().Info(fmt.Sprintf("KeySet[%d]", i), + "id", ks.Id, + "owner", ks.Owner, + "threshold", ks.Threshold, + "max_signers", ks.MaxSigners, + "status", ks.Status) + } + + response := &types.QueryAllKeySetsResponse{ + KeySets: keySets, + // TODO: Add pagination support + } + + sdkCtx.Logger().Info("AllKeySets RESPONSE", + "key_sets_len", len(response.KeySets), + "first_id", func() string { + if len(response.KeySets) > 0 { + return response.KeySets[0].Id + } + return "none" + }()) + + return response, nil +} diff --git a/x/tss/keeper/query_params.go b/x/tss/keeper/query_params.go new file mode 100644 index 000000000..5f80d2cf9 --- /dev/null +++ b/x/tss/keeper/query_params.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "context" + "errors" + + "cosmossdk.io/collections" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +func (q queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + params, err := q.k.Params.Get(ctx) + if err != nil && !errors.Is(err, collections.ErrNotFound) { + return nil, status.Error(codes.Internal, "internal error") + } + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/tss/keeper/query_signing.go b/x/tss/keeper/query_signing.go new file mode 100644 index 000000000..e3036002a --- /dev/null +++ b/x/tss/keeper/query_signing.go @@ -0,0 +1,46 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/collections" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// SigningRequest queries a signing request by ID +func (s queryServer) SigningRequest(ctx context.Context, req *types.QuerySigningRequestRequest) (*types.QuerySigningRequestResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + request, err := s.k.SigningRequestStore.Get(ctx, req.RequestId) + if err != nil { + if err == collections.ErrNotFound { + return nil, status.Error(codes.NotFound, "signing request not found") + } + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QuerySigningRequestResponse{Request: request}, nil +} + +// AllSigningRequests queries all signing requests +func (s queryServer) AllSigningRequests(ctx context.Context, req *types.QueryAllSigningRequestsRequest) (*types.QueryAllSigningRequestsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var requests []types.SigningRequest + err := s.k.SigningRequestStore.Walk(ctx, nil, func(key string, value types.SigningRequest) (bool, error) { + requests = append(requests, value) + return false, nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllSigningRequestsResponse{Requests: requests}, nil +} diff --git a/x/tss/keeper/signing.go b/x/tss/keeper/signing.go new file mode 100644 index 000000000..d663ad58f --- /dev/null +++ b/x/tss/keeper/signing.go @@ -0,0 +1,376 @@ +package keeper + +import ( + "context" + "encoding/json" + "errors" + "fmt" + + "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// CreateSigningRequest creates a new signing request and initializes a signing session +func (k Keeper) CreateSigningRequest(ctx context.Context, keySetID, requester string, messageHash []byte, callback string) (string, error) { + // Get the KeySet to verify it exists and is active + keySet, err := k.GetKeySet(ctx, keySetID) + if err != nil { + return "", err + } + + if keySet.Status != 2 { // ACTIVE status (from KeySetStatus enum) + return "", fmt.Errorf("keyset is not active") + } + + // Generate unique request ID + sdkCtx := sdk.UnwrapSDKContext(ctx) + requestID := fmt.Sprintf("sig-%s-%d", keySetID, sdkCtx.BlockHeight()) + + // Get current block height + currentHeight := sdkCtx.BlockHeight() + + // Create signing request + request := types.SigningRequest{ + Id: requestID, + KeySetId: keySetID, + Requester: requester, + MessageHash: messageHash, + Status: types.SigningRequestStatus_SIGNING_REQUEST_STATUS_PENDING, + Signature: nil, + Callback: callback, + CreatedHeight: currentHeight, + } + + // Store the request + if err := k.SigningRequestStore.Set(ctx, requestID, request); err != nil { + return "", err + } + + // Create signing session + session := types.SigningSession{ + Participants: keySet.Participants, + Threshold: keySet.Threshold, + } + + // Store the session + if err := k.SigningSessionStore.Set(ctx, requestID, session); err != nil { + return "", err + } + + return requestID, nil +} + +// GetSigningRequest retrieves a signing request by ID +func (k Keeper) GetSigningRequest(ctx context.Context, requestID string) (types.SigningRequest, error) { + request, err := k.SigningRequestStore.Get(ctx, requestID) + if err != nil { + if errors.Is(err, collections.ErrNotFound) { + return types.SigningRequest{}, fmt.Errorf("signing request not found: %s", requestID) + } + return types.SigningRequest{}, err + } + return request, nil +} + +// SetSigningRequest updates a signing request +func (k Keeper) SetSigningRequest(ctx context.Context, request types.SigningRequest) error { + return k.SigningRequestStore.Set(ctx, request.Id, request) +} + +// ProcessSigningCommitment stores a validator's Round 1 commitment +func (k Keeper) ProcessSigningCommitment(ctx context.Context, requestID, validatorAddr string, commitment []byte) error { + // Get the request + request, err := k.GetSigningRequest(ctx, requestID) + if err != nil { + return err + } + + // Verify request is in ROUND1 state + if request.Status != types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND1 { + return fmt.Errorf("signing request is not in ROUND1 state") + } + + // Get the session + session, err := k.SigningSessionStore.Get(ctx, requestID) + if err != nil { + return err + } + + // Verify validator is a participant + if !contains(session.Participants, validatorAddr) { + return fmt.Errorf("validator %s is not a participant in this signing session", validatorAddr) + } + + // Check if validator already submitted + existingKey := fmt.Sprintf("%s:%s", requestID, validatorAddr) + has, err := k.SigningCommitmentStore.Has(ctx, existingKey) + if err != nil { + return err + } + if has { + return fmt.Errorf("validator %s already submitted commitment", validatorAddr) + } + + // Store commitment + sdkCtx := sdk.UnwrapSDKContext(ctx) + commitmentData := types.SigningCommitment{ + ValidatorAddress: validatorAddr, + Commitment: commitment, + SubmittedHeight: sdkCtx.BlockHeight(), + } + + return k.SigningCommitmentStore.Set(ctx, existingKey, commitmentData) +} + +// ProcessSignatureShare stores a validator's Round 2 share +func (k Keeper) ProcessSignatureShare(ctx context.Context, requestID, validatorAddr string, share []byte) error { + // Get the request + request, err := k.GetSigningRequest(ctx, requestID) + if err != nil { + return err + } + + // Verify request is in ROUND2 state + if request.Status != types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND2 { + return fmt.Errorf("signing request is not in ROUND2 state") + } + + // Get the session + session, err := k.SigningSessionStore.Get(ctx, requestID) + if err != nil { + return err + } + + // Verify validator is a participant + if !contains(session.Participants, validatorAddr) { + return fmt.Errorf("validator %s is not a participant in this signing session", validatorAddr) + } + + // Check if validator already submitted + existingKey := fmt.Sprintf("%s:%s", requestID, validatorAddr) + has, err := k.SignatureShareStore.Has(ctx, existingKey) + if err != nil { + return err + } + if has { + return fmt.Errorf("validator %s already submitted signature share", validatorAddr) + } + + // Store share + sdkCtx := sdk.UnwrapSDKContext(ctx) + shareData := types.SignatureShare{ + ValidatorAddress: validatorAddr, + Share: share, + SubmittedHeight: sdkCtx.BlockHeight(), + } + + return k.SignatureShareStore.Set(ctx, existingKey, shareData) +} + +// GetSigningCommitmentCount returns the number of Round 1 commitments for a request +func (k Keeper) GetSigningCommitmentCount(ctx context.Context, requestID string) (int, error) { + count := 0 + prefix := requestID + ":" + + err := k.SigningCommitmentStore.Walk(ctx, nil, func(key string, value types.SigningCommitment) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + count++ + } + return false, nil + }) + + return count, err +} + +// GetSignatureShareCount returns the number of Round 2 shares for a request +func (k Keeper) GetSignatureShareCount(ctx context.Context, requestID string) (int, error) { + count := 0 + prefix := requestID + ":" + + err := k.SignatureShareStore.Walk(ctx, nil, func(key string, value types.SignatureShare) (bool, error) { + if len(key) >= len(prefix) && key[:len(prefix)] == prefix { + count++ + } + return false, nil + }) + + return count, err +} + +// CompleteSignature finalizes a signing request and stores the aggregated signature +func (k *Keeper) CompleteSignature(ctx context.Context, requestID string) error { + // Get the request + request, err := k.GetSigningRequest(ctx, requestID) + if err != nil { + return err + } + + // Get the session + session, err := k.SigningSessionStore.Get(ctx, requestID) + if err != nil { + return fmt.Errorf("failed to get signing session: %w", err) + } + + // Aggregate signature using FROST + aggregatedSignature, err := k.AggregateSignature(ctx, request, session) + if err != nil { + return fmt.Errorf("failed to aggregate signature: %w", err) + } + + // Update request status + request.Status = types.SigningRequestStatus_SIGNING_REQUEST_STATUS_COMPLETE + request.Signature = aggregatedSignature + + if err := k.SetSigningRequest(ctx, request); err != nil { + return err + } + + // Log the completed signature + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.Logger().Info("TSS Signature completed", + "request_id", requestID, + "keyset_id", request.KeySetId, + "signature_length", len(aggregatedSignature)) + fmt.Printf("TSS Signature completed: request_id=%s signature_hex=%x\n", requestID, aggregatedSignature) + + // If callback is set, invoke callback contract via sudo + if request.Callback != "" && k.wasmKeeper != nil { + if err := k.invokeSignatureCallback(ctx, request.Callback, requestID, aggregatedSignature); err != nil { + sdkCtx.Logger().Error("Failed to invoke signature callback", + "callback", request.Callback, + "request_id", requestID, + "error", err) + // Don't fail the whole operation if callback fails + // The signature is still valid and stored + } + } + + return nil +} + +// SignatureCompleteMsg is the sudo message sent to contracts when signature is ready +type SignatureCompleteMsg struct { + SignatureComplete SignatureCompleteData `json:"signature_complete"` +} + +// SignatureCompleteData contains the signature completion data +type SignatureCompleteData struct { + RequestID string `json:"request_id"` + Signature []byte `json:"signature"` +} + +// invokeSignatureCallback calls a contract's sudo entry point with the signature +func (k Keeper) invokeSignatureCallback(ctx context.Context, callbackAddr string, requestID string, signature []byte) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // Parse the callback contract address + contractAddr, err := sdk.AccAddressFromBech32(callbackAddr) + if err != nil { + return fmt.Errorf("invalid callback address %s: %w", callbackAddr, err) + } + + // Create the sudo message + sudoMsg := SignatureCompleteMsg{ + SignatureComplete: SignatureCompleteData{ + RequestID: requestID, + Signature: signature, + }, + } + + msgBytes, err := json.Marshal(sudoMsg) + if err != nil { + return fmt.Errorf("failed to marshal sudo message: %w", err) + } + + sdkCtx.Logger().Info("Invoking signature callback", + "contract", callbackAddr, + "request_id", requestID) + + // Call the contract via sudo + _, err = k.wasmKeeper.Sudo(ctx, contractAddr, msgBytes) + if err != nil { + return fmt.Errorf("sudo call failed: %w", err) + } + + sdkCtx.Logger().Info("Signature callback successful", + "contract", callbackAddr, + "request_id", requestID) + + return nil +} + +// FailSigningRequest marks a signing request as failed +func (k Keeper) FailSigningRequest(ctx context.Context, requestID string) error { + // Get the request + request, err := k.GetSigningRequest(ctx, requestID) + if err != nil { + return err + } + + // Update request status to FAILED + request.Status = types.SigningRequestStatus_SIGNING_REQUEST_STATUS_FAILED + return k.SetSigningRequest(ctx, request) +} + +// ProcessSigningEndBlock handles signing state transitions at the end of each block +func (k *Keeper) ProcessSigningEndBlock(ctx context.Context) error { + // Iterate through all signing requests + err := k.SigningRequestStore.Walk(ctx, nil, func(requestID string, request types.SigningRequest) (bool, error) { + // Skip completed or failed requests + if request.Status == types.SigningRequestStatus_SIGNING_REQUEST_STATUS_COMPLETE || + request.Status == types.SigningRequestStatus_SIGNING_REQUEST_STATUS_FAILED { + return false, nil + } + + // Get the session + session, err := k.SigningSessionStore.Get(ctx, requestID) + if err != nil { + return true, err + } + + // Handle state transitions based on current status + switch request.Status { + case types.SigningRequestStatus_SIGNING_REQUEST_STATUS_PENDING: + // Transition to ROUND1 + request.Status = types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND1 + if err := k.SetSigningRequest(ctx, request); err != nil { + return true, err + } + + case types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND1: + // Check if enough Round 1 commitments + count, err := k.GetSigningCommitmentCount(ctx, requestID) + if err != nil { + return true, err + } + + // If threshold met, advance to Round 2 + if uint32(count) >= session.Threshold { + request.Status = types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND2 + if err := k.SetSigningRequest(ctx, request); err != nil { + return true, err + } + } + + case types.SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND2: + // Check if enough Round 2 shares + count, err := k.GetSignatureShareCount(ctx, requestID) + if err != nil { + return true, err + } + + // If threshold met, complete signing + if uint32(count) >= session.Threshold { + if err := k.CompleteSignature(ctx, requestID); err != nil { + return true, err + } + } + } + + return false, nil + }) + + return err +} diff --git a/x/tss/keeper/vote_extension_helpers.go b/x/tss/keeper/vote_extension_helpers.go new file mode 100644 index 000000000..cb1abbe0c --- /dev/null +++ b/x/tss/keeper/vote_extension_helpers.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" +) + +// Vote Extension Helper Methods +// These methods generate TSS data for inclusion in vote extensions +// They are called by the ABCI vote extension handlers + +// GenerateDKGRound1Data creates DKG Round 1 commitment data for this validator +// Returns serialized commitment bytes for inclusion in vote extension +func (k Keeper) GenerateDKGRound1Data(ctx context.Context, sessionID, validatorAddr string) []byte { + return k.GenerateDKGRound1DataReal(ctx, sessionID, validatorAddr) +} + +// GenerateDKGRound2Data creates DKG Round 2 share data for this validator +// Returns serialized share bytes for inclusion in vote extension +func (k Keeper) GenerateDKGRound2Data(ctx context.Context, sessionID, validatorAddr string) []byte { + return k.GenerateDKGRound2DataReal(ctx, sessionID, validatorAddr) +} + +// GenerateSigningCommitment creates signing Round 1 commitment for this validator +// Returns serialized commitment bytes for inclusion in vote extension +func (k Keeper) GenerateSigningCommitment(ctx context.Context, requestID, validatorAddr string) []byte { + return k.GenerateSigningCommitmentReal(ctx, requestID, validatorAddr) +} + +// GenerateSignatureShare creates signing Round 2 signature share for this validator +// Returns serialized share bytes for inclusion in vote extension +func (k Keeper) GenerateSignatureShare(ctx context.Context, requestID, validatorAddr string) []byte { + return k.GenerateSignatureShareReal(ctx, requestID, validatorAddr) +} diff --git a/x/tss/module/autocli.go b/x/tss/module/autocli.go new file mode 100644 index 000000000..51c711fe4 --- /dev/null +++ b/x/tss/module/autocli.go @@ -0,0 +1,48 @@ +package tss + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: types.Query_serviceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + { + RpcMethod: "AllKeySets", + Use: "all-key-sets", + Short: "Query all KeySets", + }, + { + RpcMethod: "KeySet", + Use: "key-set [id]", + Short: "Query a KeySet by ID", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{ + {ProtoField: "id"}, + }, + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: types.Msg_serviceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/tss/module/depinject.go b/x/tss/module/depinject.go new file mode 100644 index 000000000..cb12044c2 --- /dev/null +++ b/x/tss/module/depinject.go @@ -0,0 +1,65 @@ +package tss + +import ( + "cosmossdk.io/core/address" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/depinject/appconfig" + "github.com/cosmos/cosmos-sdk/codec" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + + "github.com/scrtlabs/SecretNetwork/x/tss/keeper" + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +var _ depinject.OnePerModuleType = AppModule{} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +func init() { + appconfig.Register( + &types.Module{}, + appconfig.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + Config *types.Module + StoreService store.KVStoreService + Cdc codec.Codec + AddressCodec address.Codec + + AuthKeeper types.AuthKeeper + BankKeeper types.BankKeeper + StakingKeeper *stakingkeeper.Keeper +} + +type ModuleOutputs struct { + depinject.Out + + MpcKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(types.GovModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.StoreService, + in.Cdc, + in.AddressCodec, + authority, + in.StakingKeeper, + ) + m := NewAppModule(in.Cdc, k, in.AuthKeeper, in.BankKeeper) + + return ModuleOutputs{MpcKeeper: k, Module: m} +} diff --git a/x/tss/module/module.go b/x/tss/module/module.go new file mode 100644 index 000000000..c36b88018 --- /dev/null +++ b/x/tss/module/module.go @@ -0,0 +1,174 @@ +package tss + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + "google.golang.org/grpc" + + "github.com/scrtlabs/SecretNetwork/x/tss/client/cli" + "github.com/scrtlabs/SecretNetwork/x/tss/keeper" + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModule = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + cdc codec.Codec + keeper keeper.Keeper + authKeeper types.AuthKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + authKeeper types.AuthKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + cdc: cdc, + keeper: keeper, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + } +} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + +// Name returns the name of the module as a string. +func (AppModule) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec +func (AppModule) RegisterLegacyAminoCodec(*codec.LegacyAmino) {} + +// GetQueryCmd returns the root query command for the module +func (AppModule) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd() +} + +// GetTxCmd returns the root tx command for the module +func (AppModule) GetTxCmd() *cobra.Command { + return nil // No custom tx commands yet +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(clientCtx.CmdContext, mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (AppModule) RegisterInterfaces(registrar codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registrar) +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { + types.RegisterMsgServer(registrar, keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(registrar, keeper.NewQueryServerImpl(am.keeper)) + + return nil +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (am AppModule) DefaultGenesis(codec.JSONCodec) json.RawMessage { + return am.cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (am AppModule) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := am.cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return genState.Validate() +} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, _ codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + if err := am.cdc.UnmarshalJSON(gs, &genState); err != nil { + panic(fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)) + } + + if err := am.keeper.InitGenesis(ctx, genState); err != nil { + panic(fmt.Errorf("failed to initialize %s genesis state: %w", types.ModuleName, err)) + } +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, _ codec.JSONCodec) json.RawMessage { + genState, err := am.keeper.ExportGenesis(ctx) + if err != nil { + panic(fmt.Errorf("failed to export %s genesis state: %w", types.ModuleName, err)) + } + + bz, err := am.cdc.MarshalJSON(genState) + if err != nil { + panic(fmt.Errorf("failed to marshal %s genesis state: %w", types.ModuleName, err)) + } + + return bz +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// Processes TSS data aggregated from vote extensions during proposal handling +func (am AppModule) BeginBlock(ctx context.Context) error { + return am.keeper.ProcessPendingTSSData(ctx) +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(ctx context.Context) error { + // NOTE: Auto-participation CANNOT run in EndBlocker because: + // - DKG requires each validator to generate DIFFERENT secrets (non-deterministic) + // - EndBlocker must be deterministic across all validators (consensus requirement) + // These requirements are fundamentally incompatible. + // + // Validators must submit their DKG/signing data via TRANSACTIONS instead. + // The transaction approach allows non-deterministic generation (off-chain) + // with deterministic processing (on-chain, tx is only processed once). + + // Process DKG state machine transitions (DETERMINISTIC) + if err := am.keeper.ProcessDKGEndBlock(ctx); err != nil { + return err + } + + // Process signing state machine transitions (DETERMINISTIC) + if err := am.keeper.ProcessSigningEndBlock(ctx); err != nil { + return err + } + + return nil +} diff --git a/x/tss/module/simulation.go b/x/tss/module/simulation.go new file mode 100644 index 000000000..9c726fa99 --- /dev/null +++ b/x/tss/module/simulation.go @@ -0,0 +1,34 @@ +package tss + +import ( + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/scrtlabs/SecretNetwork/x/tss/types" +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + mpcGenesis := types.GenesisState{ + Params: types.DefaultParams(), + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&mpcGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{} +} diff --git a/x/tss/types/codec.go b/x/tss/types/codec.go new file mode 100644 index 000000000..56398f5eb --- /dev/null +++ b/x/tss/types/codec.go @@ -0,0 +1,14 @@ +package types + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterInterfaces(registrar codectypes.InterfaceRegistry) { + registrar.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) +} diff --git a/x/tss/types/errors.go b/x/tss/types/errors.go new file mode 100644 index 000000000..b6e910878 --- /dev/null +++ b/x/tss/types/errors.go @@ -0,0 +1,20 @@ +package types + +// DONTCOVER + +import ( + "cosmossdk.io/errors" +) + +// x/tss module sentinel errors +var ( + // General errors + ErrInvalidSigner = errors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + + // DKG/KeySet errors (from x/mpc) + ErrInvalidThreshold = errors.Register(ModuleName, 1101, "invalid threshold or max_signers parameters") + + // Signing errors (from x/signing) + ErrUnauthorizedKeySet = errors.Register(ModuleName, 1200, "requester is not the owner of the specified KeySet") + ErrKeySetNotFound = errors.Register(ModuleName, 1201, "KeySet not found") +) diff --git a/x/tss/types/expected_keepers.go b/x/tss/types/expected_keepers.go new file mode 100644 index 000000000..df3ac901d --- /dev/null +++ b/x/tss/types/expected_keepers.go @@ -0,0 +1,48 @@ +package types + +import ( + "context" + + "cosmossdk.io/core/address" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AuthKeeper defines the expected interface for the Auth module. +type AuthKeeper interface { + AddressCodec() address.Codec + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} + +// StakingKeeper defines the expected interface for the Staking module. +type StakingKeeper interface { + GetAllValidators(ctx context.Context) ([]ValidatorI, error) + GetValidator(ctx context.Context, addr sdk.ValAddress) (ValidatorI, error) +} + +// ValidatorI is expected interface for validators +type ValidatorI interface { + GetOperator() string + GetConsPubKey() (cryptotypes.PubKey, error) + IsBonded() bool + IsJailed() bool +} + +// WasmKeeper defines the expected interface for the Wasm module. +// Used to call contracts via sudo when signatures are completed. +type WasmKeeper interface { + Sudo(ctx context.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) +} diff --git a/x/tss/types/genesis.go b/x/tss/types/genesis.go new file mode 100644 index 000000000..9d633ecd7 --- /dev/null +++ b/x/tss/types/genesis.go @@ -0,0 +1,14 @@ +package types + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return gs.Params.Validate() +} diff --git a/x/tss/types/genesis.pb.go b/x/tss/types/genesis.pb.go new file mode 100644 index 000000000..d1e3bdb6a --- /dev/null +++ b/x/tss/types/genesis.pb.go @@ -0,0 +1,387 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: secret/tss/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the TSS module genesis state +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + KeySets []*KeySet `protobuf:"bytes,2,rep,name=key_sets,json=keySets,proto3" json:"key_sets,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_e59b9a726712c762, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetKeySets() []*KeySet { + if m != nil { + return m.KeySets + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "secret.tss.v1.GenesisState") +} + +func init() { proto.RegisterFile("secret/tss/v1/genesis.proto", fileDescriptor_e59b9a726712c762) } + +var fileDescriptor_e59b9a726712c762 = []byte{ + // 251 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x4e, 0x4d, 0x2e, + 0x4a, 0x2d, 0xd1, 0x2f, 0x29, 0x2e, 0xd6, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, + 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x48, 0xea, 0x95, 0x14, 0x17, 0xeb, + 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x65, 0xf4, 0x41, 0x2c, 0x88, 0x22, 0x29, + 0x49, 0x54, 0x13, 0x4a, 0x2a, 0x0b, 0x52, 0xa1, 0xfa, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, + 0xf5, 0xc1, 0x24, 0x44, 0x48, 0xa9, 0x8a, 0x8b, 0xc7, 0x1d, 0x62, 0x47, 0x70, 0x49, 0x62, 0x49, + 0xaa, 0x90, 0x05, 0x17, 0x5b, 0x41, 0x62, 0x51, 0x62, 0x6e, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, + 0xb7, 0x91, 0xa8, 0x1e, 0x8a, 0x9d, 0x7a, 0x01, 0x60, 0x49, 0x27, 0xce, 0x13, 0xf7, 0xe4, 0x19, + 0x56, 0x3c, 0xdf, 0xa0, 0xc5, 0x18, 0x04, 0x55, 0x2f, 0x64, 0xc0, 0xc5, 0x91, 0x9d, 0x5a, 0x19, + 0x5f, 0x9c, 0x5a, 0x52, 0x2c, 0xc1, 0xa4, 0xc0, 0x8c, 0x45, 0xaf, 0x77, 0x6a, 0x65, 0x70, 0x6a, + 0x49, 0x10, 0x7b, 0x36, 0x98, 0x2e, 0x76, 0x72, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, + 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, + 0x39, 0x86, 0x28, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xe2, + 0xe4, 0xa2, 0x92, 0x9c, 0xc4, 0xa4, 0x62, 0xfd, 0x60, 0xb0, 0x61, 0x7e, 0xa9, 0x25, 0xe5, 0xf9, + 0x45, 0xd9, 0xfa, 0x15, 0x60, 0x0f, 0x82, 0x7d, 0x97, 0xc4, 0x06, 0xf6, 0x8b, 0x31, 0x20, 0x00, + 0x00, 0xff, 0xff, 0xe7, 0x12, 0x44, 0x5e, 0x3d, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.KeySets) > 0 { + for iNdEx := len(m.KeySets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.KeySets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.KeySets) > 0 { + for _, e := range m.KeySets { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySets", 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.KeySets = append(m.KeySets, &KeySet{}) + if err := m.KeySets[len(m.KeySets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tss/types/keys.go b/x/tss/types/keys.go new file mode 100644 index 000000000..309454dd3 --- /dev/null +++ b/x/tss/types/keys.go @@ -0,0 +1,52 @@ +package types + +import "cosmossdk.io/collections" + +const ( + // ModuleName defines the module name + ModuleName = "tss" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // GovModuleName duplicates the gov module's name to avoid a dependency with x/gov. + // It should be synced with the gov module's name if it is ever changed. + // See: https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/gov/types/keys.go#L9 + GovModuleName = "gov" +) + +// ParamsKey is the prefix to retrieve all Params +var ParamsKey = collections.NewPrefix("p_tss") + +// KeySet and KeyShare prefixes (from x/mpc) +// KeySetPrefix is the prefix for KeySet storage +var KeySetPrefix = collections.NewPrefix("keyset") + +// KeySharePrefix is the prefix for KeyShare storage (per KeySet + validator) +var KeySharePrefix = collections.NewPrefix("keyshare") + +// DKG prefixes (from x/mpc) +// DKGSessionPrefix is the prefix for DKGSession storage +var DKGSessionPrefix = collections.NewPrefix("dkg_session") + +// DKGRound1DataPrefix is the prefix for DKG Round 1 commitment data +var DKGRound1DataPrefix = collections.NewPrefix("dkg_round1") + +// DKGRound2DataPrefix is the prefix for DKG Round 2 share data +var DKGRound2DataPrefix = collections.NewPrefix("dkg_round2") + +// DKGKeySubmissionPrefix is the prefix for encrypted key share submissions +var DKGKeySubmissionPrefix = collections.NewPrefix("dkg_key_submission") + +// Signing prefixes (from x/signing) +// SigningRequestPrefix is the prefix for SigningRequest storage +var SigningRequestPrefix = collections.NewPrefix("signing_request") + +// SigningSessionPrefix is the prefix for SigningSession storage +var SigningSessionPrefix = collections.NewPrefix("signing_session") + +// SigningCommitmentPrefix is the prefix for SigningCommitment storage +var SigningCommitmentPrefix = collections.NewPrefix("signing_commitment") + +// SignatureSharePrefix is the prefix for SignatureShare storage +var SignatureSharePrefix = collections.NewPrefix("signature_share") diff --git a/x/tss/types/module.pb.go b/x/tss/types/module.pb.go new file mode 100644 index 000000000..e9e91c958 --- /dev/null +++ b/x/tss/types/module.pb.go @@ -0,0 +1,321 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: secret/tss/v1/module.proto + +package types + +import ( + _ "cosmos/app/v1alpha1" + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Module is the config object of the tss module. +type Module struct { + // authority defines the custom module authority. + // if not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_0625c58b6e19b373, []int{0} +} +func (m *Module) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Module.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 *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return m.Size() +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func init() { + proto.RegisterType((*Module)(nil), "secret.tss.v1.Module") +} + +func init() { proto.RegisterFile("secret/tss/v1/module.proto", fileDescriptor_0625c58b6e19b373) } + +var fileDescriptor_0625c58b6e19b373 = []byte{ + // 203 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0x4e, 0x4d, 0x2e, + 0x4a, 0x2d, 0xd1, 0x2f, 0x29, 0x2e, 0xd6, 0x2f, 0x33, 0xd4, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, + 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0xc8, 0xe9, 0x95, 0x14, 0x17, 0xeb, 0x95, + 0x19, 0x4a, 0x29, 0x24, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0x27, 0x16, 0x14, 0xe8, 0x97, 0x19, + 0x26, 0xe6, 0x14, 0x64, 0x24, 0xa2, 0x6a, 0x50, 0x8a, 0xe3, 0x62, 0xf3, 0x05, 0xf3, 0x85, 0x64, + 0xb8, 0x38, 0x13, 0x4b, 0x4b, 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0x25, 0x18, 0x15, 0x18, 0x35, + 0x38, 0x83, 0x10, 0x02, 0x56, 0x66, 0xbb, 0x0e, 0x4c, 0xbb, 0xc5, 0x68, 0xc0, 0xa5, 0x97, 0x9e, + 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x5f, 0x9c, 0x5c, 0x54, 0x92, 0x93, 0x98, + 0x54, 0xac, 0x1f, 0x0c, 0xb6, 0xd4, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0xbf, 0x02, 0xec, + 0x32, 0x88, 0x2d, 0x4e, 0xee, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, + 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, + 0x4b, 0xac, 0x49, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xf7, 0x1a, 0x03, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x27, 0x4c, 0x2f, 0x57, 0xfe, 0x00, 0x00, 0x00, +} + +func (m *Module) 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 *Module) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Module) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintModule(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintModule(dAtA []byte, offset int, v uint64) int { + offset -= sovModule(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Module) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovModule(uint64(l)) + } + return n +} + +func sovModule(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozModule(x uint64) (n int) { + return sovModule(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Module) 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 ErrIntOverflowModule + } + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Module: 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 ErrIntOverflowModule + } + 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 ErrInvalidLengthModule + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthModule + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipModule(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthModule + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipModule(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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrIntOverflowModule + } + 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, ErrInvalidLengthModule + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupModule + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthModule + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthModule = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowModule = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupModule = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tss/types/msgs.go b/x/tss/types/msgs.go new file mode 100644 index 000000000..5af24c685 --- /dev/null +++ b/x/tss/types/msgs.go @@ -0,0 +1,93 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Ensure all message types implement the sdk.Msg interface +var ( + _ sdk.Msg = &MsgCreateKeySet{} + _ sdk.Msg = &MsgInitiateDKG{} + _ sdk.Msg = &MsgSubmitDKGRound1{} + _ sdk.Msg = &MsgSubmitDKGRound2{} + _ sdk.Msg = &MsgRequestSignature{} + _ sdk.Msg = &MsgSubmitCommitment{} + _ sdk.Msg = &MsgSubmitSignatureShare{} +) + +// ===== MsgCreateKeySet ===== + +func (msg *MsgCreateKeySet) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +// ===== MsgInitiateDKG ===== + +func (msg *MsgInitiateDKG) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + return []sdk.AccAddress{authority} +} + +// ===== MsgSubmitDKGRound1 ===== + +func (msg *MsgSubmitDKGRound1) GetSigners() []sdk.AccAddress { + // The validator field contains the consensus address (hex string) + // For now, we convert it to an AccAddress by decoding the hex + // TODO: This should properly map consensus address to operator address + // For testnet purposes, we're using a simplified approach + validator, err := sdk.AccAddressFromBech32(msg.Validator) + if err != nil { + // If it's not a bech32 address, try to decode as hex (consensus address) + // In production, this would query the staking module for the operator address + // For now, return empty to prevent panic - the msg_server will validate + return []sdk.AccAddress{} + } + return []sdk.AccAddress{validator} +} + +// ===== MsgSubmitDKGRound2 ===== + +func (msg *MsgSubmitDKGRound2) GetSigners() []sdk.AccAddress { + validator, err := sdk.AccAddressFromBech32(msg.Validator) + if err != nil { + return []sdk.AccAddress{} + } + return []sdk.AccAddress{validator} +} + +// ===== MsgRequestSignature ===== + +func (msg *MsgRequestSignature) GetSigners() []sdk.AccAddress { + requester, err := sdk.AccAddressFromBech32(msg.Requester) + if err != nil { + panic(err) + } + return []sdk.AccAddress{requester} +} + +// ===== MsgSubmitCommitment ===== + +func (msg *MsgSubmitCommitment) GetSigners() []sdk.AccAddress { + validator, err := sdk.AccAddressFromBech32(msg.Validator) + if err != nil { + return []sdk.AccAddress{} + } + return []sdk.AccAddress{validator} +} + +// ===== MsgSubmitSignatureShare ===== + +func (msg *MsgSubmitSignatureShare) GetSigners() []sdk.AccAddress { + validator, err := sdk.AccAddressFromBech32(msg.Validator) + if err != nil { + return []sdk.AccAddress{} + } + return []sdk.AccAddress{validator} +} diff --git a/x/tss/types/params.go b/x/tss/types/params.go new file mode 100644 index 000000000..d7e005010 --- /dev/null +++ b/x/tss/types/params.go @@ -0,0 +1,17 @@ +package types + +// NewParams creates a new Params instance. +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return NewParams() +} + +// Validate validates the set of params. +func (p Params) Validate() error { + + return nil +} diff --git a/x/tss/types/query.pb.go b/x/tss/types/query.pb.go new file mode 100644 index 000000000..897390211 --- /dev/null +++ b/x/tss/types/query.pb.go @@ -0,0 +1,3093 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: secret/tss/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is the request type for the Query/Params RPC method +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/Params RPC method +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// QueryKeySetRequest is the request type for the Query/KeySet RPC method +type QueryKeySetRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryKeySetRequest) Reset() { *m = QueryKeySetRequest{} } +func (m *QueryKeySetRequest) String() string { return proto.CompactTextString(m) } +func (*QueryKeySetRequest) ProtoMessage() {} +func (*QueryKeySetRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{2} +} +func (m *QueryKeySetRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryKeySetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryKeySetRequest.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 *QueryKeySetRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryKeySetRequest.Merge(m, src) +} +func (m *QueryKeySetRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryKeySetRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryKeySetRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryKeySetRequest proto.InternalMessageInfo + +func (m *QueryKeySetRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// QueryKeySetResponse is the response type for the Query/KeySet RPC method +type QueryKeySetResponse struct { + KeySet KeySet `protobuf:"bytes,1,opt,name=key_set,json=keySet,proto3" json:"key_set"` +} + +func (m *QueryKeySetResponse) Reset() { *m = QueryKeySetResponse{} } +func (m *QueryKeySetResponse) String() string { return proto.CompactTextString(m) } +func (*QueryKeySetResponse) ProtoMessage() {} +func (*QueryKeySetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{3} +} +func (m *QueryKeySetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryKeySetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryKeySetResponse.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 *QueryKeySetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryKeySetResponse.Merge(m, src) +} +func (m *QueryKeySetResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryKeySetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryKeySetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryKeySetResponse proto.InternalMessageInfo + +func (m *QueryKeySetResponse) GetKeySet() KeySet { + if m != nil { + return m.KeySet + } + return KeySet{} +} + +// QueryAllKeySetsRequest is the request type for the Query/AllKeySets RPC method +type QueryAllKeySetsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllKeySetsRequest) Reset() { *m = QueryAllKeySetsRequest{} } +func (m *QueryAllKeySetsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllKeySetsRequest) ProtoMessage() {} +func (*QueryAllKeySetsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{4} +} +func (m *QueryAllKeySetsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllKeySetsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllKeySetsRequest.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 *QueryAllKeySetsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllKeySetsRequest.Merge(m, src) +} +func (m *QueryAllKeySetsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllKeySetsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllKeySetsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllKeySetsRequest proto.InternalMessageInfo + +func (m *QueryAllKeySetsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllKeySetsResponse is the response type for the Query/AllKeySets RPC method +type QueryAllKeySetsResponse struct { + KeySets []KeySet `protobuf:"bytes,1,rep,name=key_sets,json=keySets,proto3" json:"key_sets"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllKeySetsResponse) Reset() { *m = QueryAllKeySetsResponse{} } +func (m *QueryAllKeySetsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllKeySetsResponse) ProtoMessage() {} +func (*QueryAllKeySetsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{5} +} +func (m *QueryAllKeySetsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllKeySetsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllKeySetsResponse.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 *QueryAllKeySetsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllKeySetsResponse.Merge(m, src) +} +func (m *QueryAllKeySetsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllKeySetsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllKeySetsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllKeySetsResponse proto.InternalMessageInfo + +func (m *QueryAllKeySetsResponse) GetKeySets() []KeySet { + if m != nil { + return m.KeySets + } + return nil +} + +func (m *QueryAllKeySetsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDKGSessionRequest is the request type for the Query/DKGSession RPC method +type QueryDKGSessionRequest struct { + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` +} + +func (m *QueryDKGSessionRequest) Reset() { *m = QueryDKGSessionRequest{} } +func (m *QueryDKGSessionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDKGSessionRequest) ProtoMessage() {} +func (*QueryDKGSessionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{6} +} +func (m *QueryDKGSessionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDKGSessionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDKGSessionRequest.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 *QueryDKGSessionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDKGSessionRequest.Merge(m, src) +} +func (m *QueryDKGSessionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDKGSessionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDKGSessionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDKGSessionRequest proto.InternalMessageInfo + +func (m *QueryDKGSessionRequest) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +// QueryDKGSessionResponse is the response type for the Query/DKGSession RPC method +type QueryDKGSessionResponse struct { + Session DKGSession `protobuf:"bytes,1,opt,name=session,proto3" json:"session"` +} + +func (m *QueryDKGSessionResponse) Reset() { *m = QueryDKGSessionResponse{} } +func (m *QueryDKGSessionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDKGSessionResponse) ProtoMessage() {} +func (*QueryDKGSessionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{7} +} +func (m *QueryDKGSessionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDKGSessionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDKGSessionResponse.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 *QueryDKGSessionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDKGSessionResponse.Merge(m, src) +} +func (m *QueryDKGSessionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDKGSessionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDKGSessionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDKGSessionResponse proto.InternalMessageInfo + +func (m *QueryDKGSessionResponse) GetSession() DKGSession { + if m != nil { + return m.Session + } + return DKGSession{} +} + +// QueryAllDKGSessionsRequest is the request type for the Query/AllDKGSessions RPC method +type QueryAllDKGSessionsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllDKGSessionsRequest) Reset() { *m = QueryAllDKGSessionsRequest{} } +func (m *QueryAllDKGSessionsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllDKGSessionsRequest) ProtoMessage() {} +func (*QueryAllDKGSessionsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{8} +} +func (m *QueryAllDKGSessionsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllDKGSessionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllDKGSessionsRequest.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 *QueryAllDKGSessionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllDKGSessionsRequest.Merge(m, src) +} +func (m *QueryAllDKGSessionsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllDKGSessionsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllDKGSessionsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllDKGSessionsRequest proto.InternalMessageInfo + +func (m *QueryAllDKGSessionsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllDKGSessionsResponse is the response type for the Query/AllDKGSessions RPC method +type QueryAllDKGSessionsResponse struct { + Sessions []DKGSession `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllDKGSessionsResponse) Reset() { *m = QueryAllDKGSessionsResponse{} } +func (m *QueryAllDKGSessionsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllDKGSessionsResponse) ProtoMessage() {} +func (*QueryAllDKGSessionsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{9} +} +func (m *QueryAllDKGSessionsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllDKGSessionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllDKGSessionsResponse.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 *QueryAllDKGSessionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllDKGSessionsResponse.Merge(m, src) +} +func (m *QueryAllDKGSessionsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllDKGSessionsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllDKGSessionsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllDKGSessionsResponse proto.InternalMessageInfo + +func (m *QueryAllDKGSessionsResponse) GetSessions() []DKGSession { + if m != nil { + return m.Sessions + } + return nil +} + +func (m *QueryAllDKGSessionsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QuerySigningRequestRequest is the request type for the Query/SigningRequest RPC method +type QuerySigningRequestRequest struct { + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (m *QuerySigningRequestRequest) Reset() { *m = QuerySigningRequestRequest{} } +func (m *QuerySigningRequestRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySigningRequestRequest) ProtoMessage() {} +func (*QuerySigningRequestRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{10} +} +func (m *QuerySigningRequestRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySigningRequestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySigningRequestRequest.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 *QuerySigningRequestRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySigningRequestRequest.Merge(m, src) +} +func (m *QuerySigningRequestRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySigningRequestRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySigningRequestRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySigningRequestRequest proto.InternalMessageInfo + +func (m *QuerySigningRequestRequest) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +// QuerySigningRequestResponse is the response type for the Query/SigningRequest RPC method +type QuerySigningRequestResponse struct { + Request SigningRequest `protobuf:"bytes,1,opt,name=request,proto3" json:"request"` +} + +func (m *QuerySigningRequestResponse) Reset() { *m = QuerySigningRequestResponse{} } +func (m *QuerySigningRequestResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySigningRequestResponse) ProtoMessage() {} +func (*QuerySigningRequestResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{11} +} +func (m *QuerySigningRequestResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySigningRequestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySigningRequestResponse.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 *QuerySigningRequestResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySigningRequestResponse.Merge(m, src) +} +func (m *QuerySigningRequestResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySigningRequestResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySigningRequestResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySigningRequestResponse proto.InternalMessageInfo + +func (m *QuerySigningRequestResponse) GetRequest() SigningRequest { + if m != nil { + return m.Request + } + return SigningRequest{} +} + +// QueryAllSigningRequestsRequest is the request type for the Query/AllSigningRequests RPC method +type QueryAllSigningRequestsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllSigningRequestsRequest) Reset() { *m = QueryAllSigningRequestsRequest{} } +func (m *QueryAllSigningRequestsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllSigningRequestsRequest) ProtoMessage() {} +func (*QueryAllSigningRequestsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{12} +} +func (m *QueryAllSigningRequestsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllSigningRequestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllSigningRequestsRequest.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 *QueryAllSigningRequestsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllSigningRequestsRequest.Merge(m, src) +} +func (m *QueryAllSigningRequestsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllSigningRequestsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllSigningRequestsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllSigningRequestsRequest proto.InternalMessageInfo + +func (m *QueryAllSigningRequestsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllSigningRequestsResponse is the response type for the Query/AllSigningRequests RPC method +type QueryAllSigningRequestsResponse struct { + Requests []SigningRequest `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllSigningRequestsResponse) Reset() { *m = QueryAllSigningRequestsResponse{} } +func (m *QueryAllSigningRequestsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllSigningRequestsResponse) ProtoMessage() {} +func (*QueryAllSigningRequestsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_56bfe6200bd164ea, []int{13} +} +func (m *QueryAllSigningRequestsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllSigningRequestsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllSigningRequestsResponse.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 *QueryAllSigningRequestsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllSigningRequestsResponse.Merge(m, src) +} +func (m *QueryAllSigningRequestsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllSigningRequestsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllSigningRequestsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllSigningRequestsResponse proto.InternalMessageInfo + +func (m *QueryAllSigningRequestsResponse) GetRequests() []SigningRequest { + if m != nil { + return m.Requests + } + return nil +} + +func (m *QueryAllSigningRequestsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "secret.tss.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "secret.tss.v1.QueryParamsResponse") + proto.RegisterType((*QueryKeySetRequest)(nil), "secret.tss.v1.QueryKeySetRequest") + proto.RegisterType((*QueryKeySetResponse)(nil), "secret.tss.v1.QueryKeySetResponse") + proto.RegisterType((*QueryAllKeySetsRequest)(nil), "secret.tss.v1.QueryAllKeySetsRequest") + proto.RegisterType((*QueryAllKeySetsResponse)(nil), "secret.tss.v1.QueryAllKeySetsResponse") + proto.RegisterType((*QueryDKGSessionRequest)(nil), "secret.tss.v1.QueryDKGSessionRequest") + proto.RegisterType((*QueryDKGSessionResponse)(nil), "secret.tss.v1.QueryDKGSessionResponse") + proto.RegisterType((*QueryAllDKGSessionsRequest)(nil), "secret.tss.v1.QueryAllDKGSessionsRequest") + proto.RegisterType((*QueryAllDKGSessionsResponse)(nil), "secret.tss.v1.QueryAllDKGSessionsResponse") + proto.RegisterType((*QuerySigningRequestRequest)(nil), "secret.tss.v1.QuerySigningRequestRequest") + proto.RegisterType((*QuerySigningRequestResponse)(nil), "secret.tss.v1.QuerySigningRequestResponse") + proto.RegisterType((*QueryAllSigningRequestsRequest)(nil), "secret.tss.v1.QueryAllSigningRequestsRequest") + proto.RegisterType((*QueryAllSigningRequestsResponse)(nil), "secret.tss.v1.QueryAllSigningRequestsResponse") +} + +func init() { proto.RegisterFile("secret/tss/v1/query.proto", fileDescriptor_56bfe6200bd164ea) } + +var fileDescriptor_56bfe6200bd164ea = []byte{ + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x5f, + 0x14, 0xed, 0xf4, 0xf7, 0xb3, 0x85, 0x6b, 0x64, 0xf1, 0xe4, 0xef, 0x08, 0x83, 0x3c, 0x05, 0x14, + 0xc3, 0xbc, 0x14, 0x8c, 0xc6, 0x10, 0x63, 0x24, 0x46, 0x82, 0x24, 0x06, 0x5b, 0x57, 0xc6, 0x04, + 0xa7, 0xed, 0xcb, 0x30, 0x69, 0x99, 0x29, 0x7d, 0x03, 0xda, 0x34, 0x6c, 0xd4, 0x0f, 0x60, 0x82, + 0x2b, 0xb7, 0x2c, 0xfd, 0x22, 0x2c, 0x49, 0xdc, 0xb8, 0x32, 0x06, 0xfc, 0x20, 0xa6, 0xef, 0xdd, + 0x61, 0x98, 0x3f, 0xb5, 0x2c, 0xba, 0x6b, 0xdf, 0x3b, 0xf7, 0x9e, 0x73, 0xee, 0x9d, 0x39, 0x19, + 0x98, 0x10, 0xbc, 0xd2, 0xe4, 0x3e, 0xf3, 0x85, 0x60, 0xfb, 0x05, 0xb6, 0xbb, 0xc7, 0x9b, 0x2d, + 0xb3, 0xd1, 0xf4, 0x7c, 0x8f, 0x5c, 0x53, 0x57, 0xa6, 0x2f, 0x84, 0xb9, 0x5f, 0xd0, 0x87, 0x6d, + 0xcf, 0xf6, 0xe4, 0x0d, 0xeb, 0xfc, 0x52, 0x20, 0x7d, 0xd2, 0xf6, 0x3c, 0xbb, 0xce, 0x99, 0xd5, + 0x70, 0x98, 0xe5, 0xba, 0x9e, 0x6f, 0xf9, 0x8e, 0xe7, 0x0a, 0xbc, 0x8d, 0x75, 0xf7, 0x5b, 0x0d, + 0x1e, 0x5c, 0x2d, 0x54, 0x3c, 0xb1, 0xe3, 0x09, 0x56, 0xb6, 0x04, 0x57, 0xb4, 0x6c, 0xbf, 0x50, + 0xe6, 0xbe, 0x55, 0x60, 0x0d, 0xcb, 0x76, 0x5c, 0xd9, 0x47, 0x61, 0xe9, 0x30, 0x90, 0x57, 0x1d, + 0xc4, 0xa6, 0xd5, 0xb4, 0x76, 0x44, 0x91, 0xef, 0xee, 0x71, 0xe1, 0xd3, 0x17, 0x70, 0x3d, 0x72, + 0x2a, 0x1a, 0x9e, 0x2b, 0x38, 0x59, 0x86, 0x5c, 0x43, 0x9e, 0x8c, 0x6b, 0x37, 0xb5, 0x3b, 0x57, + 0x97, 0x46, 0xcc, 0x88, 0x0f, 0x53, 0xc1, 0x57, 0xff, 0x3f, 0xfe, 0x35, 0x9d, 0x29, 0x22, 0x94, + 0xde, 0x46, 0x86, 0x0d, 0xde, 0x2a, 0x71, 0x1f, 0x19, 0xc8, 0x10, 0x64, 0x9d, 0xaa, 0x6c, 0x33, + 0x58, 0xcc, 0x3a, 0x55, 0xba, 0x81, 0x8c, 0x01, 0x0a, 0x19, 0xef, 0x43, 0xbe, 0xc6, 0x5b, 0x5b, + 0x82, 0xfb, 0x5d, 0x28, 0x15, 0x3e, 0xa0, 0xac, 0xc9, 0x7f, 0xf4, 0x1d, 0x8c, 0xca, 0x66, 0x4f, + 0xeb, 0x75, 0x75, 0x1f, 0x18, 0x23, 0xcf, 0x01, 0xc2, 0x11, 0x60, 0xcb, 0x39, 0x53, 0xcd, 0xcb, + 0xec, 0xcc, 0xcb, 0x54, 0x6b, 0xc2, 0x79, 0x99, 0x9b, 0x96, 0xcd, 0xb1, 0xb6, 0x78, 0xa1, 0x92, + 0x7e, 0xd3, 0x60, 0x2c, 0x41, 0x81, 0x9a, 0x1f, 0xc0, 0x00, 0x6a, 0xee, 0xcc, 0xe9, 0xbf, 0x5e, + 0xa2, 0xf3, 0x4a, 0xb4, 0x20, 0x6b, 0x11, 0x6d, 0x59, 0xa9, 0x6d, 0xbe, 0xa7, 0x36, 0x45, 0x1a, + 0x11, 0xf7, 0x10, 0xed, 0x3f, 0xdb, 0x58, 0x2b, 0x71, 0x21, 0x1c, 0xcf, 0x0d, 0xec, 0x4f, 0x01, + 0x08, 0x75, 0xb2, 0x75, 0x3e, 0xfd, 0x41, 0x3c, 0x59, 0xaf, 0xd2, 0xd7, 0x68, 0xea, 0x62, 0x21, + 0x9a, 0x7a, 0x04, 0x79, 0xc4, 0xe1, 0xd4, 0x26, 0x62, 0x9e, 0xc2, 0x9a, 0xc0, 0x17, 0xe2, 0x69, + 0x15, 0xf4, 0x60, 0x54, 0x21, 0xa8, 0xef, 0x1b, 0x39, 0xd2, 0xe0, 0x46, 0x2a, 0x0d, 0x1a, 0x58, + 0x81, 0x01, 0x14, 0x14, 0x6c, 0xa5, 0xa7, 0x83, 0xf3, 0x82, 0xfe, 0xad, 0x66, 0x05, 0x67, 0x51, + 0x72, 0x6c, 0xd7, 0x71, 0xed, 0xc0, 0x48, 0xb8, 0x9e, 0xa6, 0xfa, 0x79, 0x61, 0x3d, 0x78, 0xb2, + 0x5e, 0xa5, 0x6f, 0xd1, 0x61, 0xbc, 0x18, 0x1d, 0x3e, 0x86, 0x3c, 0x62, 0x71, 0x8c, 0x53, 0x31, + 0x83, 0xd1, 0xba, 0x60, 0x4d, 0x58, 0x43, 0xb7, 0xc1, 0x08, 0xe6, 0x17, 0x05, 0xf6, 0x7d, 0x55, + 0xdf, 0x35, 0x98, 0xee, 0x4a, 0x85, 0x66, 0x9e, 0xc0, 0x00, 0x0a, 0x0b, 0xd6, 0x75, 0x29, 0x37, + 0xe7, 0x45, 0x7d, 0x5b, 0xd9, 0xd2, 0x51, 0x1e, 0xae, 0x48, 0xb5, 0xc4, 0x85, 0x9c, 0x4a, 0x38, + 0x32, 0x13, 0xd3, 0x92, 0x8c, 0x50, 0x9d, 0xfe, 0x0b, 0xa2, 0x68, 0xe8, 0xd4, 0xc7, 0x1f, 0x7f, + 0x0e, 0xb3, 0x63, 0x64, 0x84, 0x45, 0xc3, 0x5c, 0x25, 0x27, 0x11, 0x90, 0x53, 0x49, 0x91, 0xce, + 0x17, 0x09, 0xd4, 0x74, 0xbe, 0x68, 0x9a, 0x52, 0x2a, 0xf9, 0x26, 0x89, 0x1e, 0xe3, 0xab, 0xf1, + 0x96, 0xe0, 0x3e, 0x6b, 0x3b, 0xd5, 0x03, 0xd2, 0x06, 0x08, 0x33, 0x8d, 0xcc, 0xa6, 0x75, 0x4d, + 0xc4, 0xaa, 0x3e, 0xd7, 0x0b, 0x86, 0x02, 0x0c, 0x29, 0x60, 0x9c, 0x8c, 0xa6, 0x0a, 0x10, 0xe4, + 0xb3, 0x06, 0x10, 0xbe, 0x86, 0xe9, 0xec, 0x89, 0x54, 0x4b, 0x67, 0x4f, 0x66, 0x18, 0x9d, 0x97, + 0xec, 0x33, 0x64, 0x3a, 0xc6, 0x5e, 0xad, 0xd9, 0xac, 0x1d, 0xe6, 0xe2, 0x01, 0xf9, 0xa4, 0xc1, + 0x50, 0x34, 0x46, 0xc8, 0xdd, 0x2e, 0x0e, 0x93, 0x89, 0xa6, 0x2f, 0x5c, 0x06, 0x8a, 0x92, 0x74, + 0x29, 0x69, 0x98, 0x90, 0xa4, 0x24, 0xf2, 0x55, 0x83, 0xa1, 0xe8, 0x43, 0x9e, 0xae, 0x22, 0x35, + 0x4b, 0xd2, 0x55, 0xa4, 0x27, 0x07, 0xbd, 0x27, 0x55, 0xcc, 0x92, 0x5b, 0x31, 0x15, 0x42, 0xc1, + 0x59, 0x3b, 0x4c, 0xa5, 0x03, 0x72, 0xa8, 0x01, 0x49, 0xbe, 0xb8, 0x64, 0xb1, 0x8b, 0xeb, 0xf4, + 0x2c, 0xd1, 0xcd, 0xcb, 0xc2, 0x7b, 0x3c, 0x39, 0x28, 0x71, 0x75, 0xed, 0xf8, 0xd4, 0xd0, 0x4e, + 0x4e, 0x0d, 0xed, 0xf7, 0xa9, 0xa1, 0x7d, 0x39, 0x33, 0x32, 0x27, 0x67, 0x46, 0xe6, 0xe7, 0x99, + 0x91, 0x79, 0xb3, 0x68, 0x3b, 0xfe, 0xf6, 0x5e, 0xd9, 0xac, 0x78, 0x3b, 0x4c, 0x54, 0x9a, 0x7e, + 0xdd, 0x2a, 0x0b, 0x56, 0x92, 0x4d, 0x5e, 0x72, 0xff, 0xbd, 0xd7, 0xac, 0xb1, 0x0f, 0xb2, 0x9b, + 0xfc, 0x84, 0x2a, 0xe7, 0xe4, 0x77, 0xd1, 0xf2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x76, + 0xd9, 0xdd, 0xbe, 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params queries module parameters + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // KeySet queries a KeySet by ID + KeySet(ctx context.Context, in *QueryKeySetRequest, opts ...grpc.CallOption) (*QueryKeySetResponse, error) + // AllKeySets queries all KeySets + AllKeySets(ctx context.Context, in *QueryAllKeySetsRequest, opts ...grpc.CallOption) (*QueryAllKeySetsResponse, error) + // DKGSession queries a DKG session by ID + DKGSession(ctx context.Context, in *QueryDKGSessionRequest, opts ...grpc.CallOption) (*QueryDKGSessionResponse, error) + // AllDKGSessions queries all DKG sessions + AllDKGSessions(ctx context.Context, in *QueryAllDKGSessionsRequest, opts ...grpc.CallOption) (*QueryAllDKGSessionsResponse, error) + // SigningRequest queries a signing request by ID + SigningRequest(ctx context.Context, in *QuerySigningRequestRequest, opts ...grpc.CallOption) (*QuerySigningRequestResponse, error) + // AllSigningRequests queries all signing requests + AllSigningRequests(ctx context.Context, in *QueryAllSigningRequestsRequest, opts ...grpc.CallOption) (*QueryAllSigningRequestsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) KeySet(ctx context.Context, in *QueryKeySetRequest, opts ...grpc.CallOption) (*QueryKeySetResponse, error) { + out := new(QueryKeySetResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/KeySet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllKeySets(ctx context.Context, in *QueryAllKeySetsRequest, opts ...grpc.CallOption) (*QueryAllKeySetsResponse, error) { + out := new(QueryAllKeySetsResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/AllKeySets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DKGSession(ctx context.Context, in *QueryDKGSessionRequest, opts ...grpc.CallOption) (*QueryDKGSessionResponse, error) { + out := new(QueryDKGSessionResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/DKGSession", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllDKGSessions(ctx context.Context, in *QueryAllDKGSessionsRequest, opts ...grpc.CallOption) (*QueryAllDKGSessionsResponse, error) { + out := new(QueryAllDKGSessionsResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/AllDKGSessions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SigningRequest(ctx context.Context, in *QuerySigningRequestRequest, opts ...grpc.CallOption) (*QuerySigningRequestResponse, error) { + out := new(QuerySigningRequestResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/SigningRequest", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllSigningRequests(ctx context.Context, in *QueryAllSigningRequestsRequest, opts ...grpc.CallOption) (*QueryAllSigningRequestsResponse, error) { + out := new(QueryAllSigningRequestsResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Query/AllSigningRequests", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params queries module parameters + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // KeySet queries a KeySet by ID + KeySet(context.Context, *QueryKeySetRequest) (*QueryKeySetResponse, error) + // AllKeySets queries all KeySets + AllKeySets(context.Context, *QueryAllKeySetsRequest) (*QueryAllKeySetsResponse, error) + // DKGSession queries a DKG session by ID + DKGSession(context.Context, *QueryDKGSessionRequest) (*QueryDKGSessionResponse, error) + // AllDKGSessions queries all DKG sessions + AllDKGSessions(context.Context, *QueryAllDKGSessionsRequest) (*QueryAllDKGSessionsResponse, error) + // SigningRequest queries a signing request by ID + SigningRequest(context.Context, *QuerySigningRequestRequest) (*QuerySigningRequestResponse, error) + // AllSigningRequests queries all signing requests + AllSigningRequests(context.Context, *QueryAllSigningRequestsRequest) (*QueryAllSigningRequestsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) KeySet(ctx context.Context, req *QueryKeySetRequest) (*QueryKeySetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method KeySet not implemented") +} +func (*UnimplementedQueryServer) AllKeySets(ctx context.Context, req *QueryAllKeySetsRequest) (*QueryAllKeySetsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllKeySets not implemented") +} +func (*UnimplementedQueryServer) DKGSession(ctx context.Context, req *QueryDKGSessionRequest) (*QueryDKGSessionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DKGSession not implemented") +} +func (*UnimplementedQueryServer) AllDKGSessions(ctx context.Context, req *QueryAllDKGSessionsRequest) (*QueryAllDKGSessionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllDKGSessions not implemented") +} +func (*UnimplementedQueryServer) SigningRequest(ctx context.Context, req *QuerySigningRequestRequest) (*QuerySigningRequestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SigningRequest not implemented") +} +func (*UnimplementedQueryServer) AllSigningRequests(ctx context.Context, req *QueryAllSigningRequestsRequest) (*QueryAllSigningRequestsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllSigningRequests not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_KeySet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryKeySetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).KeySet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/KeySet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).KeySet(ctx, req.(*QueryKeySetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllKeySets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllKeySetsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllKeySets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/AllKeySets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllKeySets(ctx, req.(*QueryAllKeySetsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DKGSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDKGSessionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DKGSession(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/DKGSession", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DKGSession(ctx, req.(*QueryDKGSessionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllDKGSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllDKGSessionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllDKGSessions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/AllDKGSessions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllDKGSessions(ctx, req.(*QueryAllDKGSessionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SigningRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySigningRequestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SigningRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/SigningRequest", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SigningRequest(ctx, req.(*QuerySigningRequestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllSigningRequests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllSigningRequestsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllSigningRequests(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Query/AllSigningRequests", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllSigningRequests(ctx, req.(*QueryAllSigningRequestsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var Query_serviceDesc = _Query_serviceDesc +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "secret.tss.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "KeySet", + Handler: _Query_KeySet_Handler, + }, + { + MethodName: "AllKeySets", + Handler: _Query_AllKeySets_Handler, + }, + { + MethodName: "DKGSession", + Handler: _Query_DKGSession_Handler, + }, + { + MethodName: "AllDKGSessions", + Handler: _Query_AllDKGSessions_Handler, + }, + { + MethodName: "SigningRequest", + Handler: _Query_SigningRequest_Handler, + }, + { + MethodName: "AllSigningRequests", + Handler: _Query_AllSigningRequests_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "secret/tss/v1/query.proto", +} + +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryKeySetRequest) 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 *QueryKeySetRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryKeySetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryKeySetResponse) 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 *QueryKeySetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryKeySetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.KeySet.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllKeySetsRequest) 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 *QueryAllKeySetsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllKeySetsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllKeySetsResponse) 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 *QueryAllKeySetsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllKeySetsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.KeySets) > 0 { + for iNdEx := len(m.KeySets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.KeySets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDKGSessionRequest) 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 *QueryDKGSessionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDKGSessionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SessionId) > 0 { + i -= len(m.SessionId) + copy(dAtA[i:], m.SessionId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SessionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDKGSessionResponse) 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 *QueryDKGSessionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDKGSessionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Session.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllDKGSessionsRequest) 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 *QueryAllDKGSessionsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllDKGSessionsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllDKGSessionsResponse) 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 *QueryAllDKGSessionsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllDKGSessionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Sessions) > 0 { + for iNdEx := len(m.Sessions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Sessions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QuerySigningRequestRequest) 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 *QuerySigningRequestRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySigningRequestRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestId) > 0 { + i -= len(m.RequestId) + copy(dAtA[i:], m.RequestId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySigningRequestResponse) 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 *QuerySigningRequestResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySigningRequestResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Request.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryAllSigningRequestsRequest) 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 *QueryAllSigningRequestsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllSigningRequestsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllSigningRequestsResponse) 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 *QueryAllSigningRequestsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllSigningRequestsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Requests) > 0 { + for iNdEx := len(m.Requests) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Requests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryKeySetRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryKeySetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.KeySet.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllKeySetsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllKeySetsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.KeySets) > 0 { + for _, e := range m.KeySets { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDKGSessionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SessionId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDKGSessionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Session.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllDKGSessionsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllDKGSessionsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Sessions) > 0 { + for _, e := range m.Sessions { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySigningRequestRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySigningRequestResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Request.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAllSigningRequestsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllSigningRequestsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Requests) > 0 { + for _, e := range m.Requests { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryKeySetRequest) 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: QueryKeySetRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryKeySetRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryKeySetResponse) 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: QueryKeySetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryKeySetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySet", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.KeySet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllKeySetsRequest) 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: QueryAllKeySetsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllKeySetsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllKeySetsResponse) 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: QueryAllKeySetsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllKeySetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySets", 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.KeySets = append(m.KeySets, KeySet{}) + if err := m.KeySets[len(m.KeySets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDKGSessionRequest) 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: QueryDKGSessionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDKGSessionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDKGSessionResponse) 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: QueryDKGSessionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDKGSessionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Session", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Session.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllDKGSessionsRequest) 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: QueryAllDKGSessionsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllDKGSessionsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllDKGSessionsResponse) 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: QueryAllDKGSessionsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllDKGSessionsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sessions", 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.Sessions = append(m.Sessions, DKGSession{}) + if err := m.Sessions[len(m.Sessions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySigningRequestRequest) 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: QuerySigningRequestRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySigningRequestRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySigningRequestResponse) 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: QuerySigningRequestResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySigningRequestResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Request.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllSigningRequestsRequest) 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: QueryAllSigningRequestsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllSigningRequestsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllSigningRequestsResponse) 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: QueryAllSigningRequestsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllSigningRequestsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Requests", 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.Requests = append(m.Requests, SigningRequest{}) + if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tss/types/query.pb.gw.go b/x/tss/types/query.pb.gw.go new file mode 100644 index 000000000..703f3d4af --- /dev/null +++ b/x/tss/types/query.pb.gw.go @@ -0,0 +1,705 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: secret/tss/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_KeySet_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryKeySetRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.KeySet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_KeySet_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryKeySetRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.KeySet(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AllKeySets_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AllKeySets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllKeySetsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllKeySets_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AllKeySets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllKeySets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllKeySetsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllKeySets_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AllKeySets(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_DKGSession_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDKGSessionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["session_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "session_id") + } + + protoReq.SessionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "session_id", err) + } + + msg, err := client.DKGSession(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DKGSession_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDKGSessionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["session_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "session_id") + } + + protoReq.SessionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "session_id", err) + } + + msg, err := server.DKGSession(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AllDKGSessions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AllDKGSessions_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllDKGSessionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllDKGSessions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AllDKGSessions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllDKGSessions_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllDKGSessionsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllDKGSessions_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AllDKGSessions(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_SigningRequest_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySigningRequestRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["request_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "request_id") + } + + protoReq.RequestId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "request_id", err) + } + + msg, err := client.SigningRequest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SigningRequest_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySigningRequestRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["request_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "request_id") + } + + protoReq.RequestId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "request_id", err) + } + + msg, err := server.SigningRequest(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AllSigningRequests_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AllSigningRequests_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllSigningRequestsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllSigningRequests_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AllSigningRequests(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllSigningRequests_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllSigningRequestsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllSigningRequests_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AllSigningRequests(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_KeySet_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_KeySet_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_KeySet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllKeySets_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_AllKeySets_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_AllKeySets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DKGSession_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_DKGSession_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_DKGSession_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllDKGSessions_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_AllDKGSessions_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_AllDKGSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SigningRequest_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_SigningRequest_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_SigningRequest_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllSigningRequests_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_AllSigningRequests_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_AllSigningRequests_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_KeySet_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_KeySet_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_KeySet_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllKeySets_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_AllKeySets_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_AllKeySets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_DKGSession_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_DKGSession_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_DKGSession_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllDKGSessions_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_AllDKGSessions_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_AllDKGSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SigningRequest_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_SigningRequest_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_SigningRequest_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllSigningRequests_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_AllSigningRequests_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_AllSigningRequests_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"secret", "tss", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_KeySet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"secret", "tss", "v1", "keyset", "id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllKeySets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"secret", "tss", "v1", "keysets"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_DKGSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"secret", "tss", "v1", "dkg", "session_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllDKGSessions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"secret", "tss", "v1", "dkg"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SigningRequest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"secret", "tss", "v1", "signing", "request_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllSigningRequests_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"secret", "tss", "v1", "signing"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_KeySet_0 = runtime.ForwardResponseMessage + + forward_Query_AllKeySets_0 = runtime.ForwardResponseMessage + + forward_Query_DKGSession_0 = runtime.ForwardResponseMessage + + forward_Query_AllDKGSessions_0 = runtime.ForwardResponseMessage + + forward_Query_SigningRequest_0 = runtime.ForwardResponseMessage + + forward_Query_AllSigningRequests_0 = runtime.ForwardResponseMessage +) diff --git a/x/tss/types/tx.pb.go b/x/tss/types/tx.pb.go new file mode 100644 index 000000000..2683647f5 --- /dev/null +++ b/x/tss/types/tx.pb.go @@ -0,0 +1,3887 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: secret/tss/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgUpdateParams updates module parameters +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +type MsgCreateKeySet struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Threshold uint32 `protobuf:"varint,2,opt,name=threshold,proto3" json:"threshold,omitempty"` + MaxSigners uint32 `protobuf:"varint,3,opt,name=max_signers,json=maxSigners,proto3" json:"max_signers,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + TimeoutBlocks int64 `protobuf:"varint,5,opt,name=timeout_blocks,json=timeoutBlocks,proto3" json:"timeout_blocks,omitempty"` +} + +func (m *MsgCreateKeySet) Reset() { *m = MsgCreateKeySet{} } +func (m *MsgCreateKeySet) String() string { return proto.CompactTextString(m) } +func (*MsgCreateKeySet) ProtoMessage() {} +func (*MsgCreateKeySet) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{2} +} +func (m *MsgCreateKeySet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateKeySet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateKeySet.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 *MsgCreateKeySet) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateKeySet.Merge(m, src) +} +func (m *MsgCreateKeySet) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateKeySet) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateKeySet.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateKeySet proto.InternalMessageInfo + +func (m *MsgCreateKeySet) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateKeySet) GetThreshold() uint32 { + if m != nil { + return m.Threshold + } + return 0 +} + +func (m *MsgCreateKeySet) GetMaxSigners() uint32 { + if m != nil { + return m.MaxSigners + } + return 0 +} + +func (m *MsgCreateKeySet) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MsgCreateKeySet) GetTimeoutBlocks() int64 { + if m != nil { + return m.TimeoutBlocks + } + return 0 +} + +type MsgCreateKeySetResponse struct { + KeySetId string `protobuf:"bytes,1,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` + DkgSessionId string `protobuf:"bytes,2,opt,name=dkg_session_id,json=dkgSessionId,proto3" json:"dkg_session_id,omitempty"` +} + +func (m *MsgCreateKeySetResponse) Reset() { *m = MsgCreateKeySetResponse{} } +func (m *MsgCreateKeySetResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateKeySetResponse) ProtoMessage() {} +func (*MsgCreateKeySetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{3} +} +func (m *MsgCreateKeySetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateKeySetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateKeySetResponse.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 *MsgCreateKeySetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateKeySetResponse.Merge(m, src) +} +func (m *MsgCreateKeySetResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateKeySetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateKeySetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateKeySetResponse proto.InternalMessageInfo + +func (m *MsgCreateKeySetResponse) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +func (m *MsgCreateKeySetResponse) GetDkgSessionId() string { + if m != nil { + return m.DkgSessionId + } + return "" +} + +type MsgInitiateDKG struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + KeySetId string `protobuf:"bytes,2,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` +} + +func (m *MsgInitiateDKG) Reset() { *m = MsgInitiateDKG{} } +func (m *MsgInitiateDKG) String() string { return proto.CompactTextString(m) } +func (*MsgInitiateDKG) ProtoMessage() {} +func (*MsgInitiateDKG) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{4} +} +func (m *MsgInitiateDKG) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInitiateDKG) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInitiateDKG.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 *MsgInitiateDKG) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInitiateDKG.Merge(m, src) +} +func (m *MsgInitiateDKG) XXX_Size() int { + return m.Size() +} +func (m *MsgInitiateDKG) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInitiateDKG.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInitiateDKG proto.InternalMessageInfo + +func (m *MsgInitiateDKG) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgInitiateDKG) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +type MsgInitiateDKGResponse struct { + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` +} + +func (m *MsgInitiateDKGResponse) Reset() { *m = MsgInitiateDKGResponse{} } +func (m *MsgInitiateDKGResponse) String() string { return proto.CompactTextString(m) } +func (*MsgInitiateDKGResponse) ProtoMessage() {} +func (*MsgInitiateDKGResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{5} +} +func (m *MsgInitiateDKGResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInitiateDKGResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInitiateDKGResponse.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 *MsgInitiateDKGResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInitiateDKGResponse.Merge(m, src) +} +func (m *MsgInitiateDKGResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgInitiateDKGResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInitiateDKGResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInitiateDKGResponse proto.InternalMessageInfo + +func (m *MsgInitiateDKGResponse) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +type MsgSubmitDKGRound1 struct { + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + Commitment []byte `protobuf:"bytes,3,opt,name=commitment,proto3" json:"commitment,omitempty"` +} + +func (m *MsgSubmitDKGRound1) Reset() { *m = MsgSubmitDKGRound1{} } +func (m *MsgSubmitDKGRound1) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitDKGRound1) ProtoMessage() {} +func (*MsgSubmitDKGRound1) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{6} +} +func (m *MsgSubmitDKGRound1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitDKGRound1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitDKGRound1.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 *MsgSubmitDKGRound1) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitDKGRound1.Merge(m, src) +} +func (m *MsgSubmitDKGRound1) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitDKGRound1) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitDKGRound1.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitDKGRound1 proto.InternalMessageInfo + +func (m *MsgSubmitDKGRound1) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *MsgSubmitDKGRound1) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +func (m *MsgSubmitDKGRound1) GetCommitment() []byte { + if m != nil { + return m.Commitment + } + return nil +} + +type MsgSubmitDKGRound1Response struct { +} + +func (m *MsgSubmitDKGRound1Response) Reset() { *m = MsgSubmitDKGRound1Response{} } +func (m *MsgSubmitDKGRound1Response) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitDKGRound1Response) ProtoMessage() {} +func (*MsgSubmitDKGRound1Response) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{7} +} +func (m *MsgSubmitDKGRound1Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitDKGRound1Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitDKGRound1Response.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 *MsgSubmitDKGRound1Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitDKGRound1Response.Merge(m, src) +} +func (m *MsgSubmitDKGRound1Response) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitDKGRound1Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitDKGRound1Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitDKGRound1Response proto.InternalMessageInfo + +type MsgSubmitDKGRound2 struct { + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + Share []byte `protobuf:"bytes,3,opt,name=share,proto3" json:"share,omitempty"` +} + +func (m *MsgSubmitDKGRound2) Reset() { *m = MsgSubmitDKGRound2{} } +func (m *MsgSubmitDKGRound2) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitDKGRound2) ProtoMessage() {} +func (*MsgSubmitDKGRound2) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{8} +} +func (m *MsgSubmitDKGRound2) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitDKGRound2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitDKGRound2.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 *MsgSubmitDKGRound2) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitDKGRound2.Merge(m, src) +} +func (m *MsgSubmitDKGRound2) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitDKGRound2) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitDKGRound2.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitDKGRound2 proto.InternalMessageInfo + +func (m *MsgSubmitDKGRound2) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *MsgSubmitDKGRound2) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +func (m *MsgSubmitDKGRound2) GetShare() []byte { + if m != nil { + return m.Share + } + return nil +} + +type MsgSubmitDKGRound2Response struct { +} + +func (m *MsgSubmitDKGRound2Response) Reset() { *m = MsgSubmitDKGRound2Response{} } +func (m *MsgSubmitDKGRound2Response) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitDKGRound2Response) ProtoMessage() {} +func (*MsgSubmitDKGRound2Response) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{9} +} +func (m *MsgSubmitDKGRound2Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitDKGRound2Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitDKGRound2Response.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 *MsgSubmitDKGRound2Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitDKGRound2Response.Merge(m, src) +} +func (m *MsgSubmitDKGRound2Response) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitDKGRound2Response) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitDKGRound2Response.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitDKGRound2Response proto.InternalMessageInfo + +type MsgRequestSignature struct { + Requester string `protobuf:"bytes,1,opt,name=requester,proto3" json:"requester,omitempty"` + KeySetId string `protobuf:"bytes,2,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` + MessageHash []byte `protobuf:"bytes,3,opt,name=message_hash,json=messageHash,proto3" json:"message_hash,omitempty"` + Callback string `protobuf:"bytes,4,opt,name=callback,proto3" json:"callback,omitempty"` +} + +func (m *MsgRequestSignature) Reset() { *m = MsgRequestSignature{} } +func (m *MsgRequestSignature) String() string { return proto.CompactTextString(m) } +func (*MsgRequestSignature) ProtoMessage() {} +func (*MsgRequestSignature) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{10} +} +func (m *MsgRequestSignature) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRequestSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRequestSignature.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 *MsgRequestSignature) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRequestSignature.Merge(m, src) +} +func (m *MsgRequestSignature) XXX_Size() int { + return m.Size() +} +func (m *MsgRequestSignature) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRequestSignature.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRequestSignature proto.InternalMessageInfo + +func (m *MsgRequestSignature) GetRequester() string { + if m != nil { + return m.Requester + } + return "" +} + +func (m *MsgRequestSignature) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +func (m *MsgRequestSignature) GetMessageHash() []byte { + if m != nil { + return m.MessageHash + } + return nil +} + +func (m *MsgRequestSignature) GetCallback() string { + if m != nil { + return m.Callback + } + return "" +} + +type MsgRequestSignatureResponse struct { + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (m *MsgRequestSignatureResponse) Reset() { *m = MsgRequestSignatureResponse{} } +func (m *MsgRequestSignatureResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRequestSignatureResponse) ProtoMessage() {} +func (*MsgRequestSignatureResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{11} +} +func (m *MsgRequestSignatureResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRequestSignatureResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRequestSignatureResponse.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 *MsgRequestSignatureResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRequestSignatureResponse.Merge(m, src) +} +func (m *MsgRequestSignatureResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRequestSignatureResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRequestSignatureResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRequestSignatureResponse proto.InternalMessageInfo + +func (m *MsgRequestSignatureResponse) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +type MsgSubmitCommitment struct { + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + Commitment []byte `protobuf:"bytes,3,opt,name=commitment,proto3" json:"commitment,omitempty"` +} + +func (m *MsgSubmitCommitment) Reset() { *m = MsgSubmitCommitment{} } +func (m *MsgSubmitCommitment) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitCommitment) ProtoMessage() {} +func (*MsgSubmitCommitment) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{12} +} +func (m *MsgSubmitCommitment) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitCommitment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitCommitment.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 *MsgSubmitCommitment) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitCommitment.Merge(m, src) +} +func (m *MsgSubmitCommitment) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitCommitment) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitCommitment.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitCommitment proto.InternalMessageInfo + +func (m *MsgSubmitCommitment) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *MsgSubmitCommitment) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +func (m *MsgSubmitCommitment) GetCommitment() []byte { + if m != nil { + return m.Commitment + } + return nil +} + +type MsgSubmitCommitmentResponse struct { +} + +func (m *MsgSubmitCommitmentResponse) Reset() { *m = MsgSubmitCommitmentResponse{} } +func (m *MsgSubmitCommitmentResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitCommitmentResponse) ProtoMessage() {} +func (*MsgSubmitCommitmentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{13} +} +func (m *MsgSubmitCommitmentResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitCommitmentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitCommitmentResponse.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 *MsgSubmitCommitmentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitCommitmentResponse.Merge(m, src) +} +func (m *MsgSubmitCommitmentResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitCommitmentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitCommitmentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitCommitmentResponse proto.InternalMessageInfo + +type MsgSubmitSignatureShare struct { + Validator string `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator,omitempty"` + RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + Share []byte `protobuf:"bytes,3,opt,name=share,proto3" json:"share,omitempty"` +} + +func (m *MsgSubmitSignatureShare) Reset() { *m = MsgSubmitSignatureShare{} } +func (m *MsgSubmitSignatureShare) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitSignatureShare) ProtoMessage() {} +func (*MsgSubmitSignatureShare) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{14} +} +func (m *MsgSubmitSignatureShare) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitSignatureShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitSignatureShare.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 *MsgSubmitSignatureShare) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitSignatureShare.Merge(m, src) +} +func (m *MsgSubmitSignatureShare) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitSignatureShare) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitSignatureShare.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitSignatureShare proto.InternalMessageInfo + +func (m *MsgSubmitSignatureShare) GetValidator() string { + if m != nil { + return m.Validator + } + return "" +} + +func (m *MsgSubmitSignatureShare) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +func (m *MsgSubmitSignatureShare) GetShare() []byte { + if m != nil { + return m.Share + } + return nil +} + +type MsgSubmitSignatureShareResponse struct { +} + +func (m *MsgSubmitSignatureShareResponse) Reset() { *m = MsgSubmitSignatureShareResponse{} } +func (m *MsgSubmitSignatureShareResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitSignatureShareResponse) ProtoMessage() {} +func (*MsgSubmitSignatureShareResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4792a583528fac51, []int{15} +} +func (m *MsgSubmitSignatureShareResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitSignatureShareResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitSignatureShareResponse.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 *MsgSubmitSignatureShareResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitSignatureShareResponse.Merge(m, src) +} +func (m *MsgSubmitSignatureShareResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitSignatureShareResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitSignatureShareResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitSignatureShareResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "secret.tss.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "secret.tss.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgCreateKeySet)(nil), "secret.tss.v1.MsgCreateKeySet") + proto.RegisterType((*MsgCreateKeySetResponse)(nil), "secret.tss.v1.MsgCreateKeySetResponse") + proto.RegisterType((*MsgInitiateDKG)(nil), "secret.tss.v1.MsgInitiateDKG") + proto.RegisterType((*MsgInitiateDKGResponse)(nil), "secret.tss.v1.MsgInitiateDKGResponse") + proto.RegisterType((*MsgSubmitDKGRound1)(nil), "secret.tss.v1.MsgSubmitDKGRound1") + proto.RegisterType((*MsgSubmitDKGRound1Response)(nil), "secret.tss.v1.MsgSubmitDKGRound1Response") + proto.RegisterType((*MsgSubmitDKGRound2)(nil), "secret.tss.v1.MsgSubmitDKGRound2") + proto.RegisterType((*MsgSubmitDKGRound2Response)(nil), "secret.tss.v1.MsgSubmitDKGRound2Response") + proto.RegisterType((*MsgRequestSignature)(nil), "secret.tss.v1.MsgRequestSignature") + proto.RegisterType((*MsgRequestSignatureResponse)(nil), "secret.tss.v1.MsgRequestSignatureResponse") + proto.RegisterType((*MsgSubmitCommitment)(nil), "secret.tss.v1.MsgSubmitCommitment") + proto.RegisterType((*MsgSubmitCommitmentResponse)(nil), "secret.tss.v1.MsgSubmitCommitmentResponse") + proto.RegisterType((*MsgSubmitSignatureShare)(nil), "secret.tss.v1.MsgSubmitSignatureShare") + proto.RegisterType((*MsgSubmitSignatureShareResponse)(nil), "secret.tss.v1.MsgSubmitSignatureShareResponse") +} + +func init() { proto.RegisterFile("secret/tss/v1/tx.proto", fileDescriptor_4792a583528fac51) } + +var fileDescriptor_4792a583528fac51 = []byte{ + // 899 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0xae, 0x53, 0x5a, 0x36, 0x2f, 0x69, 0x17, 0x86, 0xb2, 0x9b, 0x35, 0x6d, 0xda, 0x5a, 0xec, + 0xaa, 0x54, 0x6a, 0xac, 0x06, 0x09, 0x50, 0xc5, 0x85, 0x2e, 0xd2, 0x52, 0xad, 0x82, 0x50, 0x22, + 0xf6, 0x80, 0x40, 0xd1, 0xc4, 0x1e, 0x39, 0x56, 0x62, 0x4f, 0x98, 0x37, 0xe9, 0x36, 0x12, 0x07, + 0xd8, 0x23, 0x5c, 0xf8, 0x09, 0x1c, 0x39, 0x56, 0x88, 0x3f, 0xc0, 0x6d, 0x8f, 0x2b, 0x4e, 0x9c, + 0x10, 0x6a, 0x0f, 0xfd, 0x1b, 0xc8, 0x33, 0x8e, 0x63, 0x3b, 0x49, 0xd3, 0x55, 0x2f, 0x51, 0xe6, + 0x7b, 0xdf, 0x7c, 0xef, 0x7b, 0x7e, 0x6f, 0x46, 0x03, 0xf7, 0x90, 0x39, 0x82, 0x49, 0x5b, 0x22, + 0xda, 0xa7, 0x87, 0xb6, 0x3c, 0xab, 0x0d, 0x04, 0x97, 0x9c, 0xac, 0x69, 0xbc, 0x26, 0x11, 0x6b, + 0xa7, 0x87, 0xe6, 0x7d, 0x87, 0x63, 0xc0, 0xd1, 0x0e, 0xd0, 0x8b, 0x68, 0x01, 0x7a, 0x9a, 0x67, + 0x6e, 0x78, 0xdc, 0xe3, 0xea, 0xaf, 0x1d, 0xfd, 0x8b, 0xd1, 0x07, 0x39, 0xd5, 0xd1, 0x80, 0xe1, + 0x38, 0xa4, 0x95, 0xda, 0x7a, 0x8f, 0x5e, 0xc4, 0xa1, 0xb7, 0x69, 0xe0, 0x87, 0xdc, 0x56, 0xbf, + 0x1a, 0xb2, 0xfe, 0x30, 0xe0, 0x6e, 0x03, 0xbd, 0xaf, 0x07, 0x2e, 0x95, 0xec, 0x2b, 0x2a, 0x68, + 0x80, 0xe4, 0x23, 0x28, 0xd2, 0xa1, 0xec, 0x72, 0xe1, 0xcb, 0x51, 0xc5, 0xd8, 0x31, 0xf6, 0x8a, + 0xc7, 0x95, 0xbf, 0xff, 0x3c, 0xd8, 0x88, 0xb5, 0x3e, 0x73, 0x5d, 0xc1, 0x10, 0x5b, 0x52, 0xf8, + 0xa1, 0xd7, 0x9c, 0x50, 0xc9, 0x27, 0xb0, 0x3a, 0x50, 0x0a, 0x95, 0xc2, 0x8e, 0xb1, 0x57, 0xaa, + 0xbf, 0x5b, 0xcb, 0xd4, 0x58, 0xd3, 0xf2, 0xc7, 0xc5, 0x97, 0xff, 0x6e, 0x2f, 0xfd, 0x7e, 0x75, + 0xbe, 0x6f, 0x34, 0x63, 0xfe, 0xd1, 0xc1, 0x8b, 0xab, 0xf3, 0xfd, 0x89, 0xd2, 0xcf, 0x57, 0xe7, + 0xfb, 0x66, 0xaa, 0xc2, 0x9c, 0x41, 0xeb, 0x01, 0xdc, 0xcf, 0x41, 0x4d, 0x86, 0x03, 0x1e, 0x22, + 0xb3, 0xfe, 0xd2, 0xf5, 0x3c, 0x16, 0x8c, 0x4a, 0xf6, 0x94, 0x8d, 0x5a, 0x4c, 0x92, 0x0a, 0xbc, + 0xe9, 0x44, 0x6b, 0x2e, 0x74, 0x35, 0xcd, 0xf1, 0x92, 0x6c, 0x42, 0x51, 0x76, 0x05, 0xc3, 0x2e, + 0xef, 0xbb, 0xca, 0xf4, 0x5a, 0x73, 0x02, 0x90, 0x6d, 0x28, 0x05, 0xf4, 0xac, 0x8d, 0xbe, 0x17, + 0x32, 0x81, 0x95, 0x65, 0x15, 0x87, 0x80, 0x9e, 0xb5, 0x34, 0x42, 0x76, 0xa0, 0xe4, 0x32, 0x74, + 0x84, 0x3f, 0x90, 0x3e, 0x0f, 0x2b, 0x6f, 0x28, 0xf1, 0x34, 0x44, 0x1e, 0xc2, 0xba, 0xf4, 0x03, + 0xc6, 0x87, 0xb2, 0xdd, 0xe9, 0x73, 0xa7, 0x87, 0x95, 0x95, 0x1d, 0x63, 0x6f, 0xb9, 0xb9, 0x16, + 0xa3, 0xc7, 0x0a, 0x3c, 0x2a, 0x47, 0xf5, 0x8f, 0x5d, 0x59, 0xdf, 0xa9, 0xf2, 0xd2, 0x25, 0x8c, + 0xcb, 0x23, 0x9b, 0x00, 0x3d, 0x36, 0x6a, 0x23, 0x93, 0x6d, 0xdf, 0x8d, 0xab, 0xb9, 0xd3, 0x53, + 0x9c, 0x13, 0x97, 0xbc, 0x0f, 0xeb, 0x6e, 0xcf, 0x6b, 0x23, 0x43, 0xf4, 0x79, 0x18, 0x31, 0x0a, + 0x8a, 0x51, 0x76, 0x7b, 0x5e, 0x4b, 0x83, 0x27, 0xae, 0xf5, 0x2d, 0xac, 0x37, 0xd0, 0x3b, 0x09, + 0x7d, 0xe9, 0x53, 0xc9, 0x3e, 0x7f, 0xfa, 0x24, 0xfa, 0x0c, 0xb9, 0x86, 0xa7, 0xdb, 0x9a, 0xcd, + 0x59, 0xc8, 0xe6, 0x3c, 0x5a, 0xcf, 0xb6, 0xce, 0xfa, 0x18, 0xee, 0x65, 0xd5, 0x13, 0xef, 0x5b, + 0x00, 0x29, 0x67, 0x71, 0x1a, 0x4c, 0x6c, 0xfd, 0x64, 0x00, 0x69, 0xa0, 0xd7, 0x1a, 0x76, 0x02, + 0x5f, 0x46, 0xfb, 0xf8, 0x30, 0x74, 0x0f, 0x23, 0x6f, 0xa7, 0xb4, 0xef, 0xbb, 0xa9, 0xf6, 0x4d, + 0x80, 0x9c, 0x66, 0x21, 0xa7, 0x49, 0xaa, 0x00, 0x0e, 0x0f, 0x02, 0x5f, 0x06, 0x2c, 0x94, 0xaa, + 0x81, 0xe5, 0x66, 0x0a, 0x89, 0xcd, 0x27, 0x72, 0xd6, 0x26, 0x98, 0xd3, 0x16, 0x92, 0xd9, 0x7a, + 0x3e, 0xc3, 0x60, 0xfd, 0x76, 0x06, 0x37, 0x60, 0x05, 0xbb, 0x54, 0xb0, 0xd8, 0x9b, 0x5e, 0xdc, + 0xc8, 0x56, 0x3d, 0xb1, 0xf5, 0x9b, 0x01, 0xef, 0x34, 0xd0, 0x6b, 0xb2, 0xef, 0x87, 0x0c, 0x65, + 0x34, 0x9b, 0x54, 0x0e, 0x45, 0x34, 0x2b, 0x45, 0xa1, 0x31, 0x96, 0x18, 0x4b, 0x80, 0xeb, 0xbb, + 0x4a, 0x76, 0xa1, 0x1c, 0x30, 0x44, 0xea, 0xb1, 0x76, 0x97, 0x62, 0x37, 0xb6, 0x57, 0x8a, 0xb1, + 0x2f, 0x28, 0x76, 0x89, 0x09, 0x77, 0x1c, 0xda, 0xef, 0x77, 0xa8, 0xd3, 0x8b, 0x27, 0x3f, 0x59, + 0xc7, 0x05, 0x24, 0xc9, 0xac, 0x4f, 0xe1, 0xbd, 0x19, 0x0e, 0xd3, 0x93, 0x11, 0x73, 0x53, 0x93, + 0x11, 0x23, 0x27, 0xae, 0xf5, 0x42, 0x17, 0xa8, 0xeb, 0x7f, 0x9c, 0x74, 0x6f, 0xf1, 0x97, 0x4f, + 0x89, 0x16, 0x72, 0xa2, 0xaf, 0x3d, 0x1a, 0x5b, 0xaa, 0x84, 0xbc, 0x87, 0xa4, 0x09, 0x3f, 0xa8, + 0x33, 0xab, 0xc3, 0x49, 0x81, 0xad, 0xa8, 0x9b, 0xb7, 0xb3, 0x79, 0xb3, 0x01, 0xd9, 0x85, 0xed, + 0x39, 0xd9, 0xc7, 0x06, 0xeb, 0xbf, 0xac, 0xc2, 0x72, 0x03, 0x3d, 0xf2, 0x0c, 0xca, 0x99, 0xcb, + 0xbe, 0x9a, 0xbb, 0xa4, 0x73, 0x17, 0xab, 0xf9, 0xe8, 0xfa, 0x78, 0xd2, 0xc3, 0x67, 0x50, 0xce, + 0x5c, 0xba, 0x33, 0x74, 0xd3, 0xf1, 0x59, 0xba, 0x33, 0x6f, 0xbc, 0x16, 0x94, 0xd2, 0x57, 0xd5, + 0xd6, 0xf4, 0xb6, 0x54, 0xd8, 0x7c, 0x78, 0x6d, 0x38, 0x11, 0x6d, 0xc3, 0xdd, 0xfc, 0x3d, 0xb3, + 0x3b, 0xbd, 0x33, 0x47, 0x31, 0x3f, 0x58, 0x48, 0x99, 0x9f, 0xa0, 0xbe, 0x38, 0x41, 0x7d, 0x71, + 0x82, 0xe4, 0xd0, 0x93, 0x0e, 0xbc, 0x35, 0x75, 0xe0, 0xad, 0xe9, 0xed, 0x79, 0x8e, 0xb9, 0xbf, + 0x98, 0x93, 0xce, 0x31, 0x75, 0xe6, 0xac, 0x79, 0x16, 0x27, 0x9c, 0x59, 0x39, 0xe6, 0x9d, 0x1b, + 0x12, 0xc2, 0xc6, 0xcc, 0x43, 0xf3, 0x68, 0x9e, 0x46, 0x96, 0x67, 0xd6, 0x6e, 0xc6, 0x1b, 0xe7, + 0x33, 0x57, 0x7e, 0x8c, 0x1e, 0x1e, 0xc7, 0x4f, 0x5e, 0x5e, 0x54, 0x8d, 0x57, 0x17, 0x55, 0xe3, + 0xbf, 0x8b, 0xaa, 0xf1, 0xeb, 0x65, 0x75, 0xe9, 0xd5, 0x65, 0x75, 0xe9, 0x9f, 0xcb, 0xea, 0xd2, + 0x37, 0x07, 0x9e, 0x2f, 0xbb, 0xc3, 0x4e, 0xcd, 0xe1, 0x81, 0x8d, 0x8e, 0x90, 0x7d, 0xda, 0x41, + 0xbb, 0xa5, 0x72, 0x7c, 0xc9, 0xe4, 0x73, 0x2e, 0x7a, 0xf6, 0x99, 0x7a, 0x94, 0xa8, 0x37, 0x57, + 0x67, 0x55, 0x3d, 0xa3, 0x3e, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xc6, 0xe5, 0xaa, 0x5b, 0xe7, + 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // UpdateParams updates module parameters + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // DKG Messages (from x/mpc) + CreateKeySet(ctx context.Context, in *MsgCreateKeySet, opts ...grpc.CallOption) (*MsgCreateKeySetResponse, error) + InitiateDKG(ctx context.Context, in *MsgInitiateDKG, opts ...grpc.CallOption) (*MsgInitiateDKGResponse, error) + SubmitDKGRound1(ctx context.Context, in *MsgSubmitDKGRound1, opts ...grpc.CallOption) (*MsgSubmitDKGRound1Response, error) + SubmitDKGRound2(ctx context.Context, in *MsgSubmitDKGRound2, opts ...grpc.CallOption) (*MsgSubmitDKGRound2Response, error) + // Signing Messages (from x/signing) + RequestSignature(ctx context.Context, in *MsgRequestSignature, opts ...grpc.CallOption) (*MsgRequestSignatureResponse, error) + SubmitCommitment(ctx context.Context, in *MsgSubmitCommitment, opts ...grpc.CallOption) (*MsgSubmitCommitmentResponse, error) + SubmitSignatureShare(ctx context.Context, in *MsgSubmitSignatureShare, opts ...grpc.CallOption) (*MsgSubmitSignatureShareResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CreateKeySet(ctx context.Context, in *MsgCreateKeySet, opts ...grpc.CallOption) (*MsgCreateKeySetResponse, error) { + out := new(MsgCreateKeySetResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/CreateKeySet", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) InitiateDKG(ctx context.Context, in *MsgInitiateDKG, opts ...grpc.CallOption) (*MsgInitiateDKGResponse, error) { + out := new(MsgInitiateDKGResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/InitiateDKG", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitDKGRound1(ctx context.Context, in *MsgSubmitDKGRound1, opts ...grpc.CallOption) (*MsgSubmitDKGRound1Response, error) { + out := new(MsgSubmitDKGRound1Response) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/SubmitDKGRound1", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitDKGRound2(ctx context.Context, in *MsgSubmitDKGRound2, opts ...grpc.CallOption) (*MsgSubmitDKGRound2Response, error) { + out := new(MsgSubmitDKGRound2Response) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/SubmitDKGRound2", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RequestSignature(ctx context.Context, in *MsgRequestSignature, opts ...grpc.CallOption) (*MsgRequestSignatureResponse, error) { + out := new(MsgRequestSignatureResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/RequestSignature", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitCommitment(ctx context.Context, in *MsgSubmitCommitment, opts ...grpc.CallOption) (*MsgSubmitCommitmentResponse, error) { + out := new(MsgSubmitCommitmentResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/SubmitCommitment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitSignatureShare(ctx context.Context, in *MsgSubmitSignatureShare, opts ...grpc.CallOption) (*MsgSubmitSignatureShareResponse, error) { + out := new(MsgSubmitSignatureShareResponse) + err := c.cc.Invoke(ctx, "/secret.tss.v1.Msg/SubmitSignatureShare", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // UpdateParams updates module parameters + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // DKG Messages (from x/mpc) + CreateKeySet(context.Context, *MsgCreateKeySet) (*MsgCreateKeySetResponse, error) + InitiateDKG(context.Context, *MsgInitiateDKG) (*MsgInitiateDKGResponse, error) + SubmitDKGRound1(context.Context, *MsgSubmitDKGRound1) (*MsgSubmitDKGRound1Response, error) + SubmitDKGRound2(context.Context, *MsgSubmitDKGRound2) (*MsgSubmitDKGRound2Response, error) + // Signing Messages (from x/signing) + RequestSignature(context.Context, *MsgRequestSignature) (*MsgRequestSignatureResponse, error) + SubmitCommitment(context.Context, *MsgSubmitCommitment) (*MsgSubmitCommitmentResponse, error) + SubmitSignatureShare(context.Context, *MsgSubmitSignatureShare) (*MsgSubmitSignatureShareResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} +func (*UnimplementedMsgServer) CreateKeySet(ctx context.Context, req *MsgCreateKeySet) (*MsgCreateKeySetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateKeySet not implemented") +} +func (*UnimplementedMsgServer) InitiateDKG(ctx context.Context, req *MsgInitiateDKG) (*MsgInitiateDKGResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InitiateDKG not implemented") +} +func (*UnimplementedMsgServer) SubmitDKGRound1(ctx context.Context, req *MsgSubmitDKGRound1) (*MsgSubmitDKGRound1Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitDKGRound1 not implemented") +} +func (*UnimplementedMsgServer) SubmitDKGRound2(ctx context.Context, req *MsgSubmitDKGRound2) (*MsgSubmitDKGRound2Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitDKGRound2 not implemented") +} +func (*UnimplementedMsgServer) RequestSignature(ctx context.Context, req *MsgRequestSignature) (*MsgRequestSignatureResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RequestSignature not implemented") +} +func (*UnimplementedMsgServer) SubmitCommitment(ctx context.Context, req *MsgSubmitCommitment) (*MsgSubmitCommitmentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitCommitment not implemented") +} +func (*UnimplementedMsgServer) SubmitSignatureShare(ctx context.Context, req *MsgSubmitSignatureShare) (*MsgSubmitSignatureShareResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitSignatureShare not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CreateKeySet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateKeySet) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateKeySet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/CreateKeySet", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateKeySet(ctx, req.(*MsgCreateKeySet)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_InitiateDKG_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgInitiateDKG) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).InitiateDKG(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/InitiateDKG", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).InitiateDKG(ctx, req.(*MsgInitiateDKG)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitDKGRound1_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitDKGRound1) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitDKGRound1(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/SubmitDKGRound1", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitDKGRound1(ctx, req.(*MsgSubmitDKGRound1)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitDKGRound2_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitDKGRound2) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitDKGRound2(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/SubmitDKGRound2", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitDKGRound2(ctx, req.(*MsgSubmitDKGRound2)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RequestSignature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRequestSignature) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RequestSignature(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/RequestSignature", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RequestSignature(ctx, req.(*MsgRequestSignature)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitCommitment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitCommitment) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitCommitment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/SubmitCommitment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitCommitment(ctx, req.(*MsgSubmitCommitment)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitSignatureShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitSignatureShare) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitSignatureShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.tss.v1.Msg/SubmitSignatureShare", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitSignatureShare(ctx, req.(*MsgSubmitSignatureShare)) + } + return interceptor(ctx, in, info, handler) +} + +var Msg_serviceDesc = _Msg_serviceDesc +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "secret.tss.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + { + MethodName: "CreateKeySet", + Handler: _Msg_CreateKeySet_Handler, + }, + { + MethodName: "InitiateDKG", + Handler: _Msg_InitiateDKG_Handler, + }, + { + MethodName: "SubmitDKGRound1", + Handler: _Msg_SubmitDKGRound1_Handler, + }, + { + MethodName: "SubmitDKGRound2", + Handler: _Msg_SubmitDKGRound2_Handler, + }, + { + MethodName: "RequestSignature", + Handler: _Msg_RequestSignature_Handler, + }, + { + MethodName: "SubmitCommitment", + Handler: _Msg_SubmitCommitment_Handler, + }, + { + MethodName: "SubmitSignatureShare", + Handler: _Msg_SubmitSignatureShare_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "secret/tss/v1/tx.proto", +} + +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCreateKeySet) 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 *MsgCreateKeySet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateKeySet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TimeoutBlocks != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TimeoutBlocks)) + i-- + dAtA[i] = 0x28 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x22 + } + if m.MaxSigners != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxSigners)) + i-- + dAtA[i] = 0x18 + } + if m.Threshold != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Threshold)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateKeySetResponse) 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 *MsgCreateKeySetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateKeySetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DkgSessionId) > 0 { + i -= len(m.DkgSessionId) + copy(dAtA[i:], m.DkgSessionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DkgSessionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTx(dAtA, i, uint64(len(m.KeySetId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgInitiateDKG) 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 *MsgInitiateDKG) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInitiateDKG) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTx(dAtA, i, uint64(len(m.KeySetId))) + 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 *MsgInitiateDKGResponse) 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 *MsgInitiateDKGResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInitiateDKGResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SessionId) > 0 { + i -= len(m.SessionId) + copy(dAtA[i:], m.SessionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SessionId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitDKGRound1) 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 *MsgSubmitDKGRound1) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitDKGRound1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintTx(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0x1a + } + if len(m.SessionId) > 0 { + i -= len(m.SessionId) + copy(dAtA[i:], m.SessionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SessionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitDKGRound1Response) 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 *MsgSubmitDKGRound1Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitDKGRound1Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSubmitDKGRound2) 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 *MsgSubmitDKGRound2) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitDKGRound2) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Share) > 0 { + i -= len(m.Share) + copy(dAtA[i:], m.Share) + i = encodeVarintTx(dAtA, i, uint64(len(m.Share))) + i-- + dAtA[i] = 0x1a + } + if len(m.SessionId) > 0 { + i -= len(m.SessionId) + copy(dAtA[i:], m.SessionId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SessionId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitDKGRound2Response) 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 *MsgSubmitDKGRound2Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitDKGRound2Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRequestSignature) 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 *MsgRequestSignature) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRequestSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Callback) > 0 { + i -= len(m.Callback) + copy(dAtA[i:], m.Callback) + i = encodeVarintTx(dAtA, i, uint64(len(m.Callback))) + i-- + dAtA[i] = 0x22 + } + if len(m.MessageHash) > 0 { + i -= len(m.MessageHash) + copy(dAtA[i:], m.MessageHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.MessageHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTx(dAtA, i, uint64(len(m.KeySetId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Requester) > 0 { + i -= len(m.Requester) + copy(dAtA[i:], m.Requester) + i = encodeVarintTx(dAtA, i, uint64(len(m.Requester))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRequestSignatureResponse) 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 *MsgRequestSignatureResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRequestSignatureResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestId) > 0 { + i -= len(m.RequestId) + copy(dAtA[i:], m.RequestId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitCommitment) 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 *MsgSubmitCommitment) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitCommitment) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintTx(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0x1a + } + if len(m.RequestId) > 0 { + i -= len(m.RequestId) + copy(dAtA[i:], m.RequestId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitCommitmentResponse) 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 *MsgSubmitCommitmentResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitCommitmentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSubmitSignatureShare) 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 *MsgSubmitSignatureShare) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitSignatureShare) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Share) > 0 { + i -= len(m.Share) + copy(dAtA[i:], m.Share) + i = encodeVarintTx(dAtA, i, uint64(len(m.Share))) + i-- + dAtA[i] = 0x1a + } + if len(m.RequestId) > 0 { + i -= len(m.RequestId) + copy(dAtA[i:], m.RequestId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Validator) > 0 { + i -= len(m.Validator) + copy(dAtA[i:], m.Validator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitSignatureShareResponse) 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 *MsgSubmitSignatureShareResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitSignatureShareResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCreateKeySet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Threshold != 0 { + n += 1 + sovTx(uint64(m.Threshold)) + } + if m.MaxSigners != 0 { + n += 1 + sovTx(uint64(m.MaxSigners)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TimeoutBlocks != 0 { + n += 1 + sovTx(uint64(m.TimeoutBlocks)) + } + return n +} + +func (m *MsgCreateKeySetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DkgSessionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgInitiateDKG) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgInitiateDKGResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SessionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitDKGRound1) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SessionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitDKGRound1Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitDKGRound2) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SessionId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Share) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitDKGRound2Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRequestSignature) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Requester) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.MessageHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Callback) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRequestSignatureResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitCommitment) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RequestId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitCommitmentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitSignatureShare) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Validator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RequestId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Share) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitSignatureShareResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateKeySet) 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: MsgCreateKeySet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateKeySet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + m.Threshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Threshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSigners", wireType) + } + m.MaxSigners = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSigners |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutBlocks", wireType) + } + m.TimeoutBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutBlocks |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgCreateKeySetResponse) 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: MsgCreateKeySetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateKeySetResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySetId", 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.KeySetId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DkgSessionId", 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.DkgSessionId = 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 *MsgInitiateDKG) 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: MsgInitiateDKG: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInitiateDKG: 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 KeySetId", 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.KeySetId = 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 *MsgInitiateDKGResponse) 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: MsgInitiateDKGResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInitiateDKGResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionId", 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.SessionId = 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 *MsgSubmitDKGRound1) 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: MsgSubmitDKGRound1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitDKGRound1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionId", 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.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = append(m.Commitment[:0], dAtA[iNdEx:postIndex]...) + if m.Commitment == nil { + m.Commitment = []byte{} + } + 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 *MsgSubmitDKGRound1Response) 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: MsgSubmitDKGRound1Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitDKGRound1Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitDKGRound2) 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: MsgSubmitDKGRound2: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitDKGRound2: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SessionId", 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.SessionId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Share", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Share = append(m.Share[:0], dAtA[iNdEx:postIndex]...) + if m.Share == nil { + m.Share = []byte{} + } + 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 *MsgSubmitDKGRound2Response) 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: MsgSubmitDKGRound2Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitDKGRound2Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRequestSignature) 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: MsgRequestSignature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRequestSignature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Requester", 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.Requester = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySetId", 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.KeySetId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MessageHash = append(m.MessageHash[:0], dAtA[iNdEx:postIndex]...) + if m.MessageHash == nil { + m.MessageHash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Callback", 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.Callback = 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 *MsgRequestSignatureResponse) 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: MsgRequestSignatureResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRequestSignatureResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", 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.RequestId = 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 *MsgSubmitCommitment) 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: MsgSubmitCommitment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitCommitment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", 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.RequestId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = append(m.Commitment[:0], dAtA[iNdEx:postIndex]...) + if m.Commitment == nil { + m.Commitment = []byte{} + } + 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 *MsgSubmitCommitmentResponse) 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: MsgSubmitCommitmentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitCommitmentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitSignatureShare) 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: MsgSubmitSignatureShare: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitSignatureShare: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Validator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", 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.RequestId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Share", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Share = append(m.Share[:0], dAtA[iNdEx:postIndex]...) + if m.Share == nil { + m.Share = []byte{} + } + 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 *MsgSubmitSignatureShareResponse) 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: MsgSubmitSignatureShareResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitSignatureShareResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/tss/types/types.pb.go b/x/tss/types/types.pb.go new file mode 100644 index 000000000..2c28aa52c --- /dev/null +++ b/x/tss/types/types.pb.go @@ -0,0 +1,4309 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: secret/tss/v1/types.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// KeySetStatus defines the status of a KeySet +type KeySetStatus int32 + +const ( + KeySetStatus_KEY_SET_STATUS_UNSPECIFIED KeySetStatus = 0 + KeySetStatus_KEY_SET_STATUS_PENDING_DKG KeySetStatus = 1 + KeySetStatus_KEY_SET_STATUS_ACTIVE KeySetStatus = 2 + KeySetStatus_KEY_SET_STATUS_FAILED KeySetStatus = 3 +) + +var KeySetStatus_name = map[int32]string{ + 0: "KEY_SET_STATUS_UNSPECIFIED", + 1: "KEY_SET_STATUS_PENDING_DKG", + 2: "KEY_SET_STATUS_ACTIVE", + 3: "KEY_SET_STATUS_FAILED", +} + +var KeySetStatus_value = map[string]int32{ + "KEY_SET_STATUS_UNSPECIFIED": 0, + "KEY_SET_STATUS_PENDING_DKG": 1, + "KEY_SET_STATUS_ACTIVE": 2, + "KEY_SET_STATUS_FAILED": 3, +} + +func (x KeySetStatus) String() string { + return proto.EnumName(KeySetStatus_name, int32(x)) +} + +func (KeySetStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{0} +} + +// DKGState defines the state of a DKG session +type DKGState int32 + +const ( + DKGState_DKG_STATE_UNSPECIFIED DKGState = 0 + DKGState_DKG_STATE_ROUND1 DKGState = 1 + DKGState_DKG_STATE_ROUND2 DKGState = 2 + DKGState_DKG_STATE_KEY_SUBMISSION DKGState = 3 + DKGState_DKG_STATE_COMPLETE DKGState = 4 + DKGState_DKG_STATE_FAILED DKGState = 5 +) + +var DKGState_name = map[int32]string{ + 0: "DKG_STATE_UNSPECIFIED", + 1: "DKG_STATE_ROUND1", + 2: "DKG_STATE_ROUND2", + 3: "DKG_STATE_KEY_SUBMISSION", + 4: "DKG_STATE_COMPLETE", + 5: "DKG_STATE_FAILED", +} + +var DKGState_value = map[string]int32{ + "DKG_STATE_UNSPECIFIED": 0, + "DKG_STATE_ROUND1": 1, + "DKG_STATE_ROUND2": 2, + "DKG_STATE_KEY_SUBMISSION": 3, + "DKG_STATE_COMPLETE": 4, + "DKG_STATE_FAILED": 5, +} + +func (x DKGState) String() string { + return proto.EnumName(DKGState_name, int32(x)) +} + +func (DKGState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{1} +} + +// SigningState defines the state of a signing session +type SigningState int32 + +const ( + SigningState_SIGNING_STATE_UNSPECIFIED SigningState = 0 + SigningState_SIGNING_STATE_ROUND1 SigningState = 1 + SigningState_SIGNING_STATE_ROUND2 SigningState = 2 + SigningState_SIGNING_STATE_COMPLETE SigningState = 3 + SigningState_SIGNING_STATE_FAILED SigningState = 4 +) + +var SigningState_name = map[int32]string{ + 0: "SIGNING_STATE_UNSPECIFIED", + 1: "SIGNING_STATE_ROUND1", + 2: "SIGNING_STATE_ROUND2", + 3: "SIGNING_STATE_COMPLETE", + 4: "SIGNING_STATE_FAILED", +} + +var SigningState_value = map[string]int32{ + "SIGNING_STATE_UNSPECIFIED": 0, + "SIGNING_STATE_ROUND1": 1, + "SIGNING_STATE_ROUND2": 2, + "SIGNING_STATE_COMPLETE": 3, + "SIGNING_STATE_FAILED": 4, +} + +func (x SigningState) String() string { + return proto.EnumName(SigningState_name, int32(x)) +} + +func (SigningState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{2} +} + +// SigningRequestStatus defines the status of a signing request +type SigningRequestStatus int32 + +const ( + SigningRequestStatus_SIGNING_REQUEST_STATUS_UNSPECIFIED SigningRequestStatus = 0 + SigningRequestStatus_SIGNING_REQUEST_STATUS_PENDING SigningRequestStatus = 1 + SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND1 SigningRequestStatus = 2 + SigningRequestStatus_SIGNING_REQUEST_STATUS_ROUND2 SigningRequestStatus = 3 + SigningRequestStatus_SIGNING_REQUEST_STATUS_COMPLETE SigningRequestStatus = 4 + SigningRequestStatus_SIGNING_REQUEST_STATUS_FAILED SigningRequestStatus = 5 +) + +var SigningRequestStatus_name = map[int32]string{ + 0: "SIGNING_REQUEST_STATUS_UNSPECIFIED", + 1: "SIGNING_REQUEST_STATUS_PENDING", + 2: "SIGNING_REQUEST_STATUS_ROUND1", + 3: "SIGNING_REQUEST_STATUS_ROUND2", + 4: "SIGNING_REQUEST_STATUS_COMPLETE", + 5: "SIGNING_REQUEST_STATUS_FAILED", +} + +var SigningRequestStatus_value = map[string]int32{ + "SIGNING_REQUEST_STATUS_UNSPECIFIED": 0, + "SIGNING_REQUEST_STATUS_PENDING": 1, + "SIGNING_REQUEST_STATUS_ROUND1": 2, + "SIGNING_REQUEST_STATUS_ROUND2": 3, + "SIGNING_REQUEST_STATUS_COMPLETE": 4, + "SIGNING_REQUEST_STATUS_FAILED": 5, +} + +func (x SigningRequestStatus) String() string { + return proto.EnumName(SigningRequestStatus_name, int32(x)) +} + +func (SigningRequestStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{3} +} + +// Params defines the module parameters +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +// KeySet represents a threshold signature key set +type KeySet struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + Threshold uint32 `protobuf:"varint,3,opt,name=threshold,proto3" json:"threshold,omitempty"` + MaxSigners uint32 `protobuf:"varint,4,opt,name=max_signers,json=maxSigners,proto3" json:"max_signers,omitempty"` + Participants []string `protobuf:"bytes,5,rep,name=participants,proto3" json:"participants,omitempty"` + GroupPubkey []byte `protobuf:"bytes,6,opt,name=group_pubkey,json=groupPubkey,proto3" json:"group_pubkey,omitempty"` + Status KeySetStatus `protobuf:"varint,7,opt,name=status,proto3,enum=secret.tss.v1.KeySetStatus" json:"status,omitempty"` + Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` + CreatedHeight int64 `protobuf:"varint,9,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` +} + +func (m *KeySet) Reset() { *m = KeySet{} } +func (m *KeySet) String() string { return proto.CompactTextString(m) } +func (*KeySet) ProtoMessage() {} +func (*KeySet) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{1} +} +func (m *KeySet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeySet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeySet.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 *KeySet) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeySet.Merge(m, src) +} +func (m *KeySet) XXX_Size() int { + return m.Size() +} +func (m *KeySet) XXX_DiscardUnknown() { + xxx_messageInfo_KeySet.DiscardUnknown(m) +} + +var xxx_messageInfo_KeySet proto.InternalMessageInfo + +func (m *KeySet) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *KeySet) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *KeySet) GetThreshold() uint32 { + if m != nil { + return m.Threshold + } + return 0 +} + +func (m *KeySet) GetMaxSigners() uint32 { + if m != nil { + return m.MaxSigners + } + return 0 +} + +func (m *KeySet) GetParticipants() []string { + if m != nil { + return m.Participants + } + return nil +} + +func (m *KeySet) GetGroupPubkey() []byte { + if m != nil { + return m.GroupPubkey + } + return nil +} + +func (m *KeySet) GetStatus() KeySetStatus { + if m != nil { + return m.Status + } + return KeySetStatus_KEY_SET_STATUS_UNSPECIFIED +} + +func (m *KeySet) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *KeySet) GetCreatedHeight() int64 { + if m != nil { + return m.CreatedHeight + } + return 0 +} + +// KeyShare represents a validator's share of a threshold key +// The secret share is encrypted with the validator's public key (Ed25519→X25519) +type KeyShare struct { + KeySetId string `protobuf:"bytes,1,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + ShareData []byte `protobuf:"bytes,3,opt,name=share_data,json=shareData,proto3" json:"share_data,omitempty"` + GroupPubkey []byte `protobuf:"bytes,4,opt,name=group_pubkey,json=groupPubkey,proto3" json:"group_pubkey,omitempty"` + CreatedHeight int64 `protobuf:"varint,5,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` + // Encrypted FROST secret share (NaCl box sealed with validator's X25519 pubkey) + EncryptedSecretShare []byte `protobuf:"bytes,6,opt,name=encrypted_secret_share,json=encryptedSecretShare,proto3" json:"encrypted_secret_share,omitempty"` + // Encrypted FROST public shares (NaCl box sealed with validator's X25519 pubkey) + EncryptedPublicShares []byte `protobuf:"bytes,7,opt,name=encrypted_public_shares,json=encryptedPublicShares,proto3" json:"encrypted_public_shares,omitempty"` + // Ephemeral public key used for encryption (needed for decryption) + EphemeralPubkey []byte `protobuf:"bytes,8,opt,name=ephemeral_pubkey,json=ephemeralPubkey,proto3" json:"ephemeral_pubkey,omitempty"` +} + +func (m *KeyShare) Reset() { *m = KeyShare{} } +func (m *KeyShare) String() string { return proto.CompactTextString(m) } +func (*KeyShare) ProtoMessage() {} +func (*KeyShare) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{2} +} +func (m *KeyShare) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *KeyShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_KeyShare.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 *KeyShare) XXX_Merge(src proto.Message) { + xxx_messageInfo_KeyShare.Merge(m, src) +} +func (m *KeyShare) XXX_Size() int { + return m.Size() +} +func (m *KeyShare) XXX_DiscardUnknown() { + xxx_messageInfo_KeyShare.DiscardUnknown(m) +} + +var xxx_messageInfo_KeyShare proto.InternalMessageInfo + +func (m *KeyShare) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +func (m *KeyShare) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *KeyShare) GetShareData() []byte { + if m != nil { + return m.ShareData + } + return nil +} + +func (m *KeyShare) GetGroupPubkey() []byte { + if m != nil { + return m.GroupPubkey + } + return nil +} + +func (m *KeyShare) GetCreatedHeight() int64 { + if m != nil { + return m.CreatedHeight + } + return 0 +} + +func (m *KeyShare) GetEncryptedSecretShare() []byte { + if m != nil { + return m.EncryptedSecretShare + } + return nil +} + +func (m *KeyShare) GetEncryptedPublicShares() []byte { + if m != nil { + return m.EncryptedPublicShares + } + return nil +} + +func (m *KeyShare) GetEphemeralPubkey() []byte { + if m != nil { + return m.EphemeralPubkey + } + return nil +} + +// DKG Session and Round data +type DKGSession struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + KeySetId string `protobuf:"bytes,2,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` + State DKGState `protobuf:"varint,3,opt,name=state,proto3,enum=secret.tss.v1.DKGState" json:"state,omitempty"` + Threshold uint32 `protobuf:"varint,4,opt,name=threshold,proto3" json:"threshold,omitempty"` + MaxSigners uint32 `protobuf:"varint,5,opt,name=max_signers,json=maxSigners,proto3" json:"max_signers,omitempty"` + Participants []string `protobuf:"bytes,6,rep,name=participants,proto3" json:"participants,omitempty"` + StartHeight int64 `protobuf:"varint,7,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + TimeoutHeight int64 `protobuf:"varint,8,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` +} + +func (m *DKGSession) Reset() { *m = DKGSession{} } +func (m *DKGSession) String() string { return proto.CompactTextString(m) } +func (*DKGSession) ProtoMessage() {} +func (*DKGSession) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{3} +} +func (m *DKGSession) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DKGSession) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DKGSession.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 *DKGSession) XXX_Merge(src proto.Message) { + xxx_messageInfo_DKGSession.Merge(m, src) +} +func (m *DKGSession) XXX_Size() int { + return m.Size() +} +func (m *DKGSession) XXX_DiscardUnknown() { + xxx_messageInfo_DKGSession.DiscardUnknown(m) +} + +var xxx_messageInfo_DKGSession proto.InternalMessageInfo + +func (m *DKGSession) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *DKGSession) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +func (m *DKGSession) GetState() DKGState { + if m != nil { + return m.State + } + return DKGState_DKG_STATE_UNSPECIFIED +} + +func (m *DKGSession) GetThreshold() uint32 { + if m != nil { + return m.Threshold + } + return 0 +} + +func (m *DKGSession) GetMaxSigners() uint32 { + if m != nil { + return m.MaxSigners + } + return 0 +} + +func (m *DKGSession) GetParticipants() []string { + if m != nil { + return m.Participants + } + return nil +} + +func (m *DKGSession) GetStartHeight() int64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *DKGSession) GetTimeoutHeight() int64 { + if m != nil { + return m.TimeoutHeight + } + return 0 +} + +type DKGRound1Data struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Commitment []byte `protobuf:"bytes,2,opt,name=commitment,proto3" json:"commitment,omitempty"` + SubmittedHeight int64 `protobuf:"varint,3,opt,name=submitted_height,json=submittedHeight,proto3" json:"submitted_height,omitempty"` +} + +func (m *DKGRound1Data) Reset() { *m = DKGRound1Data{} } +func (m *DKGRound1Data) String() string { return proto.CompactTextString(m) } +func (*DKGRound1Data) ProtoMessage() {} +func (*DKGRound1Data) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{4} +} +func (m *DKGRound1Data) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DKGRound1Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DKGRound1Data.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 *DKGRound1Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_DKGRound1Data.Merge(m, src) +} +func (m *DKGRound1Data) XXX_Size() int { + return m.Size() +} +func (m *DKGRound1Data) XXX_DiscardUnknown() { + xxx_messageInfo_DKGRound1Data.DiscardUnknown(m) +} + +var xxx_messageInfo_DKGRound1Data proto.InternalMessageInfo + +func (m *DKGRound1Data) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *DKGRound1Data) GetCommitment() []byte { + if m != nil { + return m.Commitment + } + return nil +} + +func (m *DKGRound1Data) GetSubmittedHeight() int64 { + if m != nil { + return m.SubmittedHeight + } + return 0 +} + +type DKGRound2Data struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Share []byte `protobuf:"bytes,2,opt,name=share,proto3" json:"share,omitempty"` + SubmittedHeight int64 `protobuf:"varint,3,opt,name=submitted_height,json=submittedHeight,proto3" json:"submitted_height,omitempty"` +} + +func (m *DKGRound2Data) Reset() { *m = DKGRound2Data{} } +func (m *DKGRound2Data) String() string { return proto.CompactTextString(m) } +func (*DKGRound2Data) ProtoMessage() {} +func (*DKGRound2Data) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{5} +} +func (m *DKGRound2Data) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DKGRound2Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DKGRound2Data.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 *DKGRound2Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_DKGRound2Data.Merge(m, src) +} +func (m *DKGRound2Data) XXX_Size() int { + return m.Size() +} +func (m *DKGRound2Data) XXX_DiscardUnknown() { + xxx_messageInfo_DKGRound2Data.DiscardUnknown(m) +} + +var xxx_messageInfo_DKGRound2Data proto.InternalMessageInfo + +func (m *DKGRound2Data) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *DKGRound2Data) GetShare() []byte { + if m != nil { + return m.Share + } + return nil +} + +func (m *DKGRound2Data) GetSubmittedHeight() int64 { + if m != nil { + return m.SubmittedHeight + } + return 0 +} + +// DKGKeySubmission contains a validator's encrypted secret share for on-chain storage +type DKGKeySubmission struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // Encrypted FROST secret share (NaCl box sealed with validator's X25519 pubkey) + EncryptedSecretShare []byte `protobuf:"bytes,2,opt,name=encrypted_secret_share,json=encryptedSecretShare,proto3" json:"encrypted_secret_share,omitempty"` + // Encrypted FROST public shares (NaCl box sealed with validator's X25519 pubkey) + EncryptedPublicShares []byte `protobuf:"bytes,3,opt,name=encrypted_public_shares,json=encryptedPublicShares,proto3" json:"encrypted_public_shares,omitempty"` + // Ephemeral public key used for encryption (needed for decryption) + EphemeralPubkey []byte `protobuf:"bytes,4,opt,name=ephemeral_pubkey,json=ephemeralPubkey,proto3" json:"ephemeral_pubkey,omitempty"` + SubmittedHeight int64 `protobuf:"varint,5,opt,name=submitted_height,json=submittedHeight,proto3" json:"submitted_height,omitempty"` +} + +func (m *DKGKeySubmission) Reset() { *m = DKGKeySubmission{} } +func (m *DKGKeySubmission) String() string { return proto.CompactTextString(m) } +func (*DKGKeySubmission) ProtoMessage() {} +func (*DKGKeySubmission) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{6} +} +func (m *DKGKeySubmission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DKGKeySubmission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DKGKeySubmission.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 *DKGKeySubmission) XXX_Merge(src proto.Message) { + xxx_messageInfo_DKGKeySubmission.Merge(m, src) +} +func (m *DKGKeySubmission) XXX_Size() int { + return m.Size() +} +func (m *DKGKeySubmission) XXX_DiscardUnknown() { + xxx_messageInfo_DKGKeySubmission.DiscardUnknown(m) +} + +var xxx_messageInfo_DKGKeySubmission proto.InternalMessageInfo + +func (m *DKGKeySubmission) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *DKGKeySubmission) GetEncryptedSecretShare() []byte { + if m != nil { + return m.EncryptedSecretShare + } + return nil +} + +func (m *DKGKeySubmission) GetEncryptedPublicShares() []byte { + if m != nil { + return m.EncryptedPublicShares + } + return nil +} + +func (m *DKGKeySubmission) GetEphemeralPubkey() []byte { + if m != nil { + return m.EphemeralPubkey + } + return nil +} + +func (m *DKGKeySubmission) GetSubmittedHeight() int64 { + if m != nil { + return m.SubmittedHeight + } + return 0 +} + +// Signing Request and Session data +type SigningRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + KeySetId string `protobuf:"bytes,2,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` + Requester string `protobuf:"bytes,3,opt,name=requester,proto3" json:"requester,omitempty"` + MessageHash []byte `protobuf:"bytes,4,opt,name=message_hash,json=messageHash,proto3" json:"message_hash,omitempty"` + Callback string `protobuf:"bytes,5,opt,name=callback,proto3" json:"callback,omitempty"` + Status SigningRequestStatus `protobuf:"varint,6,opt,name=status,proto3,enum=secret.tss.v1.SigningRequestStatus" json:"status,omitempty"` + Signature []byte `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` + CreatedHeight int64 `protobuf:"varint,8,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` +} + +func (m *SigningRequest) Reset() { *m = SigningRequest{} } +func (m *SigningRequest) String() string { return proto.CompactTextString(m) } +func (*SigningRequest) ProtoMessage() {} +func (*SigningRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{7} +} +func (m *SigningRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SigningRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SigningRequest.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 *SigningRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SigningRequest.Merge(m, src) +} +func (m *SigningRequest) XXX_Size() int { + return m.Size() +} +func (m *SigningRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SigningRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SigningRequest proto.InternalMessageInfo + +func (m *SigningRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *SigningRequest) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +func (m *SigningRequest) GetRequester() string { + if m != nil { + return m.Requester + } + return "" +} + +func (m *SigningRequest) GetMessageHash() []byte { + if m != nil { + return m.MessageHash + } + return nil +} + +func (m *SigningRequest) GetCallback() string { + if m != nil { + return m.Callback + } + return "" +} + +func (m *SigningRequest) GetStatus() SigningRequestStatus { + if m != nil { + return m.Status + } + return SigningRequestStatus_SIGNING_REQUEST_STATUS_UNSPECIFIED +} + +func (m *SigningRequest) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *SigningRequest) GetCreatedHeight() int64 { + if m != nil { + return m.CreatedHeight + } + return 0 +} + +type SigningSession struct { + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + KeySetId string `protobuf:"bytes,2,opt,name=key_set_id,json=keySetId,proto3" json:"key_set_id,omitempty"` + Threshold uint32 `protobuf:"varint,3,opt,name=threshold,proto3" json:"threshold,omitempty"` + Participants []string `protobuf:"bytes,4,rep,name=participants,proto3" json:"participants,omitempty"` + State SigningState `protobuf:"varint,5,opt,name=state,proto3,enum=secret.tss.v1.SigningState" json:"state,omitempty"` + StartHeight int64 `protobuf:"varint,6,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + TimeoutHeight int64 `protobuf:"varint,7,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` +} + +func (m *SigningSession) Reset() { *m = SigningSession{} } +func (m *SigningSession) String() string { return proto.CompactTextString(m) } +func (*SigningSession) ProtoMessage() {} +func (*SigningSession) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{8} +} +func (m *SigningSession) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SigningSession) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SigningSession.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 *SigningSession) XXX_Merge(src proto.Message) { + xxx_messageInfo_SigningSession.Merge(m, src) +} +func (m *SigningSession) XXX_Size() int { + return m.Size() +} +func (m *SigningSession) XXX_DiscardUnknown() { + xxx_messageInfo_SigningSession.DiscardUnknown(m) +} + +var xxx_messageInfo_SigningSession proto.InternalMessageInfo + +func (m *SigningSession) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +func (m *SigningSession) GetKeySetId() string { + if m != nil { + return m.KeySetId + } + return "" +} + +func (m *SigningSession) GetThreshold() uint32 { + if m != nil { + return m.Threshold + } + return 0 +} + +func (m *SigningSession) GetParticipants() []string { + if m != nil { + return m.Participants + } + return nil +} + +func (m *SigningSession) GetState() SigningState { + if m != nil { + return m.State + } + return SigningState_SIGNING_STATE_UNSPECIFIED +} + +func (m *SigningSession) GetStartHeight() int64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *SigningSession) GetTimeoutHeight() int64 { + if m != nil { + return m.TimeoutHeight + } + return 0 +} + +type SigningCommitment struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Commitment []byte `protobuf:"bytes,2,opt,name=commitment,proto3" json:"commitment,omitempty"` + SubmittedHeight int64 `protobuf:"varint,3,opt,name=submitted_height,json=submittedHeight,proto3" json:"submitted_height,omitempty"` +} + +func (m *SigningCommitment) Reset() { *m = SigningCommitment{} } +func (m *SigningCommitment) String() string { return proto.CompactTextString(m) } +func (*SigningCommitment) ProtoMessage() {} +func (*SigningCommitment) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{9} +} +func (m *SigningCommitment) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SigningCommitment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SigningCommitment.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 *SigningCommitment) XXX_Merge(src proto.Message) { + xxx_messageInfo_SigningCommitment.Merge(m, src) +} +func (m *SigningCommitment) XXX_Size() int { + return m.Size() +} +func (m *SigningCommitment) XXX_DiscardUnknown() { + xxx_messageInfo_SigningCommitment.DiscardUnknown(m) +} + +var xxx_messageInfo_SigningCommitment proto.InternalMessageInfo + +func (m *SigningCommitment) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *SigningCommitment) GetCommitment() []byte { + if m != nil { + return m.Commitment + } + return nil +} + +func (m *SigningCommitment) GetSubmittedHeight() int64 { + if m != nil { + return m.SubmittedHeight + } + return 0 +} + +type SignatureShare struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Share []byte `protobuf:"bytes,2,opt,name=share,proto3" json:"share,omitempty"` + SubmittedHeight int64 `protobuf:"varint,3,opt,name=submitted_height,json=submittedHeight,proto3" json:"submitted_height,omitempty"` +} + +func (m *SignatureShare) Reset() { *m = SignatureShare{} } +func (m *SignatureShare) String() string { return proto.CompactTextString(m) } +func (*SignatureShare) ProtoMessage() {} +func (*SignatureShare) Descriptor() ([]byte, []int) { + return fileDescriptor_1eab323200622b2d, []int{10} +} +func (m *SignatureShare) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SignatureShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SignatureShare.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 *SignatureShare) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignatureShare.Merge(m, src) +} +func (m *SignatureShare) XXX_Size() int { + return m.Size() +} +func (m *SignatureShare) XXX_DiscardUnknown() { + xxx_messageInfo_SignatureShare.DiscardUnknown(m) +} + +var xxx_messageInfo_SignatureShare proto.InternalMessageInfo + +func (m *SignatureShare) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *SignatureShare) GetShare() []byte { + if m != nil { + return m.Share + } + return nil +} + +func (m *SignatureShare) GetSubmittedHeight() int64 { + if m != nil { + return m.SubmittedHeight + } + return 0 +} + +func init() { + proto.RegisterEnum("secret.tss.v1.KeySetStatus", KeySetStatus_name, KeySetStatus_value) + proto.RegisterEnum("secret.tss.v1.DKGState", DKGState_name, DKGState_value) + proto.RegisterEnum("secret.tss.v1.SigningState", SigningState_name, SigningState_value) + proto.RegisterEnum("secret.tss.v1.SigningRequestStatus", SigningRequestStatus_name, SigningRequestStatus_value) + proto.RegisterType((*Params)(nil), "secret.tss.v1.Params") + proto.RegisterType((*KeySet)(nil), "secret.tss.v1.KeySet") + proto.RegisterType((*KeyShare)(nil), "secret.tss.v1.KeyShare") + proto.RegisterType((*DKGSession)(nil), "secret.tss.v1.DKGSession") + proto.RegisterType((*DKGRound1Data)(nil), "secret.tss.v1.DKGRound1Data") + proto.RegisterType((*DKGRound2Data)(nil), "secret.tss.v1.DKGRound2Data") + proto.RegisterType((*DKGKeySubmission)(nil), "secret.tss.v1.DKGKeySubmission") + proto.RegisterType((*SigningRequest)(nil), "secret.tss.v1.SigningRequest") + proto.RegisterType((*SigningSession)(nil), "secret.tss.v1.SigningSession") + proto.RegisterType((*SigningCommitment)(nil), "secret.tss.v1.SigningCommitment") + proto.RegisterType((*SignatureShare)(nil), "secret.tss.v1.SignatureShare") +} + +func init() { proto.RegisterFile("secret/tss/v1/types.proto", fileDescriptor_1eab323200622b2d) } + +var fileDescriptor_1eab323200622b2d = []byte{ + // 1129 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4d, 0x73, 0xdb, 0x44, + 0x18, 0x8e, 0xe4, 0x8f, 0xda, 0x6f, 0x1c, 0x57, 0xdd, 0x71, 0x5b, 0x25, 0x24, 0x8e, 0xeb, 0x4e, + 0x19, 0x13, 0xa6, 0xf6, 0x24, 0x65, 0x38, 0xc0, 0x29, 0x8d, 0x55, 0xd7, 0xe3, 0xd6, 0x31, 0x52, + 0xc2, 0x0c, 0x5c, 0x34, 0x6b, 0x69, 0xc7, 0xd6, 0xc4, 0xb2, 0x8c, 0x76, 0x9d, 0x26, 0x07, 0xb8, + 0xc0, 0x0c, 0x07, 0x38, 0x70, 0x82, 0x53, 0x67, 0xf8, 0x0d, 0xfc, 0x0a, 0x8e, 0xbd, 0xc1, 0x91, + 0x49, 0x2e, 0x1c, 0xf9, 0x09, 0x8c, 0x76, 0x65, 0xf9, 0x23, 0x32, 0x69, 0x38, 0xc0, 0xcd, 0x7a, + 0x9e, 0x77, 0xb5, 0xef, 0xc7, 0xb3, 0xcf, 0x5a, 0xb0, 0x4e, 0x89, 0xe5, 0x13, 0x56, 0x63, 0x94, + 0xd6, 0x4e, 0x77, 0x6b, 0xec, 0x7c, 0x44, 0x68, 0x75, 0xe4, 0x7b, 0xcc, 0x43, 0x6b, 0x82, 0xaa, + 0x32, 0x4a, 0xab, 0xa7, 0xbb, 0x1b, 0x85, 0x9e, 0xd7, 0xf3, 0x38, 0x53, 0x0b, 0x7e, 0x89, 0xa0, + 0x72, 0x1e, 0xd2, 0x1d, 0xec, 0x63, 0x97, 0x7e, 0x94, 0xfc, 0xf3, 0xe7, 0x6d, 0xa9, 0xfc, 0x8b, + 0x0c, 0xe9, 0x16, 0x39, 0x37, 0x08, 0x43, 0x79, 0x90, 0x1d, 0x5b, 0x95, 0x4a, 0x52, 0x25, 0xab, + 0xcb, 0x8e, 0x8d, 0x0a, 0x90, 0xf2, 0x5e, 0x0d, 0x89, 0xaf, 0xca, 0x1c, 0x12, 0x0f, 0x68, 0x13, + 0xb2, 0xac, 0xef, 0x13, 0xda, 0xf7, 0x06, 0xb6, 0x9a, 0x28, 0x49, 0x95, 0x35, 0x7d, 0x0a, 0xa0, + 0x6d, 0x58, 0x75, 0xf1, 0x99, 0x49, 0x9d, 0xde, 0x90, 0xf8, 0x54, 0x4d, 0x72, 0x1e, 0x5c, 0x7c, + 0x66, 0x08, 0x04, 0x95, 0x21, 0x37, 0xc2, 0x3e, 0x73, 0x2c, 0x67, 0x84, 0x87, 0x8c, 0xaa, 0xa9, + 0x52, 0xa2, 0x92, 0xd5, 0xe7, 0x30, 0xf4, 0x00, 0x72, 0x3d, 0xdf, 0x1b, 0x8f, 0xcc, 0xd1, 0xb8, + 0x7b, 0x42, 0xce, 0xd5, 0x74, 0x49, 0xaa, 0xe4, 0xf4, 0x55, 0x8e, 0x75, 0x38, 0x84, 0x9e, 0x40, + 0x9a, 0x32, 0xcc, 0xc6, 0x54, 0xbd, 0x55, 0x92, 0x2a, 0xf9, 0xbd, 0x77, 0xaa, 0x73, 0xc5, 0x57, + 0x45, 0x49, 0x06, 0x0f, 0xd1, 0xc3, 0x50, 0x54, 0x82, 0x55, 0x9b, 0x50, 0xcb, 0x77, 0x46, 0xcc, + 0xf1, 0x86, 0x6a, 0x86, 0x97, 0x35, 0x0b, 0xa1, 0x47, 0x90, 0xb7, 0x7c, 0x82, 0x19, 0xb1, 0xcd, + 0x3e, 0x71, 0x7a, 0x7d, 0xa6, 0x66, 0x4b, 0x52, 0x25, 0xa1, 0xaf, 0x85, 0xe8, 0x73, 0x0e, 0x96, + 0x7f, 0x93, 0x21, 0x13, 0xec, 0xd0, 0xc7, 0x3e, 0x41, 0x9b, 0x00, 0x27, 0xe4, 0xdc, 0xa4, 0x84, + 0x99, 0x51, 0xfb, 0x32, 0x27, 0x7c, 0xff, 0xa6, 0x8d, 0xde, 0x87, 0x3b, 0xa7, 0x78, 0xe0, 0xd8, + 0x98, 0x79, 0xbe, 0x89, 0x6d, 0xdb, 0x27, 0x94, 0x86, 0x0d, 0x55, 0x22, 0x62, 0x5f, 0xe0, 0x68, + 0x0b, 0x80, 0x06, 0xef, 0x34, 0x6d, 0xcc, 0x30, 0x6f, 0x6e, 0x4e, 0xcf, 0x72, 0xa4, 0x8e, 0x19, + 0xbe, 0xd2, 0x97, 0xe4, 0xd5, 0xbe, 0x5c, 0x2d, 0x20, 0x15, 0x53, 0x00, 0xfa, 0x00, 0xee, 0x91, + 0xa1, 0xe5, 0x9f, 0x8f, 0x82, 0x40, 0xd1, 0x39, 0x93, 0xef, 0x13, 0xf6, 0xba, 0x10, 0xb1, 0x06, + 0x27, 0x45, 0xa5, 0x1f, 0xc2, 0xfd, 0xe9, 0xaa, 0xd1, 0xb8, 0x3b, 0x70, 0x2c, 0xb1, 0x4a, 0x4c, + 0x21, 0xa7, 0xdf, 0x8d, 0xe8, 0x0e, 0x67, 0xf9, 0x32, 0x8a, 0xde, 0x03, 0x85, 0x8c, 0xfa, 0xc4, + 0x25, 0x3e, 0x1e, 0x4c, 0x72, 0xcf, 0xf0, 0x05, 0xb7, 0x23, 0x5c, 0xe4, 0x5f, 0xfe, 0x51, 0x06, + 0xa8, 0xb7, 0x1a, 0x06, 0xa1, 0x34, 0x98, 0xc7, 0xa2, 0x24, 0xe7, 0x7b, 0x2d, 0x2f, 0xf4, 0xfa, + 0x31, 0xa4, 0x82, 0x49, 0x13, 0xde, 0xb9, 0xfc, 0xde, 0xfd, 0x05, 0x4d, 0x04, 0xef, 0x0d, 0x68, + 0x5d, 0x44, 0xcd, 0x2b, 0x39, 0x79, 0x8d, 0x92, 0x53, 0xd7, 0x2a, 0x39, 0x1d, 0xaf, 0x64, 0xca, + 0xb0, 0xcf, 0x26, 0xc3, 0xb8, 0xc5, 0x87, 0xb1, 0xca, 0xb1, 0x70, 0x14, 0x8f, 0x20, 0xcf, 0x1c, + 0x97, 0x78, 0xe3, 0x28, 0x28, 0x23, 0x26, 0x16, 0xa2, 0xa1, 0xe4, 0xbe, 0x95, 0x60, 0xad, 0xde, + 0x6a, 0xe8, 0xde, 0x78, 0x68, 0xef, 0x72, 0x35, 0xc4, 0x2a, 0x4b, 0x5a, 0xa2, 0xac, 0x22, 0x80, + 0xe5, 0xb9, 0xae, 0xc3, 0x5c, 0x32, 0x64, 0xbc, 0x71, 0x39, 0x7d, 0x06, 0x09, 0x46, 0x44, 0xc7, + 0x5d, 0xd7, 0x61, 0x33, 0xca, 0x49, 0xf0, 0x3c, 0x6e, 0x47, 0x78, 0x98, 0xc9, 0x97, 0xd3, 0x44, + 0xf6, 0x6e, 0x9e, 0x48, 0x01, 0x52, 0x42, 0x68, 0x22, 0x07, 0xf1, 0x70, 0x93, 0xed, 0xbf, 0x96, + 0x41, 0xa9, 0xb7, 0x1a, 0xc1, 0xf1, 0x0b, 0x18, 0xa1, 0x93, 0x1b, 0xa5, 0xb0, 0x5c, 0xfc, 0xf2, + 0xbf, 0x13, 0x7f, 0xe2, 0xa6, 0xe2, 0x4f, 0xc6, 0x8a, 0x3f, 0xb6, 0x0b, 0xa9, 0xf8, 0x2e, 0xbc, + 0x96, 0x21, 0x1f, 0x08, 0xd1, 0x19, 0xf6, 0x74, 0xf2, 0xc5, 0x98, 0x50, 0x76, 0xc3, 0xb3, 0xb2, + 0x09, 0x59, 0x5f, 0x2c, 0x24, 0x3e, 0x2f, 0x20, 0xab, 0x4f, 0x81, 0x40, 0xb7, 0x2e, 0xa1, 0x14, + 0xf7, 0x88, 0xd9, 0xc7, 0xb4, 0x3f, 0x71, 0x9a, 0x10, 0x7b, 0x8e, 0x69, 0x1f, 0x6d, 0x40, 0xc6, + 0xc2, 0x83, 0x41, 0x17, 0x5b, 0x27, 0x3c, 0xc9, 0xac, 0x1e, 0x3d, 0xa3, 0x8f, 0x23, 0x77, 0x4e, + 0xf3, 0x93, 0xf8, 0x70, 0xe1, 0x24, 0xce, 0x67, 0xbe, 0xe0, 0xd2, 0x9b, 0x90, 0x0d, 0x0e, 0x1d, + 0x66, 0x63, 0x9f, 0x84, 0xbe, 0x32, 0x05, 0x62, 0x0c, 0x2e, 0x13, 0xe7, 0xd0, 0xdf, 0x4f, 0xfb, + 0x33, 0xf1, 0x92, 0x2d, 0x80, 0xb0, 0xc0, 0xa9, 0x4f, 0x4f, 0x4a, 0x6e, 0xbe, 0x45, 0xbb, 0xfe, + 0xe1, 0xd6, 0x5b, 0xb4, 0x82, 0x64, 0x8c, 0x15, 0xec, 0x4e, 0xcc, 0x29, 0x15, 0x7b, 0x61, 0x4d, + 0x92, 0x9d, 0x35, 0xa8, 0x45, 0xf7, 0x48, 0xbf, 0x8d, 0x7b, 0xdc, 0x8a, 0x73, 0x8f, 0xef, 0x24, + 0xb8, 0x13, 0xee, 0x70, 0x30, 0x3d, 0xf4, 0xff, 0x97, 0x83, 0x7c, 0x25, 0x66, 0xc3, 0x07, 0x2a, + 0x0e, 0xd7, 0x7f, 0x6a, 0x21, 0x3b, 0xdf, 0x48, 0x90, 0x9b, 0xfd, 0x83, 0x80, 0x8a, 0xb0, 0xd1, + 0xd2, 0x3e, 0x33, 0x0d, 0xed, 0xc8, 0x34, 0x8e, 0xf6, 0x8f, 0x8e, 0x0d, 0xf3, 0xb8, 0x6d, 0x74, + 0xb4, 0x83, 0xe6, 0xb3, 0xa6, 0x56, 0x57, 0x56, 0x62, 0xf8, 0x8e, 0xd6, 0xae, 0x37, 0xdb, 0x0d, + 0xb3, 0xde, 0x6a, 0x28, 0x12, 0x5a, 0x87, 0xbb, 0x0b, 0xfc, 0xfe, 0xc1, 0x51, 0xf3, 0x53, 0x4d, + 0x91, 0x63, 0xa8, 0x67, 0xfb, 0xcd, 0x17, 0x5a, 0x5d, 0x49, 0xec, 0xbc, 0x96, 0x20, 0x33, 0xb9, + 0x93, 0x82, 0xb8, 0x7a, 0xab, 0xc1, 0x63, 0xb4, 0x85, 0xdd, 0x0b, 0xdc, 0xf0, 0x42, 0x4a, 0x3f, + 0x3c, 0x6e, 0xd7, 0x77, 0x15, 0x29, 0x06, 0xdd, 0x53, 0x64, 0xb4, 0x09, 0xea, 0x14, 0xe5, 0x1b, + 0x1f, 0x3f, 0x7d, 0xd9, 0x34, 0x8c, 0xe6, 0x61, 0x5b, 0x49, 0xa0, 0x7b, 0x80, 0xa6, 0xec, 0xc1, + 0xe1, 0xcb, 0xce, 0x0b, 0xed, 0x48, 0x53, 0x92, 0xf3, 0xef, 0x0a, 0xf3, 0x4b, 0xed, 0xfc, 0x24, + 0x41, 0x6e, 0x56, 0x96, 0x68, 0x0b, 0xd6, 0x8d, 0x66, 0xa3, 0x1d, 0xd4, 0x1d, 0x97, 0xa7, 0x0a, + 0x85, 0x79, 0x3a, 0xca, 0x35, 0x9e, 0x09, 0xf2, 0xdd, 0x80, 0x7b, 0xf3, 0x4c, 0x94, 0x55, 0xe2, + 0xea, 0xaa, 0x30, 0xb3, 0xe4, 0xce, 0x5f, 0x12, 0x14, 0xe2, 0x3c, 0x04, 0xbd, 0x0b, 0xe5, 0xc9, + 0x12, 0x5d, 0xfb, 0xe4, 0x58, 0x33, 0x96, 0x0c, 0xb4, 0x0c, 0xc5, 0x25, 0x71, 0xe1, 0x60, 0x15, + 0x09, 0x3d, 0x80, 0xad, 0x25, 0x31, 0x61, 0x5d, 0xf2, 0x75, 0x21, 0x7b, 0x4a, 0x02, 0x3d, 0x84, + 0xed, 0x25, 0x21, 0x33, 0xfd, 0x5f, 0xfe, 0x9e, 0xc9, 0x30, 0x9e, 0x36, 0x7e, 0xbd, 0x28, 0x4a, + 0x6f, 0x2e, 0x8a, 0xd2, 0x1f, 0x17, 0x45, 0xe9, 0x87, 0xcb, 0xe2, 0xca, 0x9b, 0xcb, 0xe2, 0xca, + 0xef, 0x97, 0xc5, 0x95, 0xcf, 0x1f, 0xf7, 0x1c, 0xd6, 0x1f, 0x77, 0xab, 0x96, 0xe7, 0xd6, 0xa8, + 0xe5, 0xb3, 0x01, 0xee, 0xd2, 0x9a, 0xb8, 0xb9, 0xda, 0x84, 0xbd, 0xf2, 0xfc, 0x93, 0xda, 0x19, + 0xff, 0x5c, 0xe0, 0xdf, 0x0a, 0xdd, 0x34, 0xff, 0x0e, 0x78, 0xf2, 0x77, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x55, 0xfd, 0xb3, 0x15, 0x49, 0x0c, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *KeySet) 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 *KeySet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeySet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreatedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreatedHeight)) + i-- + dAtA[i] = 0x48 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x42 + } + if m.Status != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x38 + } + if len(m.GroupPubkey) > 0 { + i -= len(m.GroupPubkey) + copy(dAtA[i:], m.GroupPubkey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.GroupPubkey))) + i-- + dAtA[i] = 0x32 + } + if len(m.Participants) > 0 { + for iNdEx := len(m.Participants) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Participants[iNdEx]) + copy(dAtA[i:], m.Participants[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Participants[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if m.MaxSigners != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxSigners)) + i-- + dAtA[i] = 0x20 + } + if m.Threshold != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Threshold)) + i-- + dAtA[i] = 0x18 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *KeyShare) 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 *KeyShare) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *KeyShare) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EphemeralPubkey) > 0 { + i -= len(m.EphemeralPubkey) + copy(dAtA[i:], m.EphemeralPubkey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EphemeralPubkey))) + i-- + dAtA[i] = 0x42 + } + if len(m.EncryptedPublicShares) > 0 { + i -= len(m.EncryptedPublicShares) + copy(dAtA[i:], m.EncryptedPublicShares) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EncryptedPublicShares))) + i-- + dAtA[i] = 0x3a + } + if len(m.EncryptedSecretShare) > 0 { + i -= len(m.EncryptedSecretShare) + copy(dAtA[i:], m.EncryptedSecretShare) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EncryptedSecretShare))) + i-- + dAtA[i] = 0x32 + } + if m.CreatedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreatedHeight)) + i-- + dAtA[i] = 0x28 + } + if len(m.GroupPubkey) > 0 { + i -= len(m.GroupPubkey) + copy(dAtA[i:], m.GroupPubkey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.GroupPubkey))) + i-- + dAtA[i] = 0x22 + } + if len(m.ShareData) > 0 { + i -= len(m.ShareData) + copy(dAtA[i:], m.ShareData) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ShareData))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeySetId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DKGSession) 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 *DKGSession) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DKGSession) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TimeoutHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TimeoutHeight)) + i-- + dAtA[i] = 0x40 + } + if m.StartHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x38 + } + if len(m.Participants) > 0 { + for iNdEx := len(m.Participants) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Participants[iNdEx]) + copy(dAtA[i:], m.Participants[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Participants[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if m.MaxSigners != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxSigners)) + i-- + dAtA[i] = 0x28 + } + if m.Threshold != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Threshold)) + i-- + dAtA[i] = 0x20 + } + if m.State != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x18 + } + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeySetId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DKGRound1Data) 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 *DKGRound1Data) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DKGRound1Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SubmittedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SubmittedHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DKGRound2Data) 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 *DKGRound2Data) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DKGRound2Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SubmittedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SubmittedHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Share) > 0 { + i -= len(m.Share) + copy(dAtA[i:], m.Share) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Share))) + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DKGKeySubmission) 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 *DKGKeySubmission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DKGKeySubmission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SubmittedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SubmittedHeight)) + i-- + dAtA[i] = 0x28 + } + if len(m.EphemeralPubkey) > 0 { + i -= len(m.EphemeralPubkey) + copy(dAtA[i:], m.EphemeralPubkey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EphemeralPubkey))) + i-- + dAtA[i] = 0x22 + } + if len(m.EncryptedPublicShares) > 0 { + i -= len(m.EncryptedPublicShares) + copy(dAtA[i:], m.EncryptedPublicShares) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EncryptedPublicShares))) + i-- + dAtA[i] = 0x1a + } + if len(m.EncryptedSecretShare) > 0 { + i -= len(m.EncryptedSecretShare) + copy(dAtA[i:], m.EncryptedSecretShare) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EncryptedSecretShare))) + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SigningRequest) 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 *SigningRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SigningRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreatedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreatedHeight)) + i-- + dAtA[i] = 0x40 + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x3a + } + if m.Status != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x30 + } + if len(m.Callback) > 0 { + i -= len(m.Callback) + copy(dAtA[i:], m.Callback) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Callback))) + i-- + dAtA[i] = 0x2a + } + if len(m.MessageHash) > 0 { + i -= len(m.MessageHash) + copy(dAtA[i:], m.MessageHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.MessageHash))) + i-- + dAtA[i] = 0x22 + } + if len(m.Requester) > 0 { + i -= len(m.Requester) + copy(dAtA[i:], m.Requester) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Requester))) + i-- + dAtA[i] = 0x1a + } + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeySetId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SigningSession) 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 *SigningSession) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SigningSession) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TimeoutHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TimeoutHeight)) + i-- + dAtA[i] = 0x38 + } + if m.StartHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x30 + } + if m.State != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x28 + } + if len(m.Participants) > 0 { + for iNdEx := len(m.Participants) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Participants[iNdEx]) + copy(dAtA[i:], m.Participants[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Participants[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.Threshold != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Threshold)) + i-- + dAtA[i] = 0x18 + } + if len(m.KeySetId) > 0 { + i -= len(m.KeySetId) + copy(dAtA[i:], m.KeySetId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.KeySetId))) + i-- + dAtA[i] = 0x12 + } + if len(m.RequestId) > 0 { + i -= len(m.RequestId) + copy(dAtA[i:], m.RequestId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.RequestId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SigningCommitment) 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 *SigningCommitment) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SigningCommitment) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SubmittedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SubmittedHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SignatureShare) 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 *SignatureShare) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SignatureShare) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SubmittedHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.SubmittedHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Share) > 0 { + i -= len(m.Share) + copy(dAtA[i:], m.Share) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Share))) + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *KeySet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Threshold != 0 { + n += 1 + sovTypes(uint64(m.Threshold)) + } + if m.MaxSigners != 0 { + n += 1 + sovTypes(uint64(m.MaxSigners)) + } + if len(m.Participants) > 0 { + for _, s := range m.Participants { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.GroupPubkey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovTypes(uint64(m.Status)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.CreatedHeight != 0 { + n += 1 + sovTypes(uint64(m.CreatedHeight)) + } + return n +} + +func (m *KeyShare) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ShareData) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.GroupPubkey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.CreatedHeight != 0 { + n += 1 + sovTypes(uint64(m.CreatedHeight)) + } + l = len(m.EncryptedSecretShare) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.EncryptedPublicShares) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.EphemeralPubkey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *DKGSession) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.State != 0 { + n += 1 + sovTypes(uint64(m.State)) + } + if m.Threshold != 0 { + n += 1 + sovTypes(uint64(m.Threshold)) + } + if m.MaxSigners != 0 { + n += 1 + sovTypes(uint64(m.MaxSigners)) + } + if len(m.Participants) > 0 { + for _, s := range m.Participants { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.StartHeight != 0 { + n += 1 + sovTypes(uint64(m.StartHeight)) + } + if m.TimeoutHeight != 0 { + n += 1 + sovTypes(uint64(m.TimeoutHeight)) + } + return n +} + +func (m *DKGRound1Data) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SubmittedHeight != 0 { + n += 1 + sovTypes(uint64(m.SubmittedHeight)) + } + return n +} + +func (m *DKGRound2Data) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Share) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SubmittedHeight != 0 { + n += 1 + sovTypes(uint64(m.SubmittedHeight)) + } + return n +} + +func (m *DKGKeySubmission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.EncryptedSecretShare) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.EncryptedPublicShares) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.EphemeralPubkey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SubmittedHeight != 0 { + n += 1 + sovTypes(uint64(m.SubmittedHeight)) + } + return n +} + +func (m *SigningRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Requester) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.MessageHash) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Callback) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovTypes(uint64(m.Status)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.CreatedHeight != 0 { + n += 1 + sovTypes(uint64(m.CreatedHeight)) + } + return n +} + +func (m *SigningSession) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.KeySetId) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Threshold != 0 { + n += 1 + sovTypes(uint64(m.Threshold)) + } + if len(m.Participants) > 0 { + for _, s := range m.Participants { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.State != 0 { + n += 1 + sovTypes(uint64(m.State)) + } + if m.StartHeight != 0 { + n += 1 + sovTypes(uint64(m.StartHeight)) + } + if m.TimeoutHeight != 0 { + n += 1 + sovTypes(uint64(m.TimeoutHeight)) + } + return n +} + +func (m *SigningCommitment) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SubmittedHeight != 0 { + n += 1 + sovTypes(uint64(m.SubmittedHeight)) + } + return n +} + +func (m *SignatureShare) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Share) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.SubmittedHeight != 0 { + n += 1 + sovTypes(uint64(m.SubmittedHeight)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeySet) 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 ErrIntOverflowTypes + } + 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: KeySet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeySet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + m.Threshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Threshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSigners", wireType) + } + m.MaxSigners = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSigners |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Participants", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Participants = append(m.Participants, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupPubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupPubkey = append(m.GroupPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.GroupPubkey == nil { + m.GroupPubkey = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= KeySetStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedHeight", wireType) + } + m.CreatedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyShare) 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 ErrIntOverflowTypes + } + 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: KeyShare: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyShare: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySetId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeySetId = 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + 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 ShareData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ShareData = append(m.ShareData[:0], dAtA[iNdEx:postIndex]...) + if m.ShareData == nil { + m.ShareData = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GroupPubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GroupPubkey = append(m.GroupPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.GroupPubkey == nil { + m.GroupPubkey = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedHeight", wireType) + } + m.CreatedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedSecretShare", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EncryptedSecretShare = append(m.EncryptedSecretShare[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedSecretShare == nil { + m.EncryptedSecretShare = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedPublicShares", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EncryptedPublicShares = append(m.EncryptedPublicShares[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedPublicShares == nil { + m.EncryptedPublicShares = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EphemeralPubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EphemeralPubkey = append(m.EphemeralPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.EphemeralPubkey == nil { + m.EphemeralPubkey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DKGSession) 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 ErrIntOverflowTypes + } + 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: DKGSession: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DKGSession: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySetId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeySetId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= DKGState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + m.Threshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Threshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSigners", wireType) + } + m.MaxSigners = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSigners |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Participants", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Participants = append(m.Participants, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + } + m.TimeoutHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DKGRound1Data) 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 ErrIntOverflowTypes + } + 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: DKGRound1Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DKGRound1Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = append(m.Commitment[:0], dAtA[iNdEx:postIndex]...) + if m.Commitment == nil { + m.Commitment = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmittedHeight", wireType) + } + m.SubmittedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubmittedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DKGRound2Data) 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 ErrIntOverflowTypes + } + 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: DKGRound2Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DKGRound2Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Share", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Share = append(m.Share[:0], dAtA[iNdEx:postIndex]...) + if m.Share == nil { + m.Share = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmittedHeight", wireType) + } + m.SubmittedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubmittedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DKGKeySubmission) 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 ErrIntOverflowTypes + } + 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: DKGKeySubmission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DKGKeySubmission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedSecretShare", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EncryptedSecretShare = append(m.EncryptedSecretShare[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedSecretShare == nil { + m.EncryptedSecretShare = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedPublicShares", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EncryptedPublicShares = append(m.EncryptedPublicShares[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedPublicShares == nil { + m.EncryptedPublicShares = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EphemeralPubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EphemeralPubkey = append(m.EphemeralPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.EphemeralPubkey == nil { + m.EphemeralPubkey = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmittedHeight", wireType) + } + m.SubmittedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubmittedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SigningRequest) 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 ErrIntOverflowTypes + } + 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: SigningRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SigningRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySetId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeySetId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Requester", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Requester = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MessageHash = append(m.MessageHash[:0], dAtA[iNdEx:postIndex]...) + if m.MessageHash == nil { + m.MessageHash = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Callback", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Callback = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= SigningRequestStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedHeight", wireType) + } + m.CreatedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SigningSession) 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 ErrIntOverflowTypes + } + 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: SigningSession: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SigningSession: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeySetId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeySetId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + m.Threshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Threshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Participants", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Participants = append(m.Participants, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= SigningState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutHeight", wireType) + } + m.TimeoutHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SigningCommitment) 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 ErrIntOverflowTypes + } + 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: SigningCommitment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SigningCommitment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = append(m.Commitment[:0], dAtA[iNdEx:postIndex]...) + if m.Commitment == nil { + m.Commitment = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmittedHeight", wireType) + } + m.SubmittedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubmittedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SignatureShare) 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 ErrIntOverflowTypes + } + 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: SignatureShare: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SignatureShare: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Share", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Share = append(m.Share[:0], dAtA[iNdEx:postIndex]...) + if m.Share == nil { + m.Share = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmittedHeight", wireType) + } + m.SubmittedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubmittedHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(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, ErrIntOverflowTypes + } + 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, ErrIntOverflowTypes + } + 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, ErrIntOverflowTypes + } + 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, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +)